Added new function calls for aide_message and lprintf.
[citadel.git] / citadel / include / ctdl_module.h
1 /* $Id$ */
2
3 #ifndef CTDL_MODULE_H
4 #define CTDL_MODULE_H
5
6 #include "server.h"
7 #include "sysdep_decls.h"
8 #include "msgbase.h"
9
10 /*
11  * define macros for module init stuff
12  */
13  
14 #define CTDL_MODULE_INIT(module_name) char *ctdl_module_##module_name##_init (void)
15
16 #define CTDL_INIT_CALL(module_name) ctdl_module_##module_name##_init ()
17
18
19 /*
20  * Prototype for making log entries in Citadel.
21  */
22
23 void CtdlLogPrintf(enum LogLevel loglevel, const char *format, ...);
24
25 /*
26  * Fix the interface to aide_message so that it complies with the Coding style
27  */
28  
29 #define CtdlAideMessage(TEXT, SUBJECT) aide_message(TEXT, SUBJECT)
30
31 /*
32  * Hook functions available to modules.
33  */
34
35 void CtdlRegisterSessionHook(void (*fcn_ptr)(void), int EventType);
36 void CtdlUnregisterSessionHook(void (*fcn_ptr)(void), int EventType);
37
38 void CtdlRegisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
39 void CtdlUnregisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
40
41 void CtdlRegisterXmsgHook(int (*fcn_ptr)(char *, char *, char *), int order);
42 void CtdlUnregisterXmsgHook(int (*fcn_ptr)(char *, char *, char *), int order);
43
44 void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *),
45                                                         int EventType);
46 void CtdlUnregisterMessageHook(int (*handler)(struct CtdlMessage *),
47                                                         int EventType);
48
49 void CtdlRegisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) );
50 void CtdlUnregisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) );
51
52 void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *) );
53 void CtdlUnregisterRoomHook(int (*fnc_ptr)(struct ctdlroom *) );
54
55 void CtdlRegisterDeleteHook(void (*handler)(char *, long) );
56 void CtdlUnregisterDeleteHook(void (*handler)(char *, long) );
57
58 void CtdlRegisterCleanupHook(void (*fcn_ptr)(void));
59 void CtdlUnregisterCleanupHook(void (*fcn_ptr)(void));
60
61 void CtdlRegisterProtoHook(void (*handler)(char *), char *cmd, char *desc);
62 void CtdlUnregisterProtoHook(void (*handler)(char *), char *cmd);
63
64 void CtdlRegisterServiceHook(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                              const char *ServiceName
70 );
71 void CtdlUnregisterServiceHook(int tcp_port,
72                         char *sockpath,
73                         void (*h_greeting_function) (void),
74                         void (*h_command_function) (void),
75                         void (*h_async_function) (void)
76 );
77
78 void CtdlRegisterFixedOutputHook(char *content_type,
79                         void (*output_function) (char *supplied_data, int len)
80 );
81 void CtdlUnRegisterFixedOutputHook(char *content_type);
82
83 void CtdlRegisterMaintenanceThread(char *name, void *(*thread_proc) (void *arg));
84
85 void CtdlRegisterSearchFuncHook(void (*fcn_ptr)(int *, long **, char *), char *name);
86
87
88 /*
89  * Directory services hooks for LDAP etc
90  */
91
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
98
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);
101
102 /* TODODRW: This needs to be changed into a hook type interface
103  * for now we have this horrible hack
104  */
105 void CtdlModuleStartCryptoMsgs(char *ok_response, char *nosup_response, char *error_response);
106
107 #endif /* CTDL_MODULE_H */