提交 dfe70127 编写于 作者: 报告_前方高能's avatar 报告_前方高能

1.2-20220608

上级 e01b8655
......@@ -54,11 +54,11 @@ asynframe framework解决上面所提的软件产品开发过程中的六大问
|websocket|插件[asynsock]|websocket协议<br>1.支持数据帧分片<br>2.优先发送控制帧|\support\testnetclient_websocket<br>\support\testnetserver_websocket|
|sqlite|插件|基于sqlite-3.3.20实现IDataTransmit接口|\support\testframe|
|zip|插件|基于zlib-1.2.11.0实现IDataTransmit接口<br>1.支持压缩zip文件<br>2.deflate/inflate数据|\support\testframe|
|lua|插件|基于lua-5.4.4实现ICommand接口<br>1.支持多线程|\support\testframe<br>\support\testlua\testapi|
|lua|插件|基于lua-5.4.4实现IOsCommand接口<br>1.支持多线程|\support\testframe<br>\support\testlua\testapi|
# 变更记录
> 2022/06/08 发布windows平台的asynframe framework v1.2: rtsp插件
> 2022/05/26 发布windows平台的asynframe framework v1.1: websocket插件
> 2022/06/08 发布windows平台的asynframe framework v1.2: **rtsp插件**
> 2022/05/26 发布windows平台的asynframe framework v1.1: **websocket插件**
> 2022/05/05 发布windows平台的asynframe framework v1.0
# 编译环境
......@@ -101,9 +101,9 @@ int main(int argc, const char *argv[])
```
# 开发
- [asynframe framework 导出函数](/doc/pluginapi.md)
- asynframe framework [导出函数](/doc/pluginapi.md)
- 接口
- 接口定义
[IAsynFrame](/doc/IAsynFrame.txt)
[IAsynFileSystem](/doc/IAsynFileSystem.txt)
[IAsynIpcChannel](/doc/IAsynIpcChannel.txt)
......@@ -116,14 +116,31 @@ int main(int argc, const char *argv[])
[ISsl](/doc/ISsl.txt)
[IVmHost](/doc/IVmHost.txt)
- [插件](/doc/externapi.md)
[dns](/doc/dns.md)
[ftp](/doc/ftp.md)
[http](/doc/http.md)
[rtsp](/doc/rtsp.md)
[proxy](/doc/proxy.md)
[ssl](/doc/ssl.md)
[websocket](/doc/websocket.md)
- [插件使用](/doc/externapi.md)
<u>基础模块</u>
- [asyncore](/doc/asyncore.md)
- [asynfile](/doc/asynfile.md)
- [asynipcs](/doc/asynipcs.md)
- [asynsock](/doc/asynsock.md)
- [crashexplorer](/doc/crashexplorer.md)
<u>网络模块</u>
- [asynneta](/doc/asynneta.md)
- [dtp](/doc/dtp.md)
- [dns](/doc/dns.md)
- [ftp](/doc/ftp.md)
- [http](/doc/http.md)
- [rtsp](/doc/rtsp.md)
- [proxy](/doc/proxy.md)
- [ssl](/doc/ssl.md)
- [websocket](/doc/websocket.md)
<u>扩展模块</u>
- [console](/doc/console.md)
- [lua](/doc/lua.md)
- [zip](/doc/zip.md)
- [sqlite](/doc/sqlite.md)
# 鸣谢
> [Log4cplus](https://github.com/log4cplus/log4cplus)
......
......@@ -54,7 +54,7 @@ Asynframe framework solves the six problems mentioned above in the process of so
|websocket|plugin[asynsock]|websocket protocol<br>1.implement data frame slice<br>2.priority transmission control frame|\support\testnetclient_websocket<br>\support\testnetserver_websocket|
|sqlite|plugin|Implementation of IDataTransmit interface based on sqlite-3.3.20|\support\testframe|
|zip|plugin|Implementation of IDataTransmit interface based on zlib-1.2.11.0<br>1.implement zip files<br>2.deflate/inflate data|\support\testframe|
|lua|plugin|Implementation of ICommand interface based on lua-5.4.4<br>1.implement threads and logs|\support\testframe<br>\support\testlua\testapi|ß
|lua|plugin|Implementation of IOsCommand interface based on lua-5.4.4<br>1.implement threads and logs|\support\testframe<br>\support\testlua\testapi|ß
# Change log
> 2022/06/08 Release asynframe framework v1.2: rtsp plugin
......@@ -67,7 +67,7 @@ Asynframe framework solves the six problems mentioned above in the process of so
1. The include / lib path corresponding to asynframe needs to be set in the project
2. Select and link the corresponding asynsdk of asynframe according to the runtime of the asynsdk_mini-[MD/MDd/MT/MTd].lib
3. Link asyncore.lib(Three API functions are provided[^1])
3. Link asyncore.lib(3 API functions are provided[^1])
[^1]: STDAPI_(extern HRESULT) Initialize( IAsynMessageEvents *param1, IKeyvalSetter *param2 );<br>STDAPI_(extern InstancesManager*) GetInstancesManager();<br>STDAPI_(extern HRESULT) Destory();
```c++
int main(int argc, const char *argv[])
......@@ -117,6 +117,13 @@ int main(int argc, const char *argv[])
[IVmHost](/doc/IVmHost.txt)
- [Plugins](/doc/externapi.md)
[dns](/doc/dns.md)
[ftp](/doc/ftp.md)
[http](/doc/http.md)
[rtsp](/doc/rtsp.md)
[proxy](/doc/proxy.md)
[ssl](/doc/ssl.md)
[websocket](/doc/websocket.md)
# Thanks
> [Log4cplus](https://github.com/log4cplus/log4cplus)
......
# console 插件
创建控制台,支持键盘/鼠标输入,加载/卸载实现ICommand接口的插件
便于产品在线调试
## 导出函数
```c++
HRESULT __stdcall CreateAsynFramePlugin( /*[out]*/IAsynFramePlugin** object )
```
## 开发
加载console插件
```c++
if( lpInstancesManager->Verify(STRING_from_string(IN_Console)) == S_OK )
{// 加载成功
CComPtr<IConsole> console;
lpInstancesManager->GetInstance(STRING_from_string(IN_Console), IID_IConsole, (void**)&console);
console->AllocWindow(spAsynFrameThread, asynsdk::STRING_EX::null, 3, 0); //创建控制台
}
else
{// 加载失败
}
```
## 例子
\support\testconsole
\ No newline at end of file
......@@ -27,6 +27,38 @@ D-->E(加到列表)
E-->F(结束)
```
# CreateCommand函数
调用实例管理器InstancesManager::NewInstance接口创建IOsCommand对象
# 语法
```c++
HRESULT __stdcall CreateCommand(/*[in ]*/InstancesManager* lpInstancesManager,
/*[in ]*/IUnknown* param1,
/*[in ]*/uint64_t param2,
/*[out]*/IOsCommand** object)
```
# 参数
*[in ]lpInstancesManager*
实例管理器,禁止lpInstancesManager=NULL
*[in ]param1*
*[in ]param2*
*[out]object*
返回对象指针
# 返回值
S_OK表创建对象成功,其他值表示失败
# 备注
```c++
CComPtr<IOsCommand> object;
asynsdk::CStringSetter Soname(1, name);
IUnknown *params[2];
params[0] =&Soname;
params[1] = param1;
lpInstancesManager->NewInstance(params, param2, IID_IOsCommand, (void **)&object.p);
```
# CreateDataTransmit函数
调用实例管理器InstancesManager::NewInstance接口创建IDataTransmit对象
......
# lua 插件
基于lua-5.4.4实现IOsCommand接口,用于打通asynframe framework,支持IOsCommand/IVmHost接口
## 导出函数
```c++
HRESULT __stdcall CreateCommand( /*[in ]*/InstancesManager *lpInstancesManager, /*[in ]*/IUnknown *param1, /*[in ]*/uint64_t param2, /*[out]*/IOsCommand **ppObject)
```
## 开发
创建lua对象
```c++
spCommand.Attach(asynsdk::CreateCommand(lpInstancesManager, "lua", spAsynFrameThread, 0));
if( spCommand )
{
spCommand->Execute(0, STRING_from_string("open"), &STRING_from_string("test.lua"), 1, 0); //执行test.lua脚本
}
```
## 例子
\support\testlua\testapi
\ No newline at end of file
......@@ -42,7 +42,7 @@ m_spAsynNetwork->CreateAsynTcpSocket(&spAsynInnSocket);
m_spAsynNetwork->CreateAsynPtlSocket(STRING_from_string("proxy"), (IUnknown**)&spAsynInnSocket.p, STRING_from_string("socks/" SOCKS_VERNO), &spAsynPtlSocket);
```
#设置代理信息
设置代理信息
```c++
CComPtr<IAsynProxySocket> spProxy; spAsynPtlSocket->QueryInterface(IID_IAsynProxySocket, (void **)&spProxy);
asynsdk::CKeyvalSetter params(1);
......@@ -51,5 +51,5 @@ spProxy->SetProxyContext(STRING_from_string(m_setsfile.get_string("proxy", "host
```
## 例子
[ftpx client](https://github.com/netsecsp/aftpx)
[http client](https://github.com/netsecsp/ahttp)
\ No newline at end of file
[ftpx client](https://github.com/netsecsp/aftpx)
[http client](https://github.com/netsecsp/ahttp)
\ No newline at end of file
# sqlite 插件
基于sqlite-3.3.20实现IDataTransmit接口,支持select/execute功能
## 导出函数
```c++
HRESULT __stdcall CreateDataTransmit(/*[in ]*/InstancesManager* lpInstancesManager,
/*[in ]*/IUnknown* param1,
/*[in ]*/uint64_t param2,
/*[out]*/IDataTransmit** object)
```
## 开发
插入数据
```c++
asynsdk::CStringSetter name(1, argc > 2 ? argv[2] : "test.db");
spDataTransmit.Attach(asynsdk::CreateDataTransmit(lpInstancesManager, "sqlite", &name, 0));
asynsdk::CStringSetter sql1(1, "CREATE TABLE IF NOT EXISTS coreinfo(iseq INTEGER PRIMARY KEY AUTOINCREMENT, info TEXT);");
spDataTransmit->Write(&sql1, 0, 0);
asynsdk::CStringSetter sql2(1, "insert into coreinfo(info) values('show1');");
spDataTransmit->Write(&sql2, 0, 0);
asynsdk::CStringSetter sql3(1, "insert into coreinfo(info) values('show2');");
spDataTransmit->Write(&sql3, 0, 0);
```
查询数据
```c++
asynsdk::CStringSetter sql4(1, "select * from coreinfo;");
spDataTransmit->Write(&sql4, GetAsynMessageEvents(), 0);
```
```c++
void CSqlite::OnEventNotify(uint64_t lParam1, uint64_t lParam2, IUnknown *object)
{
STRING *vals = (STRING *)lParam2;
if( lParam1 == 0 )
{// 通知列名
printf("record");
for(int i = 0; vals[i].ptr; ++ i)
{
printf("\t%*s", vals[i].len, vals[i].ptr);
}
printf("\n");
}
else
{
if(!vals )
{// 通知没有数据
printf("%6I64d records\n", lParam1);
}
else
{// 通知一行数据
printf("%6I64d", lParam1);
for(int i = 0; vals[i].ptr; ++ i)
{
....
}
printf("\n");
}
}
}
```
## 例子
\support\testframe
\ No newline at end of file
# websocket 插件
实现websocket的协议处理模块,支持INet/IAsynTcpSocket/IAsynRawSocket/IAsynTcpSocketListener等接口
自动把http/1.1协议升级到websocket协议
实现websocket的协议处理模块,支持INet/IAsynTcpSocket/IAsynRawSocket/IAsynTcpSocketListener等接口
自动把http/1.1协议升级到websocket协议
## 导出函数
```c++
......@@ -47,7 +47,7 @@ opcode定义:
spNet->Write(lpAsynIoOperation, 0x08); //发送断开命令
```
发送websocket数据帧[opcode=0x00~0x07 0x80~0x87]
发送websocket数据帧[opcode=0x00~0x07/0x80~0x87]
```c++
spNet->Write(lpAsynIoOperation, 0x82); //发送数据
```
......@@ -102,7 +102,7 @@ HRESULT CService::OnIomsgNotify( uint64_t lParam1, uint64_t lAction, IAsynIoOper
else
{// server
spNet->SendPacket(STRING_from_string("101"), STRING_from_string("Switching Protocols"), 0, lpAsynIoOperation);
m_upgrade = 1; //mark: 接受升级websokcet协议
m_upgrade = 1; //mark: 接受http升级到websokcet协议
}
.....
}
......
# zip 插件
基于zlib-1.2.11.0实现IDataTransmit接口,具备zip多个文件以及deflate/inflate数据功能
## 导出函数
```c++
HRESULT __stdcall CreateDataTransmit(/*[in ]*/InstancesManager* lpInstancesManager,
/*[in ]*/IUnknown* param1,
/*[in ]*/uint64_t param2,
/*[out]*/IDataTransmit** object)
```
## 开发
zip多个文件
```c++
asynsdk::CStringSetter name(1, "dst.zip");
spDataTransmit.Attach(asynsdk::CreateDataTransmit(lpInstancesManager, "zip", &name, 0));
if( spDataTransmit )
{
BYTE tmp[1024];
FILE *f1 = fopen(".\\1.txt", "rb");
if( f1 )
{
asynsdk::CStringSetter v(1, ".\\scripts\\1.txt");
spDataTransmit->Write(&v, "1.txt:comments=1:password=123456", 0);
while( 1 ) {
int l = fread(tmp, 1, 1024, f1);
if( l <= 0 ) break;
spDataTransmit->Write(0, tmp, l);
}
fclose(f1);
}
FILE *f2 = fopen(".\\2.txt", "rb");
if( f2 )
{
asynsdk::CStringSetter v(1, ".\\scripts\\2.txt");
spDataTransmit->Write(&v, "2\\2.txt", 0);
while( 1 ) {
int l = fread(tmp, 1, 1024, f2);
if( l <= 0 ) break;
spDataTransmit->Write(0, tmp, l);
}
fclose(f2);
}
}
```
## 例子
\support\testframe
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册