Skip to the content.

Asynframe framework v1.7.1

https://github.com/netsecsp/asynframe

Background 中文

In the process of software product development, we often encounter problems in the following scenarios:

  1. Centralized management of configuration parameters required by each module– Involving configuration parameter loading and persistence;
  2. Can the interface group use the existing network module to develop its own functions, such as submitting the log file to the background through HTTP protocol– Knowledge difficulties involving network, HTTP DNS and using network agent;
  3. Problems caused by information interaction between the interface and other SDK modules (including integration of third-party open source projects)– Thread synchronization, event sequence and long operation time are involved;
  4. Each module (including the interface) solves time-consuming / synchronous operation and other problems by creating working threads, – involving resource optimization;
  5. Using synchronous lock, – there is a deadlock problem.
  6. The complex business logic of the module leads to frequent release of patches

Introduction

This is a message driven SDK development framework based on Windows platform, which provides basic interfaces such as threads, pipes, files and networks.

Asynframe framework solves the six problems mentioned above in the process of software product development:

  1. Manage the parameters of each module through the famous parameter management object
  2. Reduce the learning cost through plug-in and unified operation interface
  3. Provide notification results in the caller’s thread and set the serial operation chain to solve the problems of thread synchronization, event sequence and long operation time
  4. Optimize the execution of working threads of each module through the named thread pool
  5. Provide lockless mechanism
  6. Integrate Lua plug-in to realize hot update
    image

Feature:

  1. Easy integration into MFC,DUISoUIQt6.x And other third-party open source projects
  2. Provide a unified device operation interface (including file, pipe, socket, etc.)
  3. The operation chain is used to solve the problems of synchronization / communication between threads, execution timeout and resource / performance when integrating third-party open source projects
  4. Provide basic network protocol module:dns/udp/tcp/ssl/ftp/http/rtsp/proxy/websocket
  5. Reference count management object memory
  6. Provide microsecond timer
  7. Integrate Log4cplus,Unified modules output log
    image

Development advantage:

  1. Support the upgradable plug-in and assist the modularization of windows products.
  2. Support the generation of stack information and dmp files when cross process acquisition crashes.
  3. Embed the micro thread core object into other threads to isolate other codes, so as to facilitate code reconstruction.
  4. Get a very smooth user experience through the asynchronous execution framework.
  5. The unified development template, non locking mechanism, high-performance IO framework and demo reduce the learning cost of developers. It can rapidly develop stable and high-performance application modules. It can greatly reduce the amount of developed code.
  6. Support network UDP/TCP port multiplexing framework.
  7. Support Lua framework.
  8. Support JVM framework.
module type function demo
asyncore framework asynframe \support\testframe
    integrate MFC \support\3rd\mfc\testnetserver
\support\3rd\mfc\testnetclient_dlg
\support\3rd\mfc\testnetclient_doc
    integrate DUI \support\3rd\Dui
    integrate SoUI \support\3rd\Sui
crashexplorer plugin[asyncore] Capture the crash information of the current process and generate DMP file at the same time \support\testcrashexplorer
console plugin[asyncore] console
1.implement loading / unloading IOsCommand plug-ins:cmd/lua
2.implement keyboard / mouse input
\support\testconsole
asynfile plugin[asyncore] file \support\testfile_copy
\support\testfile_copy-pipe
asynipcs plugin[asyncore] Interprocess communication \support\testipcclient
\support\testipcserver
asynneta plugin[asyncore] network agent service
1.implement http[s] agent:Basic/Digest authorize
2.implement ftp[s] agent
3. implement socks4.0/4.a/5.0 agent
aneta
asynsock plugin[asyncore] network:
1.implement IPv6 and compatible with IPv4
2.implement DNS
\support\testnetclient
\support\testnetserver
pingx
dns plugin[asynsock] DNS
1.implement udp dns
2.implement tcp dns
3.implement httpDNS: Alibaba cloud/Tengxun cloud
\support\testdns
ftp plugin[asynsock] ftp protocol aftpx
acurl
http plugin[asynsock] http protocol ahttp
acurl
rtsp plugin[asynsock] rtsp protocol
1.implement rtsp over http
\support\testnetclient_rtsp
\support\testnetserver_rtsp
ssl plugin[asynsock] ssl/tls encryption/decryption
1.implement p12 certificate
\support\testnetclient_ssl
\support\testnetserver_ssl
proxy plugin[asynsock] client proxy
1.implement http/https proxy:Basic/Digest authorize
2.implement ftp/ftps proxy
3.implement socks4.0/4.a/5.0 proxy
\support\testnetclient_proxy
\support\testnetserver_socks
websocket plugin[asynsock] websocket protocol
1.implement data frame slice
2.priority transmission control frame
\support\testnetclient_websocket
\support\testnetserver_websocket
zip plugin Implementation of IDataTransmit interface based on zlib-1.2.11.0
1.implement zip files
2.deflate/inflate data
\support\testframe
sqlite plugin Implementation of IOsCommand interface based on sqlite-3.3.20 \support\testframe
Dtp plugin[asyncock] port reuse framework to implement tcp/udp support testnetserver_ dtp-tcp.port
\support\testnetserver_ dtp-udp.port
lua plugin Implementation of IOsCommand interface based on lua-5.4.4 lua framework \support\testlua\testlua
\support\testlua\testapi
jvmproxy plugin Implementation of IOsCommand interface java framework \support\testjava\testjvm
\support\testjava\testapi
javax

Change log

2024/08/16 Release asynframe framework v1.7.1

  1. Release plugin: jvmvproxy
  2. Fix crashes caused by IKeyval.Set not filtering empty strings
    2024/07/12 Release asynframe framework v1.6.1
    2023/11/15 Release asynframe framework v1.5.2
    2023/03/31 Release asynframe framework v1.4.6
    2023/02/02 Release asynframe framework v1.3.2
    2022/06/08 Release asynframe framework v1.2.0
    2022/05/26 Release asynframe framework v1.1.0
    2022/05/05 Release asynframe framework v1.0.0

Build

sdk_v1.7.1-Msvc2019_20240816.zip is compiled through Microsoft Visual Studio 2019
sdk_v1.7.1-Msvc2013_20240816.zip is compiled through Microsoft Visual Studio 2013

  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
    int main(int argc, const char *argv[])
    {
     HRESULT ret = Initialize(NULL, NULL); //Initialize asynframe
     if( ret != NO_ERROR )
     {
         return 1;
     }
    
     InstancesManager *lpInstancesManager = GetInstancesManager(); //Get the instance manager, which can get all interfaces
    
     CComPtr<IAsynFrameThread> spAsynFrameThread; //Create thread
     lpInstancesManager->NewInstance(0,0,IID_IAsynFrameThread, (void**)&spAsynFrameThread);
    
     lpInstancesManager->Require(STRING_from_string(IN_AsynNetwork)); //Load network module
    
     CComPtr<IAsynNetwork    > spAsynNetwork;
     lpInstancesManager->GetInstance(STRING_from_string(IN_AsynNetwork), IID_IAsynNetwork, (void **)&spAsynNetwork);
    
     CComPtr<IAsynUdpSocket  > spAsynUdpSocket; //Create UDP object
     spAsynNetwork->CreateAsynTcpSocket(&spAsynTcpSocket );
    
     spAsynUdpSocket->Bind(asynsdk::STRING_EX::null, 0, 0, NULL);  
    
     ......
    
     Destory(); //Destory asynframe
     return 0;
    }
    

Development

Interface
IAsynFrame
IAsynFileSystem
IAsynIpcChannel
IAsynNetwork
IAsynNetAgent
IConsole
IExceptionTrapper
INet
IProxy
ISsl
IScriptHost
IDtp

[Plugins](https://netsecsp.github.io/doc/externapi.md)

base modules
asyncore
asynfile
asynipcs
asynsock
crashexplorer

network modules
asynneta
dtp
dns
ftp
http
rtsp
proxy
ssl
websocket

extend modules
console
lua
jvm
zip
sqlite

Thanks

Log4cplus
Lua
Luatinker
Zlib
Sqlite
FFmpeg

Copyright

Copyright (c) 2012 - 2032, All rights reserved.
Author: Shengqian Yang, China, netsecsp@hotmail.com