CN108055323A - A kind of communications protocol based on data link layer - Google Patents

A kind of communications protocol based on data link layer Download PDF

Info

Publication number
CN108055323A
CN108055323A CN201711326024.6A CN201711326024A CN108055323A CN 108055323 A CN108055323 A CN 108055323A CN 201711326024 A CN201711326024 A CN 201711326024A CN 108055323 A CN108055323 A CN 108055323A
Authority
CN
China
Prior art keywords
data
frame
receiving
received
sends
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
CN201711326024.6A
Other languages
Chinese (zh)
Other versions
CN108055323B (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.)
Center Control Systems Engineering (cse) Co Ltd
Original Assignee
Center Control Systems Engineering (cse) Co Ltd
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 Center Control Systems Engineering (cse) Co Ltd filed Critical Center Control Systems Engineering (cse) Co Ltd
Priority to CN201711326024.6A priority Critical patent/CN108055323B/en
Publication of CN108055323A publication Critical patent/CN108055323A/en
Application granted granted Critical
Publication of CN108055323B publication Critical patent/CN108055323B/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/30Definitions, standards or architectural aspects of layered protocol stacks
    • H04L69/32Architecture of open systems interconnection [OSI] 7-layer type protocol stacks, e.g. the interfaces between the data link level and the physical level
    • H04L69/322Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions
    • H04L69/324Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions in the data link layer [OSI layer 2], e.g. HDLC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/18Automatic repetition systems, e.g. Van Duuren systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/18Automatic repetition systems, e.g. Van Duuren systems
    • H04L1/1867Arrangements specially adapted for the transmitter end
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/18Automatic repetition systems, e.g. Van Duuren systems
    • H04L1/1867Arrangements specially adapted for the transmitter end
    • H04L1/188Time-out mechanisms

Abstract

The invention belongs to control system technical fields, and in particular to a kind of communications protocol based on data link layer.The network access of security function is realized by this communications protocol, call the sending and receiving driving of hardware, the transceiver interface of application layer is provided for upper strata, completely sends and receives service, effective receive information, so that communication is simple, reliable, safe and agreement is made more preferably to be suitable for control field communication.

Description

A kind of communications protocol based on data link layer
Technical field
The invention belongs to control system technical fields, and in particular to a kind of communications protocol based on data link layer.
Background technology
In industrial control system (such as DCS), especially with safely in leading control system, underlying device is led to News protocol security seems particularly important.Traditional network communication protocol is the communication protocol using TCP/IP as core, in application layer Related protocol and Encryption Algorithm can be used to ensure the safety of data communication.It is general in the control system based on FPGA Network communication protocol is no longer applicable in.Since FPGA is unlike CPU, the programming based on operating system reduces design with compiling Write the difficulty of code.In the case of some specific, some specific functions are also completed, standard network communication protocols are not easy reality Now change and customize in fact.Therefore under the basis there is an urgent need for being programmed in FPGA, design a kind of communications protocol based on data link layer.
The content of the invention
The technical problem to be solved in the present invention is to provide a kind of communications protocol based on data link layer, so as to redefine Communications protocol based on data link layer convenient for optimization, improves communication efficiency.
In order to realize the purpose, the present invention adopts the technical scheme that:
A kind of communications protocol based on data link layer, the network for realizing security function by this software design approach are visited It asks, the sending and receiving of hardware is called to drive, provide the transceiver interface of application layer for upper strata, completely send and receive service, effective Receive information;Specifically include following both sides design:
1. it determines to send function flow
It sends function and not only sends data, inside also receives data, the data packet received by parameter recvpkt returns; It continuously transmits same data packet 15 times, and starts timer, do not receive data more than certain time, just resend the data packet 15 times, the forwarding step is repeated, does not receive data in 1 second yet, then returned and receive data time-out error;
If receiving data, the frame number of data packet of the frame number of the data packet received with just sending is compared Compared with, if equal, data are passed into upper layer functions through recvpkt parameters, if unequal repeat forwarding step, in 1 second still Correct data is not received, then returns to the mistake for not receiving correct data;It sends a successfully data packet and frame number is just added 1, Its step are as follows:
1.1st step, upper procedure call communication interface to start;
1.2nd step, the data packet header to transmit add mac addresses, and into next step;
1.3rd step, judges whether transmission times transfinites, if being not above transmission times, into the 1.4th step, otherwise, Error message is returned to, transmission terminates;
1.4th step, continuously transmit data and wait it is to be received, and into next step;
1.5th step if receiving data time-out, into the 1.6th step, otherwise carries out the 1.7th step;
1.6th step waits the time of setting, and transmission times is added 1, into the 1.3rd step;
1.7th step compares the frame number sent and received, and into next step;
1.8th step judges whether frame number is equal, if frame number is equal, into the 1.9th step, otherwise into the 1.6th Step;
1.9th step returns to the data received, sends data success, and transmission terminates;
(2) receiver function flow is determined
The function is called when upper level applications passively receive data, calls query function inquiry control first before this Device operating mode processed is determined when being operational mode, calls receiver function;
Receiver function creates a receiving thread, the data that controller to be received is waited to send;The thread scans network interface card always On buffering area, if the data that controller is sent just take out the partial data and are put into one piece of sharing data area;
Upper layer functions at interval of setting time reading, once at interval of setting time write once by the sharing data area, receiving thread The sharing data area;
The step of receiving data thread is as follows:
2.1st step, upper procedure call communication interface to start;
2.2nd step creates receiving thread, and into next step;
2.3rd step judges to create whether receiving thread succeeds, if it fails, then returning to establishment failure error message, and tie Shu Chengxu, otherwise into the 2.4th step;
2.4th step creates program and handles other tasks;
It is as follows that receiver function receives data step:
3.1st step creates program creation receiving thread and starts;
3.2nd step, judges whether reception network card data succeeds, if it fails, then returning to error message, thread terminates, no Then, into the 3.3rd step;
3.3rd step scans the data received from controller, and into next step;
3.4th step judges whether to find purpose data, if do not found, the 3.5th step is carried out, otherwise into the 3.6th Step;
3.5th step waits setting time, into the 3.2nd step;
3.6th step, by purpose data write-in buffering area corresponding position, and into next step;
3.7th step, judges whether write-in succeeds, if write-in failure, returns to error message, thread terminates, otherwise, into Enter the 3.5th step.
Further, a kind of communications protocol based on data link layer as described above, information block and splicing provide nothing The interface of difference transmission.
Further, a kind of communications protocol based on data link layer as described above, the sender and recipient of network Using synchronous communication mode, using the form of question-response;After certain frame is sent for the first time, recipient replys sender after receiving One frame, when sender do not receive at the appointed time reply frame or the reply frame that receives it is not validated in the case of, carry out Second of transmission;And so on, if all not receiving reply frame after continuously transmitting setting number, then it is assumed that the frame sends failure.
Further, a kind of communications protocol based on data link layer as described above, upper level applications carry out subpackage, Send function no longer subpackage.
The advantageous effect of technical solution of the present invention is:It communicates simple, reliable, safe and agreement is made more preferably to be suitable for control Field communication processed.
Description of the drawings
Fig. 1 is transmission function flow;
Fig. 2 is receiver function flow;
Fig. 3 is receiving thread flow.
Specific embodiment
Technical solution of the present invention is described in detail in the following with reference to the drawings and specific embodiments.
A kind of communications protocol based on data link layer of the present invention realizes the net of security function by this software design approach Network accesses, and the sending and receiving of hardware is called to drive, and provides the transceiver interface of application layer for upper strata, completely sends and receives service, has The receive information of effect;The sender and recipient of network use synchronous communication mode, using the form of question-response;Sender exists After sending certain frame for the first time, recipient replys a frame after receiving, and frame or receipts are replied when sender does not receive at the appointed time In the case that the reply frame that arrives is not validated, carries out second and send;And so on, if all not having after continuously transmitting setting number Receive reply frame, then it is assumed that the frame sends failure.
Specifically include following both sides design:
1. it determines to send function flow
Information block and splicing provide the interface of indifference transmission.Upper level applications carry out subpackage, send function no longer Subpackage.It sends function and not only sends data, inside also receives data, the data packet received by parameter recvpkt returns;Continuously It sends same data packet 15 times, and starts timer, do not receive data more than certain time, just resend the data packet 15 It is secondary, the forwarding step is repeated, does not receive data in 1 second yet, then returns and receives data time-out error;
If receiving data, the frame number of data packet of the frame number of the data packet received with just sending is compared Compared with, if equal, data are passed into upper layer functions through recvpkt parameters, if unequal repeat forwarding step, in 1 second still Correct data is not received, then returns to the mistake for not receiving correct data;It sends a successfully data packet and frame number is just added 1, As shown in Figure 1, its step are as follows:
1.1st step, upper procedure call communication interface to start;
1.2nd step, the data packet header to transmit add mac addresses, and into next step;
1.3rd step, judges whether transmission times transfinites, if being not above transmission times, into the 1.4th step, otherwise, Error message is returned to, transmission terminates;
1.4th step, continuously transmit data and wait it is to be received, and into next step;
1.5th step if receiving data time-out, into the 1.6th step, otherwise carries out the 1.7th step;
1.6th step waits the time of setting, and transmission times is added 1, into the 1.3rd step;
1.7th step compares the frame number sent and received, and into next step;
1.8th step judges whether frame number is equal, if frame number is equal, into the 1.9th step, otherwise into the 1.6th Step;
1.9th step returns to the data received, sends data success, and transmission terminates;
(2) receiver function flow is determined
The function is called when upper level applications passively receive data, calls query function inquiry control first before this Device operating mode processed is determined when being operational mode, calls receiver function;
Receiver function creates a receiving thread, the data that controller to be received is waited to send;The thread scans network interface card always On buffering area, if the data that controller is sent just take out the partial data and are put into one piece of sharing data area;
Upper layer functions at interval of setting time reading, once at interval of setting time write once by the sharing data area, receiving thread The sharing data area.
As shown in figure 3, the step of receiving data thread is as follows:
2.1st step, upper procedure call communication interface to start;
2.2nd step creates receiving thread, and into next step;
2.3rd step judges to create whether receiving thread succeeds, if it fails, then returning to establishment failure error message, and tie Shu Chengxu, otherwise into the 2.4th step;
2.4th step creates program and handles other tasks;
As shown in Fig. 2, receiver function reception data step is as follows:
3.1st step creates program creation receiving thread and starts;
3.2nd step, judges whether reception network card data succeeds, if it fails, then returning to error message, thread terminates, no Then, into the 3.3rd step;
3.3rd step scans the data received from controller, and into next step;
3.4th step judges whether to find purpose data, if do not found, the 3.5th step is carried out, otherwise into the 3.6th Step;
3.5th step waits setting time, into the 3.2nd step;
3.6th step, by purpose data write-in buffering area corresponding position, and into next step;
3.7th step, judges whether write-in succeeds, if write-in failure, returns to error message, thread terminates, otherwise, into Enter the 3.5th step.

Claims (5)

1. a kind of communications protocol based on data link layer, it is characterised in that:
The network access of security function is realized by this communications protocol, the sending and receiving of hardware is called to drive, application layer is provided for upper strata Transceiver interface, completely send and receive service, effective receive information;Specifically include following both sides design:
1. it determines to send function flow
It sends function and not only sends data, inside also receives data, the data packet received by parameter recvpkt returns;Continuously It sends same data packet 15 times, and starts timer, do not receive data more than certain time, just resend the data packet 15 It is secondary, the forwarding step is repeated, does not receive data in 1 second yet, then returns and receives data time-out error;
If receiving data, by the frame number of the data packet received compared with the frame number of the data packet just sent, if It is equal, then data are passed into upper layer functions through recvpkt parameters, forwarding step is repeated if unequal, is not received yet in 1 second To correct data, then the mistake for not receiving correct data is returned;It sends a successfully data packet and frame number is just added 1, step It is as follows:
1.1st step, upper procedure call communication interface to start;
1.2nd step, the data packet header to transmit add mac addresses, and into next step;
1.3rd step, judges whether transmission times transfinites, if being not above transmission times, into the 1.4th step, otherwise, returns Error message, transmission terminate;
1.4th step, continuously transmit data and wait it is to be received, and into next step;
1.5th step if receiving data time-out, into the 1.6th step, otherwise carries out the 1.7th step;
1.6th step waits the time of setting, and transmission times is added 1, into the 1.3rd step;
1.7th step compares the frame number sent and received, and into next step;
1.8th step judges whether frame number is equal, if frame number is equal, into the 1.9th step, otherwise into the 1.6th step;
1.9th step returns to the data received, sends data success, and transmission terminates;
(2) receiver function flow is determined
The function is called when upper level applications passively receive data, calls query function inquiry controller first before this Operating mode is determined when being operational mode, calls receiver function;
Receiver function creates a receiving thread, the data that controller to be received is waited to send;The thread is scanned on network interface card always Buffering area, if the data that controller is sent just take out the partial data and are put into one piece of sharing data area;
Upper layer functions read the once sharing data area at interval of setting time, and receiving thread is write once this at interval of setting time and is total to Enjoy data field;
The step of receiving data thread is as follows:
2.1st step, upper procedure call communication interface to start;
2.2nd step creates receiving thread, and into next step;
2.3rd step judges to create whether receiving thread succeeds, creates failure error message if it fails, then returning, and terminate journey Sequence, otherwise into the 2.4th step;
2.4th step creates program and handles other tasks;
It is as follows that receiver function receives data step:
3.1st step creates program creation receiving thread and starts;
3.2nd step, judges whether reception network card data succeeds, if it fails, then returning to error message, thread terminates, otherwise, into Enter the 3.3rd step;
3.3rd step scans the data received from controller, and into next step;
3.4th step judges whether to find purpose data, if do not found, the 3.5th step is carried out, otherwise into the 3.6th step;
3.5th step waits setting time, into the 3.2nd step;
3.6th step, by purpose data write-in buffering area corresponding position, and into next step;
3.7th step, judges whether write-in succeeds, if write-in failure, returns to error message, thread terminates, otherwise, into the 3.5 step.
2. a kind of communications protocol based on data link layer as described in claim 1, it is characterised in that:Information block and splicing The interface of indifference transmission is provided.
3. a kind of communications protocol based on data link layer as described in claim 1, it is characterised in that:The sender of network and Recipient uses synchronous communication mode, using the form of question-response;After certain frame is sent for the first time, recipient receives sender After reply a frame, when sender do not receive at the appointed time reply frame or receive reply the not validated situation of frame Under, it carries out second and sends;And so on, if all not receiving reply frame after continuously transmitting setting number, then it is assumed that the frame is sent out Send failure.
4. a kind of communications protocol based on data link layer as described in claim 1, it is characterised in that:Upper level applications into Row subpackage sends function no longer subpackage.
5. a kind of communications protocol based on data link layer as described in claim 1, it is characterised in that:Information block and splicing The interface of indifference transmission is provided;The sender and recipient of network use synchronous communication mode, using the form of question-response; For sender after certain frame is sent for the first time, recipient replys a frame after receiving, when sender does not receive back at the appointed time In the case that multi-frame or the reply frame received are not validated, carry out second and send;And so on, if continuously transmitting setting time Reply frame is not all received after number, then it is assumed that the frame sends failure;Upper level applications carry out subpackage, send function and no longer divide Bag.
CN201711326024.6A 2017-12-13 2017-12-13 Communication method based on data link layer Active CN108055323B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711326024.6A CN108055323B (en) 2017-12-13 2017-12-13 Communication method based on data link layer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711326024.6A CN108055323B (en) 2017-12-13 2017-12-13 Communication method based on data link layer

Publications (2)

Publication Number Publication Date
CN108055323A true CN108055323A (en) 2018-05-18
CN108055323B CN108055323B (en) 2020-11-20

Family

ID=62132039

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711326024.6A Active CN108055323B (en) 2017-12-13 2017-12-13 Communication method based on data link layer

Country Status (1)

Country Link
CN (1) CN108055323B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109450838A (en) * 2018-06-27 2019-03-08 北京班尼费特科技有限公司 A kind of intelligent express delivery cabinet network communication protocol based on Intelligent internet of things interaction platform
CN110098869A (en) * 2019-05-09 2019-08-06 中国航空工业集团公司西安航空计算技术研究所 A kind of optical-fibre channel method for message transmission
CN110619012A (en) * 2019-08-20 2019-12-27 西安航天动力技术研究所 Online data processing method for missile fire control system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1808387A (en) * 2004-12-30 2006-07-26 英特尔公司 Providing access to data shared by packet processing threads
CN101277173A (en) * 2008-05-07 2008-10-01 中国电子科技集团公司第三十研究所 Data answering method for shortwave ARQ data transmission
CN101809923A (en) * 2007-10-01 2010-08-18 高通股份有限公司 Acknowledge mode polling with immediate status report timing
US20120300614A1 (en) * 2011-05-23 2012-11-29 Samsung Electronics Co., Ltd. Method and apparatus for error correction ciphering in mobile communication system
CN103141050A (en) * 2011-12-28 2013-06-05 华为技术有限公司 Data packet retransmission method and node in quick path interconnect system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1808387A (en) * 2004-12-30 2006-07-26 英特尔公司 Providing access to data shared by packet processing threads
CN101809923A (en) * 2007-10-01 2010-08-18 高通股份有限公司 Acknowledge mode polling with immediate status report timing
CN101277173A (en) * 2008-05-07 2008-10-01 中国电子科技集团公司第三十研究所 Data answering method for shortwave ARQ data transmission
US20120300614A1 (en) * 2011-05-23 2012-11-29 Samsung Electronics Co., Ltd. Method and apparatus for error correction ciphering in mobile communication system
CN103141050A (en) * 2011-12-28 2013-06-05 华为技术有限公司 Data packet retransmission method and node in quick path interconnect system

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109450838A (en) * 2018-06-27 2019-03-08 北京班尼费特科技有限公司 A kind of intelligent express delivery cabinet network communication protocol based on Intelligent internet of things interaction platform
CN110098869A (en) * 2019-05-09 2019-08-06 中国航空工业集团公司西安航空计算技术研究所 A kind of optical-fibre channel method for message transmission
CN110098869B (en) * 2019-05-09 2021-06-01 中国航空工业集团公司西安航空计算技术研究所 Optical fiber channel message transmission method
CN110619012A (en) * 2019-08-20 2019-12-27 西安航天动力技术研究所 Online data processing method for missile fire control system
CN110619012B (en) * 2019-08-20 2022-09-27 西安航天动力技术研究所 Online data processing method for missile fire control system

Also Published As

Publication number Publication date
CN108055323B (en) 2020-11-20

Similar Documents

Publication Publication Date Title
Lindgren et al. Probabilistic routing protocol for intermittently connected networks
CN102546800B (en) Handshake and communication methods for gateway, gateway and Web communication system
CN108055323A (en) A kind of communications protocol based on data link layer
US11057158B2 (en) Delegation of management of acknowledgements and of transmission of frames
CN101436978A (en) Method for authentic data transmission using UDP protocol
KR102209598B1 (en) System and method for maintaining synchronization in connectionless transmission
CN115118524B (en) Interface equipment and free intercommunication data transparent transmission method, system and device of Internet of things
CN104038325B (en) NDI is handled in random access procedure
CN104780029B (en) A kind of mixed automatic retransmission request method and relevant apparatus
CN112637149B (en) Data communication method between asymmetric security policy partitions
CN104980257B (en) Internet of things communication method and device
CN101631127A (en) File transfer method and clients
CN110493775A (en) The communication means and system being adapted to by ATT and abnormality processing
CN112152880A (en) Link health detection method and device
CN101605128A (en) The method that the LINUX master-slave equipment communicates by Ethernet interface
CN104168273A (en) Method and system for achieving TCP proxy in thin AP mode
CN114500528A (en) Data transmission method and device based on cloud platform
CN103281317A (en) Attack testing method for SDN (software defined network)
CN100576787C (en) A kind of method of between maintenance terminal and background devices, carrying out the transmission of big data quantity safety
CN100464547C (en) A method for implementing information transmission between equipments of different communication protocols
CN103124400A (en) Short message cache method and system
CN104219168B (en) Control message processing method and device based on UDP transmission
CN101409611B (en) Communication method for IP scheduling
CN107819597A (en) Network data transmission method and front end processor
US9338016B2 (en) Method and apparatus for exchanging messages

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