当前位置:网站首页>Easycwmp source code analysis

Easycwmp source code analysis

2022-06-11 18:17:00 Chenxiaoshuai HH

One 、 Source code architecture composition

 Insert picture description here
EasyCwmp The design consists of two parts :
①EasyCwmp Core: It includes TR069 CWMP engine , And be responsible for working with ACS Server communication . Use C Language development .

②EasyCwmp DataModel: It contains TR-06 Of DATAModel, And meet some DataModel standard , for example TR-098,TR-181,TR-104 etc. . Use shell Development , Only some protocol models are supported , In the process of development and maintenance, the efficiency is relatively low .

Two 、EasyCwmp Source code composition

 Insert picture description here

3、 ... and 、EasyCwmp File dependency  Insert picture description here

Four 、EasyCwmp Execute the process

 Insert picture description here

Detailed code reference easycwmp.c Medium main function .

① Get input parameters
 Insert picture description here
② Create a mutex lock , Set mutually exclusive file properties , Confirmed as root Sign in .
 Insert picture description here
③ Memory allocation , Initialization of linked list ,uloop_init,xml Backup initialization .
 Insert picture description here
④ Create child process 、 Two pipe The pipe replicates the parent-child process for communication , The subprocess is handed over to /usr/sbin/easycwmp The script program takes over , Prepare to deal with JSON Format parameters .
 Insert picture description here
⑤ load easycwpm The configuration file , Initialize the device information through the configuration file ( Device type 、 Equipment manufacturer 、 Equipment serial number 、 Manufacturer's unique number ), Initialize heartbeat timer.
 Insert picture description here

⑥ The test sends commands through the pipeline /usr/sbin/easycwmp Script program and exit it .
 Insert picture description here

⑦ Add... According to the input parameters EVENT_BOOT or EVENT_PERIODIC The event to the evens list , Set up timer Callback handles events ( Start connection event ).
 Insert picture description here
⑧netlink_init,http_server_init Local service initialization .
 Insert picture description here
⑨ Get into uloop_run Main circulation , Handling event messages .
 Insert picture description here

5、 ... and 、RPC Method

The main introduction here is CPE On the device side RPC Call methods remotely ,ACS The server has RPC Method needs to view the configuration of the corresponding server .
stay EasyCwmp The source code has realized TR069 Commonly used in protocols RPC Method , The source code defines RPC Method in xml.c In file .
 Insert picture description here

原网站

版权声明
本文为[Chenxiaoshuai HH]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206111800115301.html