From 85a574e6cc97eef54ef6099a7edb9a5e01acc59e Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 5 Jan 2024 15:22:18 -0500 Subject: [PATCH] The little LEDs on the NanoPi blink when there is activity. It's fun to watch. It's fun to build on ARM first and try x86 later. --- citadel/server/citserver.h | 2 +- citadel/server/ctdl_module.h | 126 +++++++++------------------ citadel/server/internet_addressing.h | 4 +- citadel/utils/setup.c | 6 +- 4 files changed, 47 insertions(+), 91 deletions(-) diff --git a/citadel/server/citserver.h b/citadel/server/citserver.h index 569aeeba1..9eaaa16af 100644 --- a/citadel/server/citserver.h +++ b/citadel/server/citserver.h @@ -7,7 +7,7 @@ #include "context.h" #include "ctdl_module.h" -/* Simple linked list structures ... used in a bunch of different places. */ +// Simple linked list structures ... used in a bunch of different places. typedef struct RoomProcList RoomProcList; struct RoomProcList { struct RoomProcList *next; diff --git a/citadel/server/ctdl_module.h b/citadel/server/ctdl_module.h index e3ec8098b..b588fe8bb 100644 --- a/citadel/server/ctdl_module.h +++ b/citadel/server/ctdl_module.h @@ -46,9 +46,7 @@ extern int threading; -/* - * define macros for module init stuff - */ +// define macros for module init stuff #define CTDL_MODULE_INIT(module_name) char *ctdl_module_##module_name##_init (int threading) @@ -68,36 +66,24 @@ extern int threading; FMT_CITADEL, \ SUBJECT) -/* - * Hook functions available to modules. - */ -/* Priorities for */ +// Hook functions available to modules. + +// Priority levels for event hooks #define PRIO_QUEUE 500 #define PRIO_AGGR 1000 #define PRIO_SEND 1500 #define PRIO_CLEANUP 2000 -/* Priorities for EVT_HOUSE */ #define PRIO_HOUSE 3000 -/* Priorities for EVT_LOGIN */ #define PRIO_CREATE 10000 -/* Priorities for EVT_LOGOUT */ #define PRIO_LOGOUT 15000 -/* Priorities for EVT_LOGIN */ #define PRIO_LOGIN 20000 -/* Priorities for EVT_START */ #define PRIO_START 25000 -/* Priorities for EVT_STOP */ #define PRIO_STOP 30000 -/* Priorities for EVT_ASYNC */ #define PRIO_ASYNC 35000 -/* Priorities for EVT_SHUTDOWN */ #define PRIO_SHUTDOWN 40000 -/* Priorities for EVT_UNSTEALTH */ #define PRIO_UNSTEALTH 45000 -/* Priorities for EVT_STEALTH */ #define PRIO_STEALTH 50000 - void CtdlRegisterSessionHook(void (*fcn_ptr)(void), int EventType, int Priority); void CtdlShutdownServiceHooks(void); void CtdlRegisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType); @@ -109,34 +95,28 @@ void CtdlRegisterCleanupHook(void (*fcn_ptr)(void)); void CtdlRegisterEVCleanupHook(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 + char *sockpath, + void (*h_greeting_function) (void), + void (*h_command_function) (void), + void (*h_async_function) (void), + const char *ServiceName ); void CtdlRegisterFixedOutputHook(char *content_type, void (*output_function) (char *supplied_data, int len)); void CtdlRegisterMaintenanceThread(char *name, void *(*thread_proc) (void *arg)); -/* - * if you say a) (which may take a while) - * don't forget to say b) - */ -void CtdlDisableHouseKeeping(void); -void CtdlEnableHouseKeeping(void); +void CtdlDisableHouseKeeping(void); // If you call this, it may take a while... +void CtdlEnableHouseKeeping(void); // ...so don't forget to call this later. -/* TODODRW: This needs to be changed into a hook type interface - * for now we have this horrible hack - */ +// TODODRW: This needs to be changed into a hook type interface +// for now we have this horrible hack void CtdlModuleStartCryptoMsgs(char *ok_response, char *nosup_response, char *error_response); -/* return the current context list as an array and do it in a safe manner - * The returned data is a copy so only reading is useful - * The number of contexts is returned in count. - * Beware, this does not copy any of the data pointed to by the context. - * This means that you can not rely on things like the redirect buffer being valid. - * You must free the returned pointer when done. - */ +// return the current context list as an array and do it in a safe manner +// The returned data is a copy so only reading is useful +// The number of contexts is returned in count. +// Beware, this does not copy any of the data pointed to by the context. +// This means that you can not rely on things like the redirect buffer being valid. +// You must free the returned pointer when done. struct CitContext *CtdlGetContextArray (int *count); void CtdlFillSystemContext(struct CitContext *context, char *name); int CtdlTrySingleUser(void); @@ -150,20 +130,16 @@ int CtdlIsUserLoggedInByNum (long usernum); void CtdlBumpNewMailCounter(long which_user); -/* - * CtdlGetCurrentMessageNumber() - Obtain the current highest message number in the system - * This provides a quick way to initialize a variable that might be used to indicate - * messages that should not be processed. For example, a new inbox script will use this - * to record determine that messages older than this should not be processed. - * This function is defined in control.c - */ +// CtdlGetCurrentMessageNumber() - Obtain the current highest message number in the system +// This provides a quick way to initialize a variable that might be used to indicate +// messages that should not be processed. For example, a new inbox script will use this +// to record determine that messages older than this should not be processed. +// This function is defined in control.c long CtdlGetCurrentMessageNumber(void); -/* - * Expose various room operation functions from room_ops.c to the modules API - */ +// Expose various room operation functions from room_ops.c to the modules API unsigned CtdlCreateRoom(char *new_room_name, int new_room_type, @@ -195,26 +171,22 @@ int CtdlGetAvailableFloor(void); int CtdlIsNonEditable(struct ctdlroom *qrbuf); void CtdlPutRoom(struct ctdlroom *); -/* - * Possible return values for CtdlRenameRoom() - */ +// Possible return values for CtdlRenameRoom() enum { - crr_ok, /* success */ - crr_room_not_found, /* room not found */ - crr_already_exists, /* new name already exists */ - crr_noneditable, /* cannot edit this room */ - crr_invalid_floor, /* target floor does not exist */ - crr_access_denied /* not allowed to edit this room */ + crr_ok, // success + crr_room_not_found, // room not found + crr_already_exists, // new name already exists + crr_noneditable, // cannot edit this room + crr_invalid_floor, // target floor does not exist + crr_access_denied // not allowed to edit this room }; -/* - * API declarations from citserver.h - */ +// API declarations from citserver.h int CtdlAccessCheck(int); -/* 'required access level' values which may be passed to CtdlAccessCheck() - */ + +// 'required access level' values which may be passed to CtdlAccessCheck() enum { ac_none, ac_logged_in_or_guest, @@ -235,10 +207,7 @@ enum { #define CtdlREGISTERRoomCfgType(a, p, uniq, nSegs, s, d) RegisterRoomCfgType(#a, sizeof(#a) - 1, a, p, uniq, nSegs, s, d); - -/* - * Expose API calls from user_ops.c - */ +// Expose API calls from user_ops.c int CtdlGetUser(struct ctdluser *usbuf, char *name); int CtdlGetUserLen(struct ctdluser *usbuf, const char *name, long len); int CtdlGetUserLock(struct ctdluser *usbuf, char *name); @@ -252,9 +221,7 @@ void CtdlSetRelationship(struct visit *newvisit, struct ctdluser *rel_user, stru void CtdlMailboxName(char *buf, size_t n, const struct ctdluser *who, const char *prefix); int CtdlLoginExistingUser(const char *username); -/* - * Values which may be returned by CtdlLoginExistingUser() - */ +// Values which may be returned by CtdlLoginExistingUser() enum { pass_ok, pass_already_logged_in, @@ -264,9 +231,8 @@ enum { }; int CtdlTryPassword(const char *password, long len); -/* - * Values which may be returned by CtdlTryPassword() - */ + +// Values which may be returned by CtdlTryPassword() enum { login_ok, login_already_logged_in, @@ -276,20 +242,12 @@ enum { void CtdlUserLogout(void); -/* - * Expose API calls from msgbase.c - */ - -/* - * Expose API calls from euidindex.c - */ +// Expose API calls from euidindex.c long CtdlLocateMessageByEuid(char *euid, struct ctdlroom *qrbuf); -/* - * Expose API calls from external authentication driver - */ +// Expose API calls from external authentication driver int attach_extauth(struct ctdluser *who, StrBuf *claimed_id); -#endif /* CTDL_MODULE_H */ +#endif diff --git a/citadel/server/internet_addressing.h b/citadel/server/internet_addressing.h index 443033561..0f3793858 100644 --- a/citadel/server/internet_addressing.h +++ b/citadel/server/internet_addressing.h @@ -23,9 +23,7 @@ int CtdlHostAlias(char *fqdn); char *harvest_collected_addresses(struct CtdlMessage *msg); int is_email_subscribed_to_list(char *email, char *room_name); -/* - * Values that can be returned by CtdlHostAlias() - */ +// Values that can be returned by CtdlHostAlias() enum { hostalias_nomatch, hostalias_localhost, diff --git a/citadel/utils/setup.c b/citadel/utils/setup.c index a021913a3..a2839ca72 100644 --- a/citadel/utils/setup.c +++ b/citadel/utils/setup.c @@ -1,6 +1,6 @@ // Citadel setup utility // -// Copyright (c) 1987-2023 by the citadel.org team +// Copyright (c) 1987-2024 by the citadel.org team // // This program is open source software. Use, duplication, or disclosure // is subject to the terms of the GNU General Public License, version 3. @@ -62,8 +62,8 @@ typedef enum _SetupStep { eMaxQuestions = 12 } eSetupStep; -///"CREATE_XINETD_ENTRY"; -/* Environment variables, don't translate! */ +// "CREATE_XINETD_ENTRY"; +// Environment variables, don't translate! const char *EnvNames [eMaxQuestions] = { "HOME_DIRECTORY", "SYSADMIN_NAME", -- 2.30.2