void O2IPFilter_SAX2Handler:: startElement(const XMLCh* const uri , const XMLCh* const localname , const XMLCh* const qname , const Attributes& attrs) { CurElm = IPF_XMLELM_NONE; if (MATCHLNAME(L"filter")) { if (CurRecord) delete CurRecord; CurRecord = new O2IPFilterRecord(); CurElm = IPF_XMLELM_NONE; } else if (MATCHLNAME(L"default")) { CurElm = IPF_XMLELM_DEFAULT; } else if (MATCHLNAME(L"enable")) { CurElm = IPF_XMLELM_ENABLE; } else if (MATCHLNAME(L"flag")) { CurElm = IPF_XMLELM_FLAG; } else if (MATCHLNAME(L"cond")) { CurElm = IPF_XMLELM_COND; } }
void O2Boards:: endElement(const XMLCh* const uri , const XMLCh* const localname , const XMLCh* const qname) { switch (parse_elm) { case 1: parse_name = buf; break; case 2: parse_enable = buf[0] == L'0' ? false : true; break; } buf = L""; parse_elm = 0; if (MATCHLNAME(L"board")) { ExLock.Lock(); { O2BoardExMapIt exit = exmap.find(parse_name); if (exit == exmap.end()) { O2BoardEx *ex = new O2BoardEx(); ex->enable = parse_enable; ex->collectors.SetObject(Profile, Client); exmap.insert(O2BoardExMap::value_type(parse_name, ex)); } } ExLock.Unlock(); } }
void O2Boards:: startElement(const XMLCh* const uri , const XMLCh* const localname , const XMLCh* const qname , const Attributes& attrs) { if (MATCHLNAME(L"name")) { parse_elm = 1; } else if (MATCHLNAME(L"enable")) { parse_elm = 2; } else { parse_elm = 0; } }
void O2IMDB_SAX2Handler:: endElement(const XMLCh* const uri , const XMLCh* const localname , const XMLCh* const qname) { switch (CurElm) { case IM_XMLELM_IP: CurIM->ip = e2ip(buf.c_str(), buf.size()); break; case IM_XMLELM_PORT: CurIM->port = (ushort)wcstoul(buf.c_str(), NULL, 10); break; case IM_XMLELM_ID: CurIM->id.assign(buf.c_str(), buf.size()); break; case IM_XMLELM_PUBKEY: CurIM->pubkey.assign(buf.c_str(), buf.size()); break; case IM_XMLELM_NAME: CurIM->name = buf; break; case IM_XMLELM_DATE: CurIM->date = datetime2time_t(buf.c_str(), buf.size()); break; case IM_XMLELM_MSG: CurIM->msg = buf; break; case IM_XMLELM_KEY: CurIM->key.assign(buf.c_str(), buf.size()); break; case IM_XMLELM_MINE: CurIM->mine = buf[0] == L'0' ? false : true; break; case IM_XMLELM_PATH: { hashT id; id.assign(buf.c_str(), buf.size()); CurIM->paths.push_back(id); while (CurIM->paths.size() > O2_BROADCAST_PATH_LIMIT) CurIM->paths.pop_front(); } break; } buf = L""; CurElm = IM_XMLELM_NONE; if (!CurIM || !MATCHLNAME(L"message")) return; IMDB->AddMessage(*CurIM); }
void O2IMDB_SAX2Handler:: endElement(const XMLCh* const uri , const XMLCh* const localname , const XMLCh* const qname) { CurElm = IM_XMLELM_NONE; if (!CurIM || !MATCHLNAME(L"message")) return; IMDB->AddMessage(*CurIM); }
void O2KeyDB_SAX2Handler:: endElement(const XMLCh* const uri , const XMLCh* const localname , const XMLCh* const qname) { switch (CurElm) { case KEY_XMLELM_HASH: CurKey->hash.assign(buf.c_str(), buf.size()); break; case KEY_XMLELM_NODEID: CurKey->nodeid.assign(buf.c_str(), buf.size()); break; case KEY_XMLELM_IP: CurKey->ip = e2ip(buf.c_str(), buf.size()); break; case KEY_XMLELM_PORT: CurKey->port = (ushort)wcstoul(buf.c_str(), NULL, 10); break; case KEY_XMLELM_SIZE: CurKey->size = wcstoul(buf.c_str(), NULL, 10); break; case KEY_XMLELM_URL: CurKey->url = buf; break; case KEY_XMLELM_TITLE: if (buf.size() <= O2_MAX_KEY_TITLE_LEN) CurKey->title = buf; break; case KEY_XMLELM_NOTE: if (buf.size() <= O2_MAX_KEY_NOTE_LEN) CurKey->note = buf; break; case KEY_XMLELM_DATE: CurKey->date = datetime2time_t(buf.c_str(), buf.size()); break; case KEY_XMLELM_ENABLE: CurKey->enable = buf[0] == L'e' ? true : false; break; } buf = L""; CurElm = KEY_XMLELM_NONE; if (!CurKey || !MATCHLNAME(L"key")) return; KeyDB->AddKey(*CurKey); ParseNum++; }
void O2IPFilter_SAX2Handler:: endElement(const XMLCh* const uri , const XMLCh* const localname , const XMLCh* const qname) { CurElm = IPF_XMLELM_NONE; if (!CurRecord || !MATCHLNAME(L"filter")) return; if (CurRecord->cond.empty()) return; IPFilter->add(CurRecord->enable, CurRecord->flag, CurRecord->cond.c_str()); }
void O2Profile_SAX2Handler:: endElement(const XMLCh* const uri , const XMLCh* const localname , const XMLCh* const qname) { switch (CurElm) { case PROF_XMLELM_ID: Profile->ID.assign(buf.c_str(), buf.size()); break; case PROF_XMLELM_PRIVKEY: Profile->PrivKey.assign(buf.c_str(), buf.size()); break; case PROF_XMLELM_PUBKEY: Profile->PubKey.assign(buf.c_str(), buf.size()); break; case PROF_XMLELM_IP: Profile->IP = e2ip(buf.c_str(), buf.size()); break; case PROF_XMLELM_P2PPORT: Profile->P2PPort = (ushort)wcstoul(buf.c_str(), NULL, 10); break; case PROF_XMLELM_PROXYPORT: Profile->ProxyPort = (ushort)wcstoul(buf.c_str(), NULL, 10); break; case PROF_XMLELM_ADMINPORT: Profile->AdminPort = (ushort)wcstoul(buf.c_str(), NULL, 10); break; case PROF_XMLELM_NAME: if (buf.size() <= O2_MAX_NAME_LEN) { Profile->SetNodeName(buf.c_str()); } break; case PROF_XMLELM_COMMENT: if (buf.size() <= O2_MAX_COMMENT_LEN) { for (size_t i = 0; i < buf.size(); i++) { if (buf[i] == L'\n') Profile->Comment += L"\r\n"; else Profile->Comment += buf[i]; } } break; case PROF_XMLELM_DBDIR: Profile->SetDBDir(buf.c_str()); break; case PROF_XMLELM_CACHEROOT: Profile->SetCacheRoot(buf.c_str()); break; case PROF_XMLELM_ADMINROOT: Profile->SetAdminRoot(buf.c_str()); break; case PROF_XMLELM_ADMIN_BROWSER_TYPE: Profile->AdminBrowserType = buf; break; case PROF_XMLELM_ADMIN_BROWSER_PATH: Profile->AdminBrowserPath = buf; break; case PROF_XMLELM_UPNP_ADAPTERNAME: unicode2ascii(buf, Profile->UPnPAdapterName); break; case PROF_XMLELM_UPNP_LOCATION: unicode2ascii(buf, Profile->UPnPLocation); break; case PROF_XMLELM_UPNP_SERVICEID: unicode2ascii(buf, Profile->UPnPServiceId); break; case PROF_XMLELM_LIMIT: if (plimit) *plimit = wcstoul(buf.c_str(), NULL, 10); break; case PROF_XMLELM_SIZE_T: if (puint64) *puint64 = _wcstoui64(buf.c_str(), NULL, 10); break; case PROF_XMLELM_BOOL: *pbool = buf[0] == '1' ? true : false; break; } buf = L""; CurElm = PROF_XMLELM_NONE; if (!MATCHLNAME(L"profile")) return; if (Profile->PrivKey.size() != RSA_PRIVKEY_SIZE || Profile->PubKey.size() != RSA_PUBKEY_SIZE) { Profile->SetRSAKey(NULL, 0, NULL, 0); } }
void O2Profile_SAX2Handler:: startElement(const XMLCh* const uri , const XMLCh* const localname , const XMLCh* const qname , const Attributes& attrs) { CurElm = PROF_XMLELM_NONE; plimit = NULL; pbool = NULL; if (MATCHLNAME(L"profile")) { CurElm = PROF_XMLELM_NONE; } else if (MATCHLNAME(L"ID")) { CurElm = PROF_XMLELM_ID; } else if (MATCHLNAME(L"PubKey")) { CurElm = PROF_XMLELM_PUBKEY; } else if (MATCHLNAME(L"IP")) { CurElm = PROF_XMLELM_IP; } else if (MATCHLNAME(L"nodename")) { CurElm = PROF_XMLELM_NAME; } else if (MATCHLNAME(L"comment")) { CurElm = PROF_XMLELM_COMMENT; } else if (MATCHLNAME(L"port")) { CurElm = PROF_XMLELM_P2PPORT; } // local else if (MATCHLNAME(L"ProxyPort")) { CurElm = PROF_XMLELM_PROXYPORT; } else if (MATCHLNAME(L"AdminPort")) { CurElm = PROF_XMLELM_ADMINPORT; } else if (MATCHLNAME(L"PrivKey")) { CurElm = PROF_XMLELM_PRIVKEY; } else if (MATCHLNAME(L"DBDir")) { CurElm = PROF_XMLELM_DBDIR; } else if (MATCHLNAME(L"CacheRoot")) { CurElm = PROF_XMLELM_CACHEROOT; } else if (MATCHLNAME(L"AdminRoot")) { CurElm = PROF_XMLELM_ADMINROOT; } else if (MATCHLNAME(L"AdminBrowserType")) { CurElm = PROF_XMLELM_ADMIN_BROWSER_TYPE; } else if (MATCHLNAME(L"AdminBrowserPath")) { CurElm = PROF_XMLELM_ADMIN_BROWSER_PATH; } else if (MATCHLNAME(L"UPnPAdapterName")) { CurElm = PROF_XMLELM_UPNP_ADAPTERNAME; } else if (MATCHLNAME(L"UPnPLocation")) { CurElm = PROF_XMLELM_UPNP_LOCATION; } else if (MATCHLNAME(L"UPnPServiceId")) { CurElm = PROF_XMLELM_UPNP_SERVICEID; } else if (MATCHLNAME(L"p2psessionlimit")) { CurElm = PROF_XMLELM_LIMIT; plimit = &Profile->P2PSessionLimit; } /* else if (MATCHLNAME(L"nodelimit")) { CurElm = PROF_XMLELM_LIMIT; plimit = &Profile->NodeLimit; } */ else if (MATCHLNAME(L"keylimit")) { CurElm = PROF_XMLELM_LIMIT; plimit = &Profile->KeyLimit; } else if (MATCHLNAME(L"querylimit")) { CurElm = PROF_XMLELM_LIMIT; plimit = &Profile->QueryLimit; } else if (MATCHLNAME(L"loglimit")) { CurElm = PROF_XMLELM_LIMIT; plimit = &Profile->LogLimit; } else if (MATCHLNAME(L"netloglimit")) { CurElm = PROF_XMLELM_LIMIT; plimit = &Profile->NetLogLimit; } else if (MATCHLNAME(L"hokanloglimit")) { CurElm = PROF_XMLELM_LIMIT; plimit = &Profile->HokanLogLimit; } else if (MATCHLNAME(L"ipfloglimit")) { CurElm = PROF_XMLELM_LIMIT; plimit = &Profile->IPFLogLimit; } else if (MATCHLNAME(L"quartersize")) { CurElm = PROF_XMLELM_SIZE_T; puint64 = &Profile->QuarterSize; } else if (MATCHLNAME(L"quarterfulloperation")) { CurElm = PROF_XMLELM_LIMIT; plimit = &Profile->QuarterFullOperation; } else if (MATCHLNAME(L"ResumeDelayMs")) { CurElm = PROF_XMLELM_LIMIT; plimit = &Profile->ResumeDelayMs; } else if (MATCHLNAME(L"port0")) { CurElm = PROF_XMLELM_BOOL; pbool = &Profile->Port0; } else if (MATCHLNAME(L"p2pautostart")) { CurElm = PROF_XMLELM_BOOL; pbool = &Profile->P2PAutoStart; } else if (MATCHLNAME(L"loadsubdirindex")) { CurElm = PROF_XMLELM_BOOL; pbool = &Profile->LoadSubdirIndex; } else if (MATCHLNAME(L"maruuser")) { CurElm = PROF_XMLELM_BOOL; pbool = &Profile->MaruUser; } else if (MATCHLNAME(L"publicprofile")) { CurElm = PROF_XMLELM_BOOL; pbool = &Profile->PublicReport; } else if (MATCHLNAME(L"publicrecentdat")) { CurElm = PROF_XMLELM_BOOL; pbool = &Profile->PublicRecentDat; } else if (MATCHLNAME(L"baloon_p2p")) { CurElm = PROF_XMLELM_BOOL; pbool = &Profile->Baloon_P2P; } else if (MATCHLNAME(L"baloon_query")) { CurElm = PROF_XMLELM_BOOL; pbool = &Profile->Baloon_Query; } else if (MATCHLNAME(L"baloon_hokan")) { CurElm = PROF_XMLELM_BOOL; pbool = &Profile->Baloon_Hokan; } else if (MATCHLNAME(L"baloon_im")) { CurElm = PROF_XMLELM_BOOL; pbool = &Profile->Baloon_IM; } else if (MATCHLNAME(L"AutoResume")) { CurElm = PROF_XMLELM_BOOL; pbool = &Profile->AutoResume; } else if (MATCHLNAME(L"UseUPnP")) { CurElm = PROF_XMLELM_BOOL; pbool = &Profile->UseUPnP; } }
void O2IMDB_SAX2Handler:: startElement(const XMLCh* const uri , const XMLCh* const localname , const XMLCh* const qname , const Attributes& attrs) { CurElm = IM_XMLELM_NONE; if (MATCHLNAME(L"message")) { if (CurIM) delete CurIM; CurIM = new O2IMessage(); CurElm = IM_XMLELM_NONE; } else if (MATCHLNAME(L"ip")) { CurElm = IM_XMLELM_IP; } else if (MATCHLNAME(L"port")) { CurElm = IM_XMLELM_PORT; } else if (MATCHLNAME(L"id")) { CurElm = IM_XMLELM_ID; } else if (MATCHLNAME(L"pubkey")) { CurElm = IM_XMLELM_PUBKEY; } else if (MATCHLNAME(L"name")) { CurElm = IM_XMLELM_NAME; } else if (MATCHLNAME(L"date")) { CurElm = IM_XMLELM_DATE; } else if (MATCHLNAME(L"msg")) { CurElm = IM_XMLELM_MSG; } else if (MATCHLNAME(L"key")) { CurElm = IM_XMLELM_KEY; } else if (MATCHLNAME(L"mine")) { CurElm = IM_XMLELM_MINE; } else if (MATCHLNAME(L"path")) { CurElm = IM_XMLELM_PATH; } }
void O2KeyDB_SAX2Handler:: startElement(const XMLCh* const uri , const XMLCh* const localname , const XMLCh* const qname , const Attributes& attrs) { CurElm = KEY_XMLELM_NONE; //common if (MATCHLNAME(L"key")) { if (CurKey) delete CurKey; CurKey = new O2Key(); CurElm = KEY_XMLELM_NONE; } else if (MATCHLNAME(L"hash")) { CurElm = KEY_XMLELM_HASH; } else if (MATCHLNAME(L"ip")) { CurElm = KEY_XMLELM_IP; } else if (MATCHLNAME(L"nodeid")) { CurElm = KEY_XMLELM_NODEID; } else if (MATCHLNAME(L"port")) { CurElm = KEY_XMLELM_PORT; } else if (MATCHLNAME(L"size")) { CurElm = KEY_XMLELM_SIZE; } else if (MATCHLNAME(L"url")) { CurElm = KEY_XMLELM_URL; } else if (MATCHLNAME(L"title")) { CurElm = KEY_XMLELM_TITLE; } else if (MATCHLNAME(L"note")) { CurElm = KEY_XMLELM_NOTE; } else if (MATCHLNAME(L"date")) { CurElm = KEY_XMLELM_DATE; } else if (MATCHLNAME(L"enable")) { CurElm = KEY_XMLELM_ENABLE; } }