Communication protocol interaction architecture and message interaction method thereof

Through the design and communication protocol interactive architecture, the underlying protocol change is only adapted within the interactive architecture, solving the problem of large expansion of the packet format in existing technology and complex maintenance, and improved code consistency and maintenance.

CN119383236AActive Publication Date: 2025-01-28SHANDONG SENTER ELECTRONICS
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310914627.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-25
Publication Date
2025-01-28
Estimated Expiration
2043-07-25

AI Technical Summary

Technical Problem

The existing communication protocol message format is difficult to flexibly expand when business requirements change, resulting in the implementation of new requirements requiring maintenance of multiple old versions, increasing the complexity and cost of development and maintenance.

Method used

The interactive structure of communication protocols is designed. By setting up a message receiving unit, message analysis module, message receiving distribution module and other modules, the change of simple underlying protocols only completes the adaptation within the interactive architecture and does not affect the more upper level.

Benefits of technology

Effectively prevent the diffusion of protocol changes, only affect the corresponding business processing part, improves the consistency and maintenance of the code, reduces control coupling, and improves the flexibility of the reuse and architecture of the packet processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119383236A_ABST
    Figure CN119383236A_ABST
Patent Text Reader

Abstract

The invention discloses a communication protocol interaction architecture and a message interaction method thereof, and belongs to the technical field of communication. According to the invention, the change of the underlying protocol is adapted in the interactive architecture, and the upper logic is not affected. And even if the content of the specific function protocol is changed, only the corresponding service processing part is influenced, so that the diffusion of the change is effectively prevented. According to the method, the code consistency is improved, all related information is classified in order, information redundancy and disordered storage are reduced, and control coupling is reduced. Each message processing flow is effectively isolated, and different versions and different messages are modified respectively and do not influence each other. The reusability of message processing is improved, the message processing process which is not changed can be directly reused, and the message processing process does not need to be changed. And under the division of the interactive architecture, the modules are well arranged and organized, so that the maintainability is improved. The flexibility of the architecture is improved, new messages can be conveniently expanded, and processing of different versions can be flexibly matched.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a communication protocol interaction architecture and a message interaction method thereof. Background Art

[0002] The communication protocol message format is formulated based on the usage scenario and has various forms, but generally there is a fixed overall format. The payload part occupies certain fields in the overall format or does not exist according to specific needs. The overall format determines the general form of the message, which will be reflected in the specific message; the format of the payload part will change appropriately according to the specific purpose of the message.

[0003] As business requirements change, the communication within or between systems will continue to evolve with the requirements. In the early stage, it can be supported by maintaining the original overall format and expanding the corresponding fields in some of the overall formats according to the new requirements, until the original overall format can no longer meet the requirements, at which time the overall format can only be changed. However, because the new requirements only account for a small part, in order to protect the original work results, most of the new message formats will still use the original agreement. Generally, the development team must develop for the new message format, while also maintaining and even expanding new functions for several old versions at the same time to meet their own costs, benefits, opportunities, and risks, or to meet the preferences of different customers for the original system and the new system.

[0004] Currently, there are different development forms for the above situations, such as independent development and maintenance of versions, adding function switches within the program, selective compilation and building, code generation and runtime engine technology, etc.

[0005] The traditional version-by-version independent development and maintenance method tends to be a "waterfall" development method, with a large granularity of architecture division, uncontrollable data redundancy and control coupling. If a change occurs, several places will usually be modified, and it is difficult to ensure that there will be no omissions. When the protocol is expanded or changed, copying the original code usually becomes an option, which increases the maintenance workload of the project and is not conducive to the extension of the old version by the newly developed code.

[0006] There are also some designs that use some kind of "switch" to select the part of the code that needs to be changed, such as controlling the process through specific numerical judgments (such as const Boolean variables), selective compilation through compilation switches (such as macros in C / C++), and selective construction through build tools (such as custom makefiles). The first two methods mix all versions of components and codes together. When modifying a certain version, you must consider the impact on other versions; the latter method separates two codes that may need to be maintained simultaneously, increasing the difficulty of maintenance and construction and the overall complexity of the project.

[0007] In recent years, technologies have emerged that automatically generate interactive code through certain template specifications, as well as technologies that use runtime engines to dynamically load relevant specification information. The former is heavily dependent on the ability of the code generator because the code is automatically generated, and has poor flexibility and is difficult to cope with complex and changing situations; the latter is difficult to meet the performance requirements of processors with limited performance, and has limited usage scenarios and is difficult to be widely used. Summary of the invention

[0008] The present invention provides a communication protocol interaction architecture and a message interaction method thereof. By setting up the communication protocol interaction architecture, changes in the underlying protocol are all adapted within the interaction architecture without affecting the logic of the upper layer. Even if the content of a specific functional protocol is changed, it will only affect the corresponding business processing part, effectively preventing the spread of the change.

[0009] The present invention provides the following technical solutions:

[0010] A communication protocol interaction architecture includes a message receiving unit, a first message parsing module, a first message receiving and dispatching module, a first message receiving and processing module, a second message sending and dispatching module, a second message sending and processing module, a first message packaging module and a message sending unit, wherein:

[0011] The message receiving unit, the first message parsing module and the first message receiving and distributing module are connected in communication in sequence, the first message receiving and distributing module is connected in communication with a plurality of the first message receiving and processing modules; the second message sending and distributing module is connected in communication with a plurality of the second message sending and processing modules, the second message sending and processing module, the first message packaging module and the message sending unit are connected in communication in sequence;

[0012] The first message parsing module and the first message packaging module are both associated with first message depacketization information, and the first message receiving and dispatching module and the second message sending and dispatching module are respectively associated with a first message feature analysis module and a second message feature analysis module;

[0013] The first message receiving and processing module includes a second message parsing submodule, a second message receiving and processing submodule and a corresponding first message characteristic information submodule; the second message sending and processing module includes a second message packaging submodule, a default first message characteristic information submodule and a corresponding second message characteristic information submodule.

[0014] Further, the message receiving unit is used to receive message information sent by the corresponding opposite end, and the message information includes message data;

[0015] The first message parsing module is used to parse the message information according to the first message depacketization information to obtain a first message, wherein the first message is a description of the message information, and the first message depacketization information describes information on mutual conversion between the message information and the first message;

[0016] The first message receiving and dispatching module is used to call the first message feature analysis module to analyze the first message to obtain first message feature information, and dispatch the first message to the corresponding first message receiving and processing module according to the correspondence between the first message feature information and the corresponding first message feature information submodule of the first message receiving and processing module;

[0017] The second message parsing submodule is used to convert the first message into a second message, where the second message is a description of the first message;

[0018] The second message receiving and processing submodule is used to process the second message or forward it to a corresponding second message recipient;

[0019] The corresponding first message characteristic information submodule records the first message characteristic information of the first message to be processed by the current first message receiving and processing module;

[0020] The second message sending and dispatching module is used to receive the second message sent by the corresponding second message sender, and call the second message feature analysis module to analyze the second message to obtain second message feature information, and according to the correspondence between the second message feature information and the corresponding second message feature information submodule of the second message sending and processing module, dispatch the second message to the corresponding second message sending and processing module;

[0021] The corresponding second message characteristic information submodule records the second message characteristic information of the second message to be processed by the current second message sending processing module;

[0022] The default first message characteristic information submodule records the default first message characteristic information used when converting the second message into the first message;

[0023] The second message encapsulation submodule is used to convert the second message into the first message according to the default first message characteristic information or the first message characteristic information associated with the second message itself;

[0024] The first message packaging module is used to convert the first message into the message information according to the first message depacketization information;

[0025] The message sending unit is used to send the message information to the corresponding opposite end.

[0026] Furthermore, the message information also includes relevant information of the message data, and the relevant information is used to meet the need of parsing during the receiving process, or to meet the need of sending during the sending process.

[0027] Furthermore, the first message parsing module is associated with a message extraction unit, and the message extraction unit is used to extract complete and valid message data from the message data stream.

[0028] Furthermore, when the overall structure of the message data remains unchanged, if a new receiving command is to be added, it is implemented by adding a corresponding first message receiving processing module; if a new sending command is to be added, it is implemented by adding a corresponding second message sending processing module.

[0029] Furthermore, when the overall structure of the message data remains unchanged, if the relevant fields of the message data of a certain function in the existing protocol are to be adjusted or expanded, the new receiving process is realized by adjusting or expanding the corresponding second message parsing submodule and the second message receiving and processing submodule, and the new sending process is realized by adjusting or expanding the corresponding second message packaging submodule.

[0030] Furthermore, when the protocol version is changed, the first message decapsulation information only needs to be changed.

[0031] Furthermore, when the running protocol needs to support both new and old overall formats of message data, it is achieved by changing the first message depacketization information and correspondingly changing the first message parsing module, the first message packaging module and the corresponding first message characteristic information.

[0032] A message interaction method of the communication protocol interaction architecture, the method comprising:

[0033] S1: The message receiving unit receives message information sent by the opposite end, and transmits the message information to the first message parsing module;

[0034] S2: the first message parsing module parses the message information according to the first message decapsulation information to obtain a first message, and transmits the first message to the first message receiving and dispatching module;

[0035] S3: the first message receiving and dispatching module calls the first message feature analysis module to analyze the first message to obtain first message feature information; and searches the corresponding first message feature information submodule of the first message receiving and processing module according to the first message feature information to obtain the corresponding first message receiving and processing module, and dispatches the first message to the corresponding first message receiving and processing module;

[0036] S4: the first message receiving and processing module converts the first message into a second message via the second message parsing submodule, and transmits the second message to the second message receiving and processing submodule;

[0037] S5: The second message receiving and processing submodule processes the second message or forwards it to a corresponding second message recipient;

[0038] The second message sent by the second message receiving and processing submodule is associated or not associated with the first message characteristic information as needed;

[0039] S6: The second message sending and dispatching module receives the second message sent by the corresponding second message sender, and calls the second message feature analysis module to analyze the second message to obtain second message feature information, searches the corresponding second message feature information submodule of the second message sending processing module according to the second message feature information to obtain the corresponding second message sending processing module, and dispatches the second message to the corresponding second message sending processing module;

[0040] Wherein, the second message sender includes the second message receiving and processing submodule and other modules capable of sending the second message;

[0041] S7: When the second message is associated with the first message characteristic information, the second message sending processing module converts the second message into the first message through the second message encapsulation submodule according to the first message characteristic information associated with the second message and transmits the first message to the first message encapsulation module;

[0042] When the second message is not associated with the first message characteristic information, the second message sending processing module converts the second message into the first message through the second message encapsulation submodule according to the default first message characteristic information and transmits the first message to the first message encapsulation module;

[0043] S8: The first message packaging module converts the first message into the message information according to the first message depacketization information, and transmits the message information to the message sending unit;

[0044] S9: The message sending unit sends the message data in the message information to the corresponding opposite end.

[0045] Further, when the first message parsing module is associated with a message extraction unit, the S2 further includes:

[0046] The first message parsing module calls the message extraction unit to extract complete and valid message data from the message data stream.

[0047] The present invention has the following beneficial effects:

[0048] The present invention uses a communication protocol interaction framework to achieve that changes to the underlying protocol can be adapted within the interaction framework without affecting the logic of the upper layer. Even if the content of a specific functional protocol is changed, it will only affect the corresponding business processing part, effectively preventing the spread of the change. It has the following advantages:

[0049] 1. Improve code consistency, classify all relevant information in order, reduce information redundancy and disordered storage, and reduce control coupling compared to existing technologies.

[0050] 2. Effectively isolate each message processing process, and different versions and messages can be modified separately without affecting each other.

[0051] 3. The reusability of message processing is improved. The unchanged message processing process can be reused directly without changing itself.

[0052] 4. Under the division of the interactive architecture of the present invention, each module has a distinct hierarchy and is well organized, which improves maintainability.

[0053] 5. The flexibility of the architecture is improved, which makes it easy to expand new messages and flexibly match the processing of different versions. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 A schematic diagram of the communication protocol interaction architecture of the present invention;

[0055] Figure 2 A flowchart of the receiving process;

[0056] Figure 3 Flowchart of the sending process. DETAILED DESCRIPTION

[0057] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.

[0058] The present invention provides a communication protocol interaction architecture, which is composed of a receiving process, a sending process and a public information module. Figure 1 As shown, the receiving processing process includes a message receiving unit, a first message parsing module, a first message receiving and dispatching module and a first message receiving and processing module, and the sending processing process includes a second message sending and dispatching module, a second message sending processing module, a first message packaging module and a message sending unit.

[0059] Each module and unit in the communication protocol interaction framework of the present invention can be replaced as needed. Each module involved in the present invention can be assembled and called by a higher-level module or unit. Each module can be deployed in different threads, processes, systems or clusters as needed, and can be implemented by software or hardware.

[0060] Among them, the message receiving unit, the first message parsing module and the first message receiving and dispatching module are communicatively connected in sequence, and the first message receiving and dispatching module is communicatively connected to multiple first message receiving and processing modules; the second message sending and dispatching module is communicatively connected to multiple second message sending processing modules, and the second message sending processing module, the first message packaging module and the message sending unit are communicatively connected in sequence.

[0061] The first message parsing module and the first message packaging module are both associated with the first message depacketization information, and the first message receiving and dispatching module and the second message sending and dispatching module are respectively associated with the first message feature analysis module and the second message feature analysis module.

[0062] The first message receiving and processing module includes a second message parsing submodule, a second message receiving and processing submodule and a corresponding first message characteristic information submodule; the second message sending and processing module includes a second message packaging submodule, a default first message characteristic information submodule and a corresponding second message characteristic information submodule.

[0063] The message receiving unit is used to actively or passively receive the message information sent by the corresponding opposite end. The message information includes message data. In some cases, as needed, the message information may also include relevant information of the message data, which is a description of the message data. Based on this relevant information, the needs of subsequent parsing can be met during the receiving process, and the needs of subsequent sending can be met during the sending process. Taking the UDP (User Datagram Protocol) connection as an example, the relevant information may be the sender's IP address (Internet Protocol Address) + port, which local IP address and port it is sent to, the time the message data is received, and so on. In some scenarios, for example, subsequent processing does not require other information except the message data, that is, the message data contains all the information required for subsequent processing, and the message information may not include relevant information.

[0064] Here, the message data may contain a complete message data or may be a part of a continuous message data stream according to different scenarios. Optionally, the first message parsing module is associated with a message extraction unit, which is used to extract complete and valid message data from the message data stream.

[0065] The first message parsing module is used to parse the message information according to the first message decapsulation information to obtain the first message.

[0066] The first message is a description of the message information, which can be obtained by parsing the message information through the first message parsing module, or can be converted into message information by the first message packaging module. The first message contains the first message characteristic information, and the first message characteristic information can provide a path selection basis for the subsequent first message receiving and processing module.

[0067] The first message depacketization information describes the information of the conversion between the message information and the first message, and is used in the receiving and sending processes. The first message parsing module can parse the message information to obtain the first message, and the first message packaging module can also convert the first message into message information.

[0068] The first message receiving and dispatching module is used to call the first message feature analysis module to analyze the first message, obtain the first message feature information, and dispatch the first message to the corresponding first message receiving and processing module according to the correspondence between the first message feature information and the corresponding first message feature information sub-module of the first message receiving and processing module.

[0069] The corresponding first message characteristic information submodule records the first message characteristic information of the first message to be processed by the current first message receiving and processing module.

[0070] The second message parsing submodule is used to convert the first message into a second message. The second message is a description of the first message, which includes relevant information in the first message, and may also include other runtime information that is not in the first message but is related to the first message. The second message contains the second message feature information, and when sending, the second message feature information can provide a path selection basis for the second message sending processing module.

[0071] The second message receiving and processing submodule is used to process the second message or forward it to the corresponding second message recipient, such as forwarding it to other units for further processing. When the second message is forwarded, it can also be associated with a corresponding first message feature information to be used, so that the first message feature information can be used in the second message sending and processing module to replace the default first message feature information.

[0072] The second message sending and dispatching module is used to receive the second message sent by the corresponding second message sender, and call the second message feature analysis module to analyze the second message to obtain the second message feature information, and according to the correspondence between the second message feature information and the corresponding second message feature information sub-module of the second message sending processing module, dispatch the second message to the corresponding second message sending processing module.

[0073] The second message sender represents all units that can send messages, which may be in the modules or units described in this architecture, such as the second message receiving and processing submodule, or may be outside the modules or units described in the architecture.

[0074] The corresponding second message characteristic information submodule records the second message characteristic information of the second message to be processed by the current second message sending processing module.

[0075] The default first message characteristic information submodule records the default first message characteristic information used when converting the second message into the first message.

[0076] The second message packaging submodule is used to convert the second message into the first message according to the default first message characteristic information or the first message characteristic information associated with the second message itself. If it is found that the second message itself is associated with a first message characteristic information, the associated first message characteristic information will be used to replace the default first message characteristic information for conversion.

[0077] The first message packaging module is used to convert the first message into message information according to the first message depacketization information.

[0078] The message sending unit is used to send the message information to the corresponding opposite end (ie the corresponding receiver).

[0079] The operations of the current architecture when changing specific protocols include:

[0080] 1. When the overall structure of the message data remains unchanged, if a new receiving command is to be added, it is implemented by adding a corresponding first message receiving processing module; if a new sending command is to be added, it is implemented by adding a corresponding second message sending processing module.

[0081] 2. When the overall structure of the message data remains unchanged, if the relevant fields of the message data of a certain function in the existing protocol are to be adjusted or expanded, the new receiving process is realized by adjusting or expanding the corresponding second message parsing submodule and the second message receiving and processing submodule, and the new sending process is realized by adjusting or expanding the corresponding second message packaging submodule. At the same time, the corresponding second message is also changed accordingly.

[0082] 3. When the protocol version changes, just change the first message decapsulation information.

[0083] If the message header changes from 0x5a to 0x5b, you only need to change the first message depacketization information. For example, if it is {message header: 0x5a, CRC check (cyclic redundancy check): CRC-8 / ITU, message tail: 0xa5} before the change, it will be {message header: 0x5b, CRC check: CRC-8 / ITU, message tail: 0xa5} after the change.

[0084] 4. When the running protocol needs to support both new and old overall formats of message data, it can be achieved by changing the first message unpacking information. For example, the message header in the first message unpacking information can be changed to a format similar to {message header value range: [0x5a, 0x5b], CRC check: CRC-8 / ITU, message tail: 0xa5}, and the first message parsing module, the first message packaging module and the corresponding first message feature information can be changed accordingly.

[0085] For other situations, corresponding changes can be made, which will not be described in detail in the present invention.

[0086] The present invention uses a communication protocol interaction framework to achieve that changes to the underlying protocol can be adapted within the interaction framework without affecting the logic of the upper layer. Even if the content of a specific functional protocol is changed, it will only affect the corresponding business processing part, effectively preventing the spread of the change. It has the following advantages:

[0087] 1. Improve code consistency, classify all relevant information in order, reduce information redundancy and disordered storage, and reduce control coupling compared to existing technologies.

[0088] 2. Effectively isolate each message processing process, and different versions and messages can be modified separately without affecting each other.

[0089] 3. The reusability of message processing is improved. The unchanged message processing process can be reused directly without changing itself.

[0090] 4. Under the division of the interactive architecture of the present invention, each module has a distinct hierarchy and is well organized, which improves maintainability.

[0091] 5. The flexibility of the architecture is improved, which makes it easy to expand new messages and flexibly match the processing of different versions.

[0092] The embodiment of the present invention further provides a message interaction method of the aforementioned communication protocol interaction architecture. To illustrate the interaction method of the present invention, it is assumed that the following message formats exist:

[0093]

[0094] When the command word is 0x1, it indicates time query or setting instruction. The load format is as follows:

[0095]

[0096] When the command word is 0x81, it indicates the reply of time query or setting instruction. The load format is as follows:

[0097] Fields length illustrate Query or set 1 byte 0 is for reply query, other values ​​are for reply setting time 4 bytes Unsigned integer, big endian, representing the current century seconds

[0098] The receiving process is as follows Figure 2 As shown, including:

[0099] S1: The message receiving unit receives message information sent by the opposite end, and passes the message information to the first message parsing module.

[0100] In the present invention, the receiving unit can receive the message information sent by the other end through TCP (Transmission Control Protocol) connection, UDP, SPI (Serial Peripheral Interface), RS232 (a serial bus standard), RS485 (a serial bus standard), etc., or a message queue.

[0101] In one example, optionally, the message information includes message data and related information thereof, and the related information includes an ID (Identity document) of the opposite end, and subsequent processing can distinguish the corresponding opposite end based on the ID.

[0102] Assuming that the binary message stream data received by the message receiving unit from peer No. 1 is [0x5a, 0x01, 0x01, 0x01, 0x00, 0x32, 0xa5, 0x5a], it transmits the message and the ID of the peer to the first message parsing module.

[0103] S2: The first message parsing module parses the message information according to the first message decapsulation information to obtain a first message, and transmits the first message to the first message receiving and dispatching module.

[0104] When the first message parsing module is associated with a message extraction unit, this step S2 further includes: the first message parsing module calls the message extraction unit to extract complete and valid message data from the message data stream.

[0105] For example, the first message parsing module extracts a message [0x5a, 0x01, 0x01, 0x01, 0x00, 0x32, 0xa5] according to the first message decapsulation information {message header: 0x5a, CRC check: CRC-8 / ITU, message tail: 0xa5} by calling the message stream extraction unit module, and then converts it into the first message {peer end ID: 1, command word: 0x01, message sequence number: 0x01, payload: [0x00]}, and sends it to the first message receiving and dispatching module.

[0106] S3: The first message receiving and dispatching module calls its associated first message feature analysis module to analyze the first message and obtain the first message feature information {command word: 0x01}; and searches the corresponding first message feature information submodule of the first message receiving and processing module according to the first message feature information to obtain the corresponding first message receiving and processing module, and dispatches the first message to the corresponding first message receiving and processing module.

[0107] S4: The first message receiving and processing module converts the first message into a second message via the second message parsing submodule, and transmits the second message to the second message receiving and processing submodule.

[0108] For example, the second message is {peer end ID: 1, command: query or set time, message sequence number: 0x01, time: null}.

[0109] S5: The second message receiving and processing submodule processes the second message or forwards it to a corresponding second message recipient (for example, forwards it to other business units for processing).

[0110] The second message sent by the second message receiving and processing submodule may be associated with or not associated with the first message characteristic information as required.

[0111] The sending process is as follows Figure 3 As shown, including:

[0112] S6: The second message sending and dispatching module receives the second message sent by the corresponding second message sender, and calls the second message feature analysis module to analyze the second message to obtain the second message feature information, searches the corresponding second message feature information sub-module of the second message sending processing module according to the second message feature information, obtains the corresponding second message sending processing module, and dispatches the second message to the corresponding second message sending processing module.

[0113] The second message sender includes a second message receiving and processing submodule and other modules capable of sending the second message.

[0114] For simplicity, it is assumed that after receiving the query instruction, the second message receiving and processing submodule obtains the current time, assembles the second message {peer ID: 1, command: reply to query or set time, message sequence number: 0x01, time: 0x12345678}, and then hands it over to the second message sending and dispatching module. The second message sending and dispatching module first calls the second message feature analysis unit and learns that the current message feature is {command: reply to query or set time}, so after searching, it sends it to the corresponding second message sending and processing module.

[0115] S7: When the second message is associated with the first message characteristic information, the second message sending processing module converts the second message into the first message through the second message packaging submodule according to the first message characteristic information associated with the second message and transmits the first message to the first message packaging module.

[0116] When the second message is not associated with the first message characteristic information, the second message sending processing module converts the second message into a first message and transmits the first message to the first message packaging module via the second message packaging submodule according to the default first message characteristic information.

[0117] For example, the first message obtained after conversion is {peer end ID: 1, command word: 0x81, message sequence number: 0x01, payload: [0x00, 0x12, 0x34, 0x56, 0x78]}.

[0118] S8: The first message packaging module converts the first message into message information according to the first message depacketization information, and transmits the message information to the message sending unit.

[0119] For example, the message data byte sequence of the message information is [0x5a, 0x81, 0x01, 0x05, 0x00, 0x12, 0x34, 0x56, 0x78, 0x03, 0xa5], and is sent to the message sending unit together with its corresponding peer information (peer ID).

[0120] S9: The message sending unit sends the message data in the processed message information to the corresponding opposite end.

[0121] For example, according to the relevant information in the message information (ie, the ID of the peer), the message data is sent to peer No. 1.

[0122] The message interaction method of this embodiment includes all the contents of the communication protocol interaction architecture of the aforementioned embodiment. For the sake of brief description, parts not mentioned in this embodiment can be referred to the corresponding contents in the aforementioned embodiment, which will not be repeated here.

[0123] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A communication protocol interaction architecture, characterized in that: It includes a message receiving unit, a first message parsing module, a first message receiving and dispatching module, a first message receiving and processing module, a second message sending and dispatching module, a second message sending and processing module, a first message packaging module and a message sending unit, wherein: The message receiving unit, the first message parsing module and the first message receiving and distributing module are connected in communication in sequence, the first message receiving and distributing module is connected in communication with a plurality of the first message receiving and processing modules; the second message sending and distributing module is connected in communication with a plurality of the second message sending and processing modules, the second message sending and processing module, the first message packaging module and the message sending unit are connected in communication in sequence; The first message parsing module and the first message packaging module are both associated with first message depacketization information, and the first message receiving and dispatching module and the second message sending and dispatching module are respectively associated with a first message feature analysis module and a second message feature analysis module; The first message receiving and processing module includes a second message parsing submodule, a second message receiving and processing submodule and a corresponding first message characteristic information submodule; the second message sending and processing module includes a second message packaging submodule, a default first message characteristic information submodule and a corresponding second message characteristic information submodule.

2. The communication protocol interaction architecture according to claim 1, characterized in that: The message receiving unit is used to receive message information sent by the corresponding opposite end, wherein the message information includes message data; The first message parsing module is used to parse the message information according to the first message depacketization information to obtain a first message, wherein the first message is a description of the message information, and the first message depacketization information describes information on mutual conversion between the message information and the first message; The first message receiving and dispatching module is used to call the first message feature analysis module to analyze the first message to obtain first message feature information, and dispatch the first message to the corresponding first message receiving and processing module according to the correspondence between the first message feature information and the corresponding first message feature information submodule of the first message receiving and processing module; The second message parsing submodule is used to convert the first message into a second message, where the second message is a description of the first message; The second message receiving and processing submodule is used to process the second message or forward it to a corresponding second message recipient; The corresponding first message characteristic information submodule records the first message characteristic information of the first message to be processed by the current first message receiving and processing module; The second message sending and dispatching module is used to receive the second message sent by the corresponding second message sender, and call the second message feature analysis module to analyze the second message to obtain second message feature information, and according to the correspondence between the second message feature information and the corresponding second message feature information submodule of the second message sending and processing module, dispatch the second message to the corresponding second message sending and processing module; The corresponding second message characteristic information submodule records the second message characteristic information of the second message to be processed by the current second message sending processing module; The default first message characteristic information submodule records the default first message characteristic information used when converting the second message into the first message; The second message encapsulation submodule is used to convert the second message into the first message according to the default first message characteristic information or the first message characteristic information associated with the second message itself; The first message packaging module is used to convert the first message into the message information according to the first message depacketization information; The message sending unit is used to send the message information to the corresponding opposite end.

3. The communication protocol interaction architecture according to claim 2, characterized in that: The message information also includes relevant information of the message data, and the relevant information is used to meet the need of parsing during the receiving process, or to meet the need of sending during the sending process.

4. The communication protocol interaction architecture according to claim 3, characterized in that: The first message parsing module is associated with a message extraction unit, and the message extraction unit is used to extract complete and valid message data from the message data stream.

5. The communication protocol interaction architecture according to claim 3 or 4, characterized in that: When the overall structure of the message data remains unchanged, if a new receiving command is to be added, it is implemented by adding a corresponding first message receiving processing module; if a new sending command is to be added, it is implemented by adding a corresponding second message sending processing module.

6. The communication protocol interaction architecture according to claim 5, characterized in that: When the overall structure of the message data remains unchanged, if the relevant fields of the message data of a certain function in the existing protocol are to be adjusted or expanded, the new receiving process is realized by adjusting or expanding the corresponding second message parsing submodule and the second message receiving and processing submodule, and the new sending process is realized by adjusting or expanding the corresponding second message packaging submodule.

7. The communication protocol interaction architecture according to claim 6, characterized in that: When the protocol version is changed, the first message decapsulation information only needs to be changed.

8. The communication protocol interaction architecture according to claim 7, characterized in that: When the running protocol needs to support both new and old overall formats of message data, it is achieved by changing the first message depacketization information and correspondingly changing the first message parsing module, the first message packaging module and the corresponding first message characteristic information.

9. The message interaction method of the communication protocol interaction architecture according to any one of claims 2 to 8, characterized in that: The method comprises: S1: The message receiving unit receives message information sent by the opposite end, and transmits the message information to the first message parsing module; S2: the first message parsing module parses the message information according to the first message decapsulation information to obtain a first message, and transmits the first message to the first message receiving and dispatching module; S3: the first message receiving and dispatching module calls the first message feature analysis module to analyze the first message to obtain first message feature information; and searches the corresponding first message feature information submodule of the first message receiving and processing module according to the first message feature information to obtain the corresponding first message receiving and processing module, and dispatches the first message to the corresponding first message receiving and processing module; S4: the first message receiving and processing module converts the first message into a second message via the second message parsing submodule, and transmits the second message to the second message receiving and processing submodule; S5: The second message receiving and processing submodule processes the second message or forwards it to a corresponding second message recipient; The second message sent by the second message receiving and processing submodule is associated or not associated with the first message characteristic information as needed; S6: The second message sending and dispatching module receives the second message sent by the corresponding second message sender, and calls the second message feature analysis module to analyze the second message to obtain second message feature information, searches the corresponding second message feature information submodule of the second message sending processing module according to the second message feature information to obtain the corresponding second message sending processing module, and dispatches the second message to the corresponding second message sending processing module; Wherein, the second message sender includes the second message receiving and processing submodule and other modules capable of sending the second message; S7: When the second message is associated with the first message characteristic information, the second message sending processing module converts the second message into the first message through the second message encapsulation submodule according to the first message characteristic information associated with the second message and transmits the first message to the first message encapsulation module; When the second message is not associated with the first message characteristic information, the second message sending processing module converts the second message into the first message through the second message encapsulation submodule according to the default first message characteristic information and transmits the first message to the first message encapsulation module; S8: The first message packaging module converts the first message into the message information according to the first message depacketization information, and transmits the message information to the message sending unit; S9: The message sending unit sends the message data in the message information to the corresponding opposite end.

10. The method according to claim 9, characterized in that When the first message parsing module is associated with a message extraction unit, the S2 further includes: The first message parsing module calls the message extraction unit to extract complete and valid message data from the message data stream.

Citation Information

Patent Citations

  • Message communication method and device based on industrial Internet protocol architecture

    CN110809008A

  • Terminal distribution information acquisition method, data acquisition device and communication system

    WO2012106861A1