]> code.citadel.org Git - citadel.git/commitdiff
* Added CtdlRegisterServiceHook() and its data type, for implementing arbitrary
authorArt Cancro <ajc@citadel.org>
Wed, 8 Dec 1999 18:09:10 +0000 (18:09 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 8 Dec 1999 18:09:10 +0000 (18:09 +0000)
  TCP-based services directly in the Citadel server.  Not finished yet.

citadel/ChangeLog
citadel/dynloader.c
citadel/dynloader.h
citadel/server.h

index cfa7657046e6fec976a3f8fb90c67695f153fa57..450aea79fd32c46a692b955ed05aa7e079b0cfea 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
+Revision 1.424  1999/12/08 18:09:10  ajc
+* Added CtdlRegisterServiceHook() and its data type, for implementing arbitrary
+  TCP-based services directly in the Citadel server.  Not finished yet.
+
 Revision 1.423  1999/11/29 17:39:07  nbryant
 * citserver.c: Solaris lacks inet_aton; use inet_addr instead
 
@@ -1472,3 +1476,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Initial CVS import 
+
index 259c6d3dd8f54b36004b387b143e9bcf8ceed0cb..a9e734ca320de4af6af705412ff6a39008ff1130 100644 (file)
@@ -37,6 +37,7 @@ struct SessionFunctionHook *SessionHookTable = NULL;
 struct UserFunctionHook *UserHookTable = NULL;
 struct XmsgFunctionHook *XmsgHookTable = NULL;
 struct MessageFunctionHook *MessageHookTable = NULL;
+struct ServiceFunctionHook *ServiceHookTable = NULL;
 
 struct ProtoFunctionHook {
        void (*handler) (char *cmdbuf);
@@ -227,6 +228,23 @@ void CtdlRegisterXmsgHook(int (*fcn_ptr) (char *, char *, char *), int order)
        lprintf(5, "Registered a new x-msg function (priority %d)\n", order);
 }
 
+void CtdlRegisterServiceHook(int tcp_port,
+                       void (*h_greeting_function) (void),
+                       void (*h_command_function) (void) )
+{
+       struct ServiceFunctionHook *newfcn;
+
+       newfcn = (struct ServiceFunctionHook *)
+           mallok(sizeof(struct ServiceFunctionHook));
+       newfcn->next = ServiceHookTable;
+       newfcn->tcp_port = tcp_port;
+       newfcn->h_greeting_function = h_greeting_function;
+       newfcn->h_command_function = h_command_function;
+       ServiceHookTable = newfcn;
+       lprintf(5, "Registered a new service (TCP port %d)\n", tcp_port);
+}
+
+
 
 void PerformSessionHooks(int EventType)
 {
index 4e9bb3726f9491acf69cfffb80ffebc48f1e02ee..b53e159a649de5232732c6af6cbeab0ba52fa2a3 100644 (file)
@@ -12,5 +12,8 @@ void CtdlRegisterProtoHook(void (*handler)(char *), char *cmd, char *desc);
 void CtdlRegisterUserHook(void (*fcn_ptr)(char*, long), int EventType);
 void CtdlRegisterXmsgHook(int (*fcn_ptr)(char *, char *, char *), int order);
 void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *), int EventType);
+void CtdlRegisterServiceHook(int tcp_port,
+                        void (*h_greeting_function) (void),
+                        void (*h_command_function) (void) ) ;
 int PerformMessageHooks(struct CtdlMessage *, int EventType);
 char *Dynamic_Module_Init(void);
index 001775ad8e55415f4ddc8814b4973fe92299f752..f101ca9c876ecf29e0bed661c71ea51615af62f7 100644 (file)
@@ -307,6 +307,18 @@ enum {
 
 
 
+/*
+ * ServiceFunctionHook extensions are used for hooks which implement various
+ * non-Citadel services (on TCP protocols) directly in the Citadel server.
+ */
+struct ServiceFunctionHook {
+       struct ServiceFunctionHook *next;
+       int tcp_port;
+       void (*h_greeting_function) (void) ;
+       void (*h_command_function) (void) ;
+};
+extern struct ServiceFunctionHook *ServiceHookTable;
+
 
 
 /* Defines the relationship of a user to a particular room */