ProtocolFactory::ProtocolFactory() { RegisterProtocol(ProtocolType::kLineProtocol, ADE_NEW(LineProtocol)); RegisterProtocol(ProtocolType::kRapidProtocol, ADE_NEW(RapidProtocol)); RegisterProtocol(ProtocolType::kHttpProtocol, ADE_NEW(HttpProtocol)); RegisterProtocol(ProtocolType::kRedisProtocol, ADE_NEW(RedisProtocol)); RegisterProtocol(ProtocolType::kMemcachedProtocol, ADE_NEW(MemcachedProtocol)); }
void ProcessProtocolsNew(const struct mach_header* mh, intptr_t slide) { const protocol_t** protocol_list; unsigned long protosize; protocol_list = reinterpret_cast<const protocol_t**>( getsectdata(mh, SEG_OBJC_PROTOLIST_NEW, SECT_OBJC_PROTOLIST_NEW, &protosize) ); if (protocol_list) { unsigned long refsize; protocol_t** protocol_refs; protocol_t** protocol_refs_end; std::set<const protocol_t*> setProtocols; std::vector<const protocol_t*> vecProtocols; protocol_refs = reinterpret_cast<protocol_t**>( getsectdata(mh, SEG_OBJC_PROTOREFS_NEW, SECT_OBJC_PROTOREFS_NEW, &refsize) ); if (protocol_refs) protocol_refs_end = protocol_refs + refsize / sizeof(protocol_t*); std::copy(protocol_list, protocol_list+protosize/sizeof(protocol_t*), std::inserter(setProtocols, setProtocols.begin())); topology_sort<const protocol_t>(setProtocols, vecProtocols, [&setProtocols,slide](const protocol_t* p) { return p->protocols ? std::set<const protocol_t*>(p->protocols->begin(slide), p->protocols->end(slide)) : std::set<const protocol_t*>(); }); for (const protocol_t* proto : vecProtocols) { Protocol* p = RegisterProtocol(proto, slide); if (protocol_refs) find_and_fix(protocol_refs, protocol_refs_end, proto, p); } } }
CMPlugin::CMPlugin() : PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx) { RegisterProtocol(PROTOTYPE_VIRTUAL); SetUniqueId("URL"); }