Silence logging in non-debug usecases. The raspii users gonna love this.
[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 extern int EnableMarkers;
33 #define MARKLOG(LEVEL) if ((LEVEL != LOG_DEBUG) || (EnableMarkers != 0))
34
35 #define MARK_syslog(LEVEL, FORMAT, ...)                                 \
36         MARKLOG(LEVEL) syslog(LEVEL,                                    \
37                               "%s: " FORMAT, IOSTR, __VA_ARGS__)
38
39 #define MARKM_syslog(LEVEL, FORMAT)                             \
40         MARKLOG(LEVEL) syslog(LEVEL,                            \
41                                "%s: " FORMAT, IOSTR);
42
43
44 extern int EnableCtlProto;
45 #define CTDLLOG(LEVEL) if ((LEVEL != LOG_DEBUG) || (EnableCtlProto != 0))
46
47 #define CTDL_syslog(LEVEL, FORMAT, ...)                                 \
48         CTDLLOG(LEVEL) syslog(LEVEL,                                    \
49                               "%s CC[%d]: " FORMAT, IOSTR, CCCID, __VA_ARGS__)
50
51 #define CTDLM_syslog(LEVEL, FORMAT)                             \
52         CTDLLOG(LEVEL) syslog(LEVEL,                            \
53                               "%s CC[%d]: " FORMAT, IOSTR, CCCID);
54
55
56
57 /*
58  * ServiceFunctionHook extensions are used for hooks which implement various
59  * protocols (either on TCP or on unix domain sockets) directly in the Citadel server.
60  */
61 typedef struct ServiceFunctionHook ServiceFunctionHook;
62 struct ServiceFunctionHook {
63         ServiceFunctionHook *next;
64         int tcp_port;
65         char *sockpath;
66         void (*h_greeting_function) (void) ;
67         void (*h_command_function) (void) ;
68         void (*h_async_function) (void) ;
69         int msock;
70         const char* ServiceName; /* this is just for debugging and logging purposes. */
71 };
72 extern ServiceFunctionHook *ServiceHookTable;
73
74 typedef struct CleanupFunctionHook CleanupFunctionHook;
75 struct CleanupFunctionHook {
76         CleanupFunctionHook *next;
77         void (*h_function_pointer) (void);
78 };
79 extern CleanupFunctionHook *CleanupHookTable;
80
81
82 typedef struct __LogDebugEntry {
83         CtdlDbgFunction F;
84         const char *Name;
85         long Len;
86         const int *LogP;
87 } LogDebugEntry;
88 extern HashList *LogDebugEntryTable;
89 void initialize_server_extensions(void);
90 int DLoader_Exec_Cmd(char *cmdbuf);
91 char *Dynamic_Module_Init(void);
92
93 void CtdlDestroySessionHooks(void);
94 void PerformSessionHooks(int EventType);
95
96 int CheckTDAPVeto (int DBType, StrBuf *ErrMsg);
97 void CtdlDestroyTDAPVetoHooks(void);
98
99 void CtdlDestroyUserHooks(void);
100 void PerformUserHooks(struct ctdluser *usbuf, int EventType);
101
102 int PerformXmsgHooks(char *, char *, char *, char *);
103 void CtdlDestroyXmsgHooks(void);
104
105
106
107 void CtdlDestroyMessageHook(void);
108 int PerformMessageHooks(struct CtdlMessage *, recptypes *recps, int EventType);
109
110
111 void CtdlDestroyNetprocHooks(void);
112 int PerformNetprocHooks(struct CtdlMessage *, char *);
113
114 void CtdlDestroyRoomHooks(void);
115 int PerformRoomHooks(struct ctdlroom *);
116
117
118 void CtdlDestroyDeleteHooks(void);
119 void PerformDeleteHooks(char *, long);
120
121
122 void CtdlDestroyCleanupHooks(void);
123
124 void CtdlDestroyProtoHooks(void);
125
126 void CtdlDestroyServiceHook(void);
127
128 void CtdlDestroySearchHooks(void);
129
130 void CtdlDestroyFixedOutputHooks(void);
131 int PerformFixedOutputHooks(char *, char *, int);
132
133 void CtdlRegisterDebugFlagHook(const char *Name, long len, CtdlDbgFunction F, const int *);
134 void CtdlSetDebugLogFacilities(const char **Str, long n);
135 void CtdlDestroyDebugTable(void);
136
137 void netcfg_keyname(char *keybuf, long roomnum);
138
139 #endif /* SERV_EXTENSIONS_H */