]> code.citadel.org Git - citadel.git/blobdiff - citadel/include/ctdl_module.h
NETCFG: make basic parsing
[citadel.git] / citadel / include / ctdl_module.h
index 12926921509fb8f14ad0351e970a1332506ef411..25a00fa70d250eaef5e6cad520ebcf4e0144493c 100644 (file)
@@ -378,6 +378,90 @@ struct config {
 extern struct config config;
 
 
+typedef struct CfgLineType CfgLineType;
+typedef struct RoomNetCfgLine RoomNetCfgLine;
+typedef struct OneRoomNetCfg OneRoomNetCfg;
+
+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;
+       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);
+
+
+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);
+void NetworkLearnTopology(char *node, char *path, HashList *the_netmap, int *netmap_changed);
+int CtdlIsValidNode(const StrBuf **nexthop,
+                   const StrBuf **secret,
+                   StrBuf *node,
+                   HashList *IgnetCfg,
+                   HashList *the_netmap);
+
+
+
+
+int CtdlNetworkTalkingTo(const char *nodename, long len, int operation);
+
+/*
+ * Operations that can be performed by network_talking_to()
+ */
+enum {
+        NTT_ADD,
+        NTT_REMOVE,
+        NTT_CHECK
+};
 
 /*
  * Expose API calls from user_ops.c