Index: ossp-pkg/l2/l2_test.c RCS File: /v/ossp/cvs/ossp-pkg/l2/l2_test.c,v rcsdiff -q -kk '-r1.15' '-r1.16' -u '/v/ossp/cvs/ossp-pkg/l2/l2_test.c,v' 2>/dev/null --- l2_test.c 2001/09/08 11:25:29 1.15 +++ l2_test.c 2001/09/09 16:01:43 1.16 @@ -65,7 +65,12 @@ l2_channel_t *chPrefix; l2_channel_t *chBuf; l2_channel_t *chFile; +#ifdef WITH_SOCKET l2_channel_t *chSock; +#endif +#ifdef WITH_SMTP + l2_channel_t *chSmtp; +#endif l2_stream_t *st; /* @@ -75,25 +80,27 @@ if ((st = l2_stream_create()) == NULL) die("failed to create stream"); -/* Atenzione! Before doing any socket testing, make sure you have a valid */ -/* end point listening, or else you will only get an error message when */ -/* the thing tries to connect. */ +#ifdef WITH_SOCKET + /* Atenzione! Before doing any socket testing, make sure you have a valid */ + /* end point listening, or else you will only get an error message when */ + /* the thing tries to connect. */ if ((chSock = l2_channel_create(&l2_handler_socket)) == NULL) die("failed to create socket channel"); if (l2_channel_configure(chSock, "protocol,ipversion,host,port",\ IPPROTO_UDP, AF_INET, "localhost", 2002) != L2_OK) die("failed to configure socket ipv4 channel"); - -/* if (l2_channel_configure(chSock, "protocol,ipversion,host,port",\ +#if 0 + if (l2_channel_configure(chSock, "protocol,ipversion,host,port",\ IPPROTO_TCP, AF_INET6, "0:0:0:0:0:0:0:1", 2002) != L2_OK) - die("failed to configure socket ipv6 channel"); */ - + die("failed to configure socket ipv6 channel"); +#endif if (l2_channel_open(chSock) != L2_OK) die("failed to open socket channel"); if (l2_stream_channel(st, chSock, L2_LEVEL_UPTO(L2_LEVEL_WARNING)) != L2_OK) die("failed to attach first channel into stream"); +#endif if ((chPrefix = l2_channel_create(&l2_handler_prefix)) == NULL) /* Prefix */ die("failed to create prefix channel"); @@ -125,6 +132,20 @@ if (l2_stream_channel(st, chPrefix, L2_LEVEL_UPTO(L2_LEVEL_WARNING)) != L2_OK) die("failed to attach channel stack into stream"); +#ifdef WITH_SMTP + if ((chSmtp = l2_channel_create(&l2_handler_smtp)) == NULL) /* SMTP */ + die("failed to create smtp channel"); + + if (l2_channel_configure(chSmtp, "rcpt,host,port", "rse@engelschall.com", "en1", "25") != L2_OK) + die("failed to configure smtp channel"); + + if (l2_channel_open(chSmtp) != L2_OK) + die("failed to open smtp channel"); + + if (l2_stream_channel(st, chSmtp, L2_LEVEL_UPTO(L2_LEVEL_ERROR)) != L2_OK) + die("failed to attach smtp channel into stream"); +#endif + if (l2_stream_levels(st, L2_LEVEL_UPTO(L2_LEVEL_WARNING)) != L2_OK) die("failed to set global logging level");