About: Citadel is an advanced messaging and collaboration system for groupware and BBS applications (preferred OS: Linux).
  Fossies Dox: citadel.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

ctdl_module.h File Reference
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <ctype.h>
#include <signal.h>
#include <pwd.h>
#include <errno.h>
#include <syslog.h>
#include <sys/types.h>
#include <time.h>
#include <sys/wait.h>
#include <string.h>
#include <limits.h>
#include <libcitadel.h>
#include "server.h"
#include "sysdep_decls.h"
#include "msgbase.h"
#include "threads.h"
#include "citadel_dirs.h"
#include "context.h"
Include dependency graph for ctdl_module.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define GC_MALLOC   malloc
#define GC_MALLOC_ATOMIC   malloc
#define GC_FREE   free
#define GC_REALLOC   realloc
#define CTDL_MODULE_INIT(module_name)   char *ctdl_module_##module_name##_init (int threading)
#define CTDL_INIT_CALL(module_name)   ctdl_module_##module_name##_init (threading)
#define CTDL_MODULE_UPGRADE(module_name)   char *ctdl_module_##module_name##_upgrade (void)
#define CTDL_UPGRADE_CALL(module_name)   ctdl_module_##module_name##_upgrade ()
#define CtdlAideMessage(TEXT, SUBJECT)
#define PRIO_QUEUE   500
#define PRIO_AGGR   1000
#define PRIO_SEND   1500
#define PRIO_CLEANUP   2000
#define PRIO_HOUSE   3000
#define PRIO_CREATE   10000
#define PRIO_LOGOUT   15000
#define PRIO_LOGIN   20000
#define PRIO_START   25000
#define PRIO_STOP   30000
#define PRIO_ASYNC   35000
#define PRIO_SHUTDOWN   40000
#define PRIO_UNSTEALTH   45000
#define PRIO_STEALTH   50000
#define NODENAME   CtdlGetConfigStr("c_nodename")
#define FQDN   CtdlGetConfigStr("c_fqdn")
#define CTDLUID   ctdluid
#define CREATAIDE   CtdlGetConfigInt("c_creataide")
#define REGISCALL   CtdlGetConfigInt("c_regiscall")
#define TWITDETECT   CtdlGetConfigInt("c_twitdetect")
#define TWITROOM   CtdlGetConfigStr("c_twitroom")
#define RESTRICT_INTERNET   CtdlGetConfigInt("c_restrict")
#define CtdlREGISTERRoomCfgType(a, p, uniq, nSegs, s, d)   RegisterRoomCfgType(#a, sizeof(#a) - 1, a, p, uniq, nSegs, s, d);


typedef void(* ForEachRoomCallBack) (struct ctdlroom *EachRoom, void *out_data)


enum  {
  crr_ok , crr_room_not_found , crr_already_exists , crr_noneditable ,
  crr_invalid_floor , crr_access_denied
enum  {
  ac_none , ac_logged_in_or_guest , ac_logged_in , ac_room_aide ,
  ac_aide , ac_internal
enum  {
  pass_ok , pass_already_logged_in , pass_no_user , pass_internal_error ,
enum  { login_ok , login_already_logged_in , login_too_many_users , login_not_found }


void CtdlRegisterSessionHook (void(*fcn_ptr)(void), int EventType, int Priority)
void CtdlUnregisterSessionHook (void(*fcn_ptr)(void), int EventType)
void CtdlShutdownServiceHooks (void)
void CtdlRegisterUserHook (void(*fcn_ptr)(struct ctdluser *), int EventType)
void CtdlUnregisterUserHook (void(*fcn_ptr)(struct ctdluser *), int EventType)
void CtdlRegisterXmsgHook (int(*fcn_ptr)(char *, char *, char *, char *), int order)
void CtdlUnregisterXmsgHook (int(*fcn_ptr)(char *, char *, char *, char *), int order)
void CtdlRegisterMessageHook (int(*handler)(struct CtdlMessage *, struct recptypes *), int EventType)
void CtdlUnregisterMessageHook (int(*handler)(struct CtdlMessage *, struct recptypes *), int EventType)
void CtdlRegisterRoomHook (int(*fcn_ptr)(struct ctdlroom *))
void CtdlUnregisterRoomHook (int(*fnc_ptr)(struct ctdlroom *))
void CtdlRegisterDeleteHook (void(*handler)(char *, long))
void CtdlUnregisterDeleteHook (void(*handler)(char *, long))
void CtdlRegisterCleanupHook (void(*fcn_ptr)(void))
void CtdlUnregisterCleanupHook (void(*fcn_ptr)(void))
void CtdlRegisterEVCleanupHook (void(*fcn_ptr)(void))
void CtdlUnregisterEVCleanupHook (void(*fcn_ptr)(void))
void CtdlRegisterProtoHook (void(*handler)(char *), char *cmd, char *desc)
void CtdlRegisterServiceHook (int tcp_port, char *sockpath, void(*h_greeting_function)(void), void(*h_command_function)(void), void(*h_async_function)(void), const char *ServiceName)
void CtdlUnregisterServiceHook (int tcp_port, char *sockpath, void(*h_greeting_function)(void), void(*h_command_function)(void), void(*h_async_function)(void))
void CtdlRegisterFixedOutputHook (char *content_type, void(*output_function)(char *supplied_data, int len))
void CtdlUnRegisterFixedOutputHook (char *content_type)
void CtdlRegisterMaintenanceThread (char *name, void *(*thread_proc)(void *arg))
void CtdlRegisterSearchFuncHook (void(*fcn_ptr)(int *, long **, const char *), char *name)
void CtdlDisableHouseKeeping (void)
void CtdlEnableHouseKeeping (void)
void CtdlModuleStartCryptoMsgs (char *ok_response, char *nosup_response, char *error_response)
struct CitContextCtdlGetContextArray (int *count)
void CtdlFillSystemContext (struct CitContext *context, char *name)
int CtdlTrySingleUser (void)
void CtdlEndSingleUser (void)
int CtdlWantSingleUser (void)
int CtdlIsSingleUser (void)
int CtdlIsUserLoggedIn (char *user_name)
int CtdlIsUserLoggedInByNum (long usernum)
void CtdlBumpNewMailCounter (long which_user)
long CtdlGetCurrentMessageNumber (void)
unsigned CtdlCreateRoom (char *new_room_name, int new_room_type, char *new_room_pass, int new_room_floor, int really_create, int avoid_access, int new_room_view)
int CtdlGetRoom (struct ctdlroom *qrbuf, const char *room_name)
int CtdlGetRoomLock (struct ctdlroom *qrbuf, const char *room_name)
int CtdlDoIHavePermissionToDeleteThisRoom (struct ctdlroom *qr)
void CtdlRoomAccess (struct ctdlroom *roombuf, struct ctdluser *userbuf, int *result, int *view)
void CtdlPutRoomLock (struct ctdlroom *qrbuf)
void CtdlForEachRoom (ForEachRoomCallBack CB, void *in_data)
char * LoadRoomNetConfigFile (long roomnum)
void SaveRoomNetConfigFile (long roomnum, const char *raw_netconfig)
void CtdlDeleteRoom (struct ctdlroom *qrbuf)
int CtdlRenameRoom (char *old_name, char *new_name, int new_floor)
void CtdlUserGoto (char *where, int display_result, int transiently, int *msgs, int *new, long *oldest, long *newest)
struct floorCtdlGetCachedFloor (int floor_num)
void CtdlScheduleRoomForDeletion (struct ctdlroom *qrbuf)
void CtdlGetFloor (struct floor *flbuf, int floor_num)
void CtdlPutFloor (struct floor *flbuf, int floor_num)
void CtdlPutFloorLock (struct floor *flbuf, int floor_num)
int CtdlGetFloorByName (const char *floor_name)
int CtdlGetFloorByNameLock (const char *floor_name)
int CtdlGetAvailableFloor (void)
int CtdlIsNonEditable (struct ctdlroom *qrbuf)
void CtdlPutRoom (struct ctdlroom *)
int CtdlAccessCheck (int)
void CtdlModuleDoSearch (int *num_msgs, long **search_msgs, const char *search_string, const char *func_name)
int CtdlGetUser (struct ctdluser *usbuf, char *name)
int CtdlGetUserLen (struct ctdluser *usbuf, const char *name, long len)
int CtdlGetUserLock (struct ctdluser *usbuf, char *name)
void CtdlPutUser (struct ctdluser *usbuf)
void CtdlPutUserLock (struct ctdluser *usbuf)
int CtdlLockGetCurrentUser (void)
void CtdlPutCurrentUserLock (void)
int CtdlGetUserByNumber (struct ctdluser *usbuf, long number)
void CtdlGetRelationship (visit *vbuf, struct ctdluser *rel_user, struct ctdlroom *rel_room)
void CtdlSetRelationship (visit *newvisit, struct ctdluser *rel_user, struct ctdlroom *rel_room)
void CtdlMailboxName (char *buf, size_t n, const struct ctdluser *who, const char *prefix)
int CtdlLoginExistingUser (const char *username)
int CtdlTryPassword (const char *password, long len)
void CtdlUserLogout (void)
long CtdlLocateMessageByEuid (char *euid, struct ctdlroom *qrbuf)
int attach_extauth (struct ctdluser *who, StrBuf *claimed_id)

Macro Definition Documentation


#define CREATAIDE   CtdlGetConfigInt("c_creataide")

Definition at line 260 of file ctdl_module.h.


#define CTDL_INIT_CALL (   module_name)    ctdl_module_##module_name##_init (threading)

Definition at line 52 of file ctdl_module.h.


#define CTDL_MODULE_INIT (   module_name)    char *ctdl_module_##module_name##_init (int threading)

Definition at line 50 of file ctdl_module.h.


#define CTDL_MODULE_UPGRADE (   module_name)    char *ctdl_module_##module_name##_upgrade (void)

Definition at line 54 of file ctdl_module.h.


#define CTDL_UPGRADE_CALL (   module_name)    ctdl_module_##module_name##_upgrade ()

Definition at line 56 of file ctdl_module.h.

◆ CtdlAideMessage

#define CtdlAideMessage (   TEXT,
"Citadel", \
long quickie_message(const char *from, const char *fromaddr, const char *to, char *room, const char *text, int format_type, const char *subject)
Definition: msgbase.c:2921
Definition: server.h:176
#define AIDEROOM
Definition: sysconfig.h:63

Definition at line 58 of file ctdl_module.h.

◆ CtdlREGISTERRoomCfgType

#define CtdlREGISTERRoomCfgType (   a,
)    RegisterRoomCfgType(#a, sizeof(#a) - 1, a, p, uniq, nSegs, s, d);

Definition at line 266 of file ctdl_module.h.


#define CTDLUID   ctdluid

Definition at line 259 of file ctdl_module.h.


#define FQDN   CtdlGetConfigStr("c_fqdn")

Definition at line 258 of file ctdl_module.h.


#define GC_FREE   free

Definition at line 14 of file ctdl_module.h.


#define GC_MALLOC   malloc

Definition at line 12 of file ctdl_module.h.


#define GC_MALLOC_ATOMIC   malloc

Definition at line 13 of file ctdl_module.h.


#define GC_REALLOC   realloc

Definition at line 15 of file ctdl_module.h.


#define NODENAME   CtdlGetConfigStr("c_nodename")

Definition at line 257 of file ctdl_module.h.


#define PRIO_AGGR   1000

Definition at line 73 of file ctdl_module.h.


#define PRIO_ASYNC   35000

Definition at line 89 of file ctdl_module.h.


#define PRIO_CLEANUP   2000

Definition at line 75 of file ctdl_module.h.


#define PRIO_CREATE   10000

Definition at line 79 of file ctdl_module.h.


#define PRIO_HOUSE   3000

Definition at line 77 of file ctdl_module.h.


#define PRIO_LOGIN   20000

Definition at line 83 of file ctdl_module.h.


#define PRIO_LOGOUT   15000

Definition at line 81 of file ctdl_module.h.


#define PRIO_QUEUE   500

Definition at line 72 of file ctdl_module.h.


#define PRIO_SEND   1500

Definition at line 74 of file ctdl_module.h.


#define PRIO_SHUTDOWN   40000

Definition at line 91 of file ctdl_module.h.


#define PRIO_START   25000

Definition at line 85 of file ctdl_module.h.


#define PRIO_STEALTH   50000

Definition at line 95 of file ctdl_module.h.


#define PRIO_STOP   30000

Definition at line 87 of file ctdl_module.h.


#define PRIO_UNSTEALTH   45000

Definition at line 93 of file ctdl_module.h.


#define REGISCALL   CtdlGetConfigInt("c_regiscall")

Definition at line 261 of file ctdl_module.h.


#define RESTRICT_INTERNET   CtdlGetConfigInt("c_restrict")

Definition at line 264 of file ctdl_module.h.


#define TWITDETECT   CtdlGetConfigInt("c_twitdetect")

Definition at line 262 of file ctdl_module.h.


#define TWITROOM   CtdlGetConfigStr("c_twitroom")

Definition at line 263 of file ctdl_module.h.

Typedef Documentation

◆ ForEachRoomCallBack

typedef void(* ForEachRoomCallBack) (struct ctdlroom *EachRoom, void *out_data)

Definition at line 203 of file ctdl_module.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Definition at line 224 of file ctdl_module.h.

◆ anonymous enum

anonymous enum

Definition at line 241 of file ctdl_module.h.

◆ anonymous enum

anonymous enum

Definition at line 289 of file ctdl_module.h.

◆ anonymous enum

anonymous enum

Definition at line 301 of file ctdl_module.h.

Function Documentation

◆ attach_extauth()

◆ CtdlAccessCheck()

◆ CtdlBumpNewMailCounter()

void CtdlBumpNewMailCounter ( long  which_user)

◆ CtdlCreateRoom()

◆ CtdlDeleteRoom()

◆ CtdlDisableHouseKeeping()

void CtdlDisableHouseKeeping ( void  )

◆ CtdlDoIHavePermissionToDeleteThisRoom()

int CtdlDoIHavePermissionToDeleteThisRoom ( struct ctdlroom qr)

Definition at line 1095 of file room_ops.c.

References CC, CtdlIsNonEditable(), is_room_aide(), MAILROOM, QR_MAILBOX, ctdlroom::QRflags, and ctdlroom::QRname.

Referenced by cmd_kill(), and imap_delete().

◆ CtdlEnableHouseKeeping()

void CtdlEnableHouseKeeping ( void  )

◆ CtdlEndSingleUser()

void CtdlEndSingleUser ( void  )

Definition at line 49 of file context.c.

References begin_critical_section(), end_critical_section(), S_SINGLE_USER, and want_single_user.

Referenced by cmd_migr().

◆ CtdlFillSystemContext()

◆ CtdlForEachRoom()

◆ CtdlGetAvailableFloor()

int CtdlGetAvailableFloor ( void  )

Definition at line 484 of file room_ops.c.

References CtdlGetCachedFloor(), floor::f_flags, F_INUSE, flbuf, and MAXFLOORS.

◆ CtdlGetCachedFloor()

◆ CtdlGetContextArray()

◆ CtdlGetCurrentMessageNumber()

long CtdlGetCurrentMessageNumber ( void  )

Definition at line 199 of file control.c.

References CtdlGetConfigLong().

◆ CtdlGetFloor()

void CtdlGetFloor ( struct floor flbuf,
int  floor_num 

◆ CtdlGetFloorByName()

int CtdlGetFloorByName ( const char *  floor_name)

Definition at line 454 of file room_ops.c.

References CtdlGetCachedFloor(), floor::f_flags, F_INUSE, floor::f_name, flbuf, and MAXFLOORS.

Referenced by CtdlGetFloorByNameLock().

◆ CtdlGetFloorByNameLock()

int CtdlGetFloorByNameLock ( const char *  floor_name)

Definition at line 473 of file room_ops.c.

References begin_critical_section(), CtdlGetFloorByName(), and S_FLOORTAB.

◆ CtdlGetRelationship()

◆ CtdlGetRoom()

◆ CtdlGetRoomLock()

◆ CtdlGetUser()

◆ CtdlGetUserByNumber()

◆ CtdlGetUserLen()

int CtdlGetUserLen ( struct ctdluser usbuf,
const char *  name,
long  len 

◆ CtdlGetUserLock()

◆ CtdlIsNonEditable()

int CtdlIsNonEditable ( struct ctdlroom qrbuf)

◆ CtdlIsSingleUser()

int CtdlIsSingleUser ( void  )

Definition at line 63 of file context.c.

References num_sessions, and want_single_user.

Referenced by do_housekeeping().

◆ CtdlIsUserLoggedIn()

int CtdlIsUserLoggedIn ( char *  user_name)

◆ CtdlIsUserLoggedInByNum()

int CtdlIsUserLoggedInByNum ( long  usernum)

◆ CtdlLocateMessageByEuid()

◆ CtdlLockGetCurrentUser()

int CtdlLockGetCurrentUser ( void  )

◆ CtdlLoginExistingUser()

◆ CtdlMailboxName()

◆ CtdlModuleDoSearch()

void CtdlModuleDoSearch ( int *  num_msgs,
long **  search_msgs,
const char *  search_string,
const char *  func_name 

◆ CtdlModuleStartCryptoMsgs()

void CtdlModuleStartCryptoMsgs ( char *  ok_response,
char *  nosup_response,
char *  error_response 

◆ CtdlPutCurrentUserLock()

void CtdlPutCurrentUserLock ( void  )

Definition at line 138 of file user_ops.c.

References CC, and CtdlPutUser().

Referenced by cmd_setu(), cmd_slrp(), CtdlSubmitMsg(), pop3_update(), and vcard_upload_aftersave().

◆ CtdlPutFloor()

void CtdlPutFloor ( struct floor flbuf,
int  floor_num 

◆ CtdlPutFloorLock()

void CtdlPutFloorLock ( struct floor flbuf,
int  floor_num 

Definition at line 589 of file room_ops.c.

References CtdlPutFloor(), end_critical_section(), flbuf, and S_FLOORTAB.

Referenced by lputfloor().

◆ CtdlPutRoom()

void CtdlPutRoom ( struct ctdlroom qrbuf)

◆ CtdlPutRoomLock()

◆ CtdlPutUser()

◆ CtdlPutUserLock()

◆ CtdlRegisterCleanupHook()

void CtdlRegisterCleanupHook ( void(*)(void)  fcn_ptr)

◆ CtdlRegisterDeleteHook()

void CtdlRegisterDeleteHook ( void(*)(char *, long)  handler)

◆ CtdlRegisterEVCleanupHook()

void CtdlRegisterEVCleanupHook ( void(*)(void)  fcn_ptr)

◆ CtdlRegisterFixedOutputHook()

void CtdlRegisterFixedOutputHook ( char *  content_type,
void(*)(char *supplied_data, int len)  output_function 

◆ CtdlRegisterMaintenanceThread()

void CtdlRegisterMaintenanceThread ( char *  name,
void *(*)(void *arg)  thread_proc 

◆ CtdlRegisterMessageHook()

◆ CtdlRegisterProtoHook()

◆ CtdlRegisterRoomHook()

void CtdlRegisterRoomHook ( int(*)(struct ctdlroom *)  fcn_ptr)

◆ CtdlRegisterSearchFuncHook()

void CtdlRegisterSearchFuncHook ( void(*)(int *, long **, const char *)  fcn_ptr,
char *  name 

◆ CtdlRegisterServiceHook()

◆ CtdlRegisterSessionHook()

◆ CtdlRegisterUserHook()

void CtdlRegisterUserHook ( void(*)(struct ctdluser *)  fcn_ptr,
int  EventType 

◆ CtdlRegisterXmsgHook()

void CtdlRegisterXmsgHook ( int(*)(char *, char *, char *, char *)  fcn_ptr,
int  order 

◆ CtdlRenameRoom()

◆ CtdlRoomAccess()

◆ CtdlScheduleRoomForDeletion()

void CtdlScheduleRoomForDeletion ( struct ctdlroom qrbuf)

◆ CtdlSetRelationship()

◆ CtdlShutdownServiceHooks()

void CtdlShutdownServiceHooks ( void  )

◆ CtdlTryPassword()

◆ CtdlTrySingleUser()

int CtdlTrySingleUser ( void  )

Definition at line 32 of file context.c.

References begin_critical_section(), end_critical_section(), S_SINGLE_USER, and want_single_user.

Referenced by cmd_migr().

◆ CtdlUnregisterCleanupHook()

void CtdlUnregisterCleanupHook ( void(*)(void)  fcn_ptr)

◆ CtdlUnregisterDeleteHook()

void CtdlUnregisterDeleteHook ( void(*)(char *, long)  handler)

◆ CtdlUnregisterEVCleanupHook()

void CtdlUnregisterEVCleanupHook ( void(*)(void)  fcn_ptr)

◆ CtdlUnRegisterFixedOutputHook()

void CtdlUnRegisterFixedOutputHook ( char *  content_type)

◆ CtdlUnregisterMessageHook()

void CtdlUnregisterMessageHook ( int(*)(struct CtdlMessage *, struct recptypes *)  handler,
int  EventType 

◆ CtdlUnregisterRoomHook()

void CtdlUnregisterRoomHook ( int(*)(struct ctdlroom *)  fnc_ptr)

◆ CtdlUnregisterServiceHook()

void CtdlUnregisterServiceHook ( int  tcp_port,
char *  sockpath,
void(*)(void)  h_greeting_function,
void(*)(void)  h_command_function,
void(*)(void)  h_async_function 

◆ CtdlUnregisterSessionHook()

void CtdlUnregisterSessionHook ( void(*)(void)  fcn_ptr,
int  EventType 

◆ CtdlUnregisterUserHook()

void CtdlUnregisterUserHook ( void(*)(struct ctdluser *)  fcn_ptr,
int  EventType 

◆ CtdlUnregisterXmsgHook()

void CtdlUnregisterXmsgHook ( int(*)(char *, char *, char *, char *)  fcn_ptr,
int  order 

◆ CtdlUserGoto()

◆ CtdlUserLogout()

◆ CtdlWantSingleUser()

int CtdlWantSingleUser ( void  )

Definition at line 57 of file context.c.

References want_single_user.

Referenced by begin_session().

◆ LoadRoomNetConfigFile()

char * LoadRoomNetConfigFile ( long  roomnum)

◆ SaveRoomNetConfigFile()

void SaveRoomNetConfigFile ( long  roomnum,
const char *  raw_netconfig