CN102571761B - Information transmission method of network interface - Google Patents
Information transmission method of network interface Download PDFInfo
- Publication number
- CN102571761B CN102571761B CN201110431722.9A CN201110431722A CN102571761B CN 102571761 B CN102571761 B CN 102571761B CN 201110431722 A CN201110431722 A CN 201110431722A CN 102571761 B CN102571761 B CN 102571761B
- Authority
- CN
- China
- Prior art keywords
- data
- data packet
- processing
- command
- network interface
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
- Communication Control (AREA)
Abstract
本发明涉及网络接口的信息传输方法,包括:由主控模块进行数据包处理的初始化,使系统加载数据包处理中定义的各数据包协议;系统对输入的每个词汇进行词法分析;词法分析后进行语法分析得到相应的语义;根据得到的语义执行对应的命令动作处理,将执行的结果根据数据包处理中定义的数据传输格式生成消息数据进行网络传输。本发明的方法不需要重新定义数据包的格式,只需按照统一的数据格式定义相应的语法和命令函数即可形成对应的数据包,由此简化了网络传输的数据结构,提高了数据包的通用性和灵活性,特别适合用于广电业务运营管理系统和CA(条件接收)系统之间的Socket交互。
The invention relates to an information transmission method of a network interface, comprising: initializing data packet processing by a main control module, so that the system loads each data packet protocol defined in the data packet processing; the system performs lexical analysis on each input vocabulary; lexical analysis Then perform grammatical analysis to obtain the corresponding semantics; execute the corresponding command action processing according to the obtained semantics, and generate message data according to the data transmission format defined in the data packet processing for the network transmission. The method of the present invention does not need to redefine the format of the data packet, and only needs to define the corresponding grammar and command function according to the unified data format to form the corresponding data packet, thereby simplifying the data structure of network transmission and improving the data packet efficiency. Versatility and flexibility, especially suitable for Socket interaction between broadcasting and television business operation management system and CA (conditional access) system.
Description
技术领域technical field
本发明涉及信息传输方法,具体的讲是网络接口的信息传输方法,特别适合但不仅限于CA(条件接收)系统中Socket(套接字)接口的信息传输。The invention relates to an information transmission method, specifically an information transmission method of a network interface, especially suitable for but not limited to the information transmission of a Socket (socket) interface in a CA (conditional access) system.
背景技术Background technique
Socket是一种网络编程接口,称为套接字。Socket是一进程与另一进程进行双向通讯的最终的套接点,它是由伯克利在Unix系统中推出的计算机系统的IPC和异种机网络互联的基本机制。Socket is a network programming interface called socket. Socket is the ultimate socket point for two-way communication between one process and another process. It is the basic mechanism of IPC and heterogeneous machine network interconnection of computer system introduced by Berkeley in Unix system.
传统的网络接口数据包的设计,都是通过在数据包内一个指定的固定位置存放约定的内容来实现。这种方式较为简单明了,但是不够灵活,当在不同的系统和协议间传输数据时常出现不能移植和不能兼容的情况,因此需要对不同的系统单独定义数据传输格式和协议,增大了系统的开发成本和网络传输的复杂性。The design of the traditional network interface data packet is realized by storing the agreed content in a specified fixed position in the data packet. This method is relatively simple and clear, but it is not flexible enough. When transferring data between different systems and protocols, it often cannot be transplanted or compatible. Therefore, it is necessary to define data transmission formats and protocols separately for different systems, which increases the system. Development cost and complexity of network transmission.
发明内容Contents of the invention
针对以上的问题,本发明提供了一种网络接口的信息传输方法,不需要重新定义数据包的格式,按照统一的数据格式定义相应的语法和命令函数形成对应的数据包,简化网络传输的数据结构,提高数据包的通用性。In view of the above problems, the present invention provides an information transmission method of a network interface, which does not need to redefine the format of the data packet, defines the corresponding syntax and command functions according to the unified data format to form the corresponding data packet, and simplifies the data transmitted by the network structure to improve the versatility of data packets.
本发明网络接口的信息传输方法,包括:The information transmission method of the network interface of the present invention includes:
数据包处理:用于定义通用的数据传输格式以形成至少一种数据包协议,数据传输格式的字段包括:消息起始标识,命令长度,消息ID和命令内容;Data packet processing: used to define a common data transmission format to form at least one data packet protocol, the fields of the data transmission format include: message start identifier, command length, message ID and command content;
词法分析:根据词法分析工具,定义命令中关键字词汇的格式和生成命令所需的关键字词汇;Lexical analysis: according to the lexical analysis tool, define the format of the keyword vocabulary in the command and the keyword vocabulary required to generate the command;
语法分析:根据语法分析工具,以词法分析模块生成的词汇为基础,定义由所述词汇组成正确的命令,完成IP数据到IP命令的转换;Grammatical analysis: according to the grammatical analysis tool, based on the vocabulary generated by the lexical analysis module, define the correct command composed of the vocabulary, and complete the conversion from IP data to IP command;
命令动作处理:包括对语法分析模块所生成命令的处理程序;Command action processing: including the processing program for commands generated by the syntax analysis module;
主控模块整合处理:包括主框架程序,用于把上述各功能整合为一体,然后编译成一个可执行的程序;Main control module integration processing: including the main frame program, which is used to integrate the above functions into one, and then compile it into an executable program;
由主控模块进行数据包处理的初始化,使系统加载数据包处理步骤中定义的各数据包协议,然后再根据用户选择的数据包协议进行系统初始化;Carry out the initialization of data packet processing by the main control module, make the system load each data packet protocol defined in the data packet processing step, and then perform system initialization according to the data packet protocol selected by the user;
系统接收外部输入后,对输入的每个词汇进行词法分析,如果发现有单词不符合定义的词法格式,则退出解析;After the system receives external input, it performs lexical analysis on each input vocabulary, and if any word is found that does not conform to the defined lexical format, it exits the analysis;
全部输入通过词法分析后,将结果进行语法分析得到相应的语义,如果不能被解析成与定义的语法格式相匹配的语义,则退出解析;After all the input has passed the lexical analysis, the result is parsed to obtain the corresponding semantics. If it cannot be parsed into a semantic that matches the defined grammatical format, the parsing is exited;
根据得到的语义执行对应的命令动作处理,将执行的结果根据数据包处理中定义的数据传输格式生成消息数据,将所述消息数据打包到TCP数据包中进行网络传输。Execute the corresponding command action processing according to the obtained semantics, generate message data according to the data transmission format defined in the data packet processing, and pack the message data into TCP data packets for network transmission.
本发明的方法是对TCP数据包中的数据进行重新整合,并未改变TCP包的结构,因此本发明方法所传输的数据包在全网络是通用的。The method of the invention reintegrates the data in the TCP data packet without changing the structure of the TCP packet, so the data packets transmitted by the method of the invention are universal in the whole network.
进一步的,为了使系统的处理机制更完善,提高数据的传输效率,在命令动作处理中包括对错误命令的处理,提高系统的响应时间。Furthermore, in order to make the processing mechanism of the system more perfect and improve the efficiency of data transmission, processing of error commands is included in the processing of command actions to improve the response time of the system.
通常情况下,由于不同的网络传输场景有不同的协议需求,为了节省资源,优选的一种方案是系统将数据包处理步骤中定义的各数据包协议分为至少两次进行加载。Usually, since different network transmission scenarios have different protocol requirements, in order to save resources, a preferred solution is that the system divides each data packet protocol defined in the data packet processing step into at least two loads.
优选的,语法分析成功后,开启一个新进程,在所述的新进程里执行对应的命令动作处理,以免阻塞外部响应。Preferably, after the grammatical analysis is successful, a new process is started, and the corresponding command action processing is executed in the new process, so as not to block the external response.
进一步的,命令动作处理中将消息数据进行网络传输后,系统将已调用但未释放的资源进行释放,并退出当前进程。Furthermore, after the message data is transmitted over the network during the command action processing, the system releases the resources that have been called but not released, and exits the current process.
进一步的,在进行数据包打包时,将数据包进行临时会话密钥加密,以保证数据包的安全性。Further, when packing the data packet, the data packet is encrypted with a temporary session key to ensure the security of the data packet.
本发明的方法不需要重新定义数据包的格式,只需按照统一的数据格式定义相应的语法和命令函数即可形成对应的数据包,由此简化了网络传输的数据结构,提高了数据包的通用性和灵活性,特别适合用于广电业务运营管理系统和CA(条件接收)系统之间的Socket交互。The method of the present invention does not need to redefine the format of the data packet, and only needs to define the corresponding grammar and command function according to the unified data format to form the corresponding data packet, thereby simplifying the data structure of network transmission and improving the data packet efficiency. Versatility and flexibility, especially suitable for Socket interaction between radio and television business operation management system and CA (conditional access) system.
以下结合由附图所示实施例的具体实施方式,对本发明的上述内容再作进一步的详细说明。但不应将此理解为本发明上述主题的范围仅限于以下的实例。在不脱离本发明上述技术思想情况下,根据本领域普通技术知识和惯用手段做出的各种替换或变更,均应包括在本发明的范围内。The above content of the present invention will be further described in detail below in conjunction with the specific implementation manners of the embodiments shown in the accompanying drawings. However, this should not be construed as limiting the scope of the above-mentioned subject matter of the present invention to the following examples. Without departing from the above-mentioned technical idea of the present invention, various replacements or changes made according to common technical knowledge and customary means in this field shall be included in the scope of the present invention.
附图说明Description of drawings
图1是本发明网络接口的信息传输方法的流程图。Fig. 1 is a flow chart of the information transmission method of the network interface of the present invention.
具体实施方式Detailed ways
如图1所示本发明网络接口的信息传输方法,包括:As shown in Figure 1, the information transmission method of the network interface of the present invention includes:
数据包处理:用于定义通用的数据传输格式以形成多种数据包协议,数据传输格式的字段包括:消息起始标识,消息头,命令长度,消息ID,命令内容和消息Hash码;其中命令长度为可变,为了简单起见,定义命令长度为n×8(n为整数)。根据定义的数据传输格式进行数据包处理,如封包、解包、加密、网络监听、网络连接等。Data packet processing: It is used to define a common data transmission format to form a variety of data packet protocols. The fields of the data transmission format include: message start identifier, message header, command length, message ID, command content and message Hash code; where the command The length is variable. For simplicity, define the command length as n×8 (n is an integer). Perform data packet processing according to the defined data transmission format, such as packaging, unpacking, encryption, network monitoring, network connection, etc.
词法分析:根据词法分析工具(如lex),定义命令中关键字词汇的格式和生成命令所需的关键字词汇;Lexical analysis: according to the lexical analysis tool (such as lex), define the format of the keyword vocabulary in the command and the keyword vocabulary required to generate the command;
语法分析:根据语法分析工具(如yacc),以词法分析模块生成的词汇为基础,定义由所述词汇组成正确的命令,完成IP数据到IP命令的转换;Grammatical analysis: according to the grammatical analysis tool (such as yacc), based on the vocabulary generated by the lexical analysis module, define the correct command composed of the vocabulary, and complete the conversion of IP data to IP command;
命令动作处理:包括对语法分析模块所生成命令的处理程序和错误命令的处理程序;Command action processing: including the processing program for commands generated by the syntax analysis module and the processing program for error commands;
主控模块整合处理:包括主框架程序,用于把上述各功能整合为一体,然后编译成一个可执行的程序;Main control module integration processing: including the main frame program, which is used to integrate the above functions into one, and then compile it into an executable program;
本发明方法中的数据包表头与TCP数据包表头是一致的,只是对TCP数据包的数据部分进行了重定义,使其从数据变成为一个命令集。通过本发明方法生成的Socket消息包也只是替换了TCP数据包里的数据部分。因此本发明方法的数据包是一个TCP数据包,能够在全网内进行TCP/IP的传输。The header of the data packet in the method of the present invention is consistent with the header of the TCP data packet, but the data part of the TCP data packet is redefined to make it change from data to a command set. The Socket message packet generated by the method of the present invention only replaces the data part in the TCP data packet. Therefore, the data packet of the method of the present invention is a TCP data packet, which can carry out TCP/IP transmission in the whole network.
由主控模块进行数据包处理的初始化,使系统加载数据包处理步骤中定义的各数据包协议,然后再根据用户选择的数据包协议进行系统初始化。由于不同的网络传输场景有不同的协议需求,为了节省资源,优选的一种方案是系统将所述的数据包协议分为至少两次进行加载。The data packet processing is initialized by the main control module, so that the system loads each data packet protocol defined in the data packet processing step, and then the system is initialized according to the data packet protocol selected by the user. Since different network transmission scenarios have different protocol requirements, in order to save resources, a preferred solution is that the system divides the data packet protocol into at least two loads.
系统接收外部输入后,对输入的每个词汇进行词法分析,如果发现有单词不符合定义的词法格式,打印Log信息并退出解析。词法分析模块可以选择现有软件。After the system receives external input, it performs lexical analysis on each input word. If any word is found that does not conform to the defined lexical format, it prints the Log information and exits the analysis. The lexical analysis module can choose existing software.
全部输入通过词法分析后,将结果进行语法分析得到相应的语义,如果不能被解析成与定义的语法格式相匹配的语义,打印Log信息并退出解析。语法分析模块可以选择现有软件。After all the input has passed the lexical analysis, the result is parsed to obtain the corresponding semantics. If it cannot be parsed into a semantic that matches the defined grammatical format, log information is printed and parsing is exited. The parsing module can choose existing software.
开启一个新进程,根据得到的语义执行对应的命令动作处理,以免阻塞外部响应。将执行的结果根据数据包处理中定义的数据传输格式生成消息数据,将所述消息数据和消息Hash码一同打包到TCP/IP数据包中进行端到端的互解析实现命令的直接传输。消息数据打包时将数据包进行临时会话密钥加密,以保证数据包的安全性。消息数据传输完成后,系统已调用但未释放的资源进行释放,并退出当前进程。Start a new process, and execute the corresponding command action processing according to the obtained semantics, so as not to block the external response. The execution result is generated according to the data transmission format defined in the data packet processing to generate message data, and the message data and message Hash code are packaged together into a TCP/IP data packet for end-to-end mutual analysis to realize direct transmission of commands. When the message data is packaged, the data package is encrypted with a temporary session key to ensure the security of the data package. After the message data transmission is completed, the resources that have been called but not released by the system are released, and the current process exits.
Claims (6)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110431722.9A CN102571761B (en) | 2011-12-21 | 2011-12-21 | Information transmission method of network interface |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110431722.9A CN102571761B (en) | 2011-12-21 | 2011-12-21 | Information transmission method of network interface |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102571761A CN102571761A (en) | 2012-07-11 |
CN102571761B true CN102571761B (en) | 2014-08-20 |
Family
ID=46416240
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201110431722.9A Expired - Fee Related CN102571761B (en) | 2011-12-21 | 2011-12-21 | Information transmission method of network interface |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102571761B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103236901B (en) * | 2013-04-15 | 2015-11-25 | 天脉聚源(北京)传媒科技有限公司 | A kind of method of transfer instruction and device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6978447B1 (en) * | 2001-02-28 | 2005-12-20 | Cisco Technology, Inc. | Method and system for efficiently interpreting a computer program |
CN100383755C (en) * | 2006-02-27 | 2008-04-23 | 华为技术有限公司 | Software interface testing method and apparatus |
CN100424640C (en) * | 2006-09-26 | 2008-10-08 | 四川长虹电器股份有限公司 | Domestic network intermediate parts development platform and codes conversion method thereof |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050102474A1 (en) * | 2003-11-06 | 2005-05-12 | Sridhar Lakshmanamurthy | Dynamically caching engine instructions |
-
2011
- 2011-12-21 CN CN201110431722.9A patent/CN102571761B/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6978447B1 (en) * | 2001-02-28 | 2005-12-20 | Cisco Technology, Inc. | Method and system for efficiently interpreting a computer program |
CN100383755C (en) * | 2006-02-27 | 2008-04-23 | 华为技术有限公司 | Software interface testing method and apparatus |
CN100424640C (en) * | 2006-09-26 | 2008-10-08 | 四川长虹电器股份有限公司 | Domestic network intermediate parts development platform and codes conversion method thereof |
Also Published As
Publication number | Publication date |
---|---|
CN102571761A (en) | 2012-07-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114115834B (en) | Software and hardware co-compiling processing method and system | |
Song | Protocol-oblivious forwarding: Unleash the power of SDN through a future-proof forwarding plane | |
CN110399233A (en) | The processing method and processing device of remote procedure call | |
CN104144156B (en) | Message processing method and device | |
CN100377556C (en) | Component-based Realization Method of Communication Protocol | |
US7818732B2 (en) | Transfer syntax notational system and method | |
US10333769B2 (en) | Deployable linear bitwise protocol transformation | |
Riedel et al. | Using web service gateways and code generation for sustainable IoT system development | |
EP1779593A2 (en) | Method and apparatus for converting network management protocol to markup language | |
US20120140640A1 (en) | Apparatus and method for dynamically processing packets having various characteristics | |
CN101529807B (en) | A method and system for realizing universal interfaces in the network management system | |
CN102571761B (en) | Information transmission method of network interface | |
US20230412281A1 (en) | Optical connectivity for interconnect technologies | |
US20200162410A1 (en) | Management of messaging in heterogeneous iot / iiot messaging environments | |
CN102075529B (en) | Open building automatic control network protocol conversion device and method | |
Dietz et al. | Formal techniques for automatically generating marshalling code from high-level specifications | |
McQuistin et al. | Investigating Automatic Code Generation for Network Packet Parsing | |
Weigert et al. | Automated generation of marshaling code from high-level specifications | |
Moskal | Interfacing a reasoner with heterogeneous self-controlling software | |
Tan et al. | Dynamically loadable protocol stacks-a message parser-generator implementation | |
Sgroi | Platform-based design methodologies for communication networks | |
JPH10240652A (en) | Message decoder and finite state machine generator | |
CN103152201B (en) | Verifying method of logic function block topology correctness in ForCES (forwarding and control element separation) system | |
EP4475468A1 (en) | Optical connectivity for interconnect technologies | |
Virtanen | A framework for rapid design and evaluation of protocol processors |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20140820 |