# endif
#endif
#include <dirent.h>
+#include <assert.h>
#include <libcitadel.h>
pCfg->Str.len = len;
pCfg->IsSingleLine = uniq;
pCfg->nSegments = nSegments;
- if (CfgTypeHash == NULL)
+ if (CfgTypeHash == NULL) {
CfgTypeHash = NewHash(1, NULL);
+ }
Put(CfgTypeHash, Name, len, pCfg, NULL);
}
OneRoomNetCfg *ParseRoomNetConfigFile(char *serialized_data)
{
const char *Pos = NULL;
- const char *CPos = NULL;
const CfgLineType *pCfg = NULL;
StrBuf *Line = NULL;
StrBuf *InStr = NULL;
StrBuf *Cfg = NULL;
OneRoomNetCfg *OneRNCfg = NULL;
+ int num_lines = 0;
+ int i = 0;
OneRNCfg = malloc(sizeof(OneRoomNetCfg));
memset(OneRNCfg, 0, sizeof(OneRoomNetCfg));
Line = NewStrBuf();
InStr = NewStrBuf();
Cfg = NewStrBufPlain(serialized_data, -1);
+ num_lines = num_tokens(ChrPtr(Cfg), '\n');
- while (StrBufSipLine(Line, Cfg, &CPos)) {
-
+ for (i=0; i<num_lines; ++i) {
+ StrBufExtract_token(Line, Cfg, i, '\n');
if (StrLength(Line) > 0) {
Pos = NULL;
StrBufExtract_NextToken(InStr, Line, &Pos, '|');
{
const CfgLineType *pCfg;
pCfg = GetCfgTypeByEnum(eCfg, CfgIt);
- if (pCfg->IsSingleLine)
- {
- pCfg->Serializer(pCfg, OutBuffer, OneRNCfg, NULL);
- }
- else
+ if (pCfg)
{
- RoomNetCfgLine *pName = OneRNCfg->NetConfigs[pCfg->C];
- while (pName != NULL)
+ if (pCfg->IsSingleLine)
{
- pCfg->Serializer(pCfg, OutBuffer, OneRNCfg, pName);
- pName = pName->next;
+ pCfg->Serializer(pCfg, OutBuffer, OneRNCfg, NULL);
+ }
+ else
+ {
+ RoomNetCfgLine *pName = OneRNCfg->NetConfigs[pCfg->C];
+ while (pName != NULL)
+ {
+ pCfg->Serializer(pCfg, OutBuffer, OneRNCfg, pName);
+ pName = pName->next;
+ }
}
-
-
}
}
StrBuf *NodeStr;
long nodelen;
int v;
- long lens[2];
- const char *strs[2];
const StrBuf *secret = NULL;
const StrBuf *nexthop = NULL;
);
syslog(LOG_WARNING, "%s", err_buf);
cprintf("%d authentication failed\n", ERROR + PASSWORD_REQUIRED);
-
- strs[0] = CCC->cs_addr;
- lens[0] = strlen(CCC->cs_addr);
-
- strs[1] = "SRV_UNKNOWN";
- lens[1] = sizeof("SRV_UNKNOWN") - 1;
-
- CtdlAideFPMessage(
- err_buf,
- "IGNet Networking.",
- 2, strs, (long*) &lens,
- CCC->cs_pid, 0,
- time(NULL));
-
+ CtdlAideMessage(err_buf, "IGNet Networking");
DeleteHash(&working_ignetcfg);
FreeStrBuf(&NodeStr);
return;
syslog(LOG_WARNING, "%s", err_buf);
cprintf("%d authentication failed\n", ERROR + PASSWORD_REQUIRED);
- strs[0] = CCC->cs_addr;
- lens[0] = strlen(CCC->cs_addr);
-
- strs[1] = "SRV_PW";
- lens[1] = sizeof("SRV_PW") - 1;
-
- CtdlAideFPMessage(
- err_buf,
- "IGNet Networking.",
- 2, strs,
- (long*) &lens,
- CCC->cs_pid, 0,
- time(NULL));
-
+ CtdlAideMessage(err_buf, "IGNet Networking");
DeleteHash(&working_ignetcfg);
FreeStrBuf(&NodeStr);
return;