void Register(nsScriptNameSpaceManager* aNameSpaceManager) { #define REGISTER_PROTO(_dom_class, _pref_check) \ aNameSpaceManager->RegisterDefineDOMInterface(NS_LITERAL_STRING(#_dom_class), _dom_class##Binding::DefineDOMInterface, _pref_check); REGISTER_PROTO(ClientRect, nullptr); REGISTER_PROTO(ClientRectList, nullptr); #undef REGISTER_PROTO }
int main(int argc, Char* argv[]) { HawkUtil::Init(); REGISTER_PROTO(ProtoA); REGISTER_PROTO(ProtoB); REGISTER_PROTO(ProtoC); if (argc >= 2) g_IpAddr = argv[1]; if (!g_IpAddr.size()) g_IpAddr = HawkOSOperator::ConsoleInput(); Int32 iCount = 1; if (argc >= 3) iCount = HawkStringUtil::StringToInt<AString>(argv[2]); for (Int32 i=0;i<iCount;i++) { HawkThread* pThread = new HawkThread(hawk_EchoClientRoutine); pThread->Start(); g_Threads.push_back(pThread); HawkSleep(10); } while(HawkOSOperator::WaitKeyboardInput("",false) != 'Q'); g_Running = false; for (Size_t i=0;i<g_Threads.size();i++) { g_Threads[i]->Close(); HAWK_RELEASE(g_Threads[i]); } HawkUtil::Stop(); HawkUtil::Release(); return 0; }
Bool HawkProtocolManager::RegSysProtocol() { //注册系统内部协议 REGISTER_PROTO(SysProtocol::Sys_MsgNotify); REGISTER_PROTO(SysProtocol::Sys_ErrNotify); REGISTER_PROTO(SysProtocol::Sys_HeartBeat); REGISTER_PROTO(SysProtocol::Sys_HeartBreak); REGISTER_PROTO(SysProtocol::Sys_SessionStart); REGISTER_PROTO(SysProtocol::Sys_SessionBreak); REGISTER_PROTO(SysProtocol::Sys_CloseSession); REGISTER_PROTO(SysProtocol::Sys_LogMsg); REGISTER_PROTO(SysProtocol::Sys_ProfReq); REGISTER_PROTO(SysProtocol::Sys_ProfInfo); REGISTER_PROTO(SysProtocol::Sys_RefuseConn); REGISTER_PROTO(SysProtocol::Sys_CltPing); REGISTER_PROTO(SysProtocol::Sys_SvrPong); REGISTER_PROTO(SysProtocol::Sys_Octets); return true; }