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)
18 #define CTDL_MODULE_UPGRADE(module_name) char *ctdl_module_##module_name##_upgrade (void)
20 #define CTDL_UPGRADE_CALL(module_name) ctdl_module_##module_name##_upgrade ()
24 * Prototype for making log entries in Citadel.
27 void CtdlLogPrintf(enum LogLevel loglevel, const char *format, ...);
30 * Fix the interface to aide_message so that it complies with the Coding style
33 #define CtdlAideMessage(TEXT, SUBJECT) aide_message(TEXT, SUBJECT)
36 * Hook functions available to modules.
39 void CtdlRegisterSessionHook(void (*fcn_ptr)(void), int EventType);
40 void CtdlUnregisterSessionHook(void (*fcn_ptr)(void), int EventType);
42 void CtdlRegisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
43 void CtdlUnregisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
45 void CtdlRegisterXmsgHook(int (*fcn_ptr)(char *, char *, char *, char *), int order);
46 void CtdlUnregisterXmsgHook(int (*fcn_ptr)(char *, char *, char *, char *), int order);
48 void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *),
50 void CtdlUnregisterMessageHook(int (*handler)(struct CtdlMessage *),
53 void CtdlRegisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) );
54 void CtdlUnregisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) );
56 void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *) );
57 void CtdlUnregisterRoomHook(int (*fnc_ptr)(struct ctdlroom *) );
59 void CtdlRegisterDeleteHook(void (*handler)(char *, long) );
60 void CtdlUnregisterDeleteHook(void (*handler)(char *, long) );
62 void CtdlRegisterCleanupHook(void (*fcn_ptr)(void));
63 void CtdlUnregisterCleanupHook(void (*fcn_ptr)(void));
65 void CtdlRegisterProtoHook(void (*handler)(char *), char *cmd, char *desc);
66 void CtdlUnregisterProtoHook(void (*handler)(char *), char *cmd);
68 void CtdlRegisterServiceHook(int tcp_port,
70 void (*h_greeting_function) (void),
71 void (*h_command_function) (void),
72 void (*h_async_function) (void),
73 const char *ServiceName
75 void CtdlUnregisterServiceHook(int tcp_port,
77 void (*h_greeting_function) (void),
78 void (*h_command_function) (void),
79 void (*h_async_function) (void)
82 void CtdlRegisterFixedOutputHook(char *content_type,
83 void (*output_function) (char *supplied_data, int len)
85 void CtdlUnRegisterFixedOutputHook(char *content_type);
87 void CtdlRegisterMaintenanceThread(char *name, void *(*thread_proc) (void *arg));
89 void CtdlRegisterSearchFuncHook(void (*fcn_ptr)(int *, long **, char *), char *name);
93 * Directory services hooks for LDAP etc
96 #define DIRECTORY_USER_DEL 1 // Delete a user entry
97 #define DIRECTORY_CREATE_HOST 2 // Create a host entry if not already there.
98 #define DIRECTORY_CREATE_OBJECT 3 // Create a new object for directory entry
99 #define DIRECTORY_ATTRIB_ADD 4 // Add an attribute to the directory entry object
100 #define DIRECTORY_SAVE_OBJECT 5 // Save the object to the directory service
101 #define DIRECTORY_FREE_OBJECT 6 // Free the object and its attributes
103 int CtdlRegisterDirectoryServiceFunc(int (*func)(char *cn, char *ou, void **object), int cmd, char *module);
104 int CtdlDoDirectoryServiceFunc(char *cn, char *ou, void **object, char *module, int cmd);
106 /* TODODRW: This needs to be changed into a hook type interface
107 * for now we have this horrible hack
109 void CtdlModuleStartCryptoMsgs(char *ok_response, char *nosup_response, char *error_response);
113 * Citadel Threads API
115 struct CtdlThreadNode *CtdlThreadCreate(char *name, long flags, void *(*thread_func) (void *arg), void *args);
116 struct CtdlThreadNode *CtdlThreadSchedule(char *name, long flags, void *(*thread_func) (void *arg), void *args, time_t when);
117 void CtdlThreadSleep(int secs);
118 void CtdlThreadStop(struct CtdlThreadNode *thread);
119 int CtdlThreadCheckStop(void);
120 void CtdlThreadCancel(struct CtdlThreadNode *thread);
121 const char *CtdlThreadName(const char *name);
122 struct CtdlThreadNode *CtdlThreadSelf(void);
123 int CtdlThreadGetCount(void);
124 int CtdlThreadGetWorkers(void);
125 double CtdlThreadGetWorkerAvg(void);
126 double CtdlThreadGetLoadAvg(void);
127 void CtdlThreadGC(void);
128 void CtdlThreadStopAll(void);
129 int CtdlThreadSelect(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout, struct CtdlThreadNode *self);
130 void CtdlThreadAllocTSD(void);
132 /* Macros to speed up getting outr thread */
134 #define MYCURSORS (((ThreadTSD*)pthread_getspecific(ThreadKey))->cursors)
135 #define MYTID (((ThreadTSD*)pthread_getspecific(ThreadKey))->tid)
136 #define CT (((ThreadTSD*)pthread_getspecific(ThreadKey))->self)
139 #endif /* CTDL_MODULE_H */