diff --git a/CMakeLists.txt b/CMakeLists.txt index 52fba65acc53fe7873c582f1b357a7838ef6039c..c6dff0a4415129ab94e821ac6f1795294daf564d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,7 +181,7 @@ if(CMAKE_BUILD_TYPE STREQUAL Debug) message("-- Debug Compile Project") else() set(CMAKE_BUILD_TYPE Release) - set(compile "-O3 -fPIC -fvisibility=hidden") + set(compile "-O3 -g3 -fPIC -fvisibility=hidden") set(static_compile "-g3 -fPIC -fvisibility=hidden") message("-- Release Compile Project") endif() diff --git a/asynio/asynframeimpl.cpp b/asynio/asynframeimpl.cpp index f14deb3462dfcb5bc841007484a88cb5a9850bdd..7b8a6b78f65aebb73b72e164518784457bb835bc 100644 --- a/asynio/asynframeimpl.cpp +++ b/asynio/asynframeimpl.cpp @@ -49,6 +49,73 @@ std_method_impl CAsynFrameImpl::Stop(UINT uExitCode) return S_OK; } +std_method_impl CAsynFrameImpl::CreateIo(IO_Protocol iop, IBase** pBase) +{ + if (io_operation == iop) + { + return CreateAsynIoOperation(pBase); + } + else if (io_tcp_socket == iop) + { + return CreateTcpSocket(pBase); + } + else if (io_tcplisten_socket == iop) + { + return CreateTcpListenSocket(pBase); + } + else if (io_udp_socket == iop) + { + return CreateUdpSocket(pBase); + } + else if (io_udplisten_socket == iop) + { + return E_FAIL; + } + else if (io_timer == iop) + { + return CreateTimer(pBase); + } + else if (io_file == iop) + { + return CreateFile(pBase); + } + + return E_FAIL; +} + +void async_post(void* data) +{ + +} +std_method_impl CAsynFrameImpl::PostIo(IBase* pOperation) +{ + int rc = S_SUCCESS; + rc = contexts_post(async_post, pOperation); + return rc == S_SUCCESS? S_OK : E_FAIL; +} +std_method_impl CAsynFrameImpl::Thread_Init() +{ + return S_OK; +} +std_method_impl CAsynFrameImpl::Thread_Run() +{ + SetService(true); + contexts_start(this); + return S_OK; +} +std_method_impl CAsynFrameImpl::Thread_UnInit() +{ + contexts_stop(); + return S_OK; +} +std_method_impl CAsynFrameImpl::SetService(bool bstart) +{ + if (bstart) + { + this->m_asynframe_sem.Post(); + } + return S_OK; +} std_method_impl CAsynFrameImpl::CreateAsynIoOperation(IBase **ppOperation) { CIoOperationImpl* pObject = NULL; @@ -97,38 +164,3 @@ std_method_impl CAsynFrameImpl::CreateTimer(IBase** pTimer) } -void async_post(void* data) -{ - -} -std_method_impl CAsynFrameImpl::PostAsynIo(IBase* pOperation) -{ - int rc = S_SUCCESS; - rc = contexts_post(async_post, pOperation); - return rc == S_SUCCESS? S_OK : E_FAIL; -} -std_method_impl CAsynFrameImpl::Thread_Init() -{ - return S_OK; -} -std_method_impl CAsynFrameImpl::Thread_Run() -{ - SetService(true); - contexts_start(this); - return S_OK; -} -std_method_impl CAsynFrameImpl::Thread_UnInit() -{ - contexts_stop(); - return S_OK; -} -std_method_impl CAsynFrameImpl::SetService(bool bstart) -{ - if (bstart) - { - this->m_asynframe_sem.Post(); - } - return S_OK; -} - - diff --git a/asynio/asynframeimpl.h b/asynio/asynframeimpl.h index 487a1dc0d8e076492c15941059f7640a2f444dbc..f2a88f4b18ccd3ac9e80647ff1ef0ca714f72f31 100644 --- a/asynio/asynframeimpl.h +++ b/asynio/asynframeimpl.h @@ -30,13 +30,8 @@ public: std_method(Stop)(UINT uExitCode); //IAsynFrame - std_method(CreateAsynIoOperation)(IBase **ppOperation); - std_method(CreateFile)(IBase** pFile); - std_method(CreateTcpSocket)(IBase** pAsynTcpSocket); - std_method(CreateUdpSocket)(IBase** pAsynUdpSocket); - std_method(CreateTcpListenSocket)(IBase** pAsynTcpListenSocket); - std_method(CreateTimer)(IBase** pTimer); - std_method(PostAsynIo)(IBase* pOperation); + std_method(CreateIo)(IO_Protocol iop, IBase** pBase); + std_method(PostIo)(IBase* pOperation); protected: //ithread std_method(Thread_Init)(); @@ -44,7 +39,14 @@ protected: std_method(Thread_UnInit)(); std_method(SetService)(bool bstart); private: - _lComPtr m_pRot; + std_method(CreateAsynIoOperation)(IBase **ppOperation); + std_method(CreateFile)(IBase** pFile); + std_method(CreateTcpSocket)(IBase** pAsynTcpSocket); + std_method(CreateUdpSocket)(IBase** pAsynUdpSocket); + std_method(CreateTcpListenSocket)(IBase** pAsynTcpListenSocket); + std_method(CreateTimer)(IBase** pTimer); +private: + RotPtr m_pRot; private: CSemHandle m_asynframe_sem; SafePtr m_pContextPool; diff --git a/asynio/interface.cpp b/asynio/interface.cpp index 87af49657c14a490b1bec3982c7247aead084da8..8381971f9639f2c7949690a8906ad6fc6fb46d43 100644 --- a/asynio/interface.cpp +++ b/asynio/interface.cpp @@ -102,7 +102,7 @@ _DEFINE_IID_IMPL(IID_IOperation, 0xfeb12b33, 0x7344, 0x45cd, 0xa3, 0x75, 0x24, 0x95, 0xc7, 0xbe, 0xbd, 0x88); // {0470327E-5ACF-40EC-BAED-FE2AAE877B4B} -_DEFINE_IID_IMPL(IID_IOperationEvents, +_DEFINE_IID_IMPL(IID_IOperationEvent, 0x470327e, 0x5acf, 0x40ec, 0xba, 0xed, 0xfe, 0x2a, 0xae, 0x87, 0x7b, 0x4b); @@ -154,7 +154,7 @@ _DEFINE_GUID_IMPL(CLSID_IAsynFrame, //itimer.h // {B5819C73-6EF7-4F25-B053-F6F6D4DCBE00} -_DEFINE_IID_IMPL(IID_ITimerEvents, +_DEFINE_IID_IMPL(IID_ITimerEvent, 0xb5819c73, 0x6ef7, 0x4f25, 0xb0, 0x53, 0xf6, 0xf6, 0xd4, 0xdc, 0xbe, 0x0); // {F36A3734-C9CA-46C9-8F03-AD02AD24058F} diff --git a/asynio/iooperationimpl.cpp b/asynio/iooperationimpl.cpp index 8a83ef05f2c6b45daf7b595d8af1d78d0bed0abc..365e19e99d25e42a98b7e523c1bea2f98ff49345 100644 --- a/asynio/iooperationimpl.cpp +++ b/asynio/iooperationimpl.cpp @@ -32,7 +32,7 @@ std_method_impl CIoOperationImpl::QueryIBaseIID(REFIID riid, void **ppv) std_method_impl CIoOperationImpl::BindEvent(IBase *pEvents) { HRESULT hr = S_OK; - hr = pEvents->QueryInterface(IID_IOperationEvents, (void**)&m_pEvent); + hr = pEvents->QueryInterface(IID_IOperationEvent, (void**)&m_pEvent); rc_assert(hr == S_OK, E_FAIL) return hr; } diff --git a/asynio/iooperationimpl.h b/asynio/iooperationimpl.h index 0dc9a68f22d832d580d2f1da446f1112863a80b2..9a07fd424a1f16b2e19b3a67d26bcc729ab82a37 100644 --- a/asynio/iooperationimpl.h +++ b/asynio/iooperationimpl.h @@ -50,8 +50,8 @@ private: BUFFER_SIZE m_uExpectBytes; BUFFER_SIZE m_pBufLen; UCharArrayPtr m_pBuf; - _lComPtr m_pEvent; - _lComPtr m_pBase; + OperationEventPtr m_pEvent; + BasePtr m_pBase; }; #endif diff --git a/asynio/stdafx.h b/asynio/stdafx.h index 5c1c566de6b3a7256713297b99e1cba4e1351d7a..0d3a0ccb4c6e01b66c6f8df705870f14d6566ca6 100644 --- a/asynio/stdafx.h +++ b/asynio/stdafx.h @@ -6,8 +6,8 @@ #define _STDAFX_H_ #include - -#include +#include +#include #include #include @@ -15,4 +15,7 @@ #include #include + + + #endif diff --git a/asynio/tcplistensocketimpl.cpp b/asynio/tcplistensocketimpl.cpp index e707691a067c3acb174aa94bfed0031b98ce5cf9..e21cd28bfdfe81eb2731720770c0aec328ad9bda 100644 --- a/asynio/tcplistensocketimpl.cpp +++ b/asynio/tcplistensocketimpl.cpp @@ -86,7 +86,7 @@ std_method_impl CTcpListenSocketImpl::Accept(IBase* pBase) { HRESULT hr = S_OK; - _lComPtr pAsynTcpScoket; + TcpSocketPtr pAsynTcpScoket; hr = pBase->QueryInterface(IID_ITcpSocket, (void**)&pAsynTcpScoket); rc_assert(hr == S_OK, E_FAIL) diff --git a/asynio/tcplistensocketimpl.h b/asynio/tcplistensocketimpl.h index 4fdbbfa153fb6cb932863da8f8114165f1b96309..11bb6ffe527976eb4a942fdba614c475deb9b089 100644 --- a/asynio/tcplistensocketimpl.h +++ b/asynio/tcplistensocketimpl.h @@ -44,7 +44,7 @@ public: void AcceptCB(void *data, event_id error_code, _sock_t s); private: _sock_t m_sock; - _lComPtr m_accept; + AcceptListenPtr m_accept; }; diff --git a/asynio/tcpsocketimpl.cpp b/asynio/tcpsocketimpl.cpp index 20f2457772ad1e8af8ecf39ea0b070d740a81076..33098d4f32f8230e5d3bb6a49bdb1328cf3ef16c 100644 --- a/asynio/tcpsocketimpl.cpp +++ b/asynio/tcpsocketimpl.cpp @@ -39,7 +39,8 @@ std_method_impl CTcpSocketImpl::CreateSock() std_method_impl CTcpSocketImpl::CloseSock() { HRESULT hr = S_OK; - + + rc_assert(IsOpen() == S_OK, S_OK) rc_assert(m_sock != INVALID_SOCKET, E_FAIL) //TODO: this is error int rc = _closesock(m_sock); @@ -162,7 +163,7 @@ std_method_impl CTcpSocketImpl::ReadIo(IBase* pBase, event_id event) HRESULT hr = S_OK; int rc = S_SUCCESS; - _lComPtr pOperation; + OperationPtr pOperation; hr = pBase->QueryInterface(IID_IOperation, (void**)&pOperation); rc_assert(hr == S_OK, E_FAIL) @@ -185,7 +186,7 @@ std_method_impl CTcpSocketImpl::WriteIo(IBase* pBase, event_id event) HRESULT hr = S_OK; int rc = S_SUCCESS; - _lComPtr pOperation; + OperationPtr pOperation; hr = pBase->QueryInterface(IID_IOperation, (void**)&pOperation); rc_assert(hr == S_OK, E_FAIL) @@ -212,7 +213,7 @@ std_method_impl CTcpSocketImpl::ConnectIo(NET_ADDR addr, NET_PORT port, HRESULT hr = S_OK; int rc = S_SUCCESS; - _lComPtr pOperation; + OperationPtr pOperation; hr = pBase->QueryInterface(IID_IOperation, (void**)&pOperation); rc_assert(hr == S_OK, E_FAIL) diff --git a/asynio/timerimpl.cpp b/asynio/timerimpl.cpp index 385ef2e67370e6a16d767068656284bb56274d02..2036273b33195b2a165ff220229e383785dbaa19 100644 --- a/asynio/timerimpl.cpp +++ b/asynio/timerimpl.cpp @@ -29,7 +29,7 @@ std_method_impl CTimerImpl::UnBind() std_method_impl CTimerImpl::Bind(IBase* pBase) { rc_assert(pBase != NULL, E_FAIL) - return pBase->QueryInterface(IID_ITimerEvents, (void**)&m_Event); + return pBase->QueryInterface(IID_ITimerEvent, (void**)&m_Event); } std_method_type_impl(UINT) CTimerImpl::GetId() { diff --git a/asynio/timerimpl.h b/asynio/timerimpl.h index 1a5ab225b3e9d1b97cef9e356dabd1031ee52218..d4937852e7a877ee4768c60f6e9d253ad7f3d493 100644 --- a/asynio/timerimpl.h +++ b/asynio/timerimpl.h @@ -28,8 +28,8 @@ public: int OnTime(UINT err); private: - UINT m_uId; - _lComPtr m_Event; + UINT m_uId; + TimerEventPtr m_Event; }; #endif diff --git a/asynio/udpsocketimpl.cpp b/asynio/udpsocketimpl.cpp index bb5af6c89c8f85f2b03ea6a28e52c3ca0aab904f..361c6091a0e2066494ef61034186c755c9f1b6bc 100644 --- a/asynio/udpsocketimpl.cpp +++ b/asynio/udpsocketimpl.cpp @@ -146,7 +146,7 @@ std_method_impl CUdpSocketImpl::ReadIo(NET_ADDR addr, NET_PORT port, HRESULT hr = S_OK; rc_assert(pBase != NULL, E_FAIL) - _lComPtr pOperation; + OperationPtr pOperation; hr = pBase->QueryInterface(IID_IOperation, (void**)&pOperation); rc_assert(hr == S_OK, E_FAIL) @@ -169,7 +169,7 @@ std_method_impl CUdpSocketImpl::WriteIo(NET_ADDR addr, NET_PORT port, HRESULT hr = S_OK; rc_assert(pBase != NULL, E_FAIL) - _lComPtr pOperation; + OperationPtr pOperation; hr = pBase->QueryInterface(IID_IOperation, (void**)&pOperation); rc_assert(hr == S_OK, E_FAIL) diff --git a/container/mainrun.cpp b/container/mainrun.cpp index e2e48b11310d7484823338d2f421a03d2b38c764..e2f6e63b9ccd236be4ff6027a57b7dee2dfc259c 100644 --- a/container/mainrun.cpp +++ b/container/mainrun.cpp @@ -95,7 +95,7 @@ std_method_type_impl(UINT) CMainRun::Run(_pinstance instance, UINT type) std_method_impl CMainRun::NotifyExit(_pinstance instance, UINT exit) { - _lComPtr pExit; + ExitPtr pExit; m_pRot->GetObject(m_RunPlugin, IID_IExit, (IBase**)&pExit); rc_assert(pExit.m_p != INULL, OBJECT_RUN_RET_SUCCESS); return pExit->OnExit(exit); @@ -140,12 +140,12 @@ std_method_impl CMainRun::AddObject(REFCLSID clsid, LPCSTR progId, IBase* pBase, { HRESULT hr = S_OK; - _lComPtr pObject; + BasePtr pObject; hr = pBase->QueryInterface(IID_IBase, (void**)&pObject); rc_assert(pObject.m_p != NULL, E_FAIL) rc_assert(hr == S_OK,E_FAIL); - _lComPtr pPlugin; + PluginPtr pPlugin; hr = pBase->QueryInterface(IID_IPlugin, (void**)&pPlugin); rc_assert(hr == S_OK, E_FAIL) rc_assert(pPlugin.m_p != NULL, E_FAIL) @@ -155,7 +155,7 @@ std_method_impl CMainRun::AddObject(REFCLSID clsid, LPCSTR progId, IBase* pBase, hr = pPlugin->Init(m_argc, m_argv, m_pRot, NULL); if (type & STD_START) - hr = RunPlugin_Start(m_hInstance, &pObject, 0); + hr = RunPlugin_Start(m_hInstance, pObject, 0); if (type & STD_ROT) hr = m_pRot->Register(clsid, progId, pBase, Id); @@ -258,8 +258,8 @@ std_method_impl CMainRun::RegisterRotAndlibManager() HRESULT hr = S_OK; - _lComPtr pClassFactory; - _lComPtr pIBase; + ComFactoryPtr pClassFactory; + BasePtr pIBase; pClassFactory.dispose(); hr = DllGetClassObject(ClSID_CComRunningObjectTable, IID_IComObjectFrameworkClassFactory, (void**)&pClassFactory); @@ -316,7 +316,7 @@ std_method_impl CMainRun::CreatePlugin(REFCLSID iid, UINT index) char guid[GUIDStringLength] = { 0x00 }; GUIDToString(&iid, guid); - _lComPtr pBase; + BasePtr pBase; HRESULT hr = CreateRotPlugin(iid, (IBase **)&pBase, index); if (S_FAILED(hr)) @@ -324,7 +324,7 @@ std_method_impl CMainRun::CreatePlugin(REFCLSID iid, UINT index) logi("create_plugin_error==>guid==>%s", guid); return hr; } - _lComPtr pPlugin; + PluginPtr pPlugin; hr = pBase->QueryInterface(IID_IPlugin, (void**)&pPlugin); rc_assert(hr == S_OK, E_FAIL) @@ -359,11 +359,11 @@ std_method_impl CMainRun::UninitAllPlugins() ULONG index = uSize - uloop - 1; rc_assert_continue(((index >= 0) && (index pUnknown; + BasePtr pUnknown; hr = m_pRot->GetObject(m_PluginsClsid[index].ClsId, IID_IBase, (IBase**)&pUnknown); rc_assert_continue(hr == S_OK); - _lComPtr pPlugin; + PluginPtr pPlugin; hr = pUnknown->QueryInterface(IID_IPlugin, (void**)&pPlugin); rc_assert_continue(hr == S_OK); @@ -388,11 +388,11 @@ std_method_impl CMainRun::UninitAllPlugins() ULONG index = uSize - uloop - 1; rc_assert_continue(((index >= 0) && (index < uSize))) - _lComPtr pUnknown; + BasePtr pUnknown; hr = m_pRot->GetObject(m_PluginsDynamicClsid[index].ClsId, IID_IBase, (IBase**)&pUnknown); rc_assert_continue(hr == S_OK); - _lComPtr pPlugin; + PluginPtr pPlugin; hr = pUnknown->QueryInterface(IID_IPlugin, (void**)&pPlugin); rc_assert_continue(hr == S_OK); @@ -494,7 +494,7 @@ std_method_impl CMainRun::DoPluginsStartFunc(int iArgc, basic_tchar* Argv[], UIN { rc_assert(( uloop >= 0 && uloop < m_PluginsClsid.size()), E_FAIL) - _lComPtr pUnknown; + BasePtr pUnknown; hr = m_pRot->GetObject(m_PluginsClsid[uloop].ClsId, IID_IBase, (IBase**)&pUnknown); rc_assert_continue(hr == S_OK); @@ -504,7 +504,7 @@ std_method_impl CMainRun::DoPluginsStartFunc(int iArgc, basic_tchar* Argv[], UIN m_RunPlugin = m_PluginsClsid[uloop].ClsId; logi("run plugin==>%s==>%s\n",m_PluginsClsid[uloop].szComponent.c_str(), guid); - RunPlugin_Start(m_hInstance, &pUnknown, uType); + RunPlugin_Start(m_hInstance, pUnknown, uType); } return hr; } @@ -524,14 +524,14 @@ std_method_impl CMainRun::DoPluginsStopFunc(UINT uType, UINT uExit) unsigned long index = m_PluginsDynamicClsid.size() - uloop - 1; rc_assert_continue(((index >= 0) && (index < m_PluginsDynamicClsid.size()))) - _lComPtr pUnknown; + BasePtr pUnknown; hr = m_pRot->GetObject(m_PluginsDynamicClsid[index].ClsId, IID_IBase, (IBase**)&pUnknown); rc_assert_continue(hr == S_OK); char guid[GUIDStringLength] = { 0x00 }; GUIDToString(&m_PluginsDynamicClsid[uloop].ClsId, guid); - RunPlugin_Stop(m_hInstance, &pUnknown, uExit); + RunPlugin_Stop(m_hInstance, pUnknown, uExit); } for (uloop = 0; uloop < uSize; uloop++) @@ -541,14 +541,14 @@ std_method_impl CMainRun::DoPluginsStopFunc(UINT uType, UINT uExit) unsigned long index = uSize - uloop - 1; rc_assert_continue(((index >= 0) && (index < m_PluginsClsid.size()))) - _lComPtr pUnknown; + BasePtr pUnknown; hr = m_pRot->GetObject(m_PluginsClsid[index].ClsId, IID_IBase, (IBase**)&pUnknown); rc_assert_continue(hr == S_OK); char guid[GUIDStringLength] = { 0x00 }; GUIDToString(&m_PluginsClsid[uloop].ClsId, guid); - RunPlugin_Stop(m_hInstance, &pUnknown, uExit); + RunPlugin_Stop(m_hInstance, pUnknown, uExit); } return hr; @@ -556,51 +556,51 @@ std_method_impl CMainRun::DoPluginsStopFunc(UINT uType, UINT uExit) std_method_type_impl(UINT) CMainRun::GetIExitCode(CLSID iid) { - _lComPtr exit; - m_pRot->GetObject(iid, IID_IExit, (IBase**)&exit); - rc_assert(exit.m_p != INULL, OBJECT_RUN_RET_SUCCESS); - return exit->GetExitCode(); + ExitPtr pExit; + m_pRot->GetObject(iid, IID_IExit, (IBase**)&pExit); + rc_assert(pExit.m_p != INULL, OBJECT_RUN_RET_SUCCESS); + return pExit->GetExitCode(); } -std_method_impl CMainRun::RunPlugin_Start(_pinstance hInstance, const _lComPtr* pBase, UINT uType) +std_method_impl CMainRun::RunPlugin_Start(_pinstance hInstance, BaseConstPtr pBase, UINT uType) { RunMsgPlugin_Start(pBase); return RunStdPlugin_Start(m_hInstance, pBase, uType); } -std_method_impl CMainRun::RunPlugin_Stop(_pinstance hInstance, const _lComPtr* pBase, UINT uExit) +std_method_impl CMainRun::RunPlugin_Stop(_pinstance hInstance, BaseConstPtr pBase, UINT uExit) { RunMsgPlugin_Stop(pBase); return RunStdPlugin_Stop(m_hInstance, pBase, uExit); } -std_method_impl CMainRun::RunStdPlugin_Start(_pinstance hInstance, const _lComPtr* pBase, UINT uType) +std_method_impl CMainRun::RunStdPlugin_Start(_pinstance hInstance, BaseConstPtr pBase, UINT uType) { HRESULT hr = S_OK; - _lComPtr pPluginRun; - hr = (*pBase)->QueryInterface(IID_IPluginRun, (void**)&pPluginRun); + PluginRunPtr pPluginRun; + hr = pBase->QueryInterface(IID_IPluginRun, (void**)&pPluginRun); rc_assert(hr == S_OK, E_FAIL); rc_assert(pPluginRun.m_p, E_FAIL); return pPluginRun->Start(hInstance, uType); } -std_method_impl CMainRun::RunStdPlugin_Stop(_pinstance hInstance, const _lComPtr* pBase, UINT uExit) +std_method_impl CMainRun::RunStdPlugin_Stop(_pinstance hInstance, BaseConstPtr pBase, UINT uExit) { HRESULT hr = S_OK; - _lComPtr pPluginRun; - hr = (*pBase)->QueryInterface(IID_IPluginRun, (void**)&pPluginRun); + PluginRunPtr pPluginRun; + hr = pBase->QueryInterface(IID_IPluginRun, (void**)&pPluginRun); rc_assert(hr == S_OK, E_FAIL); rc_assert(pPluginRun.m_p, E_FAIL); return pPluginRun->Stop(uExit); } -std_method_impl CMainRun::RunMsgPlugin_Start(const _lComPtr* pBase) +std_method_impl CMainRun::RunMsgPlugin_Start(BaseConstPtr pBase) { return S_OK; } -std_method_impl CMainRun::RunMsgPlugin_Stop(const _lComPtr* pBase) +std_method_impl CMainRun::RunMsgPlugin_Stop(BaseConstPtr pBase) { return S_OK; } diff --git a/container/mainrun.h b/container/mainrun.h index 7fdb8cfc521e2924d197ed11b61ed31e76f66825..8cc9d732d9ffef8f2954382bd35c2de30b8ff261 100644 --- a/container/mainrun.h +++ b/container/mainrun.h @@ -62,12 +62,12 @@ private: std_method_(UINT, GetIExitCode)(CLSID iid); private: - std_method(RunPlugin_Start)(_pinstance hInstance, const _lComPtr* pBase, UINT uType); - std_method(RunPlugin_Stop)(_pinstance hInstance, const _lComPtr* pBase, UINT uExit); - std_method(RunStdPlugin_Start)(_pinstance hInstance, const _lComPtr* pBase, UINT uType); - std_method(RunStdPlugin_Stop)(_pinstance hInstance, const _lComPtr* pBase, UINT uExit); - std_method(RunMsgPlugin_Start)(const _lComPtr* pBase); - std_method(RunMsgPlugin_Stop)(const _lComPtr* pBase); + std_method(RunPlugin_Start)(_pinstance hInstance, BaseConstPtr pBase, UINT uType); + std_method(RunPlugin_Stop)(_pinstance hInstance, BaseConstPtr pBase, UINT uExit); + std_method(RunStdPlugin_Start)(_pinstance hInstance, BaseConstPtr pBase, UINT uType); + std_method(RunStdPlugin_Stop)(_pinstance hInstance, BaseConstPtr pBase, UINT uExit); + std_method(RunMsgPlugin_Start)(BaseConstPtr pBase); + std_method(RunMsgPlugin_Stop)(BaseConstPtr pBase); private: std_method(Reset)(); @@ -75,8 +75,8 @@ private: private: _pinstance m_hInstance; - _lComPtr m_pRot; - _lComPtr m_plibManager; + RotPtr m_pRot; + LibManagerPtr m_plibManager; private: basic_tstring m_strRunPath; string m_strRegisterCode; diff --git a/container/objectloader.cpp b/container/objectloader.cpp index b3c19a6f84458ff2f4cc17bb6d29db8d81bf5e5d..1f3986e3fb40eb2523935b50749b68b7ed0d1ce5 100644 --- a/container/objectloader.cpp +++ b/container/objectloader.cpp @@ -88,7 +88,7 @@ std_method_impl CObjectLoader::CreateInstance(IBase* rot, REFCLSID clsid, IBase* ContainerTableConstiterator it = m_mapContainer.find(cls->second.pname); rc_assert((m_mapContainer.end() != it), E_INVALIDARG); - _lComPtr pfac; + ComFactoryPtr pfac; hr = it->second.DllGetClassObject(clsid, IID_IComObjectFrameworkClassFactory, diff --git a/container/rot.cpp b/container/rot.cpp index 73a590d67ae4518118b7e51bb4882db2a7a2a37e..530cc85556a98aaef16c01cce5b4aa330ed47a4a 100644 --- a/container/rot.cpp +++ b/container/rot.cpp @@ -23,7 +23,7 @@ std_method_impl CComRunningObjectTableImpl::CreateInstance(IBase* rot, REFCLSID RUNNINGTABLEITEM& Item = m_map[CLSID_CObjectLoader]; - _lComPtr pICompoentLoader; + CompoentLoaderPtr pICompoentLoader; pICompoentLoader.dispose(); hr = Item.m_ptr->QueryInterface(IID_ICompoentLoader, (void**)&pICompoentLoader); @@ -76,7 +76,7 @@ std_method_type_impl(LPCSTR) CComRunningObjectTableImpl::ProgIDFromCLSID(REFCLSI SYNC_OBJ(&m_lockSection) OBJMAP::iterator it = m_map.find(clsid); rs_assert((it != m_map.end()), it->second.progid.c_str()) - _lComPtr pICompoentLoader; + CompoentLoaderPtr pICompoentLoader; rc_assert(S_SUCCEEDED(GetBaseObject(CLSID_CObjectLoader, IID_ICompoentLoader, (IBase**)&pICompoentLoader)), ""); rc_assert(pICompoentLoader, ""); return pICompoentLoader->ProgIDFromCLSID(clsid); @@ -85,7 +85,7 @@ std_method_type_impl(LPCSTR) CComRunningObjectTableImpl::ProgIDFromCLSID(REFCLSI std_method_type_impl(CLSID) CComRunningObjectTableImpl::CLSIDFromProgID(LPCSTR lpProgId) { SYNC_OBJ(&m_lockSection) - _lComPtr pICompoentLoader; + CompoentLoaderPtr pICompoentLoader; rc_assert(S_SUCCEEDED(GetBaseObject(CLSID_CObjectLoader, IID_ICompoentLoader, (IBase**)&pICompoentLoader)), COMPONENT_NULL); rc_assert(pICompoentLoader, COMPONENT_NULL); return pICompoentLoader->CLSIDFromProgID(lpProgId); diff --git a/container/rot.h b/container/rot.h index f708dce2b77117d7ea3e5681a1272d85d0f47092..2d63a7d932bfd35c5a2d6f8b5e743f7f5b008e80 100644 --- a/container/rot.h +++ b/container/rot.h @@ -40,7 +40,7 @@ private: { string progid; CLSID cls; - _lComPtr m_ptr; + BasePtr m_ptr; UINT index; }RUNNINGTABLEITEM; diff --git a/container/stdafx.h b/container/stdafx.h index 107b6d11d0f8bcd45c3917d19b7c54965a7f4bbc..4f3310de54fc6793c547d5d65bf896b0a59b2595 100644 --- a/container/stdafx.h +++ b/container/stdafx.h @@ -8,6 +8,7 @@ #include #include +#include template diff --git a/extensions/include/io/iframe.h b/extensions/include/io/iframe.h index 3da613367ca145f8128202af91d5d6178f0aa9c2..388fc0bff44629831114495b9988ca9200017535 100644 --- a/extensions/include/io/iframe.h +++ b/extensions/include/io/iframe.h @@ -7,16 +7,26 @@ #include #include +#define IO_BASE 1000 + + +typedef enum TAG_IO_PROTOCOL +{ + io_base = 0, + io_operation = 1, + io_tcp_socket = 100, + io_tcplisten_socket = 101, + io_udp_socket = 102, + io_udplisten_socket = 103, + io_timer = 1001, + io_file = 1002 + +}IO_Protocol; interface IAsynFrame : public IBase { - std_method(CreateAsynIoOperation)(IBase **ppOperation) PURE; - std_method(CreateFile)(IBase** pReadFile) PURE; - std_method(CreateTcpSocket)(IBase** pAsynTcpSocket) PURE; - std_method(CreateUdpSocket)(IBase** pAsynUdpSocket) PURE; - std_method(CreateTcpListenSocket)(IBase** pAsynTcpListenSocket) PURE; - std_method(CreateTimer)(IBase** pTimer) PURE; - std_method(PostAsynIo)(IBase *pOperation) PURE; + std_method(CreateIo)(IO_Protocol iop, IBase** pBase) PURE; + std_method(PostIo)(IBase *pOperation) PURE; }; diff --git a/extensions/include/io/ioperation.h b/extensions/include/io/ioperation.h index 11378e71e161f49adf5e72f2176cca2389b36564..86a38e3393d9914ff045fe73701ffbf0f6e220c4 100644 --- a/extensions/include/io/ioperation.h +++ b/extensions/include/io/ioperation.h @@ -17,13 +17,13 @@ typedef ULONG ERROR_CODE; -interface IOperationEvents : public IBase +interface IOperationEvent : public IBase { std_method(OnComplete)(IBase *pOperation, event_id event, ULONG error_code) PURE; }; // {0470327E-5ACF-40EC-BAED-FE2AAE877B4B} -_DEFINE_IID(IID_IOperationEvents, +_DEFINE_IID(IID_IOperationEvent, 0x470327e, 0x5acf, 0x40ec, 0xba, 0xed, 0xfe, 0x2a, 0xae, 0x87, 0x7b, 0x4b); interface IOperation : public IBase diff --git a/extensions/include/io/isocket.h b/extensions/include/io/isocket.h index 654cdbd75f04aea48bebf66c06e178eb7f33bcc2..6d03b0941a0d3259c7fc13b28c54817d6ef5e033 100644 --- a/extensions/include/io/isocket.h +++ b/extensions/include/io/isocket.h @@ -82,7 +82,7 @@ interface IListen : public ISocket _DEFINE_IID(IID_IListen, 0xbb9da617, 0x80be, 0x4e04, 0x8e, 0xb4, 0x13, 0xcf, 0x43, 0xf1, 0xeb, 0xd1); -interface IAcceptListen : public IBase +interface IAcceptListen : public IBase { std_method(Accept)(IBase* pBase, _sock_t s, event_id error_code) PURE; }; diff --git a/extensions/include/io/itimer.h b/extensions/include/io/itimer.h index de65ae8ba6fae5ab9a141d16bc6b2dd17ccca5bf..0bb20931461bacd2e241b8b9ef69fb1d6c14ace3 100644 --- a/extensions/include/io/itimer.h +++ b/extensions/include/io/itimer.h @@ -1,13 +1,13 @@ #ifndef _ITIMER_H_ #define _ITIMER_H_ -interface ITimerEvents : public IBase +interface ITimerEvent : public IBase { std_method(OnTimer)(UINT uId, UINT err) PURE; }; // {B5819C73-6EF7-4F25-B053-F6F6D4DCBE00} -_DEFINE_IID(IID_ITimerEvents, +_DEFINE_IID(IID_ITimerEvent, 0xb5819c73, 0x6ef7, 0x4f25, 0xb0, 0x53, 0xf6, 0xf6, 0xd4, 0xdc, 0xbe, 0x0); diff --git a/extensions/include/net/ihttp.h b/extensions/include/net/ihttp.h index bd6179a427d2051246fe958d03a5caf88b2f8a38..c63bb2a06d66c967ca87525c3f317772d1a13eff 100644 --- a/extensions/include/net/ihttp.h +++ b/extensions/include/net/ihttp.h @@ -94,7 +94,7 @@ typedef const char* http_method_name; #define http_host_len 256 -interface IHttpNotify : public IBase +interface IHttpInstanceProc : public IBase { std_method_(ULONG, Event)(ULONG ulevent) PURE; std_method_(ULONG, SendHead)(void* data, ULONG nSize, size_t nLen) PURE; @@ -104,34 +104,42 @@ interface IHttpNotify : public IBase }; // {8C102441-E383-4B3C-8CC8-7C8E0B0162FE} -_DEFINE_IID(IID_IHttpNotify, +_DEFINE_IID(IID_IHttpInstanceProc, 0x8c102441, 0xe383, 0x4b3c, 0x8c, 0xc8, 0x7c, 0x8e, 0xb, 0x1, 0x62, 0xfe); - -interface IHttp_t : public IBase +interface IHttpInstance : public IBase { - std_method(BindHttp)(IBase* pIAsyncTcpSocket, IBase* pIOper, IBase* pIDns) PURE; + std_method(BindEvent)(IBase* pBase) PURE; + std_method(UnBindEvent)() PURE; std_method(SetCookies)(http_header_data *data) PURE; - std_method(SetNotify)(IHttpNotify *Notify) PURE; - std_method(Perform)(http_addr_s url, http_addr_s scheme, http_port uport) PURE; + std_method(Open)(http_addr_s url, http_addr_s scheme, http_port uport) PURE; std_method(ReSet)() PURE; std_method(Cancel)() PURE; std_method_(int, IsComplete)() PURE; }; // {6014F5E1-05A9-476F-898C-8606756A750F} -_DEFINE_IID(IID_IHttp_t, +_DEFINE_IID(IID_IHttpInstance, 0x6014f5e1, 0x5a9, 0x476f, 0x89, 0x8c, 0x86, 0x6, 0x75, 0x6a, 0x75, 0xf); -interface IHttp_s : public IBase +interface IHttpApplicationProc : public IBase +{ + std_method(OnGetHost)(int error, LPCSTR hostname, LPCSTR host) PURE; +}; + +// {23C86623-C039-416B-A489-C175C360E692} +_DEFINE_IID(IID_IHttpApplicationProc, + 0x23c86623, 0xc039, 0x416b, 0xa4, 0x89, 0xc1, 0x75, 0xc3, 0x60, 0xe6, 0x92); + +interface IHttpApplication : public IBase { }; // {75BD9CAF-2D0D-4408-B481-655F30F8613F} -_DEFINE_IID(IID_IHttp_s, +_DEFINE_IID(IID_IHttpApplication, 0x75bd9caf, 0x2d0d, 0x4408, 0xb4, 0x81, 0x65, 0x5f, 0x30, 0xf8, 0x61, 0x3f); #endif diff --git a/extensions/include/net/inet.h b/extensions/include/net/inet.h index 3224502231c82e97c3086846ca79f838301d10df..c901673c731d954d3641ca20d5bc27a9f8ef942b 100644 --- a/extensions/include/net/inet.h +++ b/extensions/include/net/inet.h @@ -4,19 +4,20 @@ #include #include -typedef enum NET_PROTOCOL +typedef enum TAG_NET_PROTOCOL { - Protocol_base = 0, - Protocol_websocket = 1, - Protocol_dns = 2, - Protocol_http = 3 + Protocol_base = 0, + Protocol_dns = 2, + Protocol_http = 100, + Protocol_https = 101, + Protocol_websocket = 150 }Net_Protocol; interface INet : public IBase { - std_method(CreateProtocol)(Net_Protocol np, IBase** pBase) PURE; + std_method(CreateProtocol)(Net_Protocol netp, IBase** pBase) PURE; }; // {7EB8185F-0F4E-4420-9991-B70671967377} diff --git a/framwork.xcodeproj/project.pbxproj b/framwork.xcodeproj/project.pbxproj index 14d473b570a4c964f8ef87666d4f95d3990fd78b..7f43c9dd8e58ca690f41fcc2f49f042c0a225ea9 100644 --- a/framwork.xcodeproj/project.pbxproj +++ b/framwork.xcodeproj/project.pbxproj @@ -272,6 +272,8 @@ A144ABC2272574260019CA5F /* stdcrt.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A144AAFD272572A30019CA5F /* stdcrt.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; A144ABC5272574290019CA5F /* stdcrt.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A144AAFD272572A30019CA5F /* stdcrt.framework */; }; A144ABC6272574290019CA5F /* stdcrt.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A144AAFD272572A30019CA5F /* stdcrt.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + A1681ABA273982CC004CC415 /* httpinstanceimpl.h in Headers */ = {isa = PBXBuildFile; fileRef = A1681AB8273982CC004CC415 /* httpinstanceimpl.h */; }; + A1681ABB273982CC004CC415 /* httpinstanceimpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1681AB9273982CC004CC415 /* httpinstanceimpl.cpp */; }; A17163F2271DCD190062A998 /* tableinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = A17163E0271DCD180062A998 /* tableinfo.h */; }; A17163F3271DCD190062A998 /* dbimpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A17163E1271DCD180062A998 /* dbimpl.cpp */; }; A17163F4271DCD190062A998 /* stringutil.h in Headers */ = {isa = PBXBuildFile; fileRef = A17163E2271DCD180062A998 /* stringutil.h */; }; @@ -290,8 +292,6 @@ A1716401271DCD190062A998 /* stdafx.h in Headers */ = {isa = PBXBuildFile; fileRef = A17163EF271DCD190062A998 /* stdafx.h */; }; A1716402271DCD190062A998 /* dbimpl.h in Headers */ = {isa = PBXBuildFile; fileRef = A17163F0271DCD190062A998 /* dbimpl.h */; }; A1716403271DCD190062A998 /* stringutil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A17163F1271DCD190062A998 /* stringutil.cpp */; }; - A1F6DB6A27284749002BF005 /* httptimpl.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F6DB5D27284749002BF005 /* httptimpl.h */; }; - A1F6DB6B27284749002BF005 /* httptimpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1F6DB5E27284749002BF005 /* httptimpl.cpp */; }; A1F6DB6C27284749002BF005 /* http_header.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A1F6DB6027284749002BF005 /* http_header.hpp */; }; A1F6DB6D27284749002BF005 /* httputil.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F6DB6127284749002BF005 /* httputil.h */; }; A1F6DB6E27284749002BF005 /* http_parser.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F6DB6227284749002BF005 /* http_parser.h */; }; @@ -1084,6 +1084,8 @@ A144AB6F272572FD0019CA5F /* compat_cjson.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compat_cjson.c; sourceTree = ""; }; A144AB70272572FD0019CA5F /* compat_endian.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compat_endian.c; sourceTree = ""; }; A144AB71272572FD0019CA5F /* compat_error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compat_error.c; sourceTree = ""; }; + A1681AB8273982CC004CC415 /* httpinstanceimpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = httpinstanceimpl.h; sourceTree = ""; }; + A1681AB9273982CC004CC415 /* httpinstanceimpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = httpinstanceimpl.cpp; sourceTree = ""; }; A17163E0271DCD180062A998 /* tableinfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tableinfo.h; sourceTree = ""; }; A17163E1271DCD180062A998 /* dbimpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dbimpl.cpp; sourceTree = ""; }; A17163E2271DCD180062A998 /* stringutil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stringutil.h; sourceTree = ""; }; @@ -1133,8 +1135,6 @@ A1EB049C27285B0600214133 /* iyangcontext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = iyangcontext.h; sourceTree = ""; }; A1EB049D27285B0600214133 /* iparser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = iparser.h; sourceTree = ""; }; A1EB049F27285B0600214133 /* imempool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = imempool.h; sourceTree = ""; }; - A1F6DB5D27284749002BF005 /* httptimpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = httptimpl.h; sourceTree = ""; }; - A1F6DB5E27284749002BF005 /* httptimpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = httptimpl.cpp; sourceTree = ""; }; A1F6DB6027284749002BF005 /* http_header.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = http_header.hpp; sourceTree = ""; }; A1F6DB6127284749002BF005 /* httputil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = httputil.h; sourceTree = ""; }; A1F6DB6227284749002BF005 /* http_parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = http_parser.h; sourceTree = ""; }; @@ -1296,9 +1296,9 @@ isa = PBXGroup; children = ( A1F6DB5F27284749002BF005 /* http_protocol */, - A1F6DB5E27284749002BF005 /* httptimpl.cpp */, - A1F6DB5D27284749002BF005 /* httptimpl.h */, A107E90627172491006A8E8E /* dllmain.cpp */, + A1681AB8273982CC004CC415 /* httpinstanceimpl.h */, + A1681AB9273982CC004CC415 /* httpinstanceimpl.cpp */, A107E90B27172491006A8E8E /* dnsimpl.cpp */, A107E91A27172492006A8E8E /* dnsimpl.h */, A107E90827172491006A8E8E /* interface.cpp */, @@ -2059,7 +2059,6 @@ A107E92F27172492006A8E8E /* udp.h in Headers */, A107E92827172492006A8E8E /* ftp.h in Headers */, A107E92527172492006A8E8E /* tcp.h in Headers */, - A1F6DB6A27284749002BF005 /* httptimpl.h in Headers */, A107E93027172492006A8E8E /* dnsimpl.h in Headers */, A107E92127172492006A8E8E /* stdafx.h in Headers */, A107E91C27172492006A8E8E /* websocketimpl.h in Headers */, @@ -2072,6 +2071,7 @@ A107E92D27172492006A8E8E /* ip.h in Headers */, A1F6DB7127284749002BF005 /* http_content_type.hpp in Headers */, A1F6DB6D27284749002BF005 /* httputil.h in Headers */, + A1681ABA273982CC004CC415 /* httpinstanceimpl.h in Headers */, A107E92027172492006A8E8E /* targetver.h in Headers */, A1F6DB6E27284749002BF005 /* http_parser.h in Headers */, ); @@ -2744,7 +2744,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - A1F6DB6B27284749002BF005 /* httptimpl.cpp in Sources */, A107E92A27172492006A8E8E /* icmp.c in Sources */, A107E92927172492006A8E8E /* smtp.c in Sources */, A107E91E27172492006A8E8E /* stdafx.cpp in Sources */, @@ -2757,6 +2756,7 @@ A107E91B27172492006A8E8E /* netimpl.cpp in Sources */, A107E92B27172492006A8E8E /* ftp.c in Sources */, A1F6DB7327284749002BF005 /* http_content_type.cpp in Sources */, + A1681ABB273982CC004CC415 /* httpinstanceimpl.cpp in Sources */, A107E91D27172492006A8E8E /* dllmain.cpp in Sources */, A107E91F27172492006A8E8E /* interface.cpp in Sources */, A1F6DB7427284749002BF005 /* chttpparser.cpp in Sources */, diff --git a/framwork.xcodeproj/project.xcworkspace/xcuserdata/com.app.xcuserdatad/UserInterfaceState.xcuserstate b/framwork.xcodeproj/project.xcworkspace/xcuserdata/com.app.xcuserdatad/UserInterfaceState.xcuserstate index 6b5cd12d9a5331f5483f8b9938660cedcdd2fe76..7459eefeb415e7c79c56b8786641c4819495923b 100644 Binary files a/framwork.xcodeproj/project.xcworkspace/xcuserdata/com.app.xcuserdatad/UserInterfaceState.xcuserstate and b/framwork.xcodeproj/project.xcworkspace/xcuserdata/com.app.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/framwork.xcodeproj/xcuserdata/com.app.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/framwork.xcodeproj/xcuserdata/com.app.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index f43a0da5c1454221e58492d97462afd39113e44a..0f0007a46cb51d2d5d3b2a5ec050743736de3003 100644 --- a/framwork.xcodeproj/xcuserdata/com.app.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/framwork.xcodeproj/xcuserdata/com.app.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -116,21 +116,5 @@ landmarkType = "7"> - - - - diff --git a/framwork.xcodeproj/xcuserdata/com.app.xcuserdatad/xcschemes/xcschememanagement.plist b/framwork.xcodeproj/xcuserdata/com.app.xcuserdatad/xcschemes/xcschememanagement.plist index d355f7212db046dba3a8ff5799eac31f3419cce5..51dda5b12df143bcae647af78fca0787ca4370c0 100644 --- a/framwork.xcodeproj/xcuserdata/com.app.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/framwork.xcodeproj/xcuserdata/com.app.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,7 @@ access.xcscheme_^#shared#^_ orderHint - 12 + 11 asynio.xcscheme_^#shared#^_ @@ -27,12 +27,12 @@ license.xcscheme_^#shared#^_ orderHint - 11 + 14 logs.xcscheme_^#shared#^_ orderHint - 9 + 10 mainui.xcscheme_^#shared#^_ @@ -47,12 +47,12 @@ mainview.xcscheme_^#shared#^_ orderHint - 14 + 13 mempool.xcscheme_^#shared#^_ orderHint - 7 + 12 msgbus.xcscheme_^#shared#^_ @@ -62,17 +62,17 @@ net.xcscheme_^#shared#^_ orderHint - 13 + 8 render.xcscheme_^#shared#^_ orderHint - 8 + 7 res.xcscheme_^#shared#^_ orderHint - 10 + 9 std_com.xcscheme_^#shared#^_ diff --git a/include/comutiliy/asynio.h b/include/comutiliy/asynio.h index ce2ded0b68c7cfeb12a140d2c580b303d31e22c1..25b1eff05b2a5cf00c19cafa2389f7747347017c 100644 --- a/include/comutiliy/asynio.h +++ b/include/comutiliy/asynio.h @@ -4,14 +4,35 @@ #include #include -typedef _lComPtr TcpListenPtr; -typedef _lComPtr TcpSocketPtr; -typedef _lComPtr UdpSocketPtr; -typedef _lComPtr OperationPtr; -typedef _lComPtr AsynFramePtr; -typedef _lComPtr TimerPtr; -typedef _lComPtr FiltPtr; +typedef _lComPtr AsynFramePtr; +typedef const _lComPtr& AsynFrameConstPtr; +typedef _lComPtr TcpListenPtr; +typedef const _lComPtr& TcpListenConstPtr; + +typedef _lComPtr AcceptListenPtr; +typedef const _lComPtr& AcceptListenConstPtr; + +typedef _lComPtr TcpSocketPtr; +typedef const _lComPtr& TcpSocketConstPtr; + +typedef _lComPtr UdpSocketPtr; +typedef const _lComPtr& UdpSocketConstPtr; + +typedef _lComPtr OperationPtr; +typedef const _lComPtr& OperationConstPtr; + +typedef _lComPtr OperationEventPtr; +typedef const _lComPtr OperationEventConstPtr; + +typedef _lComPtr TimerPtr; +typedef const _lComPtr& TimerConstPtr; + +typedef _lComPtr TimerEventPtr; +typedef const _lComPtr& TimerEventConstPtr; + +typedef _lComPtr FilePtr; +typedef const _lComPtr& FileConstPtr; #endif diff --git a/include/comutiliy/base.h b/include/comutiliy/base.h new file mode 100644 index 0000000000000000000000000000000000000000..999a2d301394023fd331be853993d41b9aeb5615 --- /dev/null +++ b/include/comutiliy/base.h @@ -0,0 +1,53 @@ +#ifndef _COMUTILIY_BASE_H_ +#define _COMUTILIY_BASE_H_ + +#include + +uvStdComNameSpaceBegin + +typedef _lComPtr BasePtr; +typedef const _lComPtr& BaseConstPtr; + +typedef _lComPtr RotPtr; +typedef const _lComPtr& RotConstPtr; + +typedef _lComPtr ComRotMessagePtr; +typedef const _lComPtr& ComRotMessageConstPtr; + +typedef _lComPtr LibManagerPtr; +typedef const _lComPtr LibManagerConstPtr; + +typedef _lComPtr CompoentLoaderPtr; +typedef const _lComPtr CompoentLoaderConstPtr; + +typedef _lComPtr ObjectRunPtr; +typedef const _lComPtr& ObjectRunConstPtr; + +typedef _lComPtr PluginPtr; +typedef const _lComPtr PluginConstPtr; + +typedef _lComPtr PluginRunPtr; +typedef const _lComPtr PluginRunConstPtr; + +typedef _lComPtr MsgPluginPtr; +typedef const _lComPtr MsgPluginConstPtr; + +typedef _lComPtr MsgPtr; +typedef const _lComPtr MsgConstPtr; + +typedef _lComPtr MsgProxyPtr; +typedef const _lComPtr MsgProxyConstPtr; + +typedef _lComPtr ComClassFactoryPtr; +typedef const _lComPtr ComClassFactoryConstPtr; + +typedef _lComPtr ComFactoryPtr; +typedef const _lComPtr ComFactoryConstPtr; + +typedef _lComPtr ExitPtr; +typedef const _lComPtr ExitConstPtr; + +uvStdComNameSpaceEnd + +#endif + diff --git a/include/comutiliy/cchannel.hpp b/include/comutiliy/cchannel.hpp index df5e42f2a6f08c4099f398cdd9e8092757d3d46f..a395d4ae0fba08ce5a5e22641d4a084796495975 100644 --- a/include/comutiliy/cchannel.hpp +++ b/include/comutiliy/cchannel.hpp @@ -24,13 +24,13 @@ public: hr = m_pRot->GetObject(CLSID_IAsynFrame, IID_IAsynFrame, (IBase**)&m_pIAsynFrame); rc_assert(hr == S_OK, E_FAIL) - hr = m_pIAsynFrame->CreateTcpSocket((IBase**)&m_pIScoket); + hr = m_pIAsynFrame->CreateIo(io_tcp_socket, (IBase**)&m_pISockket); rc_assert(hr == S_OK, E_FAIL) - hr = m_pIAsynFrame->CreateAsynIoOperation((IBase**)&m_pIWriteOperation); + hr = m_pIAsynFrame->CreateIo(io_operation, (IBase**)&m_pIWriteOperation); rc_assert(hr == S_OK, E_FAIL) - hr = m_pIAsynFrame->CreateAsynIoOperation((IBase**)&m_pIReadOperation); + hr = m_pIAsynFrame->CreateIo(io_operation, (IBase**)&m_pIReadOperation); rc_assert(hr == S_OK, E_FAIL) return hr; @@ -47,13 +47,13 @@ public: hr = m_pRot->GetObject(CLSID_IAsynFrame, IID_IAsynFrame, (IBase**)&m_pIAsynFrame); rc_assert(hr == S_OK, E_FAIL) - hr = pSocket->QueryInterface(IID_ITcpSocket, (void**)&m_pIScoket); + hr = pSocket->QueryInterface(IID_ITcpSocket, (void**)&m_pISockket); rc_assert(hr == S_OK, E_FAIL) - hr = m_pIAsynFrame->CreateAsynIoOperation((IBase**)&m_pIWriteOperation); + hr = m_pIAsynFrame->CreateIo(io_operation, (IBase**)&m_pIWriteOperation); rc_assert(hr == S_OK, E_FAIL) - hr = m_pIAsynFrame->CreateAsynIoOperation((IBase**)&m_pIReadOperation); + hr = m_pIAsynFrame->CreateIo(io_operation, (IBase**)&m_pIReadOperation); rc_assert(hr == S_OK, E_FAIL) hr = SetInterface(); @@ -65,13 +65,13 @@ public: HRESULT hr = S_OK; - hr = m_pIScoket->CreateSock(); + hr = m_pISockket->CreateSock(); rc_assert(hr == S_OK, E_FAIL) - hr = m_pIScoket->OpenIo(); + hr = m_pISockket->OpenIo(); rc_assert(hr == S_OK, E_FAIL) - hr = m_pIScoket->BindIo(); + hr = m_pISockket->BindIo(); rc_assert(hr == S_OK, E_FAIL) return hr; @@ -125,22 +125,22 @@ public: ip = s_strtok(item, ":", &port); rc_assert(ip != NULL, E_FAIL) rc_assert(port != NULL, E_FAIL) - rc_assert(m_pIScoket != NULL, E_FAIL) + rc_assert(m_pISockket != NULL, E_FAIL) - return m_pIScoket->ConnectIo(ip, atoi(port), m_pIWriteOperation, event); + return m_pISockket->ConnectIo(ip, atoi(port), m_pIWriteOperation, event); } std_method_impl CloseChannel() { - rc_assert(m_pIScoket != NULL, E_FAIL) + rc_assert(m_pISockket != NULL, E_FAIL) rc_assert(m_pIWriteOperation != NULL, E_FAIL) rc_assert(m_pIReadOperation != NULL, E_FAIL) HRESULT hr = S_OK; - hr = m_pIScoket->CloseIo(CLOSE_BOTH_IO); + hr = m_pISockket->CloseIo(CLOSE_BOTH_IO); rc_assert(hr == S_OK, E_FAIL) - hr = m_pIScoket->CloseSock(); + hr = m_pISockket->CloseSock(); rc_assert(hr == S_OK, E_FAIL) hr = m_pIWriteOperation->UnBindEvent(); @@ -159,7 +159,7 @@ public: m_pIReadOperation.dispose(); - m_pIScoket.dispose(); + m_pISockket.dispose(); m_pIAsynFrame.dispose(); @@ -169,32 +169,32 @@ public: } std_method_type_impl(BUFFER_SIZE) ReadChannel(BUFFER_PTR buf, BUFFER_SIZE size) { - rc_assert(m_pIScoket != NULL, E_FAIL) - return this->m_pIScoket->SyncRecv(buf, size); + rc_assert(m_pISockket != NULL, E_FAIL) + return this->m_pISockket->SyncRecv(buf, size); } std_method_type_impl(BUFFER_SIZE) WriteChannel(BUFFER_PTR buf, BUFFER_SIZE size) { - rc_assert(m_pIScoket != NULL, E_FAIL) - return this->m_pIScoket->SyncSend(buf, size); + rc_assert(m_pISockket != NULL, E_FAIL) + return this->m_pISockket->SyncSend(buf, size); } std_method_impl OnReadChannel(ULONG pos, ULONG size, event_id event) { - rc_assert(m_pIScoket != NULL, E_FAIL) + rc_assert(m_pISockket != NULL, E_FAIL) rc_assert(m_pIReadOperation != NULL, E_FAIL) rc_assert(size != 0, E_FAIL) rc_assert(m_pIReadOperation->SetIoParam(pos, size) == S_OK, E_FAIL) - return this->m_pIScoket->ReadIo(m_pIReadOperation, event); + return this->m_pISockket->ReadIo(m_pIReadOperation, event); } std_method_impl OnWriteChannel(ULONG pos, ULONG size, event_id event) { - rc_assert(m_pIScoket != NULL, E_FAIL) + rc_assert(m_pISockket != NULL, E_FAIL) rc_assert(m_pIWriteOperation != NULL, E_FAIL) rc_assert(size != 0, E_FAIL) rc_assert(m_pIWriteOperation->SetIoParam(pos, size) == S_OK, E_FAIL) - return this->m_pIScoket->WriteIo(m_pIWriteOperation, event); + return this->m_pISockket->WriteIo(m_pIWriteOperation, event); } std_method_impl WriteStream(BUFFER_PTR Ptr, BUFFER_SIZE Pos, BUFFER_SIZE Size) { @@ -230,14 +230,14 @@ public: private: std_method_impl SetInterface() { - rc_assert(m_pIScoket != NULL, E_FAIL) + rc_assert(m_pISockket != NULL, E_FAIL) rc_assert(m_pIWriteOperation != NULL, E_FAIL) rc_assert(m_pIReadOperation != NULL, E_FAIL) HRESULT hr = S_OK; _lComPtr pBase; - hr = m_pIScoket->QueryInterface(IID_IBase, (void**)&pBase); + hr = m_pISockket->QueryInterface(IID_IBase, (void**)&pBase); rc_assert(hr == S_OK, E_FAIL) hr = this->m_pIWriteOperation->BindIBase(pBase); @@ -265,9 +265,9 @@ private: return S_OK; } protected: - ComRotMessagePtr m_pRot; + _lComPtr m_pRot; AsynFramePtr m_pIAsynFrame; - TcpSocketPtr m_pIScoket; + TcpSocketPtr m_pISockket; OperationPtr m_pIWriteOperation; OperationPtr m_pIReadOperation; diff --git a/include/comutiliy/msg.h b/include/comutiliy/msg.h new file mode 100644 index 0000000000000000000000000000000000000000..384d6c01bc3f6c184fc53fa5181c34b30c846268 --- /dev/null +++ b/include/comutiliy/msg.h @@ -0,0 +1,23 @@ +#ifndef _COMUTILIY_MSG_H_ +#define _COMUTILIY_MSG_H_ + +#include +#include + +typedef _lComPtr MsgBusPtr; +typedef const _lComPtr MsgBusConstPtr; + +typedef _lComPtr BrokerPtr; +typedef const _lComPtr BrokerConstPtr; + +typedef _lComPtr ConsumerPtr; +typedef const _lComPtr ConsumerConstPtr; + +typedef _lComPtr ProducerPtr; +typedef const _lComPtr ProducerConstPtr; + +typedef _lComPtr AgentPtr; +typedef const _lComPtr AgentConstPtr; + +#endif + diff --git a/include/comutiliy/net.h b/include/comutiliy/net.h index 4e3a5d8a72028e9d95b174e358b81a09fb04c654..397ccbf0145c111a480ed46e9daa2d887cd9ec2d 100644 --- a/include/comutiliy/net.h +++ b/include/comutiliy/net.h @@ -4,10 +4,25 @@ #include #include +#include #include -typedef _lComPtr DnsPtr; -typedef _lComPtr httpPtr; + +typedef _lComPtr NetPtr; +typedef const _lComPtr& NetConstPtr; + +typedef _lComPtr DnsPtr; +typedef const _lComPtr& DnsConstPtr; +typedef _lComPtr DnsHandlePtr; + +typedef _lComPtr HttpInstancePtr; +typedef const _lComPtr& HttpInstanceConstPtr; +typedef _lComPtr HttpInstanceHandlePtr; + +typedef _lComPtr HttpApplicationPtr; +typedef const _lComPtr& HttpApplicationConstPtr; +typedef _lComPtr HttpApplicationHandlePtr; + #endif diff --git a/include/comutiliy/schannel.hpp b/include/comutiliy/schannel.hpp index 1b1458d72cd5309d5b8c4ea53ec33a8adb5b1e62..6015e9ffc21a2034c3e593a03f5bd47807ab5bad 100644 --- a/include/comutiliy/schannel.hpp +++ b/include/comutiliy/schannel.hpp @@ -24,7 +24,7 @@ public: hr = m_pRot->GetObject(CLSID_IAsynFrame, IID_IAsynFrame, (IBase**)&m_pIAsynFrame); rc_assert(hr == S_OK, E_FAIL) - hr = m_pIAsynFrame->CreateTcpListenSocket((IBase**)&m_pIListen); + hr = m_pIAsynFrame->CreateIo(io_tcplisten_socket, (IBase**)&m_pIListen); rc_assert(hr == S_OK, E_FAIL) return S_OK; @@ -82,7 +82,7 @@ public: HRESULT hr = S_OK; _lComPtr pSocket; - hr = m_pIAsynFrame->CreateTcpSocket((IBase**)&pSocket); + hr = m_pIAsynFrame->CreateIo(io_tcp_socket, (IBase**)&pSocket); rc_assert(hr == S_OK, E_FAIL) hr = pSocket->OpenIo(); @@ -160,7 +160,7 @@ public: } protected: - ComRotMessagePtr m_pRot; + _lComPtr m_pRot; AsynFramePtr m_pIAsynFrame; TcpListenPtr m_pIListen; diff --git a/logs/logdatabase.h b/logs/logdatabase.h index 9a67aac84db7a4d2291be15fc329fb1b3a7ed725..4ee431c882714846612e9a06f978756601ac78f7 100644 --- a/logs/logdatabase.h +++ b/logs/logdatabase.h @@ -58,9 +58,9 @@ private: std_method(ExeCommand)(LPCSTR cmd); private: - _lComPtr m_pRot; - MapTableStruct m_pMapTableStruct; - CDatabase m_db; + ComRotMessagePtr m_pRot; + MapTableStruct m_pMapTableStruct; + CDatabase m_db; }; diff --git a/logs/logfilters.h b/logs/logfilters.h index 804fc0ba7c5cb78df1665e2560312c5b0719001a..e96a04f283287322972c5e1d2564d24e74021287 100644 --- a/logs/logfilters.h +++ b/logs/logfilters.h @@ -53,7 +53,7 @@ public: _QUEUE exit_message; private: - _lComPtr m_pRot; + RotPtr m_pRot; TaskList m_ListJson; CAutoLock m_lock; CSemHandle m_sem; diff --git a/logs/logsimpl.h b/logs/logsimpl.h index 2e3f9f9ee17862f208b449b95cd6032aab366640..b5f6d39f58082d8a269058dd5a926151d261b7ad 100644 --- a/logs/logsimpl.h +++ b/logs/logsimpl.h @@ -44,7 +44,8 @@ public: std_method(ReadRuleFile)(const basic_tstring& file); std_method(SyncTable)(const cJSON* JsRoot); private: - _lComPtr m_pRot; + ComRotMessagePtr m_pRot; + _lComPtr m_pILogDataBase; _lComPtr m_pILogFilters; diff --git a/logs/stdafx.h b/logs/stdafx.h index b398ec0d269094936713e9c863c2a142a7b96190..c3d24e9d5298ba0981bc2336b1452cebb3c53f7a 100644 --- a/logs/stdafx.h +++ b/logs/stdafx.h @@ -13,6 +13,7 @@ #include #include +#include #define Rule_log "logs" #define Rule_Tables "tables" diff --git a/mainui.sln b/mainui.sln index 6d70d7dfbfdc276721bcc4ab855b113a24a57510..6ab40cea7c890b6c8ca3279ae5fe78ffff79dd5e 100644 --- a/mainui.sln +++ b/mainui.sln @@ -4,6 +4,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00 VisualStudioVersion = 15.0.27428.2002 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asynio", "asynio\AsynIo.vcxproj", "{989A9A35-8FEE-4932-82C9-E43CC573594E}" + ProjectSection(ProjectDependencies) = postProject + {2D8E323A-D4C8-4CB2-8774-201CE7F0FE69} = {2D8E323A-D4C8-4CB2-8774-201CE7F0FE69} + {46263D46-C12C-4BB6-BA9B-57CB14E2E516} = {46263D46-C12C-4BB6-BA9B-57CB14E2E516} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "main", "main\mainui.vcxproj", "{44AC7B48-D81E-4C78-A881-A15C69256C72}" EndProject diff --git a/mainui/appviewimpl.cpp b/mainui/appviewimpl.cpp index ba50894c219511319f23d2c8b0f7a2d3921c30c4..77ed2d2fbb62545919172042d4bf4e4ed036173f 100644 --- a/mainui/appviewimpl.cpp +++ b/mainui/appviewimpl.cpp @@ -34,12 +34,15 @@ std_method_impl CAppViewImpl::Start(_pinstance hInstance, UINT uType) rc_assert(pINet.m_p != INULL, E_FAIL) _lComPtr pIDns; - pINet->CreateProtocol(Protocol_dns, (IBase**)&pIDns); + + pINet->CreateProtocol(Protocol_dns, (IBase**)&pIDns); pIDns->Send("www.baidu.com", NULL); - pIDns->Close(); - + + + + return hr; } diff --git a/mainuiapp/appviewimpl.cpp b/mainuiapp/appviewimpl.cpp index ba50894c219511319f23d2c8b0f7a2d3921c30c4..2b72664d963dcc7002484aa4fd2fad10be9b4adc 100644 --- a/mainuiapp/appviewimpl.cpp +++ b/mainuiapp/appviewimpl.cpp @@ -33,12 +33,12 @@ std_method_impl CAppViewImpl::Start(_pinstance hInstance, UINT uType) m_pRot->GetObject(CLSID_INet, IID_INet, (IBase**)&pINet.m_p); rc_assert(pINet.m_p != INULL, E_FAIL) - _lComPtr pIDns; - pINet->CreateProtocol(Protocol_dns, (IBase**)&pIDns); + //_lComPtr pIDns; + //pINet->CreateProtocol(Protocol_dns, (IBase**)&pIDns); - pIDns->Send("www.baidu.com", NULL); + //pIDns->Send("www.baidu.com", NULL); - pIDns->Close(); + //pIDns->Close(); return hr; diff --git a/mainview/mainviewimpl.cpp b/mainview/mainviewimpl.cpp index eb5997babb9528a1af3ee2777eef803badf071b9..842736a2fd5d7cb09552715f34ec0d74d9ef776f 100644 --- a/mainview/mainviewimpl.cpp +++ b/mainview/mainviewimpl.cpp @@ -48,7 +48,7 @@ std_method_impl CMainViewImpl::Start(_pinstance hInstance, UINT uType) hr = m_pIUiWindow->SetResource(INSNULL, strResFile.c_str()); rc_assert(hr == S_OK, E_FAIL) - _lComPtr pBase; + BasePtr pBase; this->QueryInterface(IID_IBase, (void**)&pBase); m_pIUiWindow->BindEvent(pBase); diff --git a/mainview/mainviewimpl.h b/mainview/mainviewimpl.h index 0213d425acc9e06fe259bd2114d6f7ada264d747..480e9f9d2bfae76991b0f8049dff39a2db785ea2 100644 --- a/mainview/mainviewimpl.h +++ b/mainview/mainviewimpl.h @@ -3,7 +3,6 @@ #include "stdafx.h" - class CMainViewImpl : public IPlugin, public IPluginRun, public IMsgPlugin, @@ -45,12 +44,11 @@ public: private: - _lComPtr m_pRot; - _lComPtr m_pIUiBase; - _lComPtr m_pIUiWindow; - _lComPtr m_pIUiMessageLoop; - - _lComPtr m_pILogs; + ComRotMessagePtr m_pRot; + _lComPtr m_pIUiBase; + _lComPtr m_pIUiWindow; + _lComPtr m_pIUiMessageLoop; + _lComPtr m_pILogs; }; diff --git a/mainview/stdafx.h b/mainview/stdafx.h index 5dbcc96fac939fa212b8e788c0dd5da8f04f3d2a..549ba7a7f464947faa97662dfb4d4bbdb2a0807a 100644 --- a/mainview/stdafx.h +++ b/mainview/stdafx.h @@ -7,11 +7,9 @@ #define _STDAFX_H_ #include -#include -#include -#include +#include -#include +#include #include #if (TARGET_OS == OS_WINDOWS) diff --git a/mempool/mempoolimpl.h b/mempool/mempoolimpl.h index 08e780b3fd37a502fc1ae460bbf0828f0b379fad..212e30bec39c2676a6097734438f7d7f8ab391a0 100644 --- a/mempool/mempoolimpl.h +++ b/mempool/mempoolimpl.h @@ -35,7 +35,7 @@ public: std_method(Free)(void* ptr); private: - _lComPtr m_pRot; + RotPtr m_pRot; }; diff --git a/mempool/stdafx.h b/mempool/stdafx.h index a12bb074b12be5f1ba1fbdbbaba2001ee4f4774b..a753561956ac7aa830d4c7bd92ee866299e2d3ed 100644 --- a/mempool/stdafx.h +++ b/mempool/stdafx.h @@ -7,6 +7,7 @@ #define _STDAFX_H_ #include +#include #endif diff --git a/msgbus/agent.cpp b/msgbus/agent.cpp index c9e1c1e55de0d73fdc9485e147a0d4a48dc37f7e..5d2caef04d99ffa7c14798feb363ab87ec468670 100644 --- a/msgbus/agent.cpp +++ b/msgbus/agent.cpp @@ -20,7 +20,7 @@ std_method_impl CAgentImpl::Bind(LPCSTR addr, int len) hr = this->UnBindEvent(); rc_assert(hr == S_OK, E_FAIL) - _lComPtr pBase; + BasePtr pBase; hr = this->QueryInterface(IID_IBase, (void**)&pBase); rc_assert(hr == S_OK, E_FAIL) diff --git a/msgbus/agent.h b/msgbus/agent.h index e5f36b1619f99f37d0dd5ae929f60111adde0a57..5c555689e60848ce2e00eeb3babe01d63aed4a68 100644 --- a/msgbus/agent.h +++ b/msgbus/agent.h @@ -5,7 +5,7 @@ #include "auth.hpp" class CAgentImpl : public IAgent, - public IOperationEvents, + public IOperationEvent, public CChannel, public CUnknownImp @@ -16,7 +16,7 @@ public: BEGIN_STDCOM_MAP STDCOM_INTERFACE_ENTRY_UNKNOWN_(IAgent) - STDCOM_INTERFACE_ENTRY(IOperationEvents) + STDCOM_INTERFACE_ENTRY(IOperationEvent) STDCOM_INTERFACE_ENTRY(IAgent) END_STDCOM_MAP @@ -28,7 +28,7 @@ public: std_method(Recv)(IBase* pBase); std_method(Send)(IBase* pBase); - //IOperationEvents + //IOperationEvent std_method(OnComplete)(IBase *pOperation, event_id event, ULONG error_code); private: std_method(OnConnected)(IBase *pIBase); diff --git a/msgbus/broker.cpp b/msgbus/broker.cpp index 6f0ee048eac3af6f028b2f632ad2f9b031cadde4..6af27efc049a70de0b533d81e79df0dfa92d6b1a 100644 --- a/msgbus/broker.cpp +++ b/msgbus/broker.cpp @@ -125,10 +125,10 @@ std_method_impl CBrokerImpl::OnAccepted(IBase* pBase, _sock_t s) rc_assert(hr == S_OK, E_FAIL) OperationPtr WriteOperation; - hr = m_pIAsynFrame->CreateAsynIoOperation((IBase**)&WriteOperation); + hr = m_pIAsynFrame->CreateIo(io_operation, (IBase**)&WriteOperation); rc_assert(hr == S_OK, E_FAIL) - _lComPtr pEventBase; + BasePtr pEventBase; hr = this->QueryInterface(IID_IBase, (void**)&pEventBase); rc_assert(hr == S_OK, E_FAIL) @@ -256,7 +256,7 @@ std_method_impl CBrokerImpl::Init() hr = this->UnBindEvent(); rc_assert(hr == S_OK, E_FAIL) - _lComPtr pBase; + BasePtr pBase; hr = this->QueryInterface(IID_IBase, (void**)&pBase); rc_assert(hr == S_OK, E_FAIL) @@ -264,7 +264,7 @@ std_method_impl CBrokerImpl::Init() hr = this->BindEvent(pBase); rc_assert(hr == S_OK, E_FAIL) - hr = m_pIAsynFrame->CreateTimer((IBase**)&m_ConnectTimer); + hr = m_pIAsynFrame->CreateIo(io_timer, (IBase**)&m_ConnectTimer); rc_assert(hr == S_OK, E_FAIL) hr = m_ConnectTimer->SetId(TIMER_ID_CON); @@ -279,7 +279,7 @@ std_method_impl CBrokerImpl::Init() hr = m_ConnectTimer->Start(); rc_assert(hr == S_OK, E_FAIL) - hr = m_pIAsynFrame->CreateTimer((IBase**)&m_HeartTimer); + hr = m_pIAsynFrame->CreateIo(io_timer, (IBase**)&m_HeartTimer); rc_assert(hr == S_OK, E_FAIL) hr = m_HeartTimer->SetId(TIMER_ID_HEART); diff --git a/msgbus/broker.h b/msgbus/broker.h index b596078ebbe7bbca25535110973e5801b8504dea..e02190448d761d366e8d1a0c3fe0cdbdcb6d69d8 100644 --- a/msgbus/broker.h +++ b/msgbus/broker.h @@ -5,9 +5,9 @@ #include "node.h" class CBrokerImpl : public IBroker, - public IOperationEvents, + public IOperationEvent, public IAcceptListen, - public ITimerEvents, + public ITimerEvent, public SChannel, public CUnknownImp @@ -18,9 +18,9 @@ public: BEGIN_STDCOM_MAP STDCOM_INTERFACE_ENTRY_UNKNOWN_(IBroker) - STDCOM_INTERFACE_ENTRY(IOperationEvents) + STDCOM_INTERFACE_ENTRY(IOperationEvent) STDCOM_INTERFACE_ENTRY(IAcceptListen) - STDCOM_INTERFACE_ENTRY(ITimerEvents) + STDCOM_INTERFACE_ENTRY(ITimerEvent) STDCOM_INTERFACE_ENTRY(IBroker) END_STDCOM_MAP @@ -35,7 +35,7 @@ public: //IAcceptListen std_method(Accept)(IBase* pBase, _sock_t s, event_id error_code); - //IOperationEvents + //IOperationEvent std_method(OnComplete)(IBase *pOperation, event_id event, ULONG error_code); //ITimerEvents diff --git a/msgbus/consumer.cpp b/msgbus/consumer.cpp index d49453c78dcf7830f9899e151f08efef982ed53e..fd705a6944553d37933498eb061cdba0c1cab30a 100644 --- a/msgbus/consumer.cpp +++ b/msgbus/consumer.cpp @@ -20,7 +20,7 @@ std_method_impl CConsumerImpl::Bind(LPCSTR addr, int len) hr = this->UnBindEvent(); rc_assert(hr == S_OK, E_FAIL) - _lComPtr pBase; + BasePtr pBase; hr = this->QueryInterface(IID_IBase, (void**)&pBase); rc_assert(hr == S_OK, E_FAIL) diff --git a/msgbus/consumer.h b/msgbus/consumer.h index e4a285846a1642287cda10b63cc4f1b3697eec7c..3172840f64db8d72cee1d353c5fc625fdd14e659 100644 --- a/msgbus/consumer.h +++ b/msgbus/consumer.h @@ -5,7 +5,7 @@ #include "auth.hpp" class CConsumerImpl : public IConsumer, - public IOperationEvents, + public IOperationEvent, public CChannel, public CUnknownImp @@ -16,7 +16,7 @@ public: BEGIN_STDCOM_MAP STDCOM_INTERFACE_ENTRY_UNKNOWN_(IConsumer) - STDCOM_INTERFACE_ENTRY(IOperationEvents) + STDCOM_INTERFACE_ENTRY(IOperationEvent) STDCOM_INTERFACE_ENTRY(IConsumer) END_STDCOM_MAP @@ -27,7 +27,7 @@ public: std_method(Close)(); std_method(Recv)(IBase* pBase); - //IOperationEvents + //IOperationEvent std_method(OnComplete)(IBase *pOperation, event_id event, ULONG error_code); private: std_method(OnConnected)(IBase *pIBase); diff --git a/msgbus/interface.cpp b/msgbus/interface.cpp index 557166e8641ed5a12f92ff4ecfabc8666dc0b4ed..53a0c482f386051a194e912e7eff391d2c4fd854 100644 --- a/msgbus/interface.cpp +++ b/msgbus/interface.cpp @@ -103,7 +103,7 @@ _DEFINE_IID_IMPL(IID_IOperation, 0xfeb12b33, 0x7344, 0x45cd, 0xa3, 0x75, 0x24, 0x95, 0xc7, 0xbe, 0xbd, 0x88); // {0470327E-5ACF-40EC-BAED-FE2AAE877B4B} -_DEFINE_IID_IMPL(IID_IOperationEvents, +_DEFINE_IID_IMPL(IID_IOperationEvent, 0x470327e, 0x5acf, 0x40ec, 0xba, 0xed, 0xfe, 0x2a, 0xae, 0x87, 0x7b, 0x4b); //ifile.h @@ -151,7 +151,7 @@ _DEFINE_GUID_IMPL(CLSID_IAsynFrame, //itimer.h // {B5819C73-6EF7-4F25-B053-F6F6D4DCBE00} -_DEFINE_IID_IMPL(IID_ITimerEvents, +_DEFINE_IID_IMPL(IID_ITimerEvent, 0xb5819c73, 0x6ef7, 0x4f25, 0xb0, 0x53, 0xf6, 0xf6, 0xd4, 0xdc, 0xbe, 0x0); // {F36A3734-C9CA-46C9-8F03-AD02AD24058F} diff --git a/msgbus/msgbusimpl.h b/msgbus/msgbusimpl.h index 541249249764d56e8075195d8003eb7da291db68..7dfa9a7d98d232736616724374c8dcda02b50215 100644 --- a/msgbus/msgbusimpl.h +++ b/msgbus/msgbusimpl.h @@ -30,7 +30,7 @@ public: //IMsgBus std_method(CreateNode)(NODE_CLASS cls, IBase** pBase); protected: - ComRotMessagePtr m_pRot; - AsynFramePtr m_pIAsynFrame; + _lComPtr m_pRot; + AsynFramePtr m_pIAsynFrame; }; #endif diff --git a/msgbus/producer.cpp b/msgbus/producer.cpp index e96ad74865d6b2a9f345495aeaa74cc6e3775218..661e7913fa38a4bd2be30cea553e4bbab0ee98fd 100644 --- a/msgbus/producer.cpp +++ b/msgbus/producer.cpp @@ -20,7 +20,7 @@ std_method_impl CProducerImpl::Bind(LPCSTR addr, int len) hr = this->UnBindEvent(); rc_assert(hr == S_OK, E_FAIL) - _lComPtr pBase; + BasePtr pBase; hr = this->QueryInterface(IID_IBase, (void**)&pBase); rc_assert(hr == S_OK, E_FAIL) diff --git a/msgbus/producer.h b/msgbus/producer.h index 247a6061a30aa523097a30aa495d638c07ceab65..b78671873425ebe739c5103ad752583a6ce5e199 100644 --- a/msgbus/producer.h +++ b/msgbus/producer.h @@ -6,7 +6,7 @@ #define TCP_CONSUMER_CONNECT 100 class CProducerImpl : public IProducer, - public IOperationEvents, + public IOperationEvent, public CChannel, public CUnknownImp @@ -17,7 +17,7 @@ public: BEGIN_STDCOM_MAP STDCOM_INTERFACE_ENTRY_UNKNOWN_(IProducer) - STDCOM_INTERFACE_ENTRY(IOperationEvents) + STDCOM_INTERFACE_ENTRY(IOperationEvent) STDCOM_INTERFACE_ENTRY(IProducer) END_STDCOM_MAP @@ -29,7 +29,7 @@ public: std_method(Close)(); std_method(Send)(IBase* pBase); - //IOperationEvents + //IOperationEvent std_method(OnComplete)(IBase *pOperation, event_id event, ULONG error_code); private: diff --git a/msgbus/stdafx.h b/msgbus/stdafx.h index 9e2a8201803ff1cb546d13d215b97c1a08e8e082..9c2e5d53f7428116f8ec9a59371bd4aa635e31be 100644 --- a/msgbus/stdafx.h +++ b/msgbus/stdafx.h @@ -10,8 +10,8 @@ #include #include -typedef _lComPtr ComRotMessagePtr; +#include #include #include diff --git a/net/dnsimpl.cpp b/net/dnsimpl.cpp index 40985f999b3cfa4db8fd5a83c2f85004b2140957..14ac4bd88b8eda6723822851d1c50a6f223aa6b3 100644 --- a/net/dnsimpl.cpp +++ b/net/dnsimpl.cpp @@ -7,17 +7,16 @@ CDnsImpl::CDnsImpl() } CDnsImpl::~CDnsImpl(void) { - + logi("CDnsImpl::~CDnsImpl"); } -std_method_impl CDnsImpl::init_class(IBase* pSocket, IBase* pOper) +std_method_impl CDnsImpl::init_class(AsynFrameConstPtr AsynFrame, NetConstPtr Net) { HRESULT hr = S_OK; - hr = pSocket->QueryInterface(IID_IUdpSocket, (void**)&m_pIUdpSocket); + hr = AsynFrame->CreateIo(io_udp_socket, (IBase**)&m_pISocket); rc_assert(hr == S_OK, E_FAIL) - - hr = pOper->QueryInterface(IID_IOperation, (void**)&m_pIOperation); + hr = AsynFrame->CreateIo(io_operation, (IBase**)&m_pIOperation); rc_assert(hr == S_OK, E_FAIL) return S_OK; @@ -49,7 +48,7 @@ std_method_impl CDnsImpl::Send(LPCSTR hostname, IBase* pProc) return buflen; } - _lComPtr pIBase; + BasePtr pIBase; hr = this->QueryInterface(IID_IBase, (void**)&pIBase); rc_assert(hr == S_OK, E_FAIL) @@ -60,17 +59,17 @@ std_method_impl CDnsImpl::Send(LPCSTR hostname, IBase* pProc) hr = m_pIOperation->Attach((BUFFER_PTR)buf, 0, buflen); rc_assert(hr == S_OK, E_FAIL) - hr = m_pIUdpSocket->CreateSock(); + hr = m_pISocket->CreateSock(); rc_assert(hr == S_OK, E_FAIL) - hr = m_pIUdpSocket->OpenIo(); + hr = m_pISocket->OpenIo(); rc_assert(hr == S_OK, E_FAIL) - hr = m_pIUdpSocket->BindIo(); + hr = m_pISocket->BindIo(); rc_assert(hr == S_OK, E_FAIL) BUFFER_SIZE len = 0; - len = m_pIUdpSocket->SyncSend("114.114.114.114", 53, (BUFFER_PTR)buf, buflen); + len = m_pISocket->SyncSend("114.114.114.114", 53, (BUFFER_PTR)buf, buflen); rc_assert(len != 0, E_FAIL) hr = m_pIOperation->ClearPtr(); @@ -82,7 +81,7 @@ std_method_impl CDnsImpl::Send(LPCSTR hostname, IBase* pProc) hr = m_pIOperation->SetIoParam(0, len); rc_assert(hr == S_OK, E_FAIL) - hr = m_pIUdpSocket->ReadIo("114.114.114.114", 53, m_pIOperation, 0); + hr = m_pISocket->ReadIo("114.114.114.114", 53, m_pIOperation, 0); rc_assert(hr == S_OK, E_FAIL) m_sem.Wait(); @@ -98,16 +97,16 @@ std_method_impl CDnsImpl::Close() { HRESULT hr = S_OK; - hr = m_pIUdpSocket->CloseIo(CLOSE_BOTH_IO); + hr = m_pISocket->CloseIo(CLOSE_BOTH_IO); rc_assert(hr == S_OK, E_FAIL) - hr = m_pIUdpSocket->CloseSock(); + hr = m_pISocket->CloseSock(); rc_assert(hr == S_OK, E_FAIL) hr = m_pIOperation->UnBindEvent(); rc_assert(hr == S_OK, E_FAIL) - m_pIUdpSocket.dispose(); + m_pISocket.dispose(); m_pIOperation.dispose(); @@ -123,7 +122,7 @@ std_method_impl CDnsImpl::OnComplete(IBase *pOperation, event_id event, ULONG er dns_t resp; memset(&resp, 0, sizeof(resp)); - _lComPtr pOper; + OperationPtr pOper; pOperation->QueryInterface(IID_IOperation, (void**)&pOper); ERROR_CODE error = 0; diff --git a/net/dnsimpl.h b/net/dnsimpl.h index 3ee3c6412fc5ef11d280cdc4efdfd1cf0f5f5c65..bf5b6139aea9e991bedd0c6aa9aedd5c195b42ff 100644 --- a/net/dnsimpl.h +++ b/net/dnsimpl.h @@ -4,8 +4,8 @@ #include "stdafx.h" class CDnsImpl : public IDns, - public IOperationEvents, - public CUnknownImp + public IOperationEvent, + public CUnknownImp { public: CDnsImpl(); @@ -15,10 +15,10 @@ public: BEGIN_STDCOM_MAP STDCOM_INTERFACE_ENTRY_UNKNOWN_(IDns); STDCOM_INTERFACE_ENTRY(IDns); - STDCOM_INTERFACE_ENTRY(IOperationEvents); + STDCOM_INTERFACE_ENTRY(IOperationEvent); END_STDCOM_MAP - std_method_impl init_class(IBase* pSocket, IBase* pOper); + std_method_impl init_class(AsynFrameConstPtr AsynFrame, NetConstPtr Net); //IDns std_method(Send)(LPCSTR hostname, IBase* pProc); @@ -28,11 +28,10 @@ public: //IIoOperationEvents std_method(OnComplete)(IBase *pOperation, event_id event, ULONG error_code); - private: - _lComPtr m_pIUdpSocket; - _lComPtr m_pIOperation; - CSemHandle m_sem; + UdpSocketPtr m_pISocket; + OperationPtr m_pIOperation; + CSemHandle m_sem; }; #endif diff --git a/net/httptimpl.cpp b/net/httpinstanceimpl.cpp similarity index 56% rename from net/httptimpl.cpp rename to net/httpinstanceimpl.cpp index 64c86c892a5462da605a217c1da18bba12f1ed4d..fb4792a3852e591239908c57f71337f8a1610a2e 100644 --- a/net/httptimpl.cpp +++ b/net/httpinstanceimpl.cpp @@ -1,65 +1,118 @@ -#include "httptimpl.h" +#include "httpinstanceimpl.h" -CHttptImpl::CHttptImpl() +CHttpInstanceImpl::CHttpInstanceImpl() { m_httpcontent_length = 0; - m_Notify = NULL; - m_hstid = HTTP_IMPL_START; - + m_hstid = HTTP_IMPL_START; } -CHttptImpl::~CHttptImpl(void) -{ +CHttpInstanceImpl::~CHttpInstanceImpl(void) +{ + logi("CHttptImpl::~CHttptImpl"); } -std_method_impl CHttptImpl::BindHttp(IBase* pIAsyncTcpSocket, IBase* pIOper, IBase* pIDns) +//std_method_impl CHttpInstanceImpl::init_class(IBase* pSocket, IBase* pIOper, IBase* pIDns) + +std_method_impl CHttpInstanceImpl::init_class(AsynFrameConstPtr AsynFrame, NetConstPtr Net) { - //m_pIAsyncTcpSocket = pIAsyncTcpSocket; - //m_pIOper = pIOper; - //m_pIDns = pIDns; + + HRESULT hr = S_OK; + + BasePtr pBase; + hr = this->QueryInterface(IID_IBase, (void**)&pBase); + rc_assert(hr == S_OK, E_FAIL) + + hr = AsynFrame->CreateIo(io_tcp_socket, (IBase**)&m_pISocket.m_p); + rc_assert(hr == S_OK, E_FAIL) + + hr = AsynFrame->CreateIo(io_operation, (IBase**)&m_pIOper.m_p); + rc_assert(hr == S_OK, E_FAIL) + + hr = m_pIOper->BindEvent(pBase); + rc_assert(hr == S_OK, E_FAIL) + + hr = Net->CreateProtocol(Protocol_dns, (IBase**)&m_pIDns); + rc_assert(hr == S_OK, E_FAIL) + http_init_analyze(http_response); BUFFER_SIZE BufLen = 16 * 1024; + m_pIOper->Alloc(BufLen); - return Init(m_pIAsyncTcpSocket, BufLen, BufLen, 20, 20, 5); + + m_pISocket->OpenIo(); + + m_pISocket->SetOption(SOL_SENDLEN, 16384); + + m_pISocket->SetOption(SOL_RECVLEN, 16384); + + m_pISocket->SetOption(SOL_SENDTM, 5); + + m_pISocket->SetOption(SOL_RECVTM, 5); + + m_pISocket->SetOption(SOL_CONTM, 5); + + + return S_OK; +} + +std_method_impl CHttpInstanceImpl::BindEvent(IBase* pBase) +{ + rc_assert(m_pHandle != INULL, E_FAIL) + m_pHandle.dispose(); + return pBase->QueryInterface(IID_IHttpInstanceProc, (void**)&m_pHandle); } -std_method_impl CHttptImpl::SetCookies(http_header_data *data) +std_method_impl CHttpInstanceImpl::UnBindEvent() { + m_pHandle.dispose(); return S_OK; } -std_method_impl CHttptImpl::SetNotify(IHttpNotify *Notify) +std_method_impl CHttpInstanceImpl::SetCookies(http_header_data *data) { - rc_assert(Notify != NULL, E_FAIL) - m_Notify = Notify; return S_OK; } -std_method_impl CHttptImpl::Perform(http_addr_s url, http_addr_s scheme, http_port uport) +std_method_impl CHttpInstanceImpl::Open(http_addr_s url, http_addr_s scheme, http_port uport) { OnBuildHttp(url, scheme,uport); return OnConnect(url, uport); } -std_method_type_impl(http_header) CHttptImpl::GetHttpHead() +std_method_type_impl(http_header) CHttpInstanceImpl::GetHttpHead() { return m_szhttpHead; } -std_method_impl CHttptImpl::ReSet() +std_method_impl CHttpInstanceImpl::ReSet() { Cancel(); return S_OK; } -std_method_impl CHttptImpl::Cancel() +std_method_impl CHttpInstanceImpl::Cancel() { - httpEventComplate(m_pIAsyncTcpSocket, m_pIOper); + httpEventComplate(m_pISocket, m_pIOper); m_hstid = HTTP_IMPL_START; http_init_analyze(http_response); + HRESULT hr = S_OK; + + hr = m_pISocket->CloseIo(CLOSE_BOTH_IO); + rc_assert(hr == S_OK, E_FAIL) + + hr = m_pISocket->CloseSock(); + + m_pISocket.dispose(); + + m_pIOper->UnBindEvent(); + + m_pIOper.dispose(); + + m_pIDns.dispose(); + return S_OK; } -std_method_type_impl(int) CHttptImpl::IsComplete() +std_method_type_impl(int) CHttpInstanceImpl::IsComplete() { return m_parser->content_length == 0; } -std_method_impl CHttptImpl::OnComplete(IBase *pOperation, event_id event, ULONG error_code) +std_method_impl CHttpInstanceImpl::OnComplete(IBase *pOperation, event_id event, ULONG error_code) { HRESULT hr = S_OK; @@ -89,7 +142,7 @@ std_method_impl CHttptImpl::OnComplete(IBase *pOperation, event_id event, ULONG return S_OK; } -std_method_impl CHttptImpl::OnGetHost(int error, LPCSTR hostname, LPCSTR host) +std_method_impl CHttpInstanceImpl::OnGetHost(int error, LPCSTR hostname, LPCSTR host) { if (m_hstid < HTTP_IMPL_CONNECTING && DNS_PROC_RES_NOERROR == error) { httpConnect(m_pIOper.m_p, host, m_uport); @@ -105,18 +158,18 @@ std_method_impl CHttptImpl::OnGetHost(int error, LPCSTR hostname, LPCSTR host) } return S_OK; } -ULONG CHttptImpl::Notify(ULONG ulevent) +ULONG CHttpInstanceImpl::Notify(ULONG ulevent) { - rc_assert(m_Notify != NULL, HTTP_IMPL_UNKNOWN) - return m_Notify->Event(ulevent); + rc_assert(m_pHandle != NULL, HTTP_IMPL_UNKNOWN) + return m_pHandle->Event(ulevent); } -ULONG CHttptImpl::Id_Suc(ULONG ulid) { +ULONG CHttpInstanceImpl::Id_Suc(ULONG ulid) { ulid++; ulid++; return ulid; } -std_method_impl CHttptImpl::httpEventProc(ULONG ulevent, IOperation *pOperation) +std_method_impl CHttpInstanceImpl::httpEventProc(ULONG ulevent, IOperation *pOperation) { HRESULT hr = S_OK; @@ -143,7 +196,7 @@ std_method_impl CHttptImpl::httpEventProc(ULONG ulevent, IOperation *pOperation) return hr; } -std_method_impl CHttptImpl::httpConnected(IOperation *pOperation) +std_method_impl CHttpInstanceImpl::httpConnected(IOperation *pOperation) { HRESULT hr = S_OK; @@ -151,7 +204,7 @@ std_method_impl CHttptImpl::httpConnected(IOperation *pOperation) return hr; } -std_method_impl CHttptImpl::httpSendHeaded(IOperation *pOperation) +std_method_impl CHttpInstanceImpl::httpSendHeaded(IOperation *pOperation) { HRESULT hr = S_OK; @@ -159,7 +212,7 @@ std_method_impl CHttptImpl::httpSendHeaded(IOperation *pOperation) return hr; } -std_method_impl CHttptImpl::httpSendBodyed(IOperation *pOperation) +std_method_impl CHttpInstanceImpl::httpSendBodyed(IOperation *pOperation) { HRESULT hr = S_OK; @@ -167,7 +220,7 @@ std_method_impl CHttptImpl::httpSendBodyed(IOperation *pOperation) return hr; } -std_method_impl CHttptImpl::httpRecvHeaded(IOperation *pOperation) +std_method_impl CHttpInstanceImpl::httpRecvHeaded(IOperation *pOperation) { HRESULT hr = S_OK; @@ -191,7 +244,7 @@ std_method_impl CHttptImpl::httpRecvHeaded(IOperation *pOperation) return hr; } -std_method_impl CHttptImpl::httpRecvBodyed(IOperation *pOperation) +std_method_impl CHttpInstanceImpl::httpRecvBodyed(IOperation *pOperation) { HRESULT hr = S_OK; @@ -215,7 +268,7 @@ std_method_impl CHttptImpl::httpRecvBodyed(IOperation *pOperation) return hr; } -std_method_impl CHttptImpl::httpEvent(ULONG ulevent, ITcpSocket* pSocket, IOperation *pOperation) +std_method_impl CHttpInstanceImpl::httpEvent(ULONG ulevent, ITcpSocket* pSocket, IOperation *pOperation) { HRESULT hr = E_FAIL; @@ -241,88 +294,74 @@ std_method_impl CHttptImpl::httpEvent(ULONG ulevent, ITcpSocket* pSocket, IOpera } return hr; } -std_method_impl CHttptImpl::httpEventComplate(ITcpSocket* pSocket, IOperation *pOperation) +std_method_impl CHttpInstanceImpl::httpEventComplate(ITcpSocket* pSocket, IOperation *pOperation) { HRESULT hr = S_OK; return hr; } -ULONG CHttptImpl::Id_Faild(ULONG ulid) { +ULONG CHttpInstanceImpl::Id_Faild(ULONG ulid) { ulid++; return ulid; } -std_method_impl CHttptImpl::Init(ITcpSocket* pIAsyncTcpSocket, int sbuflen, int rbuflen, - int iwtimout, int irtimout, int iconntimout) -{ - HRESULT hr = S_OK; - pIAsyncTcpSocket->OpenIo(); - pIAsyncTcpSocket->SetOption(SOL_SENDLEN, sbuflen); - pIAsyncTcpSocket->SetOption(SOL_RECVLEN, rbuflen); - pIAsyncTcpSocket->SetOption(SOL_SENDTM, iwtimout); - pIAsyncTcpSocket->SetOption(SOL_RECVTM, irtimout); - pIAsyncTcpSocket->SetOption(SOL_CONTM, iconntimout); - - return hr; -} - -std_method_impl CHttptImpl::httpConnect(IOperation *pOperation, NET_ADDR addr, NET_PORT uport) +std_method_impl CHttpInstanceImpl::httpConnect(IOperation *pOperation, NET_ADDR addr, NET_PORT uport) { logi("CHttpClientImpl::httpConnect %s", addr); pOperation->SetId(HTTP_IMPL_CONNECTING); - return m_pIAsyncTcpSocket->ConnectIo(addr,uport,pOperation, HTTP_IMPL_CONNECTING); + return m_pISocket->ConnectIo(addr,uport,pOperation, HTTP_IMPL_CONNECTING); } -std_method_impl CHttptImpl::httpSendHead(ITcpSocket* pSocket, IOperation *pOperation) +std_method_impl CHttpInstanceImpl::httpSendHead(ITcpSocket* pSocket, IOperation *pOperation) { const char* p = m_http_resheader.build_res(); size_t ulen = m_http_resheader.build_res_len(); return httpSend(HTTP_IMPL_SEND_HEAD, pSocket, pOperation); } -std_method_impl CHttptImpl::httpSendBody(ITcpSocket* pSocket, IOperation *pOperation) +std_method_impl CHttpInstanceImpl::httpSendBody(ITcpSocket* pSocket, IOperation *pOperation) { return httpSend(HTTP_IMPL_SEND_BODY, pSocket, pOperation); } -std_method_impl CHttptImpl::httpRecvHead(ITcpSocket* pSocket, IOperation *pOperation) +std_method_impl CHttpInstanceImpl::httpRecvHead(ITcpSocket* pSocket, IOperation *pOperation) { return httpRecv(HTTP_IMPL_RECV_HEAD, pSocket, pOperation); } -std_method_impl CHttptImpl::httpRecvBody(ITcpSocket* pSocket, IOperation *pOperation) +std_method_impl CHttpInstanceImpl::httpRecvBody(ITcpSocket* pSocket, IOperation *pOperation) { return httpRecv(HTTP_IMPL_RECV_BODY, pSocket, pOperation); } -std_method_impl CHttptImpl::httpSend(ULONG uid, ITcpSocket* pSocket, IOperation *pOperation) +std_method_impl CHttpInstanceImpl::httpSend(ULONG uid, ITcpSocket* pSocket, IOperation *pOperation) { pOperation->SetId(uid); return pSocket->WriteIo(pOperation, uid); } -std_method_impl CHttptImpl::httpRecv(ULONG uid, ITcpSocket* pSocket, IOperation *pOperation) +std_method_impl CHttpInstanceImpl::httpRecv(ULONG uid, ITcpSocket* pSocket, IOperation *pOperation) { pOperation->SetId(uid); return pSocket->ReadIo(pOperation, uid); } -void CHttptImpl::on_http_message_begin() +void CHttpInstanceImpl::on_http_message_begin() { c_assert(m_parser) } -void CHttptImpl::on_http_header_complete() +void CHttpInstanceImpl::on_http_header_complete() { c_assert(m_parser) m_httpcontent_length = m_parser->content_length; m_szhttpHead = new char[m_parser->nread + 1](); memcpy(m_szhttpHead, m_parser->p, m_parser->nread); } -void CHttptImpl::on_http_body(const char* at, size_t length) +void CHttpInstanceImpl::on_http_body(const char* at, size_t length) { c_assert(m_parser) - m_Notify->RecvBody((void*)at, length, 1); + //m_Notify->RecvBody((void*)at, length, 1); } -void CHttptImpl::on_http_message_complete() +void CHttpInstanceImpl::on_http_message_complete() { c_assert(m_parser) } -std_method_impl CHttptImpl::OnConnect(NET_ADDR url, NET_PORT uport) +std_method_impl CHttpInstanceImpl::OnConnect(NET_ADDR url, NET_PORT uport) { HRESULT hr = S_OK; @@ -336,7 +375,7 @@ std_method_impl CHttptImpl::OnConnect(NET_ADDR url, NET_PORT uport) } return hr; } -std_method_impl CHttptImpl::OnBuildHttp(http_addr_s url, http_addr_s scheme, NET_PORT uport) +std_method_impl CHttpInstanceImpl::OnBuildHttp(http_addr_s url, http_addr_s scheme, NET_PORT uport) { m_http_resheader.set_method(scheme); diff --git a/net/httptimpl.h b/net/httpinstanceimpl.h similarity index 76% rename from net/httptimpl.h rename to net/httpinstanceimpl.h index e35e3a72fc87226a96b5c1f400d57f176447e35f..42fc51d4cf507df125aaa83f60e2df289445e9cd 100644 --- a/net/httptimpl.h +++ b/net/httpinstanceimpl.h @@ -4,28 +4,33 @@ #include "stdafx.h" #include "http_protocol/chttpparser.h" -class CHttptImpl : public IHttp_t, - public IOperationEvents, - public IDnsProc, - public CUnknownImp, - public CHttpParser +class CHttpInstanceImpl : public IHttpInstance, + public IOperationEvent, + public IDnsProc, + public CUnknownImp, + public CHttpParser { public: - CHttptImpl(); - virtual ~CHttptImpl(void); + CHttpInstanceImpl(); + virtual ~CHttpInstanceImpl(void); public: BEGIN_STDCOM_MAP - STDCOM_INTERFACE_ENTRY(IHttp_t) + STDCOM_INTERFACE_ENTRY_UNKNOWN_(IHttpInstance) + STDCOM_INTERFACE_ENTRY(IHttpInstance) STDCOM_INTERFACE_ENTRY(IDnsProc) - STDCOM_INTERFACE_ENTRY(IOperationEvents); + STDCOM_INTERFACE_ENTRY(IOperationEvent); END_STDCOM_MAP + +public: + std_method_impl init_class(AsynFrameConstPtr AsynFrame, NetConstPtr Net); +public: //IHttp - std_method(BindHttp)(IBase* pIAsyncTcpSocket, IBase* pIOper, IBase* pIDns); + std_method(BindEvent)(IBase* pBase); + std_method(UnBindEvent)(); std_method(SetCookies)(http_header_data *data); - std_method(SetNotify)(IHttpNotify *Notify); - std_method(Perform)(http_addr_s url, http_addr_s scheme, http_port uport); + std_method(Open)(http_addr_s url, http_addr_s scheme, http_port uport); std_method_(http_header, GetHttpHead)(); std_method(ReSet)(); std_method(Cancel)(); @@ -41,8 +46,7 @@ private: ULONG Notify(ULONG ulevent); ULONG Id_Suc(ULONG ulid); ULONG Id_Faild(ULONG ulid); - std_method_impl Init(ITcpSocket* pIAsyncTcpSocket,int sbuflen, int rbuflen - ,int iwtimout, int irtimout, int iconntimout); + private: std_method_impl httpEventProc(ULONG ulevent, IOperation *pOperation); std_method_impl httpConnected(IOperation *pOperation); @@ -72,19 +76,17 @@ private: std_method_impl OnBuildHttp(http_addr_s url, http_addr_s scheme, NET_PORT uport); private: - -private: - TcpSocketPtr m_pIAsyncTcpSocket; + TcpSocketPtr m_pISocket; OperationPtr m_pIOper; - DnsPtr m_pIDns; + DnsPtr m_pIDns; - int64 m_httpcontent_length; + int64 m_httpcontent_length; CharArrayPtr m_szhttpHead; CharArrayPtr m_szhttpSendHead; CharArrayPtr m_szhttpurl; NET_PORT m_uport; - IHttpNotify* m_Notify; + HttpInstanceHandlePtr m_pHandle; http_header_t m_http_resheader; long m_hstid; }; diff --git a/net/interface.cpp b/net/interface.cpp index 9bfa518eb1920512f5cc832fc97a326d95f2473f..caadd08d986810858603052b0f76ade489998c32 100644 --- a/net/interface.cpp +++ b/net/interface.cpp @@ -101,7 +101,7 @@ _DEFINE_IID_IMPL(IID_IOperation, 0xfeb12b33, 0x7344, 0x45cd, 0xa3, 0x75, 0x24, 0x95, 0xc7, 0xbe, 0xbd, 0x88); // {0470327E-5ACF-40EC-BAED-FE2AAE877B4B} -_DEFINE_IID_IMPL(IID_IOperationEvents, +_DEFINE_IID_IMPL(IID_IOperationEvent, 0x470327e, 0x5acf, 0x40ec, 0xba, 0xed, 0xfe, 0x2a, 0xae, 0x87, 0x7b, 0x4b); //ifile.h @@ -147,7 +147,7 @@ _DEFINE_GUID_IMPL(CLSID_IAsynFrame, //itimer.h // {B5819C73-6EF7-4F25-B053-F6F6D4DCBE00} -_DEFINE_IID_IMPL(IID_ITimerEvents, +_DEFINE_IID_IMPL(IID_ITimerEvent, 0xb5819c73, 0x6ef7, 0x4f25, 0xb0, 0x53, 0xf6, 0xf6, 0xd4, 0xdc, 0xbe, 0x0); // {F36A3734-C9CA-46C9-8F03-AD02AD24058F} @@ -164,10 +164,6 @@ _DEFINE_IID_IMPL(IID_IDnsProc, _DEFINE_IID_IMPL(IID_IDns, 0x510fd0ea, 0xbae2, 0x4bc8, 0xb6, 0x50, 0x76, 0xe8, 0xfd, 0x5e, 0xd8, 0x53); -// {99148517-E9AB-4F72-A2E3-012625A35E95} -_DEFINE_GUID_IMPL(CLSID_IDns, - 0x99148517, 0xe9ab, 0x4f72, 0xa2, 0xe3, 0x1, 0x26, 0x25, 0xa3, 0x5e, 0x95); - //iwebsocket.h // {13429C36-9903-42D1-AD82-F243D48E1A76} @@ -187,13 +183,17 @@ _DEFINE_GUID_IMPL(CLSID_INet, //ihttp.h // {8C102441-E383-4B3C-8CC8-7C8E0B0162FE} -_DEFINE_IID_IMPL(IID_IHttpNotify, +_DEFINE_IID_IMPL(IID_IHttpInstanceProc, 0x8c102441, 0xe383, 0x4b3c, 0x8c, 0xc8, 0x7c, 0x8e, 0xb, 0x1, 0x62, 0xfe); // {6014F5E1-05A9-476F-898C-8606756A750F} -_DEFINE_IID_IMPL(IID_IHttp_t, +_DEFINE_IID_IMPL(IID_IHttpInstance, 0x6014f5e1, 0x5a9, 0x476f, 0x89, 0x8c, 0x86, 0x6, 0x75, 0x6a, 0x75, 0xf); +// {23C86623-C039-416B-A489-C175C360E692} +_DEFINE_IID_IMPL(IID_IHttpApplicationProc, + 0x23c86623, 0xc039, 0x416b, 0xa4, 0x89, 0xc1, 0x75, 0xc3, 0x60, 0xe6, 0x92); + // {75BD9CAF-2D0D-4408-B481-655F30F8613F} -_DEFINE_IID_IMPL(IID_IHttp_s, +_DEFINE_IID_IMPL(IID_IHttpApplication, 0x75bd9caf, 0x2d0d, 0x4408, 0xb4, 0x81, 0x65, 0x5f, 0x30, 0xf8, 0x61, 0x3f); diff --git a/net/net.vcxproj b/net/net.vcxproj index 7df4302d7bfa10e99a5c40c5d0f76f3b49ee5590..5cabba44cacbed002896fb81858486a6fe278e8d 100644 --- a/net/net.vcxproj +++ b/net/net.vcxproj @@ -109,7 +109,7 @@ false - + @@ -129,7 +129,7 @@ - + diff --git a/net/net.vcxproj.filters b/net/net.vcxproj.filters index 54ee07c6c38b50190c423b83eef77352a413dc99..faf757ef3c20c97a0f8b40e63e3294e61f67b37d 100644 --- a/net/net.vcxproj.filters +++ b/net/net.vcxproj.filters @@ -7,7 +7,6 @@ - protocol @@ -35,6 +34,7 @@ http_protocol + @@ -42,7 +42,6 @@ - protocol @@ -79,6 +78,7 @@ http_protocol + diff --git a/net/netimpl.cpp b/net/netimpl.cpp index d50c2743a408e343ce495ad9a99aee7b6f95f68f..6918cf5cf140c458289819969a2fa68c2872278e 100644 --- a/net/netimpl.cpp +++ b/net/netimpl.cpp @@ -1,7 +1,7 @@ #include "netimpl.h" #include "dnsimpl.h" #include "websocketimpl.h" -#include "httptimpl.h" +#include "httpinstanceimpl.h" CNetImpl::CNetImpl(void) { @@ -32,64 +32,54 @@ std_method_impl CNetImpl::Start(_pinstance hInstance, UINT uType) rc_assert(hr == S_OK, E_FAIL) rc_assert(m_pIAsynFrame.m_p != INULL, E_FAIL) + hr = this->QueryInterface(IID_INet, (void**)&m_pINet); + rc_assert(hr == S_OK, E_FAIL) + rc_assert(m_pIAsynFrame.m_p != INULL, E_FAIL) + return hr; } std_method_impl CNetImpl::Stop(UINT uExitCode) { HRESULT hr = S_OK; + m_pINet.dispose(); + UnInitSocketEnv(2, 2); return hr; } -std_method_impl CNetImpl::CreateProtocol(Net_Protocol np, IBase** pBase) +std_method_impl CNetImpl::CreateProtocol(Net_Protocol netp, IBase** pBase) { rc_assert(m_pIAsynFrame.m_p != INULL, E_FAIL) HRESULT hr = S_OK; - if (np == Protocol_dns) + if (netp == Protocol_dns) { CDnsImpl* pDns = ALLOC_NEW CDnsImpl(); rc_assert(pDns != NULL, E_FAIL) - _lComPtr m_pOper; - hr = m_pIAsynFrame->CreateAsynIoOperation((IBase**)&m_pOper); - rc_assert(hr == S_OK, E_FAIL) - - _lComPtr m_pScoket; - hr = m_pIAsynFrame->CreateUdpSocket((IBase**)&m_pScoket); - rc_assert(hr == S_OK, E_FAIL) - - hr = pDns->init_class(m_pScoket, m_pOper); + + hr = pDns->init_class(m_pIAsynFrame, m_pINet); rc_assert(hr == S_OK, E_FAIL) return pDns->QueryInterface(IID_IDns, (void**)pBase); } - else if (np == Protocol_websocket) + else if (netp == Protocol_websocket) { CWebSocketImpl* pWebSocket = ALLOC_NEW CWebSocketImpl(); rc_assert(pWebSocket != NULL, E_FAIL) } - else if (np == Protocol_http) + else if (netp == Protocol_http) { - CHttptImpl* pObject = ALLOC_NEW CHttptImpl(); + CHttpInstanceImpl* pObject = ALLOC_NEW CHttpInstanceImpl(); rc_assert(pObject != NULL, E_FAIL) - hr = pObject->QueryInterface(IID_IHttp_t, (void**)pBase); - rc_assert(hr == S_OK, E_FAIL) - - _lComPtr pIAsyncTcpSocket; - hr = m_pIAsynFrame->CreateTcpSocket((IBase**)&pIAsyncTcpSocket.m_p); + hr = pObject->init_class(m_pIAsynFrame, m_pINet); rc_assert(hr == S_OK, E_FAIL) - _lComPtr pIOper; - hr = m_pIAsynFrame->CreateAsynIoOperation((IBase**)&pIOper.m_p); - rc_assert(hr == S_OK, E_FAIL) - - hr = pIOper->BindEvent(*pBase); - rc_assert(hr == S_OK, E_FAIL) + return pObject->QueryInterface(IID_IHttpInstance, (void**)pBase); } else { diff --git a/net/netimpl.h b/net/netimpl.h index 2b4e8eacb34fd108f6fd6559038dade0a063d673..b00040eddd60ac877b3e393a7f3d24f53cdd2884 100644 --- a/net/netimpl.h +++ b/net/netimpl.h @@ -28,12 +28,12 @@ public: std_method(Stop)(UINT uExitCode); //INet - std_method(CreateProtocol)(Net_Protocol np, IBase** pBase); + std_method(CreateProtocol)(Net_Protocol netp, IBase** pBase); private: - _lComPtr m_pRot; - _lComPtr m_pIAsynFrame; - + RotPtr m_pRot; + AsynFramePtr m_pIAsynFrame; + NetPtr m_pINet; }; #endif diff --git a/net/stdafx.h b/net/stdafx.h index e50f0eab59e60e75bb8bd72e1dcf89cee41ccddd..41862fa1f7174d9dd1a20ab1c144a6c9806073a5 100644 --- a/net/stdafx.h +++ b/net/stdafx.h @@ -7,9 +7,7 @@ #define _STDAFX_H_ #include -#include - - +#include #include #include diff --git a/res/fontimpl.h b/res/fontimpl.h index cd6d0308677a0a1bf7277d570680ad0219566d35..a0360223db1c5e9307b6223157b4e3b439595000 100644 --- a/res/fontimpl.h +++ b/res/fontimpl.h @@ -24,7 +24,7 @@ public: std_method(Start)(_pinstance hInstance, UINT uType); std_method(Stop)(UINT uExitCode); protected: - _lComPtr m_pRot; + RotPtr m_pRot; }; #endif diff --git a/res/langimpl.h b/res/langimpl.h index 63c1e8f3cdc1ce3dce6a5af24588dd323c3038af..3f0b6f5aa771e08da5cc7f4dda418d3df056ea59 100644 --- a/res/langimpl.h +++ b/res/langimpl.h @@ -25,6 +25,6 @@ public: std_method(Stop)(UINT uExitCode); protected: - _lComPtr m_pRot; + RotPtr m_pRot; }; #endif diff --git a/res/stdafx.h b/res/stdafx.h index 15280fe638d7f5db74f6660baa9f2a4b9e8409bc..182d646fa180956138bed0f82dcd72b1ffdc7b1c 100644 --- a/res/stdafx.h +++ b/res/stdafx.h @@ -7,5 +7,6 @@ #define _STDAFX_H_ #include +#include #endif diff --git a/testmain/appviewimpl.cpp b/testmain/appviewimpl.cpp index c60a46908b8d82cd5e3a282dd5110bb33deea278..b1a2cabda2617130a119a97a16dc0f8ceee87de6 100644 --- a/testmain/appviewimpl.cpp +++ b/testmain/appviewimpl.cpp @@ -25,18 +25,28 @@ std_method_impl CAppViewImpl::Start(_pinstance hInstance, UINT uType) { HRESULT hr = S_OK; + HttpInstancePtr m_pIHttp; + _lComPtr pINet; m_pRot->GetObject(CLSID_INet, IID_INet, (IBase**)&pINet.m_p); rc_assert(pINet.m_p != INULL, E_FAIL) - _lComPtr pIDns; - pINet->CreateProtocol(Protocol_dns, (IBase**)&pIDns); + //DnsPtr pIDns; + + //pINet->CreateProtocol(Protocol_dns, (IBase**)&pIDns); + + //pIDns->Send("www.baidu.com", NULL); + + //pIDns->Close(); + + //pINet.dispose(); - pIDns->Send("www.baidu.com", NULL); + pINet->CreateProtocol(Protocol_http, (IBase**)&m_pIHttp); - pIDns->Close(); + m_pIHttp->Cancel(); + m_pIHttp.dispose(); InitBus(); diff --git a/testmain/appviewimpl.h b/testmain/appviewimpl.h index e3c0c313c921a9762526fa1497dca63ccf036788..b3954378f6cdb8b971adf8e6fb36fd1c4293e279 100644 --- a/testmain/appviewimpl.h +++ b/testmain/appviewimpl.h @@ -3,7 +3,6 @@ #include "stdafx.h" - //{a7957a54-37cb-42a4-9ee8-599168c2a3d1} _DEFINE_GUID_IMPL(CLSID_AppView, 0xA7957A54, 0x37CB, 0x42A4, 0x9E, 0xE8, 0x59, 0x91, 0x68, 0xC2, 0xA3, 0xD1) @@ -32,24 +31,17 @@ private: std_method(InitBus)(); std_method(UnInitBus)(); private: - _lComPtr m_pRot; - - - _lComPtr m_pIMsgBus; - - _lComPtr m_pIBroker; - _lComPtr m_pIConsumer; - _lComPtr m_pIProducer; - _lComPtr m_pIAgent; - - _lComPtr m_pIUiBase; - _lComPtr m_pIUiWindow; - _lComPtr m_pIUiMessageLoop; - - _lComPtr m_pILogs; - _lComPtr m_pIHttp_t; - + ComRotMessagePtr m_pRot; + MsgBusPtr m_pIMsgBus; + BrokerPtr m_pIBroker; + ConsumerPtr m_pIConsumer; + ProducerPtr m_pIProducer; + AgentPtr m_pIAgent; + + _lComPtr m_pIUiBase; + _lComPtr m_pIUiWindow; + _lComPtr m_pIUiMessageLoop; + _lComPtr m_pILogs; - }; #endif diff --git a/testmain/interface.cpp b/testmain/interface.cpp index f0405f88ab9809cd78613303a448b09cc2784555..d45507adef65c4ae1620b6fddd6a9231e7b409f4 100644 --- a/testmain/interface.cpp +++ b/testmain/interface.cpp @@ -104,9 +104,24 @@ _DEFINE_IID_IMPL(IID_IDnsProc, _DEFINE_IID_IMPL(IID_IDns, 0x510fd0ea, 0xbae2, 0x4bc8, 0xb6, 0x50, 0x76, 0xe8, 0xfd, 0x5e, 0xd8, 0x53); -// {99148517-E9AB-4F72-A2E3-012625A35E95} -_DEFINE_GUID_IMPL(CLSID_IDns, - 0x99148517, 0xe9ab, 0x4f72, 0xa2, 0xe3, 0x1, 0x26, 0x25, 0xa3, 0x5e, 0x95); +//ihttp.h + +// {8C102441-E383-4B3C-8CC8-7C8E0B0162FE} +_DEFINE_IID_IMPL(IID_IHttpInstanceProc, + 0x8c102441, 0xe383, 0x4b3c, 0x8c, 0xc8, 0x7c, 0x8e, 0xb, 0x1, 0x62, 0xfe); + +// {6014F5E1-05A9-476F-898C-8606756A750F} +_DEFINE_IID_IMPL(IID_IHttpInstance, + 0x6014f5e1, 0x5a9, 0x476f, 0x89, 0x8c, 0x86, 0x6, 0x75, 0x6a, 0x75, 0xf); + +// {23C86623-C039-416B-A489-C175C360E692} +_DEFINE_IID_IMPL(IID_IHttpApplicationProc, + 0x23c86623, 0xc039, 0x416b, 0xa4, 0x89, 0xc1, 0x75, 0xc3, 0x60, 0xe6, 0x92); + +// {75BD9CAF-2D0D-4408-B481-655F30F8613F} +_DEFINE_IID_IMPL(IID_IHttpApplication, + 0x75bd9caf, 0x2d0d, 0x4408, 0xb4, 0x81, 0x65, 0x5f, 0x30, 0xf8, 0x61, 0x3f); + //iwebsocket.h diff --git a/testmain/main.cpp b/testmain/main.cpp index 2aea26f2e1cc054ef463e0e1f39f8ff149f99eac..c920de594cfb9b6f8f9166ee2b5d84daeb54e13b 100644 --- a/testmain/main.cpp +++ b/testmain/main.cpp @@ -55,7 +55,7 @@ int main_t(_pinstance hInstance, int argc, TCHAR* argv[]) ULONG Index = com.GetStartIndex(count - 1); CAppViewImpl *app = ALLOC_NEW CAppViewImpl(); - _lComPtr pBase; + BasePtr pBase; hr = app->QueryInterface(IID_IBase, (void**)&pBase); diff --git a/testmain/stdafx.h b/testmain/stdafx.h index 8b764fabd662b9a98643a05d66fac713e68cd40f..51b79bbd615e0ee5112f0395ad6ee606544672ca 100644 --- a/testmain/stdafx.h +++ b/testmain/stdafx.h @@ -7,15 +7,15 @@ #define _STDAFX_H_ #include -#include - -#include #include -#include -#include #include #include #include +#include +#include +#include + + #endif diff --git a/uibase/stdafx.h b/uibase/stdafx.h index 2d25d3c062b96160ff62dbd5fe8dfe3210255124..959face14694fc88c1fd9dfc8b42057816715e39 100644 --- a/uibase/stdafx.h +++ b/uibase/stdafx.h @@ -7,9 +7,8 @@ #define _STDAFX_H_ #include +#include -#include -#include #include #include #include diff --git a/uibase/uibaseimpl.h b/uibase/uibaseimpl.h index 6ae4a83a5c899284f2618dce53c13dc9035d13a4..a48978d3cae6bc0997a0700e6404521439d0daed 100644 --- a/uibase/uibaseimpl.h +++ b/uibase/uibaseimpl.h @@ -33,7 +33,7 @@ public: std_method(CreateControl)(UIType type, IBase **pControl); private: - _lComPtr m_pRot; + ComRotMessagePtr m_pRot; }; #endif