+/*
+ * API declarations from citserver.h
+ */
+int CtdlAccessCheck(int);
+/* 'required access level' values which may be passed to CtdlAccessCheck()
+ */
+enum {
+ ac_none,
+ ac_logged_in_or_guest,
+ ac_logged_in,
+ ac_room_aide,
+ ac_aide,
+ ac_internal,
+};
+
+
+
+/*
+ * API declarations from serv_extensions.h
+ */
+void CtdlModuleDoSearch(int *num_msgs, long **search_msgs, const char *search_string, const char *func_name);
+
+#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")
+
+typedef void (*CfgLineParser)(const CfgLineType *ThisOne, StrBuf *Line, const char *LinePos, OneRoomNetCfg *rncfg);
+typedef void (*CfgLineSerializer)(const CfgLineType *ThisOne, StrBuf *OuptputBuffer, OneRoomNetCfg *rncfg, RoomNetCfgLine *data);
+typedef void (*CfgLineDeAllocator)(const CfgLineType *ThisOne, RoomNetCfgLine **data);
+
+struct CfgLineType {
+ RoomNetCfg C;
+ CfgLineParser Parser;
+ CfgLineSerializer Serializer;
+ CfgLineDeAllocator DeAllocator;
+ ConstStr Str;
+ int IsSingleLine;
+ int nSegments;
+};
+
+struct RoomNetCfgLine {
+ RoomNetCfgLine *next;
+ int nValues;
+ StrBuf **Value;
+};
+
+struct OneRoomNetCfg {
+ long lastsent;
+ // long changed;
+ StrBuf *Sender;
+ StrBuf *RoomInfo;
+ RoomNetCfgLine *NetConfigs[maxRoomNetCfg];
+ StrBuf *misc;
+};
+
+
+#define CtdlREGISTERRoomCfgType(a, p, uniq, nSegs, s, d) RegisterRoomCfgType(#a, sizeof(#a) - 1, a, p, uniq, nSegs, s, d);
+void RegisterRoomCfgType(const char* Name, long len, RoomNetCfg eCfg, CfgLineParser p, int uniq, int nSegments, CfgLineSerializer s, CfgLineDeAllocator d);
+void ParseGeneric(const CfgLineType *ThisOne, StrBuf *Line, const char *LinePos, OneRoomNetCfg *sc);
+void SerializeGeneric(const CfgLineType *ThisOne, StrBuf *OutputBuffer, OneRoomNetCfg *sc, RoomNetCfgLine *data);
+void DeleteGenericCfgLine(const CfgLineType *ThisOne, RoomNetCfgLine **data);
+RoomNetCfgLine *DuplicateOneGenericCfgLine(const RoomNetCfgLine *data);
+void AddRoomCfgLine(OneRoomNetCfg *OneRNCfg, struct ctdlroom *qrbuf, RoomNetCfg LineType, RoomNetCfgLine *Line);
+
+OneRoomNetCfg *CtdlGetNetCfgForRoom(long QRNumber);
+void SaveRoomNetConfigFile(OneRoomNetCfg *, long);
+void FreeRoomNetworkStruct(OneRoomNetCfg **);
+
+typedef struct _nodeconf {
+ int DeleteMe;
+ StrBuf *NodeName;
+ StrBuf *Secret;
+ StrBuf *Host;
+ StrBuf *Port;
+}CtdlNodeConf;
+
+HashList* CtdlLoadIgNetCfg(void);
+
+
+int CtdlNetconfigCheckRoomaccess(char *errmsgbuf,
+ size_t n,
+ const char* RemoteIdentifier);
+
+
+typedef struct __NetMap {
+ StrBuf *NodeName;
+ time_t lastcontact;
+ StrBuf *NextHop;
+}CtdlNetMap;
+
+HashList* CtdlReadNetworkMap(void);
+StrBuf *CtdlSerializeNetworkMap(HashList *Map);
+
+
+
+
+/*
+ * 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);
+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);
+
+/*
+ * Values which may be returned by CtdlLoginExistingUser()
+ */
+enum {
+ pass_ok,
+ pass_already_logged_in,
+ pass_no_user,
+ pass_internal_error,
+ pass_wrong_password
+};
+
+int CtdlTryPassword(const char *password, long len);
+/*
+ * Values which may be returned by CtdlTryPassword()
+ */
+enum {
+ login_ok,
+ login_already_logged_in,
+ login_too_many_users,
+ login_not_found
+};
+
+void CtdlUserLogout(void);
+
+/*
+ * Expose API calls from msgbase.c
+ */
+
+
+/*
+ * Expose API calls from euidindex.c
+ */
+long CtdlLocateMessageByEuid(char *euid, struct ctdlroom *qrbuf);
+
+
+/*
+ * Expose API calls from modules/openid/serv_openid_rp.c in order to turn it into a generic external authentication driver
+ */
+int attach_extauth(struct ctdluser *who, StrBuf *claimed_id);
+