add whether we're in which eventloop / a worker thread to the log output.
[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                               "%s Modules: " FORMAT, IOSTR, __VA_ARGS__)
26
27 #define MODM_syslog(LEVEL, FORMAT)                              \
28         MDBGLOG(LEVEL) syslog(LEVEL,                            \
29                               "%s Modules: " FORMAT, IOSTR);
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 typedef struct __LogDebugEntry {
60         CtdlDbgFunction F;
61         const char *Name;
62         long Len;
63         const int *LogP;
64 } LogDebugEntry;
65 extern HashList *LogDebugEntryTable;
66 void initialize_server_extensions(void);
67 int DLoader_Exec_Cmd(char *cmdbuf);
68 char *Dynamic_Module_Init(void);
69
70 void CtdlDestroySessionHooks(void);
71 void PerformSessionHooks(int EventType);
72
73 int CheckTDAPVeto (int DBType, StrBuf *ErrMsg);
74 void CtdlDestroyTDAPVetoHooks(void);
75
76 void CtdlDestroyUserHooks(void);
77 void PerformUserHooks(struct ctdluser *usbuf, int EventType);
78
79 int PerformXmsgHooks(char *, char *, char *, char *);
80 void CtdlDestroyXmsgHooks(void);
81
82
83
84 void CtdlDestroyMessageHook(void);
85 int PerformMessageHooks(struct CtdlMessage *, recptypes *recps, int EventType);
86
87
88 void CtdlDestroyNetprocHooks(void);
89 int PerformNetprocHooks(struct CtdlMessage *, char *);
90
91 void CtdlDestroyRoomHooks(void);
92 int PerformRoomHooks(struct ctdlroom *);
93
94
95 void CtdlDestroyDeleteHooks(void);
96 void PerformDeleteHooks(char *, long);
97
98
99 void CtdlDestroyCleanupHooks(void);
100
101 void CtdlDestroyProtoHooks(void);
102
103 void CtdlDestroyServiceHook(void);
104
105 void CtdlDestroySearchHooks(void);
106
107 void CtdlDestroyFixedOutputHooks(void);
108 int PerformFixedOutputHooks(char *, char *, int);
109
110 void CtdlRegisterDebugFlagHook(const char *Name, long len, CtdlDbgFunction F, const int *);
111 void CtdlSetDebugLogFacilities(const char **Str, long n);
112 void CtdlDestroyDebugTable(void);
113
114 #endif /* SERV_EXTENSIONS_H */