CN106657149A - Communication protocol conversion method and device - Google Patents

Communication protocol conversion method and device Download PDF

Info

Publication number
CN106657149A
CN106657149A CN201710060240.4A CN201710060240A CN106657149A CN 106657149 A CN106657149 A CN 106657149A CN 201710060240 A CN201710060240 A CN 201710060240A CN 106657149 A CN106657149 A CN 106657149A
Authority
CN
China
Prior art keywords
communications protocol
message
string
field
target communication
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.)
Granted
Application number
CN201710060240.4A
Other languages
Chinese (zh)
Other versions
CN106657149B (en
Inventor
陈达辉
刘智慧
方俊
潘朝杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hundsun Technologies Inc
Original Assignee
Hundsun Technologies Inc
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Hundsun Technologies Inc filed Critical Hundsun Technologies Inc
Priority to CN201710060240.4A priority Critical patent/CN106657149B/en
Publication of CN106657149A publication Critical patent/CN106657149A/en
Application granted granted Critical
Publication of CN106657149B publication Critical patent/CN106657149B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/08Protocols for interworking; Protocol conversion

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)

Abstract

The disclosure provides a communication protocol conversion method and device. The method comprises the following steps: communication protocols are described in terms of format strings and the plurality of format strings corresponding to at least one communication protocol are saved; a message sending task is received, and service data and a target communication system identifier are received; a target communication protocol is determined according to the target communication system identification and the format strings corresponding to the target communication protocol are found; and a message in accord with the target communication protocol is generated in terms of the service data and the format strings and the message is sent to the target communication system. According to the disclosure, the communication protocol conversion method can reduce the development cost of the communication protocol conversion module and improve the project development efficiency.

Description

Communications protocol conversion method and device
Technical field
It relates to communication technical field, in particular to a kind of communications protocol of convertible multiple kinds Conversion method and device.
Background technology
In preposition communication system exploitation is communicated, it is often necessary to carry out to adapt to the self-defined communications protocol of Third party system System development.Existing self-defined communications protocol mainly has length to arrange and terminates format string arranges two kinds of conventional agreements:Length Agreement refers to sender's certain position write message length in messages, the message length mark in recipient's analytic message Know, and then receive complete message.Terminate format string agreement and refer to end mark of the sender in the tail end write agreement of message, connect Debit knows that reception is complete after end format string is received.
Form, position in message length in messages of the self-defined communications protocol of different Third party systems to message length Put the agreement such as definition of definition, terminating symbol different, preposition communication system developers generally need to be directed to each third party System is developed, or even after deployment operation, if third party's interface changes, developer also needs to carry out again to preposition logical News system develops compiling deployment.
Fig. 1 is the structural representation that a kind of existing preposition communication system docks multiple Third party systems.It is front with reference to Fig. 1 Communication system is put when Third party system is docked, a new system is often docked, it is necessary to develop a new communication module, will The request communication data of Third party system is converted to the real service request data for needing of preposition communication system and submits to preposition Communication system, and the business datum of preposition communication system response is converted into the communication of the self-defined communications protocol of matching third party Data return to corresponding Third party system.
Therefore, communication module development mode of the prior art is comparatively laborious, and easily error, in the project implementation, this The exploitation of class docking Third party system can take more workload toward contact, delay development progress.In order to save during project development Between, project development efficiency is improved, need a kind of efficient communications protocol conversion method.
It should be noted that information is only used for strengthening the reason of background of this disclosure disclosed in above-mentioned background section Solution, therefore can include not constituting the information to prior art known to persons of ordinary skill in the art.
The content of the invention
The purpose of the disclosure is to provide a kind of communications protocol conversion method and device, at least to a certain extent gram Take due to correlation technique restriction and defect and caused one or more problems.
According to an aspect of this disclosure, there is provided a kind of communications protocol conversion method, including:
With form string descriptor communications protocol, multiple format strings of at least one communications protocol of correspondence are preserved;
Receive message and send task, receive business datum and target communication system banner;
Target communication agreement is determined according to the target communication system banner, the lattice of the correspondence target communication agreement are searched Formula string;
The message for meeting the target communication agreement is generated according to the business datum and the format string, by the report Text is sent to the target communication system.
It is described that symbol is generated according to the business datum and the format string in a kind of exemplary embodiment of the disclosure Closing the message of the target communication agreement includes:
The format string is loaded as into descriptor array;
According to the business datum, according to the implication of each character mark of format string, traversal fills in the descriptor Array;
Output fills in the descriptor array for completing as message.
In a kind of exemplary embodiment of the disclosure, the use form string descriptor communications protocol includes:
The mapping relations in domain in field descritor, the information of Third party system and communications protocol are set;
Information, the mapping relations according to the Third party system and the actual communications protocol for receiving, determine institute The field type for stating the communications protocol of Third party system puts in order;
The field type is described using field descritor, is put in order according to the field type and is arranged the field descritor.
In a kind of exemplary embodiment of the disclosure, the field type includes length field, terminator-string domain, synchronization character Identifier field, length computation start mark, general character occupy-place and connection closed mark.
According to an aspect of this disclosure, there is provided a kind of communications protocol conversion method, including:
With form string descriptor communications protocol, multiple format strings of at least one communications protocol of correspondence are preserved;
Message request task is received, target communication system is recognized;
Target communication agreement is determined according to the target communication system, the form of the correspondence target communication agreement is searched String;
To receive complete from the message of the target communication system according to the format string, and recognize in the message Business datum.
In a kind of exemplary embodiment of the disclosure, it is described will be from the target communication system according to the format string Message receive completely include:
The format string is loaded as into descriptor array;
The message is received according to the implication of each character mark of format string, traversal fills in the descriptor array;
The business datum in the descriptor array for completing is filled in identification.
In a kind of exemplary embodiment of the disclosure, the use form string descriptor communications protocol includes:
The mapping relations in domain in field descritor, the information of Third party system and communications protocol are set;
Information, the mapping relations according to the Third party system and the actual communications protocol for receiving, determine institute The field type for stating the communications protocol of Third party system puts in order;
The field type is described using field descritor, is put in order according to the field type and is arranged the field descritor.
In a kind of exemplary embodiment of the disclosure, the field type includes length field, terminator-string domain, synchronization character Identifier field, length computation start mark, general character occupy-place and connection closed mark.
According to an aspect of this disclosure, there is provided a kind of communication protocol conversion device, including:
Format string generation module, for form string descriptor communications protocol, preserving many of at least one communications protocol of correspondence Individual format string;
Task receiver module, for receiving message task is sent, and receives business datum and target communication system banner;
Format string matching module, for determining target communication agreement according to the target communication system banner, searches correspondence The format string of the target communication agreement;
Message generation module, for generating according to the business datum and the format string target communication association is met The message of view, by the message target communication system is sent to.
In a kind of exemplary embodiment of the disclosure, the message generation module includes:
Array signal generating unit, for the format string to be loaded as into descriptor array;
Array fills in unit, for according to the business datum, according to the implication of each character mark of format string, time Go through and fill in the descriptor array;
Array output unit, the descriptor array for completing is filled in as message for output.
In a kind of exemplary embodiment of the disclosure, the format string generation module includes:
Element setting unit, for arranging field descritor, the information of Third party system and communications protocol in domain mapping Relation;
Protocol analysis unit, for according to the information of the Third party system, the mapping relations and the reality for receiving Border communications protocol, the field type for determining the communications protocol of the Third party system puts in order;
Protocol description unit, for describing the field type using field descritor, puts in order according to the field type Arrange the field descritor.
In a kind of exemplary embodiment of the disclosure, the field type includes length field, terminator-string domain, synchronization character Identifier field, length computation start mark, general character occupy-place and connection closed mark.
According to an aspect of this disclosure, there is provided a kind of communication protocol conversion device, including:
Format string generation module, for form string descriptor communications protocol, preserving many of at least one communications protocol of correspondence Individual format string;
Task receiver module, for receiving message request task, recognizes target communication system;
Format string matching module, for determining target communication agreement according to the target communication system, searches correspondence described The format string of target communication agreement;
Data extraction module, for will receive complete from the message of the target communication system according to the format string, And recognize the business datum in the message.
In a kind of exemplary embodiment of the disclosure, the data extraction module includes:
Array signal generating unit, for the format string to be loaded as into descriptor array;
Array fills in unit, and for receiving the message according to the implication of each character mark of format string, traversal is filled out Write the descriptor array;
Data identification unit, the business datum in the descriptor array for completing is filled in for identification.
In a kind of exemplary embodiment of the disclosure, the format string generation module includes:
Element setting unit, for arranging field descritor, the information of Third party system and communications protocol in domain mapping Relation;
Protocol analysis unit, for according to the information of the Third party system, the mapping relations and the reality for receiving Border communications protocol, the field type for determining the communications protocol of the Third party system puts in order;
Protocol description unit, for describing the field type using field descritor, puts in order according to the field type Arrange the field descritor.
In a kind of exemplary embodiment of the disclosure, the field type includes length field, terminator-string domain, synchronization character Identifier field, length computation start mark, general character occupy-place and connection closed mark.
The communications protocol conversion method that the disclosure is provided is various logical by using the form string descriptor being made up of field descritor News agreement, and generated or identification Third party system message using format string when communicating with Third party system, communications protocol is turned Mold changing block development process is changed to format string generating process.Generation is write due to generating format string relative to respectively each communications protocol Code is more simple, and enforcement personnel are not required to concern communication details, and format string generation module can be used for multiple times with primary development, many Secondary test checking, it is to avoid in the case where communications protocol code means are directly write, code efficiency and quality depend on programmer's technology The situation of ability, realizes flexible conversion multiple kinds, reduces communication exploitation threshold and workload, raising project development effect The effect of rate.
It should be appreciated that the general description of the above and detailed description hereinafter are only exemplary and explanatory, not The disclosure can be limited.
Description of the drawings
Accompanying drawing herein is merged in specification and constitutes the part of this specification, shows the enforcement for meeting the disclosure Example, and be used to explain the principle of the disclosure together with specification.It should be evident that drawings in the following description are only the disclosure Some embodiments, for those of ordinary skill in the art, on the premise of not paying creative work, can be with basis These accompanying drawings obtain other accompanying drawings.
Fig. 1 illustrates that a kind of existing preposition communication system docks the structural representation of multiple Third party systems.
Fig. 2 schematically shows a kind of flow chart of communications protocol conversion method in disclosure exemplary embodiment.
Fig. 3 schematically shows the flow chart of another kind of communications protocol conversion method in disclosure exemplary embodiment.
Fig. 4 schematically shows the structural representation of communications protocol conversion method in disclosure exemplary embodiment.
Fig. 5 A schematically show the stream that preposition communication system in disclosure exemplary embodiment receives Third party system information Journey schematic diagram.
Fig. 5 B schematically show preposition communication system in disclosure exemplary embodiment and send information to Third party system Schematic flow sheet.
Fig. 6 A schematically show the communications protocol schematic diagram of Third party system A in disclosure exemplary embodiment.
Fig. 6 B schematically show the communications protocol schematic diagram of Third party system B in disclosure exemplary embodiment.
Fig. 7 schematically shows a kind of block diagram of communication protocol conversion device in disclosure exemplary embodiment.
Fig. 8 schematically shows a kind of block diagram of another communication protocol conversion device in disclosure exemplary embodiment.
Specific embodiment
Example embodiment is described more fully with referring now to accompanying drawing.However, example embodiment can be with various shapes Formula is implemented, and is not understood as limited to example set forth herein;Conversely, thesing embodiments are provided so that the disclosure will more Fully and completely, and by the design of example embodiment those skilled in the art is comprehensively conveyed to.Described feature, knot Structure or characteristic can be combined in any suitable manner in one or more embodiments.In the following description, there is provided perhaps Many details are so as to providing fully understanding for embodiment of this disclosure.It will be appreciated, however, by one skilled in the art that can Omit one or more in the specific detail to put into practice the technical scheme of the disclosure, or other sides can be adopted Method, constituent element, device, step etc..In other cases, be not shown in detail or describe known solution a presumptuous guest usurps the role of the host avoiding and So that each side of the disclosure thickens.
Additionally, accompanying drawing is only the schematic illustrations of the disclosure, identical reference represents same or similar portion in figure Point, thus repetition thereof will be omitted.Some block diagrams shown in accompanying drawing are functional entitys, not necessarily necessary and thing Reason or the entity being logically independent are corresponding.These functional entitys can be realized using software form, or at one or more These functional entitys are realized in hardware module or integrated circuit, or in heterogeneous networks and/or processor device and/or microcontroller These functional entitys are realized in device.
Disclosure example embodiment is described in detail below in conjunction with the accompanying drawings.
Fig. 2 is a kind of flow chart of communications protocol conversion method in disclosure exemplary embodiment.
With reference to Fig. 2, communications protocol conversion method 100 can include:
Step S102, with form string descriptor communications protocol, preserves multiple format strings of at least one communications protocol of correspondence.
Step S104, receives message and sends task, receives business datum and target communication system banner.
Step S106, according to the target communication system banner target communication agreement is determined, is searched the correspondence target and is led to The format string of news agreement.
Step S108, the report for meeting the target communication agreement is generated according to the business datum and the format string Text, by the message target communication system is sent to.
The communications protocol conversion method that the disclosure is provided is various logical by using the form string descriptor being made up of field descritor News agreement, and generated or identification Third party system message using format string when communicating with Third party system, communications protocol is turned Mold changing block development process is changed to format string generating process.Generation is write due to generating format string relative to respectively each communications protocol Code is more simple, and enforcement personnel are not required to concern communication details, and format string generation module can be used for multiple times with primary development, many Secondary test checking, it is to avoid in the case where communications protocol code means are directly write, code efficiency and quality depend on programmer's technology The situation of ability, realizes flexible conversion multiple kinds, reduces communication exploitation threshold and workload, raising project development effect The effect of rate.
Each step of communications protocol conversion method 200 is described in detail below.
Step S102, with form string descriptor communications protocol, preserves multiple format strings of at least one communications protocol of correspondence.
In a kind of exemplary embodiment of the disclosure, included with form string descriptor communications protocol:
1) mapping relations in domain in field descritor, the information of Third party system and communications protocol are set.
This step can be realized by storing a mapping table.The mapping table can store field descritor, Third party system letter The mapping relations in each domain in breath and communications protocol.Wherein, field descritor is used to describe each domain in communication protocol Type, such as length field, end format string domain, synchronization character identifier field, length computation start mark, general character occupy-place, connection pass The field types such as mark are closed, some additional modified descriptions can also be added to field descritor in description.
Field descritor can be defined as below mode to adopt, but be not limited to this.
A/a:Character occupy-place symbol, for describing message in one piece of data, occupy-place symbol immediately numeral represent the character Byte number is taken, capitalization is represented and abandons data.For example, in transmission process, A16 is represented to give up and is sent correspondence position in message 16 byte datas, recipient will not receive this 16 bytes;A16 is represented from sender and is received 16 bytes during reception And abandon, this content is not included in the message that client is finally received.
L/l:Length occupy-place symbol, for describing length field, needs are additionally implemented for describing the mark of length field actual type, Such as 32 without symbolic network syllable sequence shaping, form string type and actual occupancy digit.Can closely follow after length occupy-place symbol Length storage class, for example, LN32 represents 32 network bytes sequences, and LN16 represents 16 network bytes sequences, and LC8 represents 8 bytes Character type length.Length field is the primary identity for judging message size, and in transmission process, program is calculated in this domain of addition automatically Hold, alphabet size is write insensitive.During reception, program judges actual message length by obtaining the value in this domain.Need Noticing is, capitalization represents that the content for giving up this domain is not put into final message.
H/h:Heading is identified, and for describing heading position, when needing to describe data body length, this mark can be used In it is determined that calculating the starting position of data body length.During transmission, program according to this position calculation length, write unwise by alphabet size Sense;During reception, program judges whether message receives completely with reference to this mark.Capitalization represents the number abandoned before this mark According in not being written into final message.
S/s:Synchronization character, for describing some application layer protocols in synchronization character.It is tight after synchronization character occupy-place symbol Encode with 16 binary datas of synchronization character content.During transmission, program fills this domain automatically, and alphabet size is write insensitive;Receive When, the content in this domain of program ver-ify, capitalization represents that the data for giving up this domain are not put into final message.
T/t:End mark string, the application layer protocol of complete message is determined for describing some using end mark.End mark Immediately following the 16 binary datas coding of physical end symbol after number.During transmission, program adds this domain content automatically, and alphabet size is write unwise Sense;During reception, capitalization is represented gives up this end mark string, is not put into final message.
$:Stream terminates descriptor, and for describing some using the semi-closed modes of TCP the application layer for completing message is determined Agreement.During transmission, this symbol can close transmitting terminal with trigger after transmission data are finished;During reception, this symbol can make Program receiving data is until connection disconnects.
2) information according to Third party system, mapping relations and the actual communications protocol for receiving, determine that third party is The field type of the communications protocol of system puts in order.
In this step, can according to the Third party system information of user input, based on the actual communications protocol for receiving, With reference to the mapping table stored in abovementioned steps, actual communications protocol is analyzed, determine the field type of the communications protocol of Third party system Put in order.
3) field type is described using field descritor, is put in order arrangement field descritor according to field type.
After obtaining being put in order according to above-mentioned field type, each field type in the order is replaced using field descritor, So as to be combined into the format string for describing the communications protocol.Field type in this step can include length field, terminator-string domain, Synchronization character identifier field, length computation start mark, general character occupy-place and connection closed mark, but those skilled in the art can root Freely arrange according to actual conditions, the disclosure is not limited.
In certain embodiments, this step unit can provide figure configuration interface, and form is arranged or checked with convenient use person String.
Step S104, receives message and sends task, receives business datum and target communication system banner.Method 100 can Communication packet is sent to one or more Third party systems for preposition communication system.When message transmission task is received, can To extract the business datum and target communication system banner of this subtask.Goal systems mark can be for preposition communication system certainly Definition, for example, can be numeral, letter or character string etc..
Step S106, according to the target communication system banner target communication agreement is determined, is searched the correspondence target and is led to The format string of news agreement.It is determined that after target communication system, the target can be determined according to the mapping table stored in abovementioned steps The communications protocol of communication system, and load the corresponding format string of the communications protocol.
Step S108, the report for meeting the target communication agreement is generated according to the business datum and the format string Text, by the message target communication system is sent to.
It is described that symbol is generated according to the business datum and the format string in a kind of exemplary embodiment of the disclosure Closing the message of the target communication agreement includes:
1) format string is loaded as into descriptor array.
Format string is loaded as descriptor array by field descritor that can be in format string, is arranged according to field descritor order The array is arranged, and confirms array size.
2) according to the business datum, according to the implication of each character mark of format string, traversal fills in the description Symbol array.In certain embodiments, it is possible to use Switch-Case structures realize traversal descriptor array.
3) output fills in the descriptor array for completing as message.
Fig. 3 is the flow chart of another kind of communications protocol conversion method in disclosure exemplary embodiment.
With reference to Fig. 3, communications protocol conversion method 200 can include:
Step S202, with form string descriptor communications protocol, preserves multiple format strings of at least one communications protocol of correspondence.
Step S204, receives message request task, recognizes target communication system.
Step S206, according to the target communication system target communication agreement is determined, searches the correspondence target communication association The format string of view.
Step S208, will receive complete according to the format string from the message of the target communication system, and recognize institute State the business datum in message.
Method 200 can be used for the message that preposition communication system obtains multiple Third party systems, improve communications protocol conversion Efficiency.
Each step of communications protocol conversion method 200 is described in detail below.
In step S202, with form string descriptor communications protocol, multiple format strings of at least one communications protocol of correspondence are preserved.
In a kind of exemplary embodiment of the disclosure, the use form string descriptor communications protocol includes:Domain description is set The mapping relations in domain in symbol, the information of Third party system and communications protocol;Information according to the Third party system, described reflect Relation and the actual communications protocol for receiving are penetrated, the field type for determining the communications protocol of the Third party system puts in order; The field type is described using field descritor, is put in order according to the field type and is arranged the field descritor.
In a kind of exemplary embodiment of the disclosure, the field type includes length field, terminator-string domain, synchronization character Identifier field, length computation start mark, general character occupy-place and connection closed mark.
Each sub-step of step S202 can refer to the detailed description in step S102, and the disclosure is repeated no more in this.
Step S204, receives message request task, recognizes target communication system.
When preposition communication system needs to receive the message of one or more Third party systems, it is only necessary to send destinations traffic system Device of the system mark to implementation method 200.
Step S206, according to the target communication system target communication agreement is determined, searches the correspondence target communication association The format string of view.
Step S208, will receive complete according to the format string from the message of the target communication system, and recognize institute State the business datum in message.
In a kind of exemplary embodiment of the disclosure, it is described will be from the target communication system according to the format string Message receive completely include:
1) format string is loaded as into descriptor array.
2) message is received according to the implication of each character mark of format string, traversal fills in the descriptor counts Group.
In this step, it can be determined that whether the message for receiving meets the description of field descritor in format string, and according to Field descritor traversal fills in descriptor array.
3) business datum in the descriptor array for completing is filled in identification.
Said method 100 is described in detail with method 200 below by specific embodiment.
Fig. 4 schematically shows the structural representation of communications protocol conversion method in disclosure exemplary embodiment.With reference to figure 4, the disclosure provide communications protocol conversion method can by Third party system A, B......N and preposition communication system it Between increase a communication protocol conversion device transmitting and change between preposition communication system and Third party system A, B......N Communication data, business datum is separated with communications protocol, be preposition communication system shielding Third party system difference communications protocol Difference.
According to this method, preposition communication system, only need to be by business number when data are sent to Third party system A, B.....N According to and Third party system mark pass to communication protocol conversion device, communication protocol conversion device can be according to identifier lookup correspondence The format string of Third party system, is processed according to format string to business datum, and final generation meets the Third party system The packet of communications protocol specification, and it is sent to specified Third party system.When preposition communication system to Third party system A, During B....N request datas, only Third party system mark need to be informed communication protocol conversion device, communication protocol conversion device meeting According to identifier lookup correspondence format string, according to the message for meeting communications protocol specification that format string sends over Third party system Receive complete, and isolate business datum, business datum is returned into preposition communication system.Therefore, this communications protocol conversion method Code development process can be substituted by configuration format string, development efficiency is improved.
Fig. 5 A schematically show the stream that preposition communication system in disclosure exemplary embodiment receives Third party system information Journey schematic diagram.
Fig. 5 B schematically show preposition communication system in disclosure exemplary embodiment and send information to Third party system Schematic flow sheet.
With reference to Fig. 5 A and Fig. 5 B, when communicating between preposition communication system and two systems (A, B), it is necessary first to confirm Two communication systems distinguish corresponding communications protocol.
Fig. 6 A are the communications protocol schematic diagrames of Third party system A.
Fig. 6 B are the communications protocol schematic diagrames of Third party system B.
For convenience of describing, it is now assumed that certain inquiry business request data of two systems is " john | XMJ&@SSD | ", answer Answer evidence is " john | 1200.30 | " (being described with the format string of C language).
With reference to Fig. 6 A and Fig. 6 B, during preposition communication system docking system A:
The request communication packet of transmission is " x01 x020014john | XMJ&@SSD | ".Wherein, 0014 it is because john | XMJ&@SSD | the byte of service request message length 14,4 character type length are stored as in a computer 0014.
The response communication packet of reception is " x01 x020013john | 1200.30 | ".Wherein, 0013 it is because john | 1200.30 | the byte of business response message length 13,4 character type length are stored as in the calculation 0013.
During docking system B:
The request communication packet of transmission for " x00 x00 x00 x0ejohn | XMJ&@SSD | ".Because network bytes sequence is Low address preserves high-order, therefore, length 14 can save as in a computer x00 x00 x00 x0e.
The response communication packet of reception for " x00 x00 x00 x0djohn | 1200.30 | ".Because network bytes sequence is Low address preserves high-order, length 13 be saved as in a computer x00 x00 x00 x0d.
Communications protocol A/B different for two, communication protocol conversion device is according to the third party system stored in mapping table The communications protocol specification of system, with reference to field descritor definition, the process using each communications protocol of form string descriptor is as follows:
The first step:Generate and send and receive format string for two Third party system communications protocol.In some embodiments In, sending and receiving format string can be identical.
During docking system A, format string can be generated according to the field descritor of definition and communications protocol specification S0102LC4Ha*.Due to system A communications protocol with a synchronization character x01 x02 beginnings, therefore format string accounts for S0102 Synchronization character identifier field in the presentation protocol of position, the length field in agreement closelys follow synchronization character identifier field, and data type is 4 byte character types Data, therefore length field can be described with LC4.Immediately business datum after length field in agreement, and length field only describes business Data itself, therefore can be represented with H and start to calculate the real length of message from there, one piece is described with a* and is determined by length Data.The SLH of capitalization and a of small letter represented when being ultimately transferred to preposition communication system, a retained business data itself.
During docking system B, format string LN32Ha* can be generated according to the description of the domain of definition and communications protocol specification.Wherein, Due to system B communications protocol with the length that 32 network bytes sequences start business datum, therefore format string are described with LN32 starts;S represents synchronization character description field, and 0102 is the additional description to S, represents 16 system characters of synchronization character content String;L represents length field, and C4/N32 is the additional description to length, indicates the storage mode of length;H represents that length computation starts Mark;A represents general character occupy-place domain, and " * " is the additional description to A, represents that this domain, without clear and definite length, is needed according to actual number According to being calculated.
Second step:The send/receive operation of communication protocol conversion device is called, using format string business number is sent/receive According to.
During docking system A, preposition communication system with " S0102LC4Ha* " format string send business datum " john | XMJ&@ SSD | ", the process of communication protocol conversion device is included:
A by format string " S0102LC4Ha* " be loaded as comprising synchronization character identifier field, length field, length computation starting position domain, The descriptor array in character occupy-place domain.
B traversal descriptor arrays are processed:
Section 1, processes synchronization character identifier field S0102:According to additional description, add the transmission block of " x01 x02 ", tire out Product length 2 (cumulative length is used to insert the length field in communications protocol).
Section 2, treated length domain LC4:According to additional description, add the length field reserved block of 4 bytes, accumulation length Degree 6.
Section 3, treated length is calculated and starts mark:Represent the value of real write communications protocol length field from follow-up herein Item starts to calculate, therefore it is 0 to correct cumulative length.
Section 4, processes general character occupy-place:According to additional description, add a transmission comprising whole business datum Block, cumulative length is the length of business datum, and because business datum length is 14, therefore cumulative length is set to 14.
0014 string is write length field reserved block by c according to cumulative length 14 and the additional description c4 of length field.
D calls actual communication to send the data in transmission block successively.From the foregoing it will be appreciated that have 3 transmission blocks to generate, the One piece of content is synchronization character " x01 x02 ", and second piece of content is length field " 0014 ", and the 3rd piece of content is business datum " john | XMJ&@SSD | ", therefore the final communication packet sent to system A is " x01 x020014john | XMJ&@SSD | ", Meet the communications protocol of system A.
During docking system A, preposition communication system with the message data of " S0102LC4Ha* " format string reception system A " X01 x020013john | 1200.30 | ", the process of communication protocol conversion device is included:
A by format string " S0102LC4Ha* " be loaded as comprising synchronization character identifier field, length field, length computation starting position domain, The descriptor array in character occupy-place domain.
B traversal descriptor arrays are processed:
Section 1, processes synchronization character identifier field:According to additional description, receive 2 byte datas and with " x01 x02 " compared Compared with discarding does not meet the data of description.
Section 2, treated length domain:According to additional description, 4 byte datas " 0013 " are received, it is long that conversion obtains real data Degree 13, discarding does not meet the data of description.
Section 3, treated length is calculated and starts mark:According to the data length for having obtained, mark length to be received is 13, according to additional description, discarding length computation starts the data before identifying.
Section 4, processes general character occupy-place:According to additional description and length to be received, 13 byte datas are received, and will This data is added in data accepted.
Data accepted " john | 1200.30 | " is passed to preposition communication system by c as response message.
During docking system B, preposition communication system with " LN32Ha* " format string send business datum " john | XMJ&@SSD | ", the process of communication protocol conversion device is included:
A is loaded as format string " LN32Ha* " to retouch comprising length field, length computation starting position domain, character occupy-place domain State symbol array.
B traversal descriptor arrays are processed:
Section 1, treated length domain:According to additional description, add the length field reserved block of 4 bytes, cumulative length 4.
Section 2, treated length is calculated and starts mark:Represent the value of real write communications protocol length field from follow-up herein Item starts to calculate, therefore it is 0 to correct cumulative length.
Section 3, processes general character occupy-place:According to additional description, add a transmission comprising whole business datum Block, cumulative length is business datum length, and because business datum length is 14, therefore cumulative length is set to 14.
C according to cumulative length 14 and the additional description N32 of length field, will " x00 x00 x00 x0e " write length field reserves Block.
D calls actual communication to send the data in transmission block successively.From the foregoing it will be appreciated that two transmission blocks are had, first Block be length field " x00 x00 x00 x0e ", second piece is business datum " john | XMJ&@SSD ", therefore final to system B The communication packet of transmission for " x00 x00 x00 x0ejohn | XMJ&@SSD | ", meet the communications protocol of system B.
During docking system B, preposition communication system with the message data of " LN32Ha* " format string reception system B " x00 X00 x00 x0d john | 1200.30 | ", the process of communication protocol conversion device is included:
A is loaded as format string " LN32Ha* " to retouch comprising length field, length computation starting position domain, character occupy-place domain State symbol array.
B traversal descriptor arrays are processed:
Section 1, treated length domain:According to additional description, receive 4 byte datas, obtain data " x00 x00 x00 X0d ", according to adding description information N32, changes acquisition real data length 13 (16 system 0d values are into 13), and discarding does not meet The data of description.
Section 2, treated length is calculated and starts mark:According to the data length for having obtained, mark length to be received is 13, according to additional description, it is discarded in the data that length computation starts before identifying.
Section 3, processes general character occupy-place:According to additional description and length to be received, 13 byte datas are received, and will This data is added in data accepted.
Data accepted " john | 1200.30 | " is given preposition communication system by c.
Corresponding to said method embodiment, the disclosure also provides a kind of communication protocol conversion device, can be used for performing State embodiment of the method.
Fig. 7 schematically shows a kind of block diagram of communication protocol conversion device in disclosure exemplary embodiment.With reference to figure 7, communication protocol conversion device 300 can be used for being converted to the business datum of preposition communication system and meet one or more third parties The message of the corresponding communications protocol of system is simultaneously transmitted.Device 300 can be received including format string generation module 302, task Module 304, format string matching module 306 and message generation module 308.
Format string generation module 302 can be used for form string descriptor communications protocol, preserve the communication of correspondence at least one association Multiple format strings of view.
Task receiver module 304 can be used for receiving message transmission task, receive business datum and target communication system Mark.
Format string matching module 306 can be used for determining target communication agreement according to the target communication system banner, look into Look for the format string of the correspondence target communication agreement.
Message generation module 308 can be used for meeting the target according to the business datum and format string generation The message of communications protocol, by the message target communication system is sent to.
Wherein, format string generation module 302 can include:
Element setting unit, for arranging field descritor, the information of Third party system and communications protocol in domain mapping Relation.
Protocol analysis unit, for according to the information of the Third party system, the mapping relations and the reality for receiving Border communications protocol, the field type for determining the communications protocol of the Third party system puts in order.
In a kind of exemplary embodiment of the disclosure, the field type includes length field, terminator-string domain, synchronization character Identifier field, length computation start mark, general character occupy-place and connection closed mark.
Protocol description unit, for describing the field type using field descritor, puts in order according to the field type Arrange the field descritor.
Message generation module 308 can include:
Array signal generating unit, for the format string to be loaded as into descriptor array.
Array fills in unit, for according to the business datum, according to the implication of each character mark of format string, time Go through and fill in the descriptor array.
Array output unit, the descriptor array for completing is filled in as message for output.
Fig. 8 schematically shows a kind of block diagram of another communication protocol conversion device in disclosure exemplary embodiment.With reference to Fig. 8, communication protocol conversion device 400 can be used for receiving the message of one or more Third party systems and being converted into preposition logical The business datum that news system is capable of identify that.Device 400 can include format string generation module 402, task receiver module 404, lattice Formula String matching module 406 and data extraction module 408.
Format string generation module 402 can be used for form string descriptor communications protocol, preserve the communication of correspondence at least one association Multiple format strings of view.
Task receiver module 404 can be used for receiving message request task, recognize target communication system.
Format string matching module 406 can be used for determining target communication agreement according to the target communication system that it is right to search Answer the format string of the target communication agreement.
Data extraction module 408 can be used for be received from the message of the target communication system according to the format string Completely, and the business datum in the message is recognized.
Wherein, format string generation module 402 can include:
Element setting unit, for arranging field descritor, the information of Third party system and communications protocol in domain mapping Relation.
Protocol analysis unit, for according to the information of the Third party system, the mapping relations and the reality for receiving Border communications protocol, the field type for determining the communications protocol of the Third party system puts in order.
In a kind of exemplary embodiment of the disclosure, the field type includes length field, terminator-string domain, synchronization character Identifier field, length computation start mark, general character occupy-place and connection closed mark.
Protocol description unit, for describing the field type using field descritor, puts in order according to the field type Arrange the field descritor.
Data extraction module 408 can include:
Array signal generating unit, for the format string to be loaded as into descriptor array.
Array fills in unit, and for receiving the message according to the implication of each character mark of format string, traversal is filled out Write the descriptor array.
Data identification unit, the business datum in the descriptor array for completing is filled in for identification.
Because each function of device 300, device 400 is described in detail in its corresponding embodiment of the method, this public affairs Open and repeated no more in this.
In certain embodiments, device 300 can be combined into a device with device 400, perform preposition communication system pair The message of one or more Third party systems sends task and message receives task.
Those skilled in the art will readily occur to its of the disclosure after considering specification and putting into practice invention disclosed herein Its embodiment.The application is intended to any modification, purposes or the adaptations of the disclosure, these modifications, purposes or Person's adaptations follow the general principle of the disclosure and including the undocumented common knowledge in the art of the disclosure Or conventional techniques.Description and embodiments are considered only as exemplary, and the true scope of the disclosure and spirit are by appended Claim is pointed out.

Claims (16)

1. a kind of communications protocol conversion method, it is characterised in that include:
With form string descriptor communications protocol, multiple format strings of at least one communications protocol of correspondence are preserved;
Receive message and send task, receive business datum and target communication system banner;
Target communication agreement is determined according to the target communication system banner, the form of the correspondence target communication agreement is searched String;
The message for meeting the target communication agreement is generated according to the business datum and the format string, the message is sent out Give the target communication system.
2. communications protocol conversion method according to claim 1, it is characterised in that it is described according to the business datum and The message that the format string generation meets the target communication agreement includes:
The format string is loaded as into descriptor array;
According to the business datum, according to the implication of each character mark of format string, traversal fills in the descriptor array;
Output fills in the descriptor array for completing as message.
3. communications protocol conversion method according to claim 1, it is characterised in that the use form string descriptor communications protocol Including:
The mapping relations in domain in field descritor, the information of Third party system and communications protocol are set;
Information, the mapping relations according to the Third party system and the actual communications protocol for receiving, determine described The field type of the communications protocol of three method, systems puts in order;
The field type is described using field descritor, is put in order according to the field type and is arranged the field descritor.
4. communications protocol conversion method according to claim 3, it is characterised in that the field type includes length field, knot Beam character string domain, synchronization character identifier field, length computation start mark, general character occupy-place and connection closed mark.
5. a kind of communications protocol conversion method, it is characterised in that include:
With form string descriptor communications protocol, multiple format strings of at least one communications protocol of correspondence are preserved;
Message request task is received, target communication system is recognized;
Target communication agreement is determined according to the target communication system, the format string of the correspondence target communication agreement is searched;
To receive complete from the message of the target communication system according to the format string, and recognize the business in the message Data.
6. communications protocol conversion method according to claim 5, it is characterised in that it is described will be from according to the format string The message of the target communication system is received completely to be included:
The format string is loaded as into descriptor array;
The message is received according to the implication of each character mark of format string, traversal fills in the descriptor array;
The business datum in the descriptor array for completing is filled in identification.
7. communications protocol conversion method according to claim 5, it is characterised in that the use form string descriptor communications protocol Including:
The mapping relations in domain in field descritor, the information of Third party system and communications protocol are set;
Information, the mapping relations according to the Third party system and the actual communications protocol for receiving, determine described The field type of the communications protocol of three method, systems puts in order;
The field type is described using field descritor, is put in order according to the field type and is arranged the field descritor.
8. communications protocol conversion method according to claim 7, it is characterised in that the field type includes length field, knot Beam character string domain, synchronization character identifier field, length computation start mark, general character occupy-place and connection closed mark.
9. a kind of communication protocol conversion device, it is characterised in that include:
Format string generation module, for form string descriptor communications protocol, preserving multiple lattice of at least one communications protocol of correspondence Formula string;
Task receiver module, for receiving message task is sent, and receives business datum and target communication system banner;
Format string matching module, for determining target communication agreement according to the target communication system banner, searches correspondence described The format string of target communication agreement;
Message generation module, for generating according to the business datum and the format string target communication agreement is met Message, by the message target communication system is sent to.
10. communication protocol conversion device according to claim 9, it is characterised in that the message generation module includes:
Array signal generating unit, for the format string to be loaded as into descriptor array;
Array fills in unit, for according to the business datum, according to the implication of each character mark of format string, traversal to be filled out Write the descriptor array;
Array output unit, the descriptor array for completing is filled in as message for output.
11. communication protocol conversion devices according to claim 9, it is characterised in that the format string generation module includes:
Element setting unit, for arranging field descritor, the information of Third party system and communications protocol in domain mapping relations;
Protocol analysis unit, for logical according to the information of the Third party system, the mapping relations and the reality for receiving News agreement, the field type for determining the communications protocol of the Third party system puts in order;
Protocol description unit, for describing the field type using field descritor, puts in order according to the field type and arranges institute State field descritor.
12. communication protocol conversion devices according to claim 11, it is characterised in that the field type include length field, Terminator-string domain, synchronization character identifier field, length computation start mark, general character occupy-place and connection closed mark.
13. a kind of communication protocol conversion devices, it is characterised in that include:
Format string generation module, for form string descriptor communications protocol, preserving multiple lattice of at least one communications protocol of correspondence Formula string;
Task receiver module, for receiving message request task, recognizes target communication system;
Format string matching module, for determining target communication agreement according to the target communication system, searches the correspondence target The format string of communications protocol;
Data extraction module, for will receive complete from the message of the target communication system according to the format string, and knows Business datum in not described message.
14. communication protocol conversion devices according to claim 13, it is characterised in that the data extraction module includes:
Array signal generating unit, for the format string to be loaded as into descriptor array;
Array fills in unit, and for receiving the message according to the implication of each character mark of format string, traversal fills in institute State descriptor array;
Data identification unit, the business datum in the descriptor array for completing is filled in for identification.
15. communication protocol conversion devices according to claim 13, it is characterised in that the format string generation module bag Include:
Element setting unit, for arranging field descritor, the information of Third party system and communications protocol in domain mapping relations;
Protocol analysis unit, for logical according to the information of the Third party system, the mapping relations and the reality for receiving News agreement, the field type for determining the communications protocol of the Third party system puts in order;
Protocol description unit, for describing the field type using field descritor, puts in order according to the field type and arranges institute State field descritor.
16. communication protocol conversion devices according to claim 15, it is characterised in that the field type include length field, Terminator-string domain, synchronization character identifier field, length computation start mark, general character occupy-place and connection closed mark.
CN201710060240.4A 2017-01-24 2017-01-24 Communication protocol conversion method and device Active CN106657149B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710060240.4A CN106657149B (en) 2017-01-24 2017-01-24 Communication protocol conversion method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710060240.4A CN106657149B (en) 2017-01-24 2017-01-24 Communication protocol conversion method and device

Publications (2)

Publication Number Publication Date
CN106657149A true CN106657149A (en) 2017-05-10
CN106657149B CN106657149B (en) 2020-03-17

Family

ID=58841442

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710060240.4A Active CN106657149B (en) 2017-01-24 2017-01-24 Communication protocol conversion method and device

Country Status (1)

Country Link
CN (1) CN106657149B (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107547574A (en) * 2017-10-31 2018-01-05 哈尔滨工业大学 A kind of communication system and method based on puppy parc
CN108933779A (en) * 2018-05-23 2018-12-04 和芯星通科技(北京)有限公司 Input blended data stream recognition method and device, computer readable storage medium
CN109361628A (en) * 2018-10-16 2019-02-19 深圳壹账通智能科技有限公司 Message assemble method, device, computer equipment and storage medium
CN110113318A (en) * 2019-04-16 2019-08-09 深圳壹账通智能科技有限公司 Front-end system data processing method, device, computer equipment and storage medium
CN110275532A (en) * 2019-06-21 2019-09-24 珠海格力智能装备有限公司 Control method and device, the control method and device of visual apparatus of robot
CN110381050A (en) * 2019-07-12 2019-10-25 中国人民解放军战略支援部队信息工程大学 The multi-protocols conversion method of calibration and device of data packet
CN111385292A (en) * 2020-03-04 2020-07-07 西安旌旗电子股份有限公司 Descriptor-based protocol message and data interaction method and system
CN112054916A (en) * 2019-06-06 2020-12-08 烽火通信科技股份有限公司 Method and system for automatic event conversion
CN113596045A (en) * 2021-08-03 2021-11-02 神州灵云(北京)科技有限公司 User-defined service analysis method
CN117651084A (en) * 2024-01-26 2024-03-05 井芯微电子技术(天津)有限公司 Heterogeneous protocol message processing method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1635763A (en) * 2003-12-26 2005-07-06 中国电子科技集团公司第三十研究所 General coding decoding method for high layer application of abstract syntax representation
CN101267378A (en) * 2008-05-04 2008-09-17 海信集团有限公司 Communication method and device between terminals in LAN
CN103457845A (en) * 2013-09-09 2013-12-18 江南大学 Conversion technology capable of being configured with multiple protocols
CN104753958A (en) * 2015-04-17 2015-07-01 深圳市英威腾电气股份有限公司 Card and method for converting communication protocols

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1635763A (en) * 2003-12-26 2005-07-06 中国电子科技集团公司第三十研究所 General coding decoding method for high layer application of abstract syntax representation
CN100518171C (en) * 2003-12-26 2009-07-22 中国电子科技集团公司第三十研究所 General coding decoding method for high layer application of abstract syntax representation
CN101267378A (en) * 2008-05-04 2008-09-17 海信集团有限公司 Communication method and device between terminals in LAN
CN103457845A (en) * 2013-09-09 2013-12-18 江南大学 Conversion technology capable of being configured with multiple protocols
CN104753958A (en) * 2015-04-17 2015-07-01 深圳市英威腾电气股份有限公司 Card and method for converting communication protocols

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107547574B (en) * 2017-10-31 2020-08-25 哈尔滨工业大学 Communication system and method based on universal protocol
CN107547574A (en) * 2017-10-31 2018-01-05 哈尔滨工业大学 A kind of communication system and method based on puppy parc
CN108933779A (en) * 2018-05-23 2018-12-04 和芯星通科技(北京)有限公司 Input blended data stream recognition method and device, computer readable storage medium
CN108933779B (en) * 2018-05-23 2021-12-07 和芯星通科技(北京)有限公司 Input mixed data stream identification method and device, and computer readable storage medium
CN109361628A (en) * 2018-10-16 2019-02-19 深圳壹账通智能科技有限公司 Message assemble method, device, computer equipment and storage medium
CN109361628B (en) * 2018-10-16 2022-04-12 深圳壹账通智能科技有限公司 Message assembling method and device, computer equipment and storage medium
CN110113318A (en) * 2019-04-16 2019-08-09 深圳壹账通智能科技有限公司 Front-end system data processing method, device, computer equipment and storage medium
CN112054916A (en) * 2019-06-06 2020-12-08 烽火通信科技股份有限公司 Method and system for automatic event conversion
CN110275532B (en) * 2019-06-21 2020-12-15 珠海格力智能装备有限公司 Robot control method and device and visual equipment control method and device
CN110275532A (en) * 2019-06-21 2019-09-24 珠海格力智能装备有限公司 Control method and device, the control method and device of visual apparatus of robot
CN110381050A (en) * 2019-07-12 2019-10-25 中国人民解放军战略支援部队信息工程大学 The multi-protocols conversion method of calibration and device of data packet
CN111385292A (en) * 2020-03-04 2020-07-07 西安旌旗电子股份有限公司 Descriptor-based protocol message and data interaction method and system
CN111385292B (en) * 2020-03-04 2022-08-16 西安旌旗电子股份有限公司 Descriptor-based protocol message and data interaction method and system
CN113596045A (en) * 2021-08-03 2021-11-02 神州灵云(北京)科技有限公司 User-defined service analysis method
CN113596045B (en) * 2021-08-03 2023-08-11 神州灵云(北京)科技有限公司 Custom service analysis method
CN117651084A (en) * 2024-01-26 2024-03-05 井芯微电子技术(天津)有限公司 Heterogeneous protocol message processing method and device, electronic equipment and storage medium
CN117651084B (en) * 2024-01-26 2024-04-19 井芯微电子技术(天津)有限公司 Heterogeneous protocol message processing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN106657149B (en) 2020-03-17

Similar Documents

Publication Publication Date Title
CN106657149A (en) Communication protocol conversion method and device
CN108462758A (en) Bank-corporate express communication means, device, equipment and computer readable storage medium
CN108491373A (en) A kind of entity recognition method and system
CN105471917A (en) Data transmission method and system
CN110741573A (en) Method and system for selectively propagating transactions using network coding in a blockchain network
CN104079571B (en) A kind of method and device for recognizing Android simulator
CN112817602B (en) JSON format data transmitting and receiving method, device and medium
CN103841111A (en) Method for preventing data from being submitted repeatedly and server
CN109660639A (en) A kind of data uploading method, equipment, system and medium
CN109460220A (en) The predefined code generating method of message, device, electronic equipment and storage medium
CN109933269A (en) Method, equipment and the computer storage medium that small routine is recommended
CN112585927A (en) Communication link detection method, device and system and movable platform
CN108667732A (en) A kind of message forwarding method and device
CN108632020A (en) Data transmission method for uplink, method of reseptance and device
CN111884833A (en) Simulation system integration method based on network virtualization technology
CN116723058B (en) Network attack detection and protection method and device
US10574392B2 (en) System. methods and devices for transmitting and/or receiving data using an inter communication link
CN108681760A (en) Data transmission method for uplink, method of reseptance and device
CN110222282A (en) Data processing method, device, server and storage medium
CN108063986A (en) Frame number bearing method, the apparatus and system of multichannel passive optical network
KR20180059385A (en) Apparatus for generating common container connecting messages transmitted through a plurality of low power wide area interfaces to open cloud system
US10339091B2 (en) Packet data processing method, apparatus, and system
CN104333515B (en) A kind of SWIFT message processing methods and device
CN110045980A (en) Remote upgrade method, equipment and the system of a kind of pair of NB-IOT equipment
US7180851B1 (en) Method for quick identification of special data packets

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant