7 #include "sysdep_decls.h"
11 * define macros for module init stuff
14 #define CTDL_MODULE_INIT(module_name) char *ctdl_module_##module_name##_init (int threading)
16 #define CTDL_INIT_CALL(module_name) ctdl_module_##module_name##_init (threading)
20 * Prototype for making log entries in Citadel.
23 void CtdlLogPrintf(enum LogLevel loglevel, const char *format, ...);
26 * Fix the interface to aide_message so that it complies with the Coding style
29 #define CtdlAideMessage(TEXT, SUBJECT) aide_message(TEXT, SUBJECT)
32 * Hook functions available to modules.
35 void CtdlRegisterSessionHook(void (*fcn_ptr)(void), int EventType);
36 void CtdlUnregisterSessionHook(void (*fcn_ptr)(void), int EventType);
38 void CtdlRegisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
39 void CtdlUnregisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
41 void CtdlRegisterXmsgHook(int (*fcn_ptr)(char *, char *, char *), int order);
42 void CtdlUnregisterXmsgHook(int (*fcn_ptr)(char *, char *, char *), int order);
44 void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *),
46 void CtdlUnregisterMessageHook(int (*handler)(struct CtdlMessage *),
49 void CtdlRegisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) );
50 void CtdlUnregisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) );
52 void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *) );
53 void CtdlUnregisterRoomHook(int (*fnc_ptr)(struct ctdlroom *) );
55 void CtdlRegisterDeleteHook(void (*handler)(char *, long) );
56 void CtdlUnregisterDeleteHook(void (*handler)(char *, long) );
58 void CtdlRegisterCleanupHook(void (*fcn_ptr)(void));
59 void CtdlUnregisterCleanupHook(void (*fcn_ptr)(void));
61 void CtdlRegisterProtoHook(void (*handler)(char *), char *cmd, char *desc);
62 void CtdlUnregisterProtoHook(void (*handler)(char *), char *cmd);
64 void CtdlRegisterServiceHook(int tcp_port,
66 void (*h_greeting_function) (void),
67 void (*h_command_function) (void),
68 void (*h_async_function) (void),
69 const char *ServiceName
71 void CtdlUnregisterServiceHook(int tcp_port,
73 void (*h_greeting_function) (void),
74 void (*h_command_function) (void),
75 void (*h_async_function) (void)
78 void CtdlRegisterFixedOutputHook(char *content_type,
79 void (*output_function) (char *supplied_data, int len)
81 void CtdlUnRegisterFixedOutputHook(char *content_type);
83 void CtdlRegisterMaintenanceThread(char *name, void *(*thread_proc) (void *arg));
85 void CtdlRegisterSearchFuncHook(void (*fcn_ptr)(int *, long **, char *), char *name);
89 * Directory services hooks for LDAP etc
92 #define DIRECTORY_USER_DEL 1 // Delete a user entry
93 #define DIRECTORY_CREATE_HOST 2 // Create a host entry if not already there.
94 #define DIRECTORY_CREATE_OBJECT 3 // Create a new object for directory entry
95 #define DIRECTORY_ATTRIB_ADD 4 // Add an attribute to the directory entry object
96 #define DIRECTORY_SAVE_OBJECT 5 // Save the object to the directory service
97 #define DIRECTORY_FREE_OBJECT 6 // Free the object and its attributes
99 int CtdlRegisterDirectoryServiceFunc(int (*func)(char *cn, char *ou, void **object), int cmd, char *module);
100 int CtdlDoDirectoryServiceFunc(char *cn, char *ou, void **object, char *module, int cmd);
102 /* TODODRW: This needs to be changed into a hook type interface
103 * for now we have this horrible hack
105 void CtdlModuleStartCryptoMsgs(char *ok_response, char *nosup_response, char *error_response);
109 * Citadel Threads API
111 struct CtdlThreadNode *CtdlThreadCreate(char *name, long flags, void *(*thread_func) (void *arg), void *args);
112 void CtdlThreadSleep(int secs);
113 void CtdlThreadStop(struct CtdlThreadNode *thread);
114 int CtdlThreadCheckStop(struct CtdlThreadNode *thread);
115 void CtdlThreadCancel(struct CtdlThreadNode *thread);
116 char *CtdlThreadName(struct CtdlThreadNode *thread, char *name);
117 struct CtdlThreadNode *CtdlThreadSelf(void);
118 int CtdlThreadGetCount(void);
119 void CtdlThreadGC(void);
120 void CtdlThreadStopAll(void);
121 int CtdlThreadSelect(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout, struct CtdlThreadNode *self);
123 /* Macros to speed up getting outr thread */
124 #define CT _this_cit_thread
126 struct CtdlThreadNode *_this_cit_thread;\
127 _this_cit_thread = CtdlThreadSelf()
130 #ifdef WITH_THREADLOG
131 #define CtdlThreadPushName(NAME) \
133 _push_name = CtdlThreadName(CtdlThreadSelf(), NAME)
135 #define CtdlThreadPopName() \
136 free (CtdlThreadName(CtdlThreadSelf(), _push_name))
138 #define CtdlThreadPushName(NAME)
139 #define CtdlThreadPopName()
142 #endif /* CTDL_MODULE_H */