f4f720144d090da94eb6d5d816dddf35cbe31cb8
[citadel.git] / citadel / serv_extensions.h
1
2 #ifndef SERV_EXTENSIONS_H
3 #define SERV_EXTENSIONS_H
4
5 #include "server.h"
6
7 /*
8  * This is where we declare all of the server extensions we have.
9  * We'll probably start moving these to a more sane location in the near
10  * future.  For now, this just shuts up the compiler.
11  */
12 //void serv_calendar_destroy(void);
13 //char *serv_test_init(void);
14 //char *serv_postfix_tcpdict(void);
15 /*
16  */
17
18 typedef void (*CtdlDbgFunction) (const int);
19
20 extern int DebugModules;
21 #define MDBGLOG(LEVEL) if ((LEVEL != LOG_DEBUG) || (DebugModules != 0))
22
23 #define MOD_syslog(LEVEL, FORMAT, ...)                          \
24         MDBGLOG(LEVEL) syslog(LEVEL,                            \
25                               "Modules: " FORMAT, __VA_ARGS__)
26
27 #define MODM_syslog(LEVEL, FORMAT)                      \
28         MDBGLOG(LEVEL) syslog(LEVEL,                    \
29                               "Modules: " FORMAT);
30
31
32
33
34 /*
35  * ServiceFunctionHook extensions are used for hooks which implement various
36  * protocols (either on TCP or on unix domain sockets) directly in the Citadel server.
37  */
38 typedef struct ServiceFunctionHook ServiceFunctionHook;
39 struct ServiceFunctionHook {
40         ServiceFunctionHook *next;
41         int tcp_port;
42         char *sockpath;
43         void (*h_greeting_function) (void) ;
44         void (*h_command_function) (void) ;
45         void (*h_async_function) (void) ;
46         int msock;
47         const char* ServiceName; /* this is just for debugging and logging purposes. */
48 };
49 extern ServiceFunctionHook *ServiceHookTable;
50
51 typedef struct CleanupFunctionHook CleanupFunctionHook;
52 struct CleanupFunctionHook {
53         CleanupFunctionHook *next;
54         void (*h_function_pointer) (void);
55 };
56 extern CleanupFunctionHook *CleanupHookTable;
57
58
59 void initialize_server_extensions(void);
60 int DLoader_Exec_Cmd(char *cmdbuf);
61 char *Dynamic_Module_Init(void);
62
63 void CtdlDestroySessionHooks(void);
64 void PerformSessionHooks(int EventType);
65
66 void CtdlDestroyUserHooks(void);
67 void PerformUserHooks(struct ctdluser *usbuf, int EventType);
68
69 int PerformXmsgHooks(char *, char *, char *, char *);
70 void CtdlDestroyXmsgHooks(void);
71
72
73
74 void CtdlDestroyMessageHook(void);
75 int PerformMessageHooks(struct CtdlMessage *, int EventType);
76
77
78 void CtdlDestroyNetprocHooks(void);
79 int PerformNetprocHooks(struct CtdlMessage *, char *);
80
81 void CtdlDestroyRoomHooks(void);
82 int PerformRoomHooks(struct ctdlroom *);
83
84
85 void CtdlDestroyDeleteHooks(void);
86 void PerformDeleteHooks(char *, long);
87
88
89 void CtdlDestroyCleanupHooks(void);
90
91 void CtdlDestroyProtoHooks(void);
92
93 void CtdlDestroyServiceHook(void);
94
95 void CtdlDestroySearchHooks(void);
96
97 void CtdlDestroyFixedOutputHooks(void);
98 int PerformFixedOutputHooks(char *, char *, int);
99
100 void CtdlRegisterDebugFlagHook(const char *Name, long len, CtdlDbgFunction F, const int *);
101 void CtdlSetDebugLogFacilities(const char **Str, long n);
102 void CtdlDestroyDebugTable(void);
103
104 #endif /* SERV_EXTENSIONS_H */