OSSP CVS Repository

ossp - Check-in [1071]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1071
Date: 2001-Oct-04 16:58:29 (local)
2001-Oct-04 14:58:29 (UTC)
User:ms
Branch:
Comment: Birth of IRC channel.
Tickets:
Inspections:
Files:
ossp-pkg/l2/Makefile.in      1.24 -> 1.25     2 inserted, 0 deleted
ossp-pkg/l2/l2_ch_irc.c      added-> 1.1
ossp-pkg/l2/l2_test.c      1.30 -> 1.31     18 inserted, 0 deleted

ossp-pkg/l2/Makefile.in 1.24 -> 1.25

--- Makefile.in  2001/09/15 16:03:37     1.24
+++ Makefile.in  2001/10/04 14:58:29     1.25
@@ -70,6 +70,7 @@
     l2_ch_pipe.lo \
     l2_ch_syslog.lo \
     l2_ch_socket.lo \
+    l2_ch_irc.lo \
     l2_ch_smtp.lo \
     l2_ch_null.lo \
     l2_ch_filter.lo \
@@ -92,6 +93,7 @@
     l2_ch_pipe.c \
     l2_ch_syslog.c \
     l2_ch_socket.c \
+    l2_ch_irc.c \
     l2_ch_smtp.c \
     l2_ch_null.c \
     l2_ch_filter.c \


ossp-pkg/l2/l2_ch_irc.c -> 1.1

*** /dev/null    Tue Oct 26 11:45:34 2021
--- -    Tue Oct 26 11:51:16 2021
***************
*** 0 ****
--- 1,71 ----
+ /*
+ **  L2 - OSSP Logging Library
+ **  Copyright (c) 2001 The OSSP Project (http://www.ossp.org/)
+ **  Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/)
+ **
+ **  This file is part of OSSP L2, a flexible logging library which
+ **  can be found at http://www.ossp.org/pkg/l2/.
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  l2_ch_irc.c: internet relay chat channel implementation
+ */
+ 
+ #include "l2.h"
+ 
+ static l2_result_t hook_create(l2_context_t *ctx, l2_channel_t *ch)
+ {
+     return L2_OK;
+ }
+ 
+ static l2_result_t hook_configure(l2_context_t *ctx, l2_channel_t *ch, const char *fmt, va_list ap)
+ {
+     return L2_OK;
+ }
+ 
+ static l2_result_t hook_open(l2_context_t *ctx, l2_channel_t *ch)
+ {
+     return L2_OK;
+ }
+ 
+ static l2_result_t hook_write(l2_context_t *ctx, l2_channel_t *ch, l2_level_t level, const char *buf, size_t buf_size)
+ {
+     return L2_OK;
+ }
+ 
+ static l2_result_t hook_close(l2_context_t *ctx, l2_channel_t *ch)
+ {
+     return L2_OK;
+ }
+ 
+ static l2_result_t hook_destroy(l2_context_t *ctx, l2_channel_t *ch)
+ {
+     return L2_OK;
+ }
+ 
+ l2_handler_t l2_handler_irc = {
+     L2_CHANNEL_OUTPUT,
+     hook_create,
+     hook_configure,
+     hook_open,
+     hook_write,
+     hook_close,
+     hook_destroy
+ };
+ 


ossp-pkg/l2/l2_test.c 1.30 -> 1.31

--- l2_test.c    2001/10/04 13:35:47     1.30
+++ l2_test.c    2001/10/04 14:58:29     1.31
@@ -70,6 +70,9 @@
 #ifdef WITH_SOCKET
     l2_channel_t *chSock;
 #endif
+#ifdef WITH_IRC
+    l2_channel_t *chIrc;
+#endif
 #ifdef WITH_SMTP
     l2_channel_t *chSmtp;
 #endif
@@ -157,6 +160,21 @@
         die("failed to attach channel pipe into stream");
 #endif /* Pipe */
 
+#ifdef WITH_IRC
+    /* Atenzione! Before testing IRC start the IRC server. */
+    if ((chIrc = l2_channel_create(&l2_handler_irc)) == NULL)   /* IRC */
+        die("failed to create IRC channel");
+
+    if (l2_channel_configure(chIrc) != L2_OK)
+        die("failed to configure IRC channel");
+
+    if (l2_channel_open(chIrc) != L2_OK)
+        die("failed to open IRC channel");
+
+    if (l2_stream_channel(st, chIrc, L2_LEVEL_UPTO(L2_LEVEL_WARNING), L2_LEVEL_NONE) != L2_OK)
+        die("failed to attach channel IRC into stream");
+#endif /* IRC */
+
 #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   */

CVSTrac 2.0.1