CN113746827B - Real-time data link byte stream error-proofing method based on multi-band turing machine - Google Patents

Real-time data link byte stream error-proofing method based on multi-band turing machine Download PDF

Info

Publication number
CN113746827B
CN113746827B CN202111013281.0A CN202111013281A CN113746827B CN 113746827 B CN113746827 B CN 113746827B CN 202111013281 A CN202111013281 A CN 202111013281A CN 113746827 B CN113746827 B CN 113746827B
Authority
CN
China
Prior art keywords
data
band
length
stack
controller
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.)
Active
Application number
CN202111013281.0A
Other languages
Chinese (zh)
Other versions
CN113746827A (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.)
China Academy of Railway Sciences Corp Ltd CARS
Signal and Communication Research Institute of CARS
Beijing Ruichi Guotie Intelligent Transport Systems Engineering Technology Co Ltd
Beijing Huatie Information Technology Co Ltd
Original Assignee
China Academy of Railway Sciences Corp Ltd CARS
Signal and Communication Research Institute of CARS
Beijing Ruichi Guotie Intelligent Transport Systems Engineering Technology Co Ltd
Beijing Huatie Information Technology 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 China Academy of Railway Sciences Corp Ltd CARS, Signal and Communication Research Institute of CARS, Beijing Ruichi Guotie Intelligent Transport Systems Engineering Technology Co Ltd, Beijing Huatie Information Technology Co Ltd filed Critical China Academy of Railway Sciences Corp Ltd CARS
Priority to CN202111013281.0A priority Critical patent/CN113746827B/en
Publication of CN113746827A publication Critical patent/CN113746827A/en
Application granted granted Critical
Publication of CN113746827B publication Critical patent/CN113746827B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • G06F9/4484Executing subprograms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0823Errors, e.g. transmission errors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/18Protocol analysers
    • 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/03Protocol definition or specification 
    • 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/329Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions in the application layer [OSI layer 7]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Environmental & Geological Engineering (AREA)
  • Computer And Data Communications (AREA)
  • Communication Control (AREA)

Abstract

The invention discloses a real-time data link byte stream error-proofing method based on a multi-band turing machine, the whole scheme not only has the traditional communication buffer data reading and writing functions, but also can detect invalid byte stream from the receiving end and make failure-operable guidance, thereby avoiding the interference of illegal data, abnormal data and length error data to the data exchange of application layers and protecting the program.

Description

Real-time data link byte stream error-proofing method based on multi-band turing machine
Technical Field
The invention relates to the technical field of communication, in particular to a real-time data link byte stream error prevention method based on a multi-band turing machine.
Background
The TCP/IP protocol is a networking format commonly used between computers, and includes a link layer, a network layer, a transport layer and an application layer. The four layers correspond to hardware devices, data frame routing, packet grouping, communication details of application programs, and control functions in the computer network, respectively. On computers of different models and different operating systems, an application program uses a TCP/IP protocol to establish a reliable real-time data link on a transmission layer, and then completes data exchange through byte streams, thereby realizing service requests and responses in a computer network. The specific content and read-write method of the byte stream are specified by the specific scenario or communication protocol of the TCP/IP application layer.
The existing TCP/IP application layer byte stream data exchange method can be summarized as two flows of reading and writing as shown in fig. 1. The reading process firstly stores the byte stream transmitted by the data link into a communication cache of a program, and then processes effective data according to an application layer communication protocol; the writing process converts the effective data into a byte stream according to an application layer communication protocol, and then writes the byte stream into a communication cache to be transmitted by a data link.
According to the protocol, all valid data occupy a fixed byte length in the communication buffer and have a unique data number. The application layer communication protocol also specifies the ordering of different types of valid data in the communication cache, so that the TCP/IP application program can control the read-write behavior of the network data according to a fixed sequence and an information format.
The effective data types and read-write modes in the communication cache can be summarized as table 1, and table 1 is a specific method for controlling the communication cache by a TCP/IP application program, and a software developer usually directly encodes and writes a program according to the specification of an application layer protocol.
Figure BDA0003239585200000011
TABLE 1 description of the read/write modes of different types of data
The TCP/IP protocol is a transport layer service oriented to a data link, and the reading and writing of byte streams in a communication cache are controlled by an application layer. In the prior art, when the computer network connection is unstable or communication software fails, invalid byte streams will appear in the communication cache. Because a TCP/IP application program designed in the prior art cannot perform data validity determination and error-proofing process while reading and writing a byte stream, an invalid byte stream may generate severe interference on data exchange of an application layer, resulting in an unexpected behavior of the application program and even a breakdown.
Disclosure of Invention
The invention aims to provide a real-time data link byte stream error-proofing method based on a multi-band turing machine, which can detect invalid byte streams and conduct failure-operable guidance from the perspective of a receiving end.
The purpose of the invention is realized by the following technical scheme:
a real-time data link byte stream error-proofing method based on a multi-band turing machine comprises the following steps:
constructing a multi-band smart machine, performing read-write operation of communication cache through a state transfer function of the multi-band smart machine, detecting an invalid byte stream in the read-write operation or before the read-write operation, and returning to a read operation initial state or skipping related bytes when the invalid byte stream is detected; the state transition function is divided into five subroutines according to functions: main, mark, pullSym, readLen and ReadRan; wherein:
main subprogram for processing the initial and end states of the reading and writing operation of the multi-band smart machine, and switching to PullSym subprogram after the initial state of the reading and writing operation is processed;
a PullSym subroutine for pulling data symbols from the data symbol stack of the multi-band smart machine during a read operation, and entering a ReadLen subroutine, a ReadRan subroutine, or a Mark subroutine according to a data type identifier, or returning to a Main subroutine; the system is also used for pulling data symbols from the data symbol stack of the multi-band turing machine in the write operation and entering a Mark subprogram;
the Mark subprogram is used for marking data symbols on a communication cache belt according to the data type identification in the reading operation and detecting invalid byte streams through validity judgment, if the valid data passes the validity judgment, the valid data is read into the data symbols of the application program and then returned to the PullSym subprogram, or the data symbols are marked and the data reading is completed and then returned to the Main subprogram, and the terminal state is entered; the communication cache is also used for marking data symbols on the communication cache according to the data type identification in the write operation, obtaining the value of effective data through an operator and returning the value to the PullSym subprogram, or writing corresponding data after marking the data symbols and returning the corresponding data to the PullSym subprogram;
the ReadLen subprogram is a reading program of word length data, a protocol mark and length data, after the word length data, the protocol mark or the length data are marked, an invalid byte stream is detected through validity judgment, if the validity judgment is passed, the valid data is read into a data symbol of an application program, and then the valid data returns to the PullSym subprogram;
the ReadRan subprogram is a reading program of the cycle data, after the marking of the cycle data is completed, the invalid byte stream is detected through validity judgment, if the invalid byte stream passes the validity judgment, the valid data is read into a data symbol of an application program, and after the reading of the cycle data is completed, the PullSym subprogram is returned.
The technical scheme provided by the invention can be seen that the whole scheme not only has the traditional communication cache data reading and writing functions, but also can detect invalid byte streams from the angle of a receiving end and conduct invalidation-operable guidance, thereby avoiding the interference of illegal data, abnormal data and length error data on the data exchange of the application layer and protecting the program.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
FIG. 1 is a schematic diagram of a method for exchanging byte stream data of a TCP/IP application layer according to the background art of the present invention;
fig. 2 is a flowchart of a real-time data link byte stream error protection method based on a multi-band turing machine according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a data group relationship of application layer communication protocol valid data according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a multi-band turing machine model of a communication cache read-write flow according to an embodiment of the present invention;
fig. 5 is a flow chart of state transition of a multi-band turing machine according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention are clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
The terms that may be used herein are first described as follows:
the term "and/or" means that either or both can be achieved, for example, X and/or Y means that both cases include "X" or "Y" as well as three cases including "X and Y".
The terms "comprising," "including," "containing," "having," or other similar terms of meaning should be construed as non-exclusive inclusions. For example: including a feature (e.g., material, component, ingredient, carrier, formulation, material, dimension, part, component, mechanism, device, process, procedure, method, reaction condition, processing condition, parameter, algorithm, signal, data, product, or article of manufacture), is to be construed as including not only the particular feature explicitly listed but also other features not explicitly listed as such which are known in the art.
The error-proofing method for the byte stream of the real-time data link based on the multi-band turing machine provided by the invention is described in detail below. Details which are not described in detail in the embodiments of the invention belong to the prior art which is known to a person skilled in the art. The examples of the present invention, in which specific conditions are not specified, were carried out according to the conventional conditions in the art or conditions suggested by the manufacturer.
As shown in fig. 2, a method for preventing errors of a byte stream of a real-time data link based on a multi-band turing machine includes the following steps:
1. and constructing a multi-band turing machine.
2. And performing read-write operation of communication buffer memory through the state transfer function of the multi-band smart machine, and detecting invalid byte streams in the read-write operation or before the read-write operation.
3. When an invalid byte stream is detected, a read operation start state is returned or the relevant bytes are skipped.
In the embodiment of the invention, the state transfer function is divided into five subprograms according to functions: main, mark, pullSym, readLen and ReadRan; wherein:
main subprogram for processing the initial and end states of the reading and writing operation of the multi-band smart machine, and switching to PullSym subprogram after the initial state of the reading and writing operation is processed;
a PullSym subroutine for pulling data symbols from the data symbol stack of the multi-band smart machine during a read operation, and entering a ReadLen subroutine, a ReadRan subroutine, or a Mark subroutine according to a data type identifier, or returning to a Main subroutine; the system is also used for pulling data symbols from the data symbol stack of the multi-band turing machine in the write operation and entering a Mark subprogram;
the Mark subprogram is used for marking data symbols on the communication cache according to the data type identification in the reading operation and detecting invalid byte streams through validity judgment, if the validity judgment is passed, valid data is read into the data symbols of the application program and then returned to the PullSym subprogram, or the data symbols are marked and the data reading is completed and then returned to the Main subprogram, and the terminal state is entered; the communication cache is also used for marking data symbols on the communication cache according to the data type identification in the write operation, obtaining the value of effective data through an operator and returning the value to the PullSym subprogram, or writing corresponding data after marking the data symbols and returning the corresponding data to the PullSym subprogram;
the ReadLen subprogram is a reading program of word length data, a protocol mark and length data, after the word length data, the protocol mark or the length data are marked, an invalid byte stream is detected through validity judgment, if the validity judgment is passed, the valid data is read into a data symbol of an application program, and then the valid data returns to the PullSym subprogram;
the ReadRan subprogram is a reading program of the cyclic data, after the marking of the cyclic data is completed, the invalid byte stream is detected through validity judgment, if the invalid byte stream passes the validity judgment, the valid data is read into a data symbol of an application program, and after the cyclic data is read, the PullSym subprogram is returned.
In an embodiment of the present invention, the invalid byte stream includes: illegal data, abnormal data, and length error data.
Wherein the illegal data comprises: data in the byte stream that is not within the valid range specified by the communication protocol; the exception data includes: data within the byte stream that can cause the operating system to force the application to close; the length error data includes: data with inconsistent data length and actual length recorded by the byte stream;
the illegal data and the abnormal data are detected by validity judgment in the read-write operation (a specific mode will be described later); the length error data is detected before the read-write operation, the execution flow during the detection is consistent with the read operation flow, if the length calculation band B 6 If the storage content is 0 before the completion of all the flags of the byte stream or if the storage content is not 0 after all the flags of the byte stream are completed, it indicates that the length error data is detected (a specific mode will be described later).
The above-mentioned scheme of the embodiment of the invention not only has the traditional communication cache data reading and writing functions, but also can detect invalid byte streams and make invalidation-operable guidance from the receiving end, thereby avoiding the interference of illegal data, abnormal data and length error data on the data exchange of the application layer and protecting the program.
In order to show the technical scheme and the technical effects provided by the invention more clearly, the invention is described in detail in the following aspects of communication cache read-write flow analysis, a mathematical model of the communication cache read-write flow and a principle.
1. And analyzing the read-write flow of the communication cache.
At present, the valid data defined by the application layer communication protocol is generally divided into different data groups according to type codes, the data groups are ordered sequences formed by a plurality of valid data, and the ordering is based on data numbers specified by the application layer communication protocol. The relationship between different data sets can be represented as a tree structure as shown in fig. 3, which is called a protocol tree.
The position of each data group in the tree in fig. 3 can be determined by the sequence of type codes, and the data numbers in all groups in a single path satisfy the succession relationship. The data group at the root node typically contains a byte stream length field. Valid data read from and written to the communication cache may be abstractly expressed as data symbols operable within the application. The data symbols can store data and automatically record the storage time, the effective data type is specified by a communication protocol, and attribute information can be acquired through operators. Table 2 is a description of the operators and functions of the data symbols, which are available in the byte stream algorithm since the data symbols can be directly manipulated by the application.
Figure BDA0003239585200000061
TABLE 2 data symbol function and operator description
2. And (4) a mathematical model of a communication cache read-write flow.
The communication cache read-write flow of the application program provided by the embodiment of the invention is shown in table 3.
Figure BDA0003239585200000062
Table 3 communication buffer read-write flow of application program
In the reading and writing processes, the loading, emptying and data copying of the communication cache are easy to realize in an application program, and how to mark the communication cache as a data symbol under the known conditions is a difficult point of a byte stream error-proofing algorithm. The mathematical model of the communication cache read-write process can be formally expressed as a multi-band turing machine M meeting specific specifications, as shown in fig. 4, and mainly comprises: the device comprises a controller, a data symbol stack, a data buffer stack, a protocol position stack, a word length buffer zone, a loop calculation zone and a length calculation zone. The multi-band smart phone marks the communication buffer as a data symbol through a state transfer function.
1) The controller is used for storing state variables of the state transfer functions of the multi-band turing machine and controlling the conversion among the subprograms, and each subprogram outputs the corresponding state variable and the corresponding input variable after executing each process; wherein the state variables include: the method comprises the following steps of (1) a main state, a data type identifier, a data symbol stack state, a data buffer stack state and a protocol position stack state (the last four are all extension states), wherein the main state comprises a ready state, a reading state and a writing state of the multi-band turing machine; the input variables include: the controller currently points to the communication buffer zone position, the value of the word size buffer zone, and the value of the loop calculation zone.
2) Character length buffer belt B 2 And a loop calculation band B 4 And length calculating band B 6 For temporarily storing local variables used in the read and write processes, each bin in the band represents a single byte of storage space. The content specifically contained by the local variables can be summarized as
Table 4.
Figure BDA0003239585200000071
TABLE 4 local variables used in the read-write procedure
3) Data symbol stack E 1 Each cell of (a) represents a single data symbol, a data structure for storing valid data inside the application, a data buffer stack E 3 And protocol location stack E 5 For temporarily storing a byte stream, each bin represents a single byte.
In addition, communication buffer zone B in fig. 4 0 Corresponding to the communication cache, each bin represents a single byte in the cache.
In the embodiment of the invention, the multi-band smart machine is defined by using a seven-tuple form and is expressed as follows:
M=(Q,Σ,Γ,δ,Q 0 ,C,F)
wherein:
m represents a multi-band turing machine.
Q is a set of multi-band turing machine states
Figure BDA0003239585200000072
Is an ordered pair of five state components. q. q.s 0 、q 1 、q 2 In turn, the components are arranged in sequenceIndicating ready state, read state, write state, t 0 、t 1
Figure BDA0003239585200000081
t 3 、t 4 、t 5 、t B Is data type identification respectively representing ready, fixed length data, word length data, variable length data, cycle data, protocol mark, length data and null data, the last three components respectively corresponding to data symbol stack E 1 Data buffer stack E 3 And protocol location stack E 5 I, e, epsilon are the state labels of the linear stack, respectively representing stack-in, stack-out and no-operation, considering that if the state labels of the linear stack are distinguished by the angle labels, the state function will not completely express the states of the plurality of linear stacks, and therefore, the text brackets [,,,,, etc.)]The different linear stack states in (A) are distinguished by the different filling positions, i.e. corresponding to the data symbol stack E in turn 1 Data buffer stack E 3 And protocol location stack E 5
Sigma is a finite set of input data symbols
Figure BDA0003239585200000082
Is an ordered pair of four input variables; beta is a beta B Representing a blank symbol in the communication buffer band B 0 The upper part shows that the grid is not loaded with the byte stream, and the communication buffer after the byte stream is loaded is signed by beta 0 Represents; character length buffer band B 2 And a loop calculation band B 4 Sum Length calculation band B 6 All the bytes in the table can be equivalently converted into integers, and the input contents of the three are respectively recorded as
Figure BDA0003239585200000083
References to content are all non-negative integers.
Γ is the complete set of signed symbols
Figure BDA0003239585200000084
Alpha represents a data symbol and represents that the byte on the communication cache band forms a matching relation with effective data stored in the application program;β B in the word length buffer zone B 2 And a loop calculation band B 4 Sum Length calculation band B 6 Upper indicates the initialization state.
And delta is a state transfer function of the multi-band turing machine, and is used for defining the normal state of reading and writing of the communication cache.
Q 0 Is an initial state set of a multi-band Turing machine (q) 0 ,t 0 ,ε,ε,ε],β BBBB ),([q 0 ,t 0 ,i,ε,ε],β BBBB ) And (c) both represent the states of the turing machine before the communication buffer starts data reading and writing, respectively, the initial state being automatically set by the application, similar to the state of the linear stack, the bracket ([ 2 ]]The states of each cache band and the computation band in (v) are distinguished by the difference of the filling positions of the symbols, and the beta of the four positions B Sequentially corresponding to communication buffer band B 0 Character length buffer band B 2 And a loop calculation band B 4 And length calculating band B 6 Beta in gamma B Thus; it is noted that the specific positional sequence may also be adjusted by those skilled in the art according to actual situations or experience, and a practical example is provided here.
C is communication buffer band B 0 Character length buffer band B 2 And a loop calculation band B 4 Sum Length calculation band B 6 Blank symbol set [ beta ] used in B }。
F is the termination state set of the multi-band turing machine { ([ q ] 0 ,t B ,ε,ε,ε],β BBBB ) And the state is the final state of the turing machine after the turing machine finishes reading or writing the communication cache data.
3. The working principle.
As described above, in the embodiment of the present invention, the state transition function of the multi-band turing machine may be divided into five subroutines: main, mark, pullSym, readLen and ReadRan, wherein the Main subprogram processes the initial and termination states of the reading and writing operation of the Turing machine; the Mark subprogram is used for marking the data symbols on the communication buffer tape; the purpose of the PullSym subroutine is to pull data symbols from a stack of data symbols; the ReadLen subprogram is a reading program of word length data and protocol marks; the ReadRan subroutine is the process for cycling data. The interaction relationship between the five sub-programs and the interaction relationship between the sub-programs can be represented as a flow chart shown in fig. 5.
The flowchart shown in fig. 5 includes read and write flows of the communication buffer as a whole, where the read flow starts from (1) and ends from (6), and the write flow starts from (7) and ends from (8). When the states of the multi-band turing machine do not correspond to the numbers, it can be determined that the controller points to an invalid byte stream. After the invalid byte stream is detected from the receiving end, the application program performs invalidation-operable guidance with the purpose of maintaining the operating state, by forcing to return to the initial state (1) of the reading flow, or skipping the current byte and recording the error log. The data at the transmitting end is not checked for invalid byte streams.
The numbers in fig. 5 are the flow numbers of the state transition functions. The state transfer function is composed of state variables and input variables, wherein the state variables comprise a main state, a data type identifier, a data symbol stack state, a data buffer stack state and a protocol position stack state, and the input variables comprise a communication buffer zone position, a word length buffer zone numerical value and a cycle calculation zone numerical value pointed by the controller at present. And after each step is executed, outputting the multi-element group consisting of the state variables and the input variables. The controller can be in communication buffer zone B 0 Up-shift, the direction of shift is marked by the last variable of the tuple, S denotes no shift, and R denotes shift to the right. Communication buffer zone B 0 Each cell is blank symbol beta before loading B . In the description of the procedure, l 2 、l 4 And l 6 Buffer zones B for respectively indicating character lengths 2 And a loop calculation band B 4 And length calculating band B 6 Non-zero data in (1), satisfies the relation l 2 >0、l 4 > 0 and l 6 >0。
The flow of steps of each subroutine will be described below with reference to fig. 5.
1. Main subprogram.
The Main sub-program comprises: a step of reading operation and a step of writing operation; wherein:
1) The step of the read operation includes:
step 1, δ ([ q ] 0 ,t 0 ,ε,ε,ε],β BBBB )=([q 0 ,t 0 ,ε,ε,i],β 0 0, S), enters the initial state of the read operation, communication buffer band B 0 Loading byte stream, word length buffer band B 2 And a loop calculation band B 4 Is preset to 0 and the controller does not move.
Step 1 corresponds to flow (1) in fig. 5, and the numbers of the subsequent steps correspond one-to-one to the numbers of the flows in fig. 5.
In the above equation, the five state components in parentheses on the left side correspond to the multi-zone turing machine state set Q in the aforementioned seven-tuple, and sequentially represent turing machine ready, data type identifier ready, and data symbol stack E 1 No-operation, data buffer stack E 3 No operation, protocol location stack E 5 Not operating;
the first four input variables outside the encircled numbers in the left side correspond to a complete set gamma of the multi-band turing machine with symbols in the seven-element group, and represent that the multi-band turing machine is in a communication cache band B 0 Pointing to blank symbols, word length buffer zone B 2 Pointing to blank symbols, calculating band B cyclically 4 Pointing to blank symbols, length calculation band B 6 Pointing to a blank symbol.
Five state components in brackets on the right side correspond to the multi-band turing machine state set Q in the seven tuples, and sequentially represent turing machine ready, data type identification ready and data symbol stack E 1 No operation, data buffer stack E 3 No operation, protocol location stack E 5 Stacking;
the first four input variables outside the middle part of the right side and including the number correspond to a complete set gamma of the multi-band turing machine with symbols in the seven tuples, and represent that the multi-band turing machine is in a communication cache band B 0 Buffer zone B for indicating blank symbol and word length 2 The content of the pointer byte is 0, and the band B is circularly calculated 4 The content of the pointer byte is 0, and the length calculation band B 6 The content of the pointer byte is 0.
The last variable outside the middle-bracketed right corresponds to the multi-band turing machine controller in the communication cache band B 0 Upward, indicates that the controller is not moving.
The symbols appearing in the subsequent steps have similar meanings and are not described in detail one by one.
Step 2, δ ([ q ] 0 ,t 0 ,ε,ε,i],β 0 ,0,0,0)=([q 1 ,t B ,ε,ε,e],β 0 ,L E5 ,0,p l S), protocol location stack E 5 Loading type code of root node of protocol tree and word length position p of byte stream length field in root node data group l Protocol location stack E 5 Content L of E5 Move to the word length buffer zone B 2 Data type identification changed to null data t B (ii) a As described above, the protocol tree is a tree structure formed by different data groups, the data groups are obtained by dividing valid data according to type codes, and the data groups in the protocol tree are used as nodes.
Step 3, δ ([ q ] 1 ,t B ,ε,ε,e],β 0 ,l 2 ,0,l 6 )=([q 1 ,t B ,i,ε,ε],β 0 ,0,0,l 6 S), the application executes a function Tree (-), the argument of which is the word size buffer zone B 2 Content l of 2 At this time,/ 2 Is the type code of the protocol tree node, and the obtained data group is loaded to the data symbol stack E in the form of a data symbol sequence 1 Length calculation band B 6 The content of (a) is not changed; and the function Tree (-) is used for acquiring the data group from the protocol Tree according to the type code and recording the current position of the protocol Tree.
Step 4, δ ([ q ] 1 ,t B ,i,ε,ε],β 0 ,0,0,l 6 )=([q 0 ,t 0 ,e,ε,ε],β 0 ,0,0,l 6 S), data set loading to data symbol stack E 1 Then, the data type identification of the controller is changed to ready t 0 Enter PullSym subroutine, length calculation band B 6 Is not changed.
Step 5, δ ([ q ] 1 ,t B ,ε,ε,ε],β 0 ,0,0,l 6 )=([q 1 ,t B ,ε,ε,e],β 0 ,L E5 ,0,l 6 S), the step is skipped to by the PullSym subprogram, specifically, the type of the loaded data symbol in the step 9 of the PullSym subprogram is null data t B The step is shifted to, and the protocol position stack E is carried out 5 Content L of E5 Move to the word length buffer zone B 2 Length calculation band B 6 After the content of (2) is not changed, the process proceeds to step 3.
Step 6, δ ([ q ] 1 ,t B ,ε,ε,ε],β B ,0,0,0)=([q 0 ,t B ,ε,ε,ε],β BBBB S), the step jumps into by the Mark subprogram, enters the ending state of the reading operation, finishes the reading operation, and the word length buffer zone B 2 And a loop calculation band B 4 And resetting.
2) The step of writing comprises:
step 7, δ ([ q ] 0 ,t 0 ,i,ε,ε],β BBBB )=([q 2 ,t 0 ,e,ε,ε],β B 0, S), entering an initial state of write operation, executing a function Load (-) by an application program, giving an argument of the function Load (-) by the application program, and loading acquired effective data to a data symbol stack E in a data symbol sequence form 1 And then the method is transferred into a PullSym subprogram (specifically, step 11 in the PullSym subprogram), wherein the function Load () is used for loading all the pre-sent valid data, and the ordering of all the valid data conforms to the specification of the application layer communication protocol.
Step 8, δ ([ q ] 2 ,t B ,ε,ε,ε],β B ,0,0,0)=([q 0 ,t B ,ε,ε,ε],β BBBB S), the step skips to enter by the PullSym subprogram, enters the termination state of the write operation, completes the read operation, and the word length buffer zone B 2 And a loop calculation band B 4 And resetting.
2. PullSym subroutine.
In the embodiment of the invention, the PullSym subprogram respectively executes different steps for read operation and write operation; wherein:
1) The performing step for the read operation includes:
step 9, δ ([ q ] 0 ,t 0 ,e,ε,ε],β 0 ,0,0,l 6 )=([q 1 ,t(α),ε,ε,ε],β 0 ,l(α),0,l 6 S), when the data type of the controller is marked as ready t 0 Time, data symbol stack E 1 Popping up a data symbol alpha, a data type identifier and a word length buffer zone B 2 Type and word length of data symbol and length calculation band B are loaded by operators t (-) and l (-) respectively 6 Is not changed. The subsequent steps differ according to the type of the data symbol loaded by the operator t (-), as described in table 5.
Figure BDA0003239585200000111
TABLE 5 description of the steps subsequent to step 9
Step 10,
Figure BDA0003239585200000112
This step is carried over from step 33 in the ReadLen subroutine when the data type identifier of the controller is word length data
Figure BDA0003239585200000124
Time, data symbol stack E 1 Popping a data symbol alpha, identifying the type of the data symbol loaded by an operator t (-), and a data buffer stack E 3 Content L of E3 Move to the word length buffer zone B 2 Length calculation band B 6 And (4) the content is not changed, and the Mark subprogram is entered according to the read data type identification.
2) The step of performing for the write operation comprises:
step 11, δ ([ q ] 2 ,t 0 ,e,ε,ε],β B ,0,0,0)=([q 2 ,t(α),ε,ε,ε],β B L (α), 0, S) when the data type of the controller is identified as ready t 0 Time, data symbol stack E 1 Ejecting a data symbol alpha, a data type identifier and a word length buffer band B 2 And loading the type and the word length of the data symbol through operators t (-) and l (-) respectively, and entering a Mark subprogram according to the data type identification. When the type and word length of the loaded data symbol are t B And 0, the flow proceeds to step (8) to end the write flow.
Step 12,
Figure BDA0003239585200000121
This step is carried over from step 22 in the Mark subroutine when the data type identifier of the controller is word length data
Figure BDA0003239585200000122
Time, data symbol stack E 1 Popping up a data symbol alpha, loading the data symbol type by the data type identification through an operator t (-), and buffering a word length buffer band B 2 Is stored in 2 And if not, marking to enter a Mark subprogram according to the data type.
3. Mark subprogram.
In the embodiment of the invention, the Mark subprogram respectively executes different steps for read operation and write operation; wherein:
1) The step of performing for the read operation comprises:
step 13, δ ([ q ] 1 ,t 1 ,ε,ε,ε],β 0 ,l 2 ,0,l 6 )=([q 1 ,t 1 ,ε,ε,ε],α,l 2 -1,0,l 6 1, R), this step is jumped in by the read operation of the PullSym subroutine (specifically, the aforementioned step 9), when the data type of the controller is identified as fixed-length data t 1 And the character length buffer zone B 2 When the memory content of (2) is not 0, the communication buffer pointed to by the controller is signed by beta 0 Marking the data symbol alpha as the current one, and marking the word length buffer band B after the marking is finished 2 Of (1) storage content l 2 Subtract 1, calculate band B 6 Non-zero data l in (1) 6 Minus 1, the controller moves to the right.
Step 14, δ ([ q ] 1 ,t 1 ,ε,ε,ε],β 0 ,0,0,l 6 )=([q 0 ,t 0 ,e,ε,ε],β 0 ,0,0,E(α)*l 6 S), after step 13 is executed, buffer zone B is formed when word length is longer 2 Is stored in 2 When the value is 0, the controller finishes marking the fixed-length data, executes validity judgment E (alpha), reads the valid data after the judgment is passed into the data symbol of the application program, and returns to the PullSym subprogram to read the next data symbol.
Step 15,
Figure BDA0003239585200000125
This step is entered by a read jump of the PullSym subroutine (specifically, step 10), when the data type identifier of the controller is variable-length data
Figure BDA0003239585200000131
And the character length buffer belt B 2 Is stored in 2 When not 0, the controller points to the communication buffer with a symbol beta 0 Will be marked as the current data symbol alpha, after marking is completed l 2 Minus 1,l 6 Minus 1, the controller moves to the right.
Step 16,
Figure BDA0003239585200000132
After step 15, buffer zone B is written to 2 Is stored in 2 When the value is 0, the controller finishes marking the variable-length data, executes validity judgment E (alpha), judges that valid data after passing is read into the data symbol of the application program, and returns to the PullSym subprogram to read the next data symbol.
Step 17, δ ([ q ] 1 ,t 1 ,ε,ε,ε],β B ,0,0,0)=([q 1 ,t B ,ε,ε,ε],β B 0, s), after step 13 is executed, when the data symbol of the pointing position of the controller is β B Hour and word length buffer zone B 2 Is stored in 2 To 0, the data type identification will be changed to null data t B The program returns to the Main subroutine (specifically, returns to the step 6) to end the reading process.
Step 18,
Figure BDA0003239585200000133
After step 15, when the data symbol of the pointing position of the controller is β B Hour and word length buffer zone B 2 Is stored in 2 To 0, the data type identification will be changed to null data t B The program returns to the Main subroutine (specifically, returns to the step 6) to end the reading process.
2) The step of performing for the write operation comprises:
step 19, δ ([ q ] 2 ,t 1 ,ε,ε,ε],β B ,l 2 ,0,0)=([q 2 ,t 1 ,ε,ε,ε],α,l 2 -1,0, R) when the data type of the controller is identified as fixed-length data t 1 And the character length buffer belt B 2 Is stored in 2 If not 0, the controller points to the communication buffer band B 0 Blank symbol beta of B Will be marked as the current data symbol alpha, after marking is completed l 2 Minus 1, the controller moves to the right.
Step 20, δ ([ q ] 2 ,t 1 ,ε,ε,ε],β B ,0,0,0)=([q 2 ,t 0 ,e,ε,ε],β B 0, S), after step 19 is performed, when the word length buffer zone B 2 Is stored in 2 When 0, the controller has buffered the communication with the band B 0 Blank symbol of (2) B Marking as a data symbol alpha, returning to the PullSym subprogram (specifically, the step 11) to write the next data symbol; at the same time, the marked bytes will be written to data and sent to the network via the TCPIP protocol.
Step 21,
Figure BDA0003239585200000135
When the data type of the controller is marked as word length data
Figure BDA0003239585200000136
And the character length buffer zone B 2 Is stored in 2 When not 0, the communication buffer zone B pointed by the controller 0 Blank symbol of (2) B The data symbol alpha to be marked as the current is markedAfter formation 2 Subtracting 1, and moving the controller to the right;
step 22,
Figure BDA0003239585200000134
After step 21, buffer B is written 2 Is stored in 2 When 0, the character length buffer zone B 2 Loading valid data stored by the current data symbol alpha through an operator v (·), and returning to the PullSym subprogram (specifically, the step 12) to write the next data symbol; the marked bytes will be written to data and sent to the network via the TCPIP protocol.
Step 23,
Figure BDA0003239585200000141
When the data type of the controller is identified as variable-length data
Figure BDA0003239585200000142
And the character length buffer zone B 2 Is stored in 2 When not 0, the communication buffer zone B pointed by the controller 0 Blank symbol beta of B Will be marked as the current data symbol alpha, after marking is completed l 2 Minus 1, the controller moves to the right.
Step 24,
Figure BDA0003239585200000143
After step 23, buffer zone B with word size is formed 2 Is stored in 2 When 0, the controller has buffered the communication with the band B 0 Blank symbol of (2) B Marked as data symbol a, returns to PullSym subroutine (specifically step 11 described above) to write the next data symbol, while the marked bytes will be written to data and sent to the network via the TCPIP protocol.
Step 25, δ ([ q ] 2 ,t 3 ,ε,ε,ε],β B ,l 2 ,0,0)=([q 2 ,t 3 ,ε,ε,ε],α, l 2 1,0, R) when the data type of the controller is identified as cycle data t 3 And the character length buffer belt B 2 Is stored in 2 When the value is not equal to 0, the value is,controller directed communication buffer band B 0 Blank symbol of (2) B Will be marked as the current data symbol alpha, after marking is completed l 2 Minus 1, the controller moves to the right.
Step 26, δ ([ q ] 2 ,t 3 ,ε,ε,ε],β B ,0,0,0)=([q 2 ,t 0 ,e,ε,ε],β B 0, s), after step 25 is performed, when the word length buffer zone B is present 2 Is stored in 2 When 0, the controller has buffered the communication with the band B 0 Blank symbol of (2) B Marked as data symbol a, the return PullSym subroutine (specifically step 11 described above) writes the next data symbol, and at the same time, the marked bytes will be written to data and sent to the network via the TCPIP protocol.
Step 27, δ ([ q ] 2 ,t 4 ,ε,ε,ε],β B ,l 2 ,0,0)=([q 2 ,t 4 ,ε,ε,ε],α, l 2 1,0, R) when the data type of the controller is identified as the protocol label t 4 And the character length buffer belt B 2 Is stored in 2 When not 0, the controller points to the blank symbol beta of the communication buffer zone B Will be marked as the current data symbol alpha, after marking is completed l 2 Minus 1, the controller moves to the right.
Step 28, δ ([ q ] 2 ,t 4 ,ε,ε,ε],β B ,0,0,0)=([q 2 ,t 0 ,e,ε,ε],β B 0, s), after step 27 is performed, when the word size buffer zone B is present 2 Is stored in 2 When 0, the controller has buffered the communication with the band B 0 Blank symbol of (2) B Marking as a data symbol alpha, returning to a PullSym subprogram (specifically, the step 11) to write the next data symbol, and simultaneously, writing the marked byte into data and sending the data to the network through a TCPIP protocol;
step 29, δ ([ q ] 2 ,t 5 ,ε,ε,ε],β B ,l 2 ,0,0)=([q 2 ,t 5 ,ε,ε,ε],α, l 2 1,0, R) when the data type of the controller is identified as length data t 5 And the character length buffer belt B 2 Is stored in 2 If not 0, the controller points to the communication buffer band B 0 Symbol beta B Will be marked as the current data symbol alpha, after marking is completed l 2 Minus 1, the controller moves to the right.
Step 30, δ ([ q ] 2 ,t 5 ,ε,ε,ε],β B ,0,0,0)=([q 2 ,t 0 ,e,ε,ε],β B 0, s), after step 29 is performed, when the word size buffer zone B is filled 2 Is stored in 2 When 0, the controller has buffered the communication with the band B 0 Blank symbol of (2) B Marked as data symbol a, the return PullSym subroutine (specifically step 11 described above) writes the next data symbol, and at the same time, the marked bytes will be written to data and sent to the network via the TCPIP protocol.
4. ReadLen subroutine.
In the embodiment of the present invention, the step of executing the ReadLen subroutine includes:
step 31,
Figure BDA0003239585200000151
When the data type is identified as word length data
Figure BDA0003239585200000152
And the character length buffer belt B 2 Is stored in 2 When not 0, the controller sets the data buffer stack E 3 Is in the stack state and proceeds to step 32.
Step 32,
Figure BDA0003239585200000153
Controller directed communication buffer signed beta 0 The data symbol alpha to be marked as current, the byte pointed to by the controller is stored in the data buffer stack E 3 After marking,/ 2 Minus 1, non-zero data l in the length calculation band 6 Minus 1, the controller moves to the right.
Step 33,
Figure BDA0003239585200000154
After step 32, the long buffer zone B is formed 2 Is stored in 2 When the data length is 0, the controller finishes marking the word length data, executes validity judgment E (alpha), reads valid data after the judgment is passed into a data symbol, and stores the valid data of the data symbol alpha into a data buffer stack E 3 And then returns to the PullSym subroutine (specifically, step 10) to read the next data symbol.
Step 34, δ ([ q ] 1 ,t 4 ,ε,ε,ε],β 0 ,l 2 ,0,l 6 )=([q 1 ,t 4 ,ε,ε,i],β 0 ,l 2 ,0,l 6 S), when the data type is marked as a protocol tag t 4 And the character length buffer belt B 2 Is stored in 2 When not 0, the controller sets the protocol position stack E 5 Is in the stack state and proceeds to step 35.
Step 35, δ ([ q ] 1 ,t 4 ,ε,ε,i],β 0 ,l 2 ,0,l 6 )=([q 1 ,t 4 ,ε,ε,i],α,l 2 -1,0,l 6 -1, r), controller directed communication buffer signed β 0 The data symbol alpha to be marked as current, the byte pointed to by the controller is stored in the protocol location stack E 5 After marking,/, is 2 Minus 1,l 6 Minus 1, the controller moves to the right.
Step 36, δ ([ q ] 1 ,t 4 ,ε,ε,i],β 0 ,0,0,l 6 )=([q 1 ,t 0 ,e,ε,ε],β 0 ,0,0,E(α)*l 6 S), after step 35 is executed, buffer zone B is written to word length 2 Is stored in 2 When the number is 0, the controller finishes marking the protocol mark, executes validity judgment E (alpha), reads valid data after the judgment is passed into a data symbol of the application program, and stores the valid data of the data symbol alpha into a protocol position stack E 5 And then returns to the PullSym subroutine (specifically, step 9) to read the next data symbol.
Step 37, δ ([ q ] 1 ,t 5 ,ε,ε,ε],β 0 ,l 2 ,0,l 6 )=([q 1 ,t 5 ,ε,i,ε],β 0 ,l 2 ,0,l 6 S), when the data type is markedIdentified as length data t 5 And the character length buffer belt B 2 Is stored in 2 When not 0, the controller sets the protocol position stack E 5 Is in the stacked state and proceeds to step 38.
Step 38, δ ([ q ] 1 ,t 5 ,ε,i,ε],β 0 ,l 2 ,0,l 6 )=([q 1 ,t 5 ,ε,i,ε],α,l 2 -1,0,l 6 R), controller directed communication buffer signed beta 0 The data symbol alpha to be marked as current, the byte pointed to by the controller is stored in the data buffer stack E 3 After marking,/ 2 Minus 1,l 6 Without change, the controller moves to the right.
Step 39, δ ([ q ] 1 ,t 5 ,ε,i,ε],β 0 ,0,0,l 6 )=([q 1 ,t 0 ,e,ε,ε],β 0 ,0,0,E(α)*L E3 S), after step 38 is executed, buffer zone B is written to word length 2 Is stored in 2 When the data is 0, the controller finishes marking the length data, executes validity judgment E (alpha), and reads valid data after the judgment is passed into a data symbol of the application program; storing the valid data of the data symbol alpha to the data buffer stack E 3 And the storage content is marked as l E3 Then moved to the length calculation band B 6 And then returns to the PullSym subroutine (specifically, step 9) to read the next data symbol.
5. ReadRan subroutine.
In the embodiment of the present invention, the steps executed by the ReadRan subroutine sequentially include:
step 40, δ ([ q ] 1 ,t 3 ,ε,ε,ε],β 0 ,l 2 ,0,l 6 )=([q 1 ,t 3 ,ε,i,ε],β 0 ,l 2 ,0,l 6 S), when the data type is identified as cycle data t 3 And the character length buffer belt B 2 Is stored in 2 When not 0, the controller sets the data buffer stack E 3 Is in the stacked state.
Step 41, δ ([ q ] 1 ,t 3 ,ε,i,ε],β 0 ,l 2 ,0,l 6 )=([q 1 ,t 3 ,ε,i,ε],α,l 2 -1,0,l 6 -1, r), controller directed communication buffer signed β 0 The byte pointed to by the controller, which will be marked as the current data symbol alpha, will be stored in the data buffer stack E 3 After marking,/, is 2 Minus 1, non-zero data l in the length calculation band 6 Minus 1, the controller moves to the right.
Step 42, δ ([ q ] 1 ,t 3 ,ε,i,ε],β 0 ,0,0,l 6 )=([q 1 ,t 3 ,i,ε,ε],β 0 ,l E3 ,r(α),E(α)*l 6 S), the controller has completed marking of the cycle data, performs validity determination E (α), and determines that valid data after passing is read into the data symbol; buffer data on stack E 3 Data storage content l of E3 Move to the word length buffer zone B 2 The end point r (alpha) of the number of the current cycle data is loaded into the cycle calculation band B 4 Data symbol stack E 1 Set to a stacked state if l E3 If the content of (1) is 0, the read cyclic data content is 0, go to step 45, if l is E3 If the content of (1) is not 0, the process proceeds to step 43.
Step 43, δ ([ q ] 1 ,t 3 ,i,ε,ε],β 0 ,l 2 ,l 4 ,l 6 )=([q 1 ,t 3 ,i,ε,ε],β 0 ,l 2 ,l 4 -1,l 6 S), when the data type is identified as cycle data t 3 And the character length buffer belt B 2 And a loop calculation band B 4 When the storage content of (2) is not 0, the band B is cyclically calculated 4 Is stored in 4 Is a data number of a communication protocol and can uniquely correspond to a data symbol a operable in a program. Adding alpha to the data symbol stack E 1 After, l 4 Subtract by 1, if l 4 Equals the number starting point s (α) of the current cycle data, and proceeds to step 44, otherwise step 43 is executed again.
Step 44, δ ([ q ] 1 ,t 3 ,i,ε,ε],β 0 ,l 2 ,s(α),l 6 )=([q 1 ,t 3 ,i,ε,ε],β 0 ,l 2 -1,r(α),l 6 S) when calculating band B 4 Is stored in 4 A word length buffer zone B for numbering the start s (alpha) of the current cycle data 2 Is stored in 2 Subtracting 1, loading the numbering end point r (alpha) of the current cycle data into a cycle calculation band B 4 If l is 2 If 0, go to step 45, if l 2 If it is greater than 0, the process proceeds to step 43.
Step 45, δ ([ q ] 1 ,t 3 ,i,ε,ε],β 0 ,0,l 4 ,l 6 )=([q 1 ,t 3 ,e,ε,ε],β 0 ,0,l 4 ,l 6 S), as long as character buffer zone B 2 When the memory content of (2) is 0, the data symbol stack E 1 And adjusting the stack pushing state into the stack popping state.
Step 46, δ ([ q ] 1 ,t 3 ,e,ε,ε],β 0 ,0,l 4 ,l 6 )=([q 1 ,t 3 ,e,ε,ε],β 0 ,0,l 4 -1,l 6 S) buffer zone B with equivalent length 2 When the memory content of (2) is 0, the data symbol stack E 1 And executing the pop operation. The purpose of the pop operation is to empty the preloaded data symbols so that the number of repetitions of the data symbols in the loop is equal to the memory content l of the data buffer stack loaded in step 39 E3 And (5) the consistency is achieved. Because the step (3) loads the data symbol stack E 1 In time, the data symbols within the specified range of the cycle data are preloaded once, and if the preloaded data is popped without executing the pop operation, the data symbols are stacked E 1 The accumulated number of data symbols in the buffer stack can not be equal to the storage content l of the data buffer stack loaded in step 39 E3 A matching relationship is formed, resulting in a failure of the read flow.
Step 47, δ ([ q ] 1 ,t 3 ,e,ε,ε],β 0 ,0,s(α),l 6 )=([q 0 ,t 0 ,e,ε,ε],β 0 ,0,0,l 6 And S), after the pop operation is finished, returning to the PullSym subprogram (specifically, the step 9) to read the next data symbol.
The above is the interaction relationship between the interior of the five subprograms and the subprograms, and for convenience of understanding, four application cases of normal data reception, normal data transmission, data content error and data length error are introduced below by combining the interaction relationship between the interior of the five subprograms and the subprograms.
Since the data link itself may also generate disturbance to cause invalid data to appear in the byte stream, only the receiving end detects illegal data, abnormal data and length error data and performs failure-operable direction, and the transmitting end does not perform detection operation of invalid byte stream. The content of the data received and sent by the communication buffer in each case conforms to the data set specifications described in tables 6, 7, and 8. The definition of data group 0, data groups 0-1, and data groups 0-1-3 comes from the application layer proprietary communication protocol actually used in some large-scale distributed hard real-time system.
Data numbering Data type Description of the invention
1 t 5 Data length
2 t 4 Type code
3 t 1 Version number
4 t 1 Time
TABLE 6 definition of data set 0
Figure BDA0003239585200000171
TABLE 7 definition of data sets 0-1
Figure BDA0003239585200000181
TABLE 8 definition of data sets 0-1-3
1. The data receives the case normally.
The byte stream received by the communication cache conforms to the specifications of the application layer private communication protocol. When data is normally received, there is no illegal data, abnormal data, and length error data in the byte stream. An example of the implementation is as follows:
1) Executing step 1 and step 2, finishing the initialization of the reading process and loading the type code of the root node of the protocol tree to a protocol position stack E 5
2) Step 3 and step 4 are executed, and the data symbols of the data group 0 are loaded to the data symbol stack E 1 Protocol location stack E 5 And (4) emptying.
3) Step 9, step 37, step 38, step 39 are executed, and the slave data symbol stack E 1 Pull data with number 1 and type length t 5 The data symbol of (2). Communication buffer marked bytes are stored in data symbols, length calculation band B 6 The load is marked byte by the total length of the byte stream.
4) Executing the steps 9, 34, 35 and 36, and stacking the data symbols E 1 The pull number is 2 and the type is the protocol label t 4 The data symbol of (2). Communication buffer marked bytes into data symbols, protocol location stack E 5 The type code marked byte as the next data group is loaded.
5) Executing step 9, step 13 and step 14, and stacking E from the data symbols 1 The drawing number is 3 and the type is fixed lengthData t 1 The data symbols of (2). The marked bytes of the communication buffer are stored in data symbols. The data symbol processing flow of number 4 corresponds to 3.
6) Executing step 9, step 5, step 3 and step 4, and acquiring a protocol position stack E 5 After the contents of (1), load the data symbols of data groups 0-1 into a data symbol stack E 1 Protocol location stack E 5 And (4) emptying.
7) Step 9, step 13 and step 14 are executed, and the slave data symbol stack E 1 The pull number is 5 and the type is fixed length data t 1 The data symbols of (2). The marked bytes of the communication buffer are stored in data symbols.
8) Step 9, step 34, step 35, step 36 are executed, and the slave data symbol stack E 1 The pull number is 6 and the type is the protocol label t 4 The data symbol of (2). Communication buffer marked bytes into data symbols, protocol location stack E 5 The type code is loaded with the tagged byte as the next data group.
9) Executing the steps 9, 31, 32, 33, 10, 15 and 16 to obtain the data symbol stack E 1 Sequentially pulling data with number of 7 and type of word length
Figure BDA0003239585200000193
And data symbols of type 8 and variable length data
Figure BDA0003239585200000194
The data symbol of (2). Communication buffer marked bytes are stored in data symbols, word length buffer band B 2 And a data buffer stack E 3 Emptied after use is complete.
10 Step 9, step 5, step 3, step 4 are executed to obtain the protocol location stack E 5 After the contents of (2), load the data symbols of data groups 0-1-3 onto data symbol stack E 1 Protocol location stack E 5 And (4) emptying.
11 Step 9, step 13, step 14 are performed from the data symbol stack E 1 The drawing number is 9 and the type is fixed length data t 1 The data symbol of (2). Communication cache tagged byte storesAnd inputting data symbols. The data symbol processing flow of number 10 corresponds to 9.
12 Step 9, step 40, step 41, step 42, step 43, step 44, step 45, step 46, step 47 are performed from the data symbol stack E 1 Pull number 11 and type cycle data t 3 The data symbol of (2). Circular calculation band B 4 Loading the marked bytes as a number of cycles, and then inserting the data symbols into the data symbol stack E in reverse order 1 Each time the inserted data symbols are numbered 19, 18, 17, 16, 15, 14, 13 and 12 in sequence. If the number of cycles is 0, step 46 can ensure that the number of insertions is consistent with the number of cycles read in the byte stream.
13 Step 9, step 13, step 14 are performed from the data symbol stack E 1 The drawing number is 12 and the type is fixed length data t 1 The data symbols of (2). The marked bytes of the communication buffer are stored in data symbols.
14 Step 9, step 31, step 32, step 33, step 10, step 15, step 16 are performed from the data symbol stack E 1 Sequentially pulling data with serial number of 13 and type of word length
Figure BDA0003239585200000191
And 14 and the type is variable length data
Figure BDA0003239585200000192
The data symbol of (2). Communication buffer marked bytes are stored in data symbols, word length buffer band B 2 And a data buffer stack E 3 Emptied after use is complete.
15 Step 9, step 13, step 14 are performed from the data symbol stack E 1 Drawing a fixed-length data t with the number of 15 1 The data symbol of (2). The marked bytes of the communication buffer are stored in data symbols.
16 Step 9, step 40, step 41, step 42, step 43, step 44, step 45, step 46, step 47 are performed from the data symbol stack E 1 Pull number 16 and type cycle data t 3 The data symbol of (2). Loop calculation band B 4 Loading quiltMarking bytes as the number of cycles, and then inserting data symbols into the data symbol stack in reverse order 1 Each inserted data symbol is numbered 19, 18 and 17 in that order. If the number of loops is 0, step 46 can ensure that the number of insertions is identical to the number of loops read in the byte stream.
17 Step 9, step 13, step 14 are executed from the data symbol stack E 1 The drawing number is 17 and the type is fixed length data t 1 The data symbols of (2). The marked bytes of the communication buffer are stored in data symbols.
18 Step 9, step 31, step 32, step 33, step 10, step 15, step 16 are performed from the data symbol stack E 1 Sequentially pulling data with 18 serial numbers and word length types
Figure BDA0003239585200000201
And data symbol of type 19 and variable length data
Figure BDA0003239585200000202
The data symbol of (2). Communication buffer marked bytes into data symbols, word length buffer band B 2 And a data buffer stack E 3 Emptied after use is complete.
19 From data symbol stack E 1 And continuously pulling data symbols, and marking communication buffer and storing data according to the data type until all the byte streams are marked.
20 Step 18 and step 6 are executed, the multi-belt turing machine is reset and stopped in a receiving state, and the reading process is finished.
2. The data is sent to the case normally.
The effective data ordering pre-sent by the application program conforms to the specification of the communication protocol of the application layer. When the values of data numbers 11 and 16 in Table 8 are 2 and 1, respectively, the loaded sequence is α 1 α 2 α 3 α 4 α 5 α 6 α 7 α 8 α 9 α 10 α 11 α 12 α 13 α 14 α 15 α 16 α 17 α 18 α 19 α 12 α 13 α 14 α 15 α 16 α 17 α 18 α 19 When data is normally transmitted, each data symbol α i ,i∈[1,19]The prestored data are all in the valid range, and the execution example is as follows:
1) Executing step 7, completing the initialization of the writing process and loading the pre-sent content to the data symbol stack E in the form of data symbols 1 . All symbols are arranged according to data numbering and storage time sequence.
2) Executing step 11, step 29 and step 30, and stacking E from the data symbols 1 The pull number is 1 and the type is length data t 5 The data symbols of (2). And writing the valid data stored in the data symbol into a communication buffer.
3) Executing step 11, step 27 and step 28, and stacking E from the data symbols 1 The pull number is 2 and the type is the protocol label t 4 The data symbols of (2). And writing the valid data stored in the data symbol into a communication buffer.
4) Executing step 11, step 19 and step 20, and stacking E from the data symbols 1 Drawing number of 3 and type of fixed length data t 1 The data symbol of (2). And writing the valid data stored in the data symbol into a communication buffer. The data symbol processing flow of numbers 4 and 5 is identical to 3.
5) Step 11, step 27 and step 28 are executed, and the slave data symbol stack E 1 The pull number is 6 and the type is the protocol label t 4 The data symbol of (2). And writing the valid data stored in the data symbol into a communication buffer.
6) Executing the steps 11, 21, 22, 12, 23 and 24, and stacking the data symbols E 1 Sequentially pulling data with number of 7 and type of word length
Figure BDA0003239585200000211
And data symbols of type 8 and variable length data
Figure BDA0003239585200000212
The data symbols of (2). Storing the data symbol content with number 7 into word length buffer zone B 2 Then, it is followed byAnd writing into the communication cache. Buffer zone B according to word length for data symbol number 8 2 Writing the stored word length data into a communication buffer, word length buffer band B 2 Emptied after use is complete.
7) Executing step 11, step 19 and step 20, and stacking E from the data symbols 1 The drawing number is 9 and the type is fixed length data t 1 The data symbols of (2). And writing the valid data stored in the data symbol into a communication buffer. The data symbol processing flow of number 10 corresponds to 9.
8) Executing step 11, step 25 and step 26, and stacking E from the data symbols 1 Pull number 11 and type cycle data t 3 The data symbols of (2). And writing the valid data stored in the data symbol into a communication buffer. Since the value stored in the data number 11 is 2, the contents of the data numbers 12 to 19 appear 2 times in the loaded contents.
9) Executing step 11, step 19 and step 20, and stacking E from the data symbols 1 The drawing number is 12 and the type is fixed length data t 1 The data symbol of (2). And writing the valid data stored in the data symbol into a communication buffer.
10 Step 11, step 21, step 22, step 12, step 23, step 24 are performed from the data symbol stack E 1 Sequentially pulling data with serial number of 13 and type of word length
Figure BDA0003239585200000213
And 14 and the type is variable length data
Figure BDA0003239585200000214
The data symbols of (2). The data symbol content with the number of 13 is stored in a word length buffer band B 2 And then writing into the communication buffer. Buffer zone B of data symbols numbered 14 according to word length 2 Writing the stored word length data into communication buffer, word length buffer band B 2 Emptied after use is complete.
11 Step 11, step 19, step 20 are performed from the data symbol stack E 1 The drawing number is 15 and the type is fixed length data t 1 The data symbols of (2). Communication of valid data writes stored within data symbolsAnd (4) caching.
12 Step 11, step 25, step 26 are performed from the stack of data symbols E 1 Pull number 16 and type cycle data t 3 The data symbol of (2). And writing the valid data stored in the data symbol into a communication buffer. Since the value stored in the data number 16 is 1, the contents of the data numbers 17 to 19 appear 1 time in the loaded contents. If the value stored in the data number 16 is 0, the contents of the data numbers 17 to 19 do not appear.
13 Step 11, step 19, step 20 are performed from the data symbol stack E 1 The drawing number is 17 and the type is fixed length data t 1 The data symbols of (2). And writing the valid data stored in the data symbol into a communication buffer.
14 Step 11, step 21, step 22, step 12, step 23, step 24 are performed from the data symbol stack E 1 Sequentially pulling data with 18 serial numbers and word length types
Figure BDA0003239585200000215
And data symbol of type 19 and variable length data
Figure BDA0003239585200000216
The data symbols of (2). The data symbol content with the number of 18 is stored in a word length buffer band B 2 And then writing into the communication buffer. Buffer zone B according to word length for data symbol number 19 2 Writing the stored word length data into a communication buffer, word length buffer band B 2 Emptied after use is complete.
15 From the data symbol stack E 1 Pulling the rest data symbols in sequence, writing the data into the cache according to the data type mark until the data symbol stack E 1 Is empty.
16 Step 11 and step 8 are executed, the multi-band turing machine is reset and stopped in the receiving state, and the writing process is finished.
3. Data content error case.
Invalid data in the byte stream can be detected and a fail-actionable guided flow can be executed in the receiving flow. When illegal data or abnormal data exists in the byte stream, the execution example is as follows:
1) Data symbols numbered 3, 4, 5, 9, 10, 12, 15, 17: step 13 is executed to read the type as fixed-length data t 1 Then, the process proceeds to step 14, and a validity determination E (α) is performed. If there is data or an outlier in the marked byte stream that is outside the valid range, the operator E (α) will return 0, resulting in step 14 in the length calculation band B 6 Count 0 in (1). Because the state transfer function has no connection rule, the multi-band turing machine will stop in the non-acceptance state, and will execute the failure-operable guiding flow, the concrete method is to force to return to the initial state or skip the current byte, and then record the error log.
2) Data symbols numbered 7, 13, 18: the step 32 of reading data of type word length is executed
Figure BDA0003239585200000221
Then, the process proceeds to step 33, and validity determination E (α) is performed. If there is data or an outlier in the marked byte stream that is outside the valid range, the operator E (α) will return 0, resulting in step 33 in the length calculation band B 6 Count 0 in (1). Because the state transfer function has no connection rule, the multi-band turing machine is stopped in a non-acceptance state, and a failure-operable guide flow is executed.
3) Data symbols numbered 8, 14, 19: step 15 of reading data t of variable length type is executed 2 After the data symbol of 1, the flow proceeds to step 16 and validity determination E (α) is performed. If there are data or outliers in the marked byte stream that are outside the valid range, the operator E (α) will return 0, resulting in step 16 in the length calculation band B 6 The number of the particles is 0. Because the state transfer function has no connection rule, the multi-band turing machine will stop in the non-acceptance state, and will execute the failure-operable guiding flow, the concrete method is to force to return to the initial state or skip the current byte, and then record the error log.
4) Data symbols numbered 11, 16: step 41 is executed to read the type of cycle data t 3 After the data symbolThe routine proceeds to step 42 and validity determination E (α) is performed. If there are data or outliers in the marked byte stream that are outside the valid range, the operator E (α) will return 0, resulting in step 42 in the length calculation band B 6 Count 0 in (1). Because the state transfer function has no connection rule, the multi-band turing machine is stopped in a non-acceptance state, and the failure-operable guide logic is executed.
5) Data symbols numbered 2, 6: the step 35 is executed to read the type as protocol flag t 4 Then, the process proceeds to step 35, and a validity determination E (α) is performed. If there is data or an outlier in the marked byte stream that is outside the valid range, the operator E (α) will return 0, resulting in step 36 in the length calculation band B 6 Count 0 in (1). Because the state transfer function has no connection rule, the multi-band turing machine will stop in the non-acceptance state, and will execute the failure-operable guide logic, the specific method is to force to return to the initial state or skip the current byte, and then record the error log.
6) Data symbol numbered 1: step 38 is performed to read the type as length data t 5 Then, the process proceeds to step 39, and a validity determination E (α) is performed. If there are data or outliers in the marked byte stream that are outside the valid range, the operator E (α) will return 0, resulting in step 39 in the length calculation band B 6 The number of the particles is 0. Because the state transfer function has no connection rule, the multi-band turing machine will stop in the non-acceptance state, and will execute the failure-operable guide logic, the specific method is to force to return to the initial state or skip the current byte, and then record the error log.
4. Data length error case.
When detecting data with a length error, the steps executed are the same as those when the data is normally read. The application program first detects the data with the length error once, and if no error exists, the byte stream reading process is executed.
Since the purpose of executing the reading process is changed into length check, the multi-band turing machine can only mark and read word length data
Figure BDA0003239585200000231
Cycle data t 3 Protocol label t 4 And length data t 5 Only mark unread fixed-length data t 1 Variable length data
Figure BDA0003239585200000232
The content of (1). If the length calculation band B 6 If the storage content is 0 before all the marks of the byte stream are finished or the storage content is not 0 after all the marks of the byte stream are finished, the algorithm detects the data with the wrong length, the multi-belt turing machine is stopped in a non-receiving state, the algorithm executes failure-operable guide logic, and the specific method is to force the multi-belt turing machine to return to an initial state or skip the current byte and then record an error log.
The four application cases of normal data receiving, normal data sending, data content error and data length error show that the method provided by the invention has the function of reading and writing the real-time data link byte stream by the traditional method, and realizes the detection and invalidation of invalid byte stream and the operable guide process on the basis. The method provided by the invention is manufactured according to the application layer private communication protocol actually used in a large-scale distributed hard real-time system, and the beneficial effects brought by the method can be summarized as follows:
1) Allowing TCP/IP applications to perform invalidity detection and invalidation of illegal data-an operationally directed process. The process is carried out simultaneously with the reading process of the real-time data link byte stream, so that the situation that invalid data further causes unexpected behaviors of the application program can be prevented.
2) Allowing the TCP/IP application to perform the detection of invalidity and invalidation of anomalous data-an operational guided flow. The process and the reading process of the real-time data link byte stream are carried out simultaneously, so that invalid data can be prevented from further causing application program crash.
3) The TCP/IP application program is allowed to determine in advance whether the whole real-time data link byte stream is data with wrong length before the data reading flow begins.
Through the description of the above embodiments, it is clear to those skilled in the art that the above embodiments may be implemented by software, or by software plus a necessary general hardware platform. With this understanding, the technical solutions of the embodiments can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods according to the embodiments of the present invention.
It is obvious to those skilled in the art that, for convenience and simplicity of description, the above division of each functional module is only used for illustration, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the system is divided into different functional modules to complete all or part of the above described functions.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims (9)

1. A real-time data link byte stream error-proofing method based on a multi-band turing machine is characterized by comprising the following steps:
constructing a multi-band smart machine, performing read-write operation of communication cache through a state transfer function of the multi-band smart machine, detecting invalid byte streams in the read-write operation or before the read-write operation, and returning to a read operation initial state or skipping related bytes when the invalid byte streams are detected; the state transfer function is divided into five subroutines according to functions: main, mark, pullSym, readLen and ReadRan; wherein:
main subprogram for processing the initial and end states of the reading and writing operation of the multi-band smart machine, and switching to PullSym subprogram after the initial state of the reading and writing operation is processed;
a PullSym subroutine for pulling data symbols from the data symbol stack of the multi-band smart machine during a read operation, and entering a ReadLen subroutine, a ReadRan subroutine, or a Mark subroutine according to a data type identifier, or returning to a Main subroutine; the system is also used for pulling data symbols from the data symbol stack of the multi-band turing machine in the write operation and entering a Mark subprogram;
the Mark subprogram is used for marking data symbols on a communication cache belt according to the data type identification in the reading operation and detecting invalid byte streams through validity judgment, if the valid data passes the validity judgment, the valid data is read into the data symbols of the application program and then returned to the PullSym subprogram, or the data symbols are marked and the data reading is completed and then returned to the Main subprogram, and the terminal state is entered; the communication cache is also used for marking data symbols on the communication cache according to the data type identification in the write operation, obtaining the value of effective data through an operator and returning the value to the PullSym subprogram, or writing corresponding data after marking the data symbols and returning the corresponding data to the PullSym subprogram;
the ReadLen subprogram is a reading program of word length data, protocol marks and length data, after the word length data, the protocol marks or the length data are marked, invalid byte streams are detected through validity judgment, if the validity judgment is passed, valid data are read into a data symbol of an application program, and then the valid data are returned to the PullSym subprogram;
the ReadRan subprogram is a reading program of the cyclic data, after the marking of the cyclic data is completed, the invalid byte stream is detected through validity judgment, if the invalid byte stream passes the validity judgment, the valid data is read into a data symbol of an application program, and after the cyclic data is read, the PullSym subprogram is returned.
2. The method of claim 1, wherein the multi-band smart machine comprises: the device comprises a controller, a data symbol stack, a data buffer stack, a protocol position stack, a word length buffer zone, a cycle calculation zone and a length calculation zone;
the controller is used for storing state variables of the state transfer functions of the multi-belt turing machine and controlling the conversion among subprograms, and each subprogram outputs corresponding state variables and input variables after executing each flow; wherein the state variables include: the system comprises a main state, a data type identifier, a data symbol stack state, a data buffer stack state and a protocol position stack state, wherein the main state comprises a ready state, a reading state and a writing state of the multi-band turing machine; the input variables include: the position of a communication buffer zone, the numerical value of a word length buffer zone and the numerical value of a circular calculation zone which are currently pointed by the controller;
character length buffer band B 2 And a loop calculation band B 4 And length calculating band B 6 The local variables are used for temporarily storing the local variables used in the reading and writing process;
data symbol stack E 1 Each cell of (a) represents a single data symbol, a data structure for storing valid data inside the application, a data buffer stack E 3 And protocol location stack E 5 For temporarily storing the byte stream.
3. The method of claim 2, wherein the invalid byte stream comprises: illegal data, abnormal data, and length error data;
wherein the illegal data comprises: data in the byte stream that is not within the valid range specified by the communication protocol; the exception data includes: data within the byte stream that can cause the operating system to force the application to close; the length error data includes: data with inconsistent data length and actual length recorded by the byte stream;
the illegal data and the abnormal data are detected through validity judgment in read-write operation; the length error data is detected before the read-write operation, the execution flow during the detection is consistent with the read operation flow, if the length calculation band B 6 The content is 0 before the byte stream is completely marked, or the byte stream is stored after the byte stream is completely markedIf not 0, it indicates that the length error data is detected.
4. The method of claim 2, wherein the real-time data link byte stream error proofing is defined using a seven-tuple form, expressed as:
M=(Q,Σ,Γ,δ,Q 0 ,C,F)
wherein:
m represents a multi-band turing machine;
q is a set of multi-band turing machine states
Figure FDA0003239585190000023
q 0 、q 1 、q 2 Sequentially indicating a ready state, a read state, a write state, t 0 、t 1
Figure FDA0003239585190000021
t 3 、t 4 、t 5 、t B Is data type identification respectively representing ready, fixed length data, word length data, variable length data, cycle data, protocol mark, length data and null data, the last three components respectively corresponding to data symbol stack E 1 Data buffer stack E 3 And protocol location stack E 5 I, e and epsilon are state identifiers of the linear stack and respectively represent stack entering, stack exiting and no operation;
sigma is a finite set of input data symbols
Figure FDA0003239585190000022
Is an ordered pair of four input variables; beta is a beta B Representing a blank symbol in the communication buffer band B 0 The upper part shows that the grid is not loaded with the byte stream, and the communication buffer after the byte stream is loaded is signed by beta 0 Representing; character length buffer belt B 2 And a loop calculation band B 4 And length calculating band B 6 All the bytes can be equivalently converted into integers, and the input contents of the three are respectively recorded as
Figure FDA0003239585190000031
Refers to content as all non-negative integers;
Γ is a signed complete set
Figure FDA0003239585190000032
Alpha represents a data symbol and represents that the byte on the communication cache band forms a matching relation with effective data stored in the application program; beta is a B In the word length buffer zone B 2 And a loop calculation band B 4 Sum Length calculation band B 6 Up represents the initialization state;
δ is the state transfer function of the multi-band turing machine;
Q 0 is the initial state set of the multi-band turing machine { ([ q ] 0 ,t 0 ,ε,ε,ε],β BBBB ),([q 0 ,t 0 ,i,ε,ε],β BBBB ) And the two states respectively represent the states of the Turing machine before the communication buffer starts to read and write data, and beta at four positions B Sequentially corresponding to communication buffer zone B 0 Word length buffer belt B 2 And a loop calculation band B 4 Sum Length calculation band B 6
C is communication buffer band B 0 Word length buffer belt B 2 And a loop calculation band B 4 And length calculating band B 6 Blank symbol set [ beta ] used in B };
F is the termination state set { ([ q ]) of the multi-band Turing machine 0 ,t B ,ε,ε,ε],β BBBB ) And the state is the final state of the turing machine after the turing machine finishes reading or writing the communication cache data.
5. The method for preventing errors of the real-time data link byte stream based on the multi-band turing machine according to the claim 2, 3 or 4, characterized in that the Main sub-program comprises: a step of reading operation and a step of writing operation; wherein:
the step of the read operation includes:
step 1, entering the initial state of read operation, and communicating a buffer band B 0 Loading byte stream, word length buffer zone B 2 And a loop calculation band B 4 The storage content of (2) is preset to 0, and the controller does not move;
step 2, protocol position stack E 5 Loading type code of root node of protocol tree and word length position p of byte stream length field in data group of root node l Protocol location stack E 5 Content L of E5 Move to the word length buffer zone B 2 The data type identification is changed to null data t B (ii) a The protocol tree is a tree structure formed by different data groups, the data groups are obtained by dividing effective data according to type codes, and the data groups in the protocol tree are used as nodes;
step 3, the application program executes a function Tree (-) of which the argument is a word length buffer zone B 2 Content of (1) 2 The acquired data set is loaded in the form of a sequence of data symbols into a stack of data symbols E 1 Length calculation band B 6 The content of (a) is not changed; the function Tree (-) is used for acquiring a data group from the protocol Tree according to the type code and recording the current position of the protocol Tree;
step 4, loading the data group to a data symbol stack E 1 Then, the data type identification of the controller is changed to ready t 0 Enter PullSym subroutine, length calculation band B 6 The content of (2) is not changed;
and 5, jumping into the step by the PullSym subprogram, wherein the type of the loaded data symbol in the PullSym subprogram is null data t B The protocol position stack E is shifted to the present step 5 Content L of E5 Move to the word length buffer zone B 2 Length calculation band B 6 After the content is not changed, the step 3 is carried out;
6, the step jumps into the Mark subprogram, enters the termination state of the reading operation, finishes the reading operation, and the word length buffer zone B 2 And a loop calculation band B 4 Resetting;
the step of writing comprises:
step 7, entering the initial state of the write operation, and executing the function Loa by the application programd (-) and the argument of the function Load (-) is given by an application program, and the obtained valid data is loaded to a data symbol stack E in the form of a data symbol sequence 1 The function Load (-) is used for loading all the effective data which are sent in advance, and the sequence of all the effective data accords with the specification of an application layer communication protocol;
step 8, the PullSym subprogram jumps into the step, enters the termination state of the write operation, completes the read operation, and the word length buffer zone B 2 And a loop calculation band B 4 And (5) resetting.
6. The real-time data link byte stream error proofing method based on multi-zone turing machine according to the claim 2, 3 or 4, characterized in that the PullSym subprogram executes different steps for each of the read operation and the write operation; wherein:
the step of performing for the read operation comprises:
step 9, when the data type of the controller is marked as ready t 0 Time, data symbol stack E 1 Popping up a data symbol alpha, a data type identifier and a word length buffer zone B 2 The type of data symbol and the word length, length calculation band B are loaded by operators t (-) and l (-) respectively 6 The content of (2) is not changed, and the subsequent steps are transferred into different subprograms according to different types of loading data symbols of an operator t (·);
step 10, the step is transferred by ReadLen subprogram, when the data type of the controller is marked as word length data
Figure FDA0003239585190000042
Time, data symbol stack E 1 Popping a data symbol alpha, identifying the type of the data symbol loaded by an operator t (-), and a data buffer stack E 3 Content L of E3 Move to the word length buffer zone B 2 Length calculation band B 6 The content is not changed, and a Mark subprogram is entered according to the read data type identification;
the step of performing for the write operation comprises:
step 11, when the data type of the controller is marked asReady t 0 Time, data symbol stack E 1 Popping up a data symbol alpha, a data type identifier and a word length buffer zone B 2 Loading the type and the word length of a data symbol through an operator t (-) and an operator l (-) respectively, and entering a Mark subprogram according to data type identification; when the type and word length of the loaded data symbol are null data t B When the sum is 0, the Main subprogram is switched into, and the ending state of the write operation is entered;
step 12, when the data type of the controller is marked as word length data
Figure FDA0003239585190000041
Time, data symbol stack E 1 Popping up a data symbol alpha, loading the data symbol type by the data type identification through an operator t (-), and buffering a word length buffer band B 2 Is stored in 2 And unchanged, entering a Mark subprogram according to the data type identification.
7. The error protection method for the byte stream of the real-time data link based on the multi-band turing machine according to the claim 2, 3 or 4, characterized in that the Mark subprogram executes different steps for each of the read operation and the write operation; wherein:
the performing step for the read operation includes:
step 13, the step is entered by the read operation jump of the PullSym subprogram, when the data type identifier of the controller is fixed-length data t 1 And the character length buffer belt B 2 When the memory content of (2) is not 0, the communication buffer pointed to by the controller is signed by beta 0 Marking the data symbol alpha as the current one, and marking the word length buffer band B after the marking is finished 2 Of (2) storage content l 2 Minus 1, length calculation band B 6 Non-zero data l in 6 Subtracting 1, and moving the controller to the right;
step 14, after step 13, buffer zone B with word length is formed 2 Is stored in 2 When the data is 0, the controller finishes marking the fixed-length data, executes validity judgment E (alpha), reads the valid data after the judgment is passed into the data symbol of the application program, and returns to the PullSym subprogram; wherein, when the validity is judgedThe operator E (-) of (1) represents whether the data is out of the valid range or has an abnormal value;
step 15, this step is entered by the read operation jump of the PullSym subprogram, when the data type of the controller is identified as variable-length data
Figure FDA0003239585190000051
And the character length buffer belt B 2 Is stored in 2 When not 0, the controller points to the communication buffer with a symbol beta 0 Will be marked as the current data symbol alpha, after marking is completed l 2 Minus 1,l 6 Subtracting 1, the controller moves to the right;
step 16, after step 15, buffer zone B with word length is formed 2 Is stored in 2 When the data is 0, the controller finishes marking the variable-length data, executes effectiveness judgment E (alpha), reads the passed effective data into the data symbol of the application program, and returns to the PullSym subprogram;
step 17, after step 13, when the controller points to the communication buffer zone B 0 The data symbol of the position is a blank symbol beta B Hour and word length buffer zone B 2 Is stored in 2 To 0, the data type identification will be changed to null data t B The program returns to the Main subprogram to finish the reading process; step 18, after step 15, when the data symbol of the communication buffer zone pointed by the controller is a blank symbol β B Hour and word length buffer zone B 2 Is stored in 2 To 0, the data type identification will be changed to null data t B The program returns to the Main subprogram to finish the reading process;
the step of performing for the write operation comprises:
step 19, when the data type of the controller is marked as fixed-length data t 1 And a character long buffer zone B 2 Is stored in 2 If not 0, the controller points to the communication buffer band B 0 Blank symbol of (2) B Will be marked as the current data symbol alpha, after marking is completed l 2 Subtracting 1, and moving the controller to the right;
step 20, after step 19 is executed, when the word length is equal toBuffer zone B 2 Is stored in 2 When 0, the controller has buffered the communication with the band B 0 Blank symbol of (2) B Marking as a data symbol alpha, returning to a PullSym subprogram, and simultaneously writing the marked bytes into data and sending the data to a network through a TCPIP protocol;
step 21, when the data type of the controller is marked as word length data
Figure FDA0003239585190000061
And the character length buffer belt B 2 Is stored in 2 If not 0, the controller points to the communication buffer band B 0 Blank symbol beta of B Will be marked as the current data symbol alpha, after marking is completed l 2 Subtracting 1, and moving the controller to the right;
step 22, after step 21, buffer zone B with word length is formed 2 Is stored in 2 When 0, the character length buffer zone B 2 Loading valid data stored by the current data symbol alpha through an operator v (·), returning to a PullSym subprogram, and simultaneously writing the marked bytes into data and sending the data to a network through a TCPIP protocol;
step 23, when the data type of the controller is marked as variable-length data
Figure FDA0003239585190000062
And the character length buffer zone B 2 Is stored in 2 When not 0, the communication buffer zone B pointed by the controller 0 Blank symbol of (2) B Marking the current data symbol alpha as a mark I 2 Subtracting 1, the controller moves to the right;
step 24, after step 23, buffer zone B with word length is formed 2 Is stored in 2 When 0, the controller has buffered the communication with the band B 0 Blank symbol of (2) B Marking as a data symbol alpha, returning to a PullSym subprogram, and simultaneously writing the marked bytes into data and sending the data to a network through a TCPIP protocol;
step 25, when the data type of the controller is marked as cycle data t 3 And are combinedAnd the character length buffer zone B 2 Is stored in 2 If not 0, the controller points to the communication buffer band B 0 Blank symbol beta of B Will be marked as the current data symbol alpha, after marking is completed l 2 Subtracting 1, the controller moves to the right;
step 26, after step 25, buffer zone B with word length 2 Is stored in 2 When 0, the controller has buffered the communication with the band B 0 Blank symbol of (2) B Marking as a data symbol alpha, returning to a PullSym subprogram, and simultaneously writing marked bytes into data and sending the data to a network through a TCPIP protocol;
step 27, when the data type of the controller is marked as the protocol mark t 4 And the character length buffer belt B 2 Is stored in 2 When not 0, the communication buffer zone B pointed by the controller 0 Blank symbol beta of B Marking the current data symbol alpha as a mark I 2 Subtracting 1, the controller moves to the right;
step 28, after step 27, buffer B with word length is taken 2 Is stored in 2 When 0, the controller has buffered the communication with B 0 Blank symbol of (2) B Marking as a data symbol alpha, returning to a PullSym subprogram, and simultaneously writing the marked bytes into data and sending the data to a network through a TCPIP protocol;
step 29, when the data type of the controller is marked as length data t 5 And a character long buffer zone B 2 Is stored in 2 When not 0, the communication buffer zone B pointed by the controller 0 Blank symbol of (2) B Will be marked as the current data symbol alpha, after marking is completed l 2 Subtracting 1, the controller moves to the right;
step 30, after step 29, buffer zone B with word length is formed 2 Is stored in 2 When 0, the controller has buffered the communication with B 0 Blank symbol of (2) B Marked as data symbol a, the PullSym subroutine is returned, while the marked bytes will be written to data and sent to the network via the TCPIP protocol.
8. The method for preventing errors of the real-time data link byte stream based on the multi-band turing machine according to the claim 2, 3 or 4, characterized in that the ReadLen sub-program executes the steps of:
step 31, when the data type is marked as word length data
Figure FDA0003239585190000071
And the character length buffer zone B 2 Is stored in 2 When not 0, the controller sets the data buffer stack E 3 Is in the stack state and proceeds to step 32;
step 32, the controller directed communication buffer is signed beta 0 The data symbol alpha to be marked as current, the byte pointed to by the controller is stored in the data buffer stack E 3 After marking,/ 2 Minus 1, non-zero data l in the length calculation band 6 Subtracting 1, the controller moves to the right;
after step 33, step 32 is executed, the long buffer zone B is formed 2 Is stored in 2 When the data length is 0, the controller finishes marking the word length data, executes validity judgment E (alpha), reads valid data after the judgment is passed into a data symbol, and stores the valid data of the data symbol alpha into a data buffer stack E 3 Then returning to the PullSym subprogram; wherein, the operator E (-) during the validity judgment represents whether the data exceeds the valid range or has an abnormal value;
step 34, when the data type is identified as the protocol mark t 4 And a character long buffer zone B 2 Is stored in 2 When not 0, the controller sets the protocol position stack E 5 Is in the stack state and proceeds to step 35;
step 35, the controller directed communication buffer is signed by β 0 The data symbol alpha to be marked as current, the byte pointed to by the controller is stored in the protocol location stack E 5 After marking,/ 2 Minus 1,l 6 Subtracting 1, the controller moves to the right;
step 36, after step 35, buffer zone B with word length is formed 2 Is stored in 2 When it is 0, controlMarking the protocol mark by the device, executing validity judgment E (alpha), reading valid data after the judgment is passed into a data symbol of the application program, and storing the valid data of the data symbol alpha into a protocol position stack E 5 Then returning to the PullSym subprogram;
step 37, when the data type is marked as length data t 5 And the character length buffer belt B 2 Is stored in 2 When not 0, the controller sets the protocol position stack E 5 Is in the stack state and proceeds to step 38;
step 38, the controller directs the communication buffer to be signed beta 0 The data symbol alpha to be marked as current, the byte pointed to by the controller is stored in the data buffer stack E 3 After marking,/ 2 Minus 1,l 6 The controller moves to the right without changing;
step 39, after step 38, buffer zone B with word length is formed 2 Is stored in 2 When the data is 0, the controller finishes marking the length data, executes validity judgment E (alpha), and reads valid data after the judgment is passed into a data symbol of the application program; storing the valid data of the data symbol alpha to the data buffer stack E 3 Then moved to the length calculation band B 6 And then returns to the PullSym subroutine.
9. The method as claimed in claim 2, 3 or 4, wherein the ReadRan subroutine performs the steps of:
step 40, when the data type is marked as cycle data t 3 And the character length buffer belt B 2 Is stored in 2 When not 0, the controller sets the data buffer stack E 3 Is in a stack entering state;
step 41, the controller directed communication buffer is signed beta 0 The data symbol alpha to be marked as current, the byte pointed to by the controller is stored in the data buffer stack E 3 After marking,/ 2 Minus 1, length calculating the non-zero data l in the band 6 Subtracting 1, the controller moves to the right;
step 42, controlThe device finishes marking the cycle data, executes validity judgment E (alpha), and reads the valid data after the judgment is passed into the data symbol; buffer data on stack E 3 Data storage content l of E3 Move to the word length buffer zone B 2 The end point r (alpha) of the number of the current cycle data is loaded into the cycle calculation band B 4 Data symbol stack E 1 Setting to a stack entering state; if the data storage content l E3 If the content of (1) is 0, the read cyclic data content is 0, go to step 45, if the data storage content l E3 If not, go to step 43; wherein, an operator E (-) during the validity judgment represents whether the judgment data exceeds the valid range or has an abnormal value;
step 43, when the data type is identified as cycle data t 3 And the character length buffer belt B 2 And a loop calculation band B 4 When the storage content of (2) is not 0, the band B is cyclically calculated 4 Is stored in 4 Is a data number of a communication protocol, can uniquely correspond to a data symbol alpha operable in a program, and adds the data symbol alpha into a data symbol stack E 1 Then, the content l is stored 4 Subtract 1 if the content l is stored 4 Equal to the number starting point s (α) of the current cycle data, go to step 44, otherwise go to step 43 again;
step 44, calculating the band B in a loop 4 Is stored in 4 A word length buffer zone B for numbering the start s (alpha) of the current cycle data 2 Is stored in 2 Subtracting 1, loading the numbering end point r (alpha) of the current cycle data into a cycle calculation band B 4 (ii) a If the content l is stored 2 If it is 0, go to step 45, if store content l 2 If the value is more than 0, the step 43 is carried out;
step 45, buffer zone B when word length 2 When the stored content of (2) is 0, the data symbol stack E 1 The stack pushing state is adjusted to be a stack pulling state;
step 46, buffer zone B when word size 2 When the stored content of (2) is 0, the data symbol stack E 1 Executing pop operation, emptying the pre-loaded data symbols, and enabling the repetition times of the data symbols in the circulation and the storage loaded into the data buffer stack in the ReadLen subprogramContainer E3 The consistency is achieved;
and step 47, returning to the PullSym subprogram after the pop operation is finished.
CN202111013281.0A 2021-08-31 2021-08-31 Real-time data link byte stream error-proofing method based on multi-band turing machine Active CN113746827B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111013281.0A CN113746827B (en) 2021-08-31 2021-08-31 Real-time data link byte stream error-proofing method based on multi-band turing machine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111013281.0A CN113746827B (en) 2021-08-31 2021-08-31 Real-time data link byte stream error-proofing method based on multi-band turing machine

Publications (2)

Publication Number Publication Date
CN113746827A CN113746827A (en) 2021-12-03
CN113746827B true CN113746827B (en) 2023-02-10

Family

ID=78734393

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111013281.0A Active CN113746827B (en) 2021-08-31 2021-08-31 Real-time data link byte stream error-proofing method based on multi-band turing machine

Country Status (1)

Country Link
CN (1) CN113746827B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005151492A (en) * 2003-11-20 2005-06-09 Nippon Telegr & Teleph Corp <Ntt> Method and apparatus for generating rule to deal with unauthorized access, method and apparatus for dealing with unauthorized access, and system for taking measure to stack-smashing attack
CN111061434A (en) * 2019-12-17 2020-04-24 人和未来生物科技(长沙)有限公司 Gene compression multi-stream data parallel writing and reading method, system and medium
WO2020125839A1 (en) * 2018-12-18 2020-06-25 GRID INVENT gGmbH Electronic element and electrically controlled display element

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150261541A1 (en) * 2009-09-14 2015-09-17 Aemea, Inc. Dynamic register machine
EP3192213A1 (en) * 2014-09-12 2017-07-19 Voellmy, Andreas R. Managing network forwarding configurations using algorithmic policies

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005151492A (en) * 2003-11-20 2005-06-09 Nippon Telegr & Teleph Corp <Ntt> Method and apparatus for generating rule to deal with unauthorized access, method and apparatus for dealing with unauthorized access, and system for taking measure to stack-smashing attack
WO2020125839A1 (en) * 2018-12-18 2020-06-25 GRID INVENT gGmbH Electronic element and electrically controlled display element
CN111061434A (en) * 2019-12-17 2020-04-24 人和未来生物科技(长沙)有限公司 Gene compression multi-stream data parallel writing and reading method, system and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《Verification State-Space Reduction through Restricted Parsing Environments》;Jacob I. Torrey;《2015 IEEE CS Security and Privacy Workshops》;20151231;第106-116页 *

Also Published As

Publication number Publication date
CN113746827A (en) 2021-12-03

Similar Documents

Publication Publication Date Title
JPH0736123B2 (en) Equipment group control method
JPS59154538A (en) Method of building screen control system
CN107391366B (en) Test case generation method, test case execution method and test case execution device
CN109981599A (en) A kind of the general-purpose data parsing platform and method of communication data stream
CN101651679A (en) Data frame analyzing and processing system and method based on tree structure
US9665412B2 (en) Programmable logic controller and event-driven programming method thereof
CN113746827B (en) Real-time data link byte stream error-proofing method based on multi-band turing machine
CN112634973A (en) Data rereading method and system of storage medium, terminal device and storage medium
EP0297248B1 (en) Look-ahead inference-type rule-based system
CN110806979B (en) Interface return value checking method, device, equipment and storage medium
CN115660540B (en) Cargo tracking method, cargo tracking device, computer equipment and storage medium
CN117473949A (en) Form dynamic layout method and system
CN113671924B (en) DCS real-time value setting method and system, equipment and storage medium
CN113127352B (en) Automatic case statistical method and device and computer readable storage medium
CN109213475B (en) Artificial intelligence writing method for satellite multi-loop comparison instruction unit remote control source program
CN108885612A (en) For handling the device and method through binary-coded structured documents
CN108459963A (en) A kind of interruption verification method based on interruption controlling stream graph
CN103227741A (en) Data processing apparatus, input control apparatus, and control method
CN107612919B (en) Protocol configuration method and device
CN109144859A (en) A kind of program debugging method, device, system and equipment, storage medium
US10812415B1 (en) Active intelligent message filtering for increased digital communication throughput and error resiliency
CN117252559B (en) Business process processing method, device, computer equipment and storage medium
CN114021659A (en) Circuit board material coding packaging method, device, equipment and medium
JP4389786B2 (en) Transmission of general-purpose digital messages through microprocessor monitoring circuitry
CN116401081B (en) data sharing method

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