[go: up one dir, main page]

CN108924200A - A kind of message processing method and device - Google Patents

A kind of message processing method and device Download PDF

Info

Publication number
CN108924200A
CN108924200A CN201810647318.7A CN201810647318A CN108924200A CN 108924200 A CN108924200 A CN 108924200A CN 201810647318 A CN201810647318 A CN 201810647318A CN 108924200 A CN108924200 A CN 108924200A
Authority
CN
China
Prior art keywords
message
state
tcp
state machine
processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810647318.7A
Other languages
Chinese (zh)
Other versions
CN108924200B (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.)
Electric Power Research Institute of State Grid Shandong Electric Power Co Ltd
State Grid Shandong Electric Power Co Ltd
Beijing Kedong Electric Power Control System Co Ltd
State Grid Corp of China SGCC
Original Assignee
Electric Power Research Institute of State Grid Shandong Electric Power Co Ltd
State Grid Shandong Electric Power Co Ltd
Beijing Kedong Electric Power Control System Co Ltd
State Grid Corp of China SGCC
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 Electric Power Research Institute of State Grid Shandong Electric Power Co Ltd, State Grid Shandong Electric Power Co Ltd, Beijing Kedong Electric Power Control System Co Ltd, State Grid Corp of China SGCC filed Critical Electric Power Research Institute of State Grid Shandong Electric Power Co Ltd
Priority to CN201810647318.7A priority Critical patent/CN108924200B/en
Publication of CN108924200A publication Critical patent/CN108924200A/en
Application granted granted Critical
Publication of CN108924200B publication Critical patent/CN108924200B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/142Managing session states for stateless protocols; Signalling session states; State transitions; Keeping-state mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明提供了一种报文处理及装置,涉及电力系统配电通信技术领域,包括接收待处理的TCP报文;根据所述TCP报文的报文头以及所述状态机的起始状态确定报文处理方式以及所述状态机的下一状态;按照所述报文处理方式处理所述TCP报文,并将状态机的起始状态更新为所述下一状态。解决了现有TCP状态机很难判断是否收到过报文以及报文的发送方向导致的对报文的处理容易出现遗漏,代码复杂且不容易维护技术问题,达到了避免由于无法区分报文当前状态导致的对报文处理出现遗漏的问题,减少了代码复杂度,增强了代码健壮性和可维护性。

The invention provides a message processing device and relates to the technical field of power system power distribution communication, including receiving a TCP message to be processed; determining according to the message header of the TCP message and the initial state of the state machine A message processing method and the next state of the state machine; process the TCP message according to the message processing method, and update the initial state of the state machine to the next state. It solves the technical problems that it is difficult for the existing TCP state machine to judge whether the message has been received and the sending direction of the message, which is prone to omissions in the processing of the message, the code is complicated and it is not easy to maintain. The problem of missing message processing caused by the current state reduces the complexity of the code and enhances the robustness and maintainability of the code.

Description

A kind of message processing method and device
Technical field
The present invention relates to electric power system power distribution fields of communication technology, more particularly, to a kind of message processing method and device.
Background technique
According to the requirement of State Grid Corporation of China, electrical power distribution automatization system should between distribution main website and distribution terminal serial interface Enter safe distribution of electric power interactive gateway.Since safe distribution of electric power interactive gateway needs to carry out the message between distribution main website and distribution terminal Forwarding and processing, so the communication mode transition for causing distribution main website to connect with distribution terminal is distribution main website, safe distribution of electric power friendship Connection between three equipment of mutual gateway and distribution terminal.
Currently, existing safe distribution of electric power interactive gateway carries out respective handling according only to the message information for receiving message, such as:? In the case where not receiving message, movement A is executed when receiving the SYN message that main website is sent, in upper one received In the case that a message is the SYN of terminal hair, execution acts B when receiving the SYNACK message that main website is sent, it is necessary to class Like following pseudocode:
If (direction==main website hair &&type==IS_SYN&& did not receive message)
{
Action(A);
}
If (SYN that the direction==main website hair upper message of &&type==IS_SYNACK&& is terminal hair)
{
Action(B);
}
In practical applications, " do not received message " and " the upper message received be terminal hair SYN " this two It plants situation to be difficult to judge, causes to be easy to appear the processing of message omission, code is complicated and does not allow easy to maintain.
Summary of the invention
In view of this, the purpose of the present invention is to provide a kind of message processing method and device, to solve in the prior art Existing Message processing is easy to appear omission, and code is complicated and does not allow problem easy to maintain.
In a first aspect, being applied to safe distribution of electric power interactive gateway, institute the embodiment of the invention provides a kind of message processing method State safe distribution of electric power interactive gateway and be built-in with TCP state machine, the safe distribution of electric power interactive gateway respectively with the distribution in distribution network Main website is connected with distribution terminal, the method includes:
Receive TCP message to be processed;
Message processing mode and institute are determined according to the initial state of the heading of the TCP message and the state machine State the NextState of state machine;
Handle the TCP message according to the Message processing mode, and by the initial state of state machine be updated to it is described under One state.
With reference to first aspect, the embodiment of the invention provides the first possible embodiments of first aspect, wherein institute It states and Message processing mode and the state is determined according to the heading of the TCP message and the initial state of the state machine The NextState of machine, including:
The message characteristic of the TCP message is determined according to the heading of the TCP message;
The message characteristic is input to the state machine, so that the state machine is according to preset state-transition table and works as The preceding initial state determines the processing mode to the TCP message and the NextState.
With reference to first aspect, the embodiment of the invention provides second of possible embodiments of first aspect, wherein Further include before receiving TCP message to be processed:
According to the message characteristic of user configuration and Message processing mode, it is arranged pre- in TCP state machine and TCP state machine If state-transition table, in the state-transition table comprising multiple groups initial state, message characteristic, NextState and processing mode it Between corresponding relationship.
With reference to first aspect, the embodiment of the invention provides the third possible embodiments of first aspect, wherein institute It states and handles the TCP message according to the Message processing mode, including:
Transparent transmission processing or discard processing are carried out to the TCP message.
Second aspect, the embodiment of the present invention also provide a kind of message process device, including:
Receiving module, for receiving TCP message to be processed;
Determining module, for determining message according to the heading of the TCP message and the initial state of the state machine The NextState of processing mode and the state machine;
Processing module, for handling the TCP message according to the Message processing mode, and by the initial state of state machine It is updated to the NextState.
In conjunction with second aspect, the embodiment of the invention provides the first possible embodiments of second aspect, wherein institute Determining module is stated, including:
First determination unit, for determining the message characteristic of the TCP message according to the heading of the TCP message;
Second determination unit, for the message characteristic to be input to the state machine, so that the state machine is according to pre- If state-transition table and the current initial state, determine the processing mode to the TCP message and the NextState.
In conjunction with second aspect, the embodiment of the invention provides second of possible embodiments of second aspect, wherein institute Further include before stating receiving module:
TCP state machine is arranged for the message characteristic and Message processing mode according to user configuration in setup module, and Preset state-transition table in TCP state machine includes multiple groups initial state, message characteristic, Xia Yizhuan in the state-transition table Corresponding relationship between state and processing mode.
In conjunction with second aspect, the embodiment of the invention provides the third possible embodiments of second aspect, wherein institute Processing module is stated, including:
Processing unit, for carrying out transparent transmission processing or discard processing to the TCP message.
The third aspect, present example also provide a kind of electronic equipment, including memory, processor, in the memory It is stored with the computer program that can be run on the processor, wherein the processor executes real when the computer program Method described in existing first aspect.
Fourth aspect, the embodiment of the present invention also provide a kind of meter of non-volatile program code that can be performed with processor Calculation machine readable medium, wherein said program code makes the processor execute first aspect the method.
The embodiment of the present invention brings following beneficial effect:The embodiment of the present invention passes through receives TCP report to be processed first Text;Then Message processing mode and institute are determined according to the initial state of the heading of the TCP message and the state machine State the NextState of state machine;The TCP message finally is handled according to the Message processing mode, and by the starting shape of state machine State is updated to the NextState.
The embodiment of the present invention can the initial state when receiving TCP message based on state machine determine Message processing side Formula, and can between distribution main website and distribution terminal message the different transmission stages, according to determining Message processing mode in net It shuts realization and carries out different processing to TCP message.Moreover, updating the initial state of state machine, just after handling TCP message Use when receiving TCP message next time, to Message processing caused by avoiding since the message current transmission stage cannot be distinguished The problem of omitting reduces code complexity, enhances code robustness and maintainability.
Other features and advantages of the present invention will illustrate in the following description, also, partly become from specification It obtains it is clear that understand through the implementation of the invention.The objectives and other advantages of the invention are in specification, claims And specifically noted structure is achieved and obtained in attached drawing.
To enable the above objects, features and advantages of the present invention to be clearer and more comprehensible, preferred embodiment is cited below particularly, and cooperate Appended attached drawing, is described in detail below.
Detailed description of the invention
It, below will be to specific in order to illustrate more clearly of the specific embodiment of the invention or technical solution in the prior art Embodiment or attached drawing needed to be used in the description of the prior art be briefly described, it should be apparent that, it is described below Attached drawing is some embodiments of the present invention, for those of ordinary skill in the art, before not making the creative labor It puts, is also possible to obtain other drawings based on these drawings.
Fig. 1 is a kind of flow chart of Message processing provided in an embodiment of the present invention;
Fig. 2 is the flow chart of step S102 in Fig. 1;
Fig. 3 is TCP state machine flow chart;
Fig. 4 is a kind of structure chart of message process device provided in an embodiment of the present invention.
Icon:11- receiving module;12- determining module;13- processing module.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with attached drawing to the present invention Technical solution be clearly and completely described, it is clear that described embodiments are some of the embodiments of the present invention, rather than Whole embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art are not making creative work premise Under every other embodiment obtained, shall fall within the protection scope of the present invention.
Currently, existing safe distribution of electric power interactive gateway in the case where not receiving message, receives the SYN report that main website is sent Movement A is executed when literary, in the case where the upper message received is the SYN of terminal hair, receive what main website was sent When SYNACK message execution act B, however, in practical application safe distribution of electric power interactive gateway be difficult distinguish " do not received Message " and " the SYN both of these case that the upper message received is terminal hair ", cause to be easy to appear something lost to the processing of message Leakage causes the processing of message to be easy to appear omission, and code is complicated and does not allow easy to maintain.A kind of message provided in an embodiment of the present invention Processing method and processing device, can the initial state when receiving TCP message based on state machine determine Message processing mode, and energy In the different transmission stages of message, realize on gateway according to determining Message processing mode between distribution main website and distribution terminal Different processing is carried out to TCP message.Moreover, the initial state of state machine is updated after handling TCP message, convenient for next time Use when receiving TCP message avoids omitting Message processing caused by since the message current transmission stage cannot be distinguished The problem of, reduce code complexity, enhances code robustness and maintainability.
For convenient for understanding the present embodiment, first to a kind of message processing method disclosed in the embodiment of the present invention into Row is discussed in detail, as shown in Figure 1, the message processing method can be applied to safe distribution of electric power interactive gateway, the safe distribution of electric power Interactive gateway is built-in with TCP state machine, the safe distribution of electric power interactive gateway respectively with the distribution main website and distribution in distribution network Terminal connection, includes the following steps:
Step S101 receives TCP message to be processed;
In embodiments of the present invention, illustratively, described in following Tables 1 and 2 state-transition table shown in first row TCP message can be F_SYN message, or R_SYN message, can also be F_SYN/ACK message, R_SYN/ACK message, F_ACK message, R_ACK message, F_FIN message, R_FIN message, F_FIN/ACK message, R_FIN/ACK message, RST message, F_PUSH message, R_PUSH message, F_PUSH/ACK message, R_PUSH/ACK message.
Table 1
Table 2
In embodiments of the present invention, TCP message to be processed can be the transmission of distribution main website, be also possible to distribution terminal It sends.
Step S102 determines Message processing according to the initial state of the heading of the TCP message and the state machine The NextState of mode and the state machine;
It in embodiments of the present invention, include message characteristic inside the heading of the TCP message;
The state machine shares 13 kinds of states, as shown in the first row of Tables 1 and 2, illustratively there is CLOSED, SYN_S_ SENT, SYN_T_SENT, SYN_S_RCVD, SYN_T_RCVD, ESTABLISHED, S_FIN_WAIT1, T_FIN_WAIT1, S_ FIN_WAIT2, T_FIN_WAIT2, ST_FIN_WAIT, S_CLOSING and T_CLOSING etc..The initial state of the state machine Refer to the current state of the state machine.The NextState of the state machine is next shape that state machine terminates that current state is switched to State.
In practical applications, there are two types of Message processing modes, respectively transparent transmission processing and discard processing, specifically, transparent transmission Processing may include:Normal transparent transmission retransmits transparent transmission and uncommon transparent transmission etc., and normal transparent transmission refers to state machine by requesting for comments (Request For Comments, abbreviation RFC) transparent transmission message;After re-transmission transparent transmission refers to that state machine transparent transmission message returns to current state Transparent transmission message again;Uncommon transparent transmission refers to uncommon normal transparent transmission in practical applications.Discard processing refers in Tables 1 and 2 It is illegal to abandon.
Step S103 handles the TCP message according to the Message processing mode, and the initial state of state machine is updated For the NextState.
The embodiment of the present invention can the initial state when receiving TCP message based on state machine determine Message processing side Formula, and can between distribution main website and distribution terminal message the different transmission stages, according to determining Message processing mode in net It shuts realization and carries out different processing to message.Moreover, the initial state of state machine is updated, under being convenient for after handling TCP message Use when once receiving TCP message avoids Message processing occur caused by since the message current transmission stage cannot be distinguished The problem of omission, reduces code complexity, enhances code robustness and maintainability.
In another embodiment of the present invention, as shown in Fig. 2, the step S102 may comprise steps of:
Step S201 determines the message characteristic of the TCP message according to the heading of the TCP message.
In embodiments of the present invention, the message characteristic of the TCP message includes sending direction and type of message.In reality In, there are two types of sending directions, the message that terminal direction is sent to from main website direction is indicated respectively with the message that F_ starts, with R_ The message of beginning indicates the message that main website direction is sent to from terminal direction.Type of message includes SYN, ACK, FIN, RST, PUSH etc. Content, these message contents can be designed specifically as the case may be.Connection is established in SYN expression, and ACK indicates response, and FIN is indicated Connection is closed, RST indicates connection resetting, and PUSH indicates that DATA data are transmitted.Illustratively, F_ACK expression is sent to from main website Terminal, the message that content is in response to, R_SYN indicates to be sent to main website from terminal, and content is to establish the message of connection.
The message characteristic is input to the state machine by step S202, so that the state machine is according to preset state Transfer table and the current initial state, determine the processing mode to the TCP message and the NextState.
Illustratively, the current state of the state machine is in CLOSED state, message characteristic F_SYN is input to described State machine can determine that the processing mode of TCP message is transparent transmission, and the NextState is according to preset state-transition table SYN_S_SENT。
In embodiments of the present invention, the starting according to the heading and the state machine of the TCP message can be passed through State determines the NextState of Message processing mode and the state machine, provides foundation for the Message processing of next step.
In another embodiment of the present invention, further include before the step S101:
According to the message characteristic of user configuration and Message processing mode, it is arranged pre- in TCP state machine and TCP state machine If state-transition table, in the state-transition table comprising multiple groups initial state, message characteristic, NextState and processing mode it Between corresponding relationship.
The TCP state machine that the present invention is arranged, as shown in figure 3, the state of ellipse representation state machine, arrow indicates state conversion Direction, the character representation message having on arrow, arrow are to be directed toward NextState by the current state of state machine.
Preset state-transition table in the TCP state machine of setting, as shown in figure 3, the first row indicates the current shape of state machine State, first row indicate the message received, and the information of other positions indicates the NextState and Message processing mode of state machine. So including the corresponding relationship between multiple groups initial state, message characteristic, NextState and processing mode in state-transition table.
Through the embodiment of the present invention, can be convenient for utilizing preset shape in the TCP state machine and TCP state machine set State transfer table determines the NextState and Message processing mode of state machine.
In another embodiment of the present invention, the step S103, including:
Transparent transmission processing or discard processing are carried out to the TCP message.
Transparent transmission processing is a kind of mode of Message processing, i.e., under current state, to the message transmission received, state machine It is updated according to preset state machine state transfer table to NextState.Illustratively, current state is SYN_S_SENT, if receiving The message arrived is R_SYN/ACK, and state machine is then updated according to preset state machine state transfer table to NextState SYN_S_ RCVD。
Discard processing is another mode of Message processing, i.e., under current state, packet loss to receiving, and shape State machine will return to CLOSED init state.Illustratively, current state is SYN_S_SENT, if the message received is F_ SYN/ACK, state machine then return to CLOSED init state according to preset state machine state transfer table.
Through the embodiment of the present invention, message can be handled, processing mode is transparent transmission or discarding.
In another embodiment of the present invention, as shown in figure 4, the apparatus may include with lower module:
Receiving module 11, for receiving TCP message to be processed;
Determining module 12, for determining report according to the heading of the TCP message and the initial state of the state machine The NextState of literary processing mode and the state machine;
Processing module 13, for handling the TCP message according to the Message processing mode, and by the starting shape of state machine State is updated to the NextState.
The technical effect and preceding method embodiment phase of device provided by the embodiment of the present invention, realization principle and generation Together, to briefly describe, Installation practice part does not refer to place, can refer to corresponding contents in preceding method embodiment.
In another embodiment of the present invention, the determining module, including:
First determination unit, for determining the message characteristic of the TCP message according to the heading of the TCP message;
Second determination unit, for the message characteristic to be input to the state machine, so that the state machine is according to pre- If state-transition table and the current initial state, determine the processing mode to the TCP message and the NextState.
In another embodiment of the present invention, further include before the receiving module:
TCP state machine is arranged for the message characteristic and Message processing mode according to user configuration in setup module, and Preset state-transition table in TCP state machine includes multiple groups initial state, message characteristic, Xia Yizhuan in the state-transition table Corresponding relationship between state and processing mode.
In another embodiment of the present invention, the processing module, including:
Processing unit, for carrying out transparent transmission processing or discard processing to the TCP message.
In another embodiment of the present invention, a kind of non-volatile program code that can be performed with processor is also provided Computer-readable medium, said program code make the processor execute embodiment of the method the method.
The flow chart and block diagram in the drawings show system, method and computer journeys based on multiple embodiments of the invention The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation A part of one module, section or code of table, a part of the module, section or code include one or more use The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box The function of note can also occur in a different order than that indicated in the drawings.For example, two continuous boxes can actually base Originally it is performed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.It is also noted that It is the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart, can uses and execute rule The dedicated hardware based system of fixed function or movement is realized, or can use the group of specialized hardware and computer instruction It closes to realize.
The computer program product of message processing method provided by the embodiment of the present invention, including storing program code Computer readable storage medium, the instruction that said program code includes can be used for executing previous methods side as described in the examples Method, specific implementation can be found in embodiment of the method, and details are not described herein.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description It with the specific work process of device, can refer to corresponding processes in the foregoing method embodiment, details are not described herein.
In addition, in the description of the embodiment of the present invention unless specifically defined or limited otherwise, term " installation ", " phase Even ", " connection " shall be understood in a broad sense, for example, it may be being fixedly connected, may be a detachable connection, or be integrally connected;It can To be mechanical connection, it is also possible to be electrically connected;It can be directly connected, can also can be indirectly connected through an intermediary Connection inside two elements.For the ordinary skill in the art, above-mentioned term can be understood at this with concrete condition Concrete meaning in invention.
It, can be with if the function is realized in the form of SFU software functional unit and when sold or used as an independent product It is stored in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially in other words The part of the part that contributes to existing technology or the technical solution can be embodied in the form of software products, the meter Calculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be a People's computer, server or network equipment etc.) it performs all or part of the steps of the method described in the various embodiments of the present invention. And storage medium above-mentioned includes:USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), arbitrary access are deposited The various media that can store program code such as reservoir (RAM, Random Access Memory), magnetic or disk.
In the description of the present invention, it should be noted that term " center ", "upper", "lower", "left", "right", "vertical", The orientation or positional relationship of the instructions such as "horizontal", "inner", "outside" be based on the orientation or positional relationship shown in the drawings, merely to Convenient for description the present invention and simplify description, rather than the device or element of indication or suggestion meaning must have a particular orientation, It is constructed and operated in a specific orientation, therefore is not considered as limiting the invention.In addition, term " first ", " second ", " third " is used for descriptive purposes only and cannot be understood as indicating or suggesting relative importance.
Finally it should be noted that:Embodiment described above, only a specific embodiment of the invention, to illustrate the present invention Technical solution, rather than its limitations, scope of protection of the present invention is not limited thereto, although with reference to the foregoing embodiments to this hair It is bright to be described in detail, those skilled in the art should understand that:Anyone skilled in the art In the technical scope disclosed by the present invention, it can still modify to technical solution documented by previous embodiment or can be light It is readily conceivable that variation or equivalent replacement of some of the technical features;And these modifications, variation or replacement, do not make The essence of corresponding technical solution is detached from the spirit and scope of technical solution of the embodiment of the present invention, should all cover in protection of the invention Within the scope of.Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1.一种报文处理方法,其特征在于,应用于配电安全交互网关,所述配电安全交互网关内置有TCP状态机,所述配电安全交互网关分别与配电网络中的配电主站和配电终端连接,所述方法包括:1. A message processing method, characterized in that it is applied to a power distribution security interactive gateway, the power distribution security interactive gateway has a built-in TCP state machine, and the power distribution security interactive gateway communicates with the power distribution network in the power distribution network respectively The master station is connected to the power distribution terminal, and the method includes: 接收待处理的TCP报文;Receive pending TCP packets; 根据所述TCP报文的报文头以及所述状态机的起始状态确定报文处理方式以及所述状态机的下一状态;Determine the message processing mode and the next state of the state machine according to the message header of the TCP message and the initial state of the state machine; 按照所述报文处理方式处理所述TCP报文,并将状态机的起始状态更新为所述下一状态。Processing the TCP message according to the message processing manner, and updating the initial state of the state machine to the next state. 2.根据权利要求1所述的报文处理方法,其特征在于,所述根据所述TCP报文的报文头以及所述状态机的起始状态确定报文处理方式以及所述状态机的下一状态,包括:2. message processing method according to claim 1, it is characterized in that, described according to the message header of described TCP message and the initial state of described state machine, determine message processing mode and described state machine next state, including: 根据所述TCP报文的报文头确定所述TCP报文的报文特征;determining the message characteristics of the TCP message according to the message header of the TCP message; 将所述报文特征输入至所述状态机,以使所述状态机根据预设的状态转移表及当前的所述起始状态,确定对所述TCP报文的处理方式及所述下一状态。Inputting the message characteristics into the state machine, so that the state machine determines the processing mode of the TCP message and the next step according to the preset state transition table and the current initial state. state. 3.根据权利要求1所述的报文处理方法,其特征在于,在接收待处理的TCP报文之前还包括:3. message processing method according to claim 1, is characterized in that, also comprises before receiving the TCP message to be processed: 根据用户配置的报文特征及报文处理方式,设置TCP状态机,以及TCP状态机中预设的状态转移表,所述状态转移表中包含多组起始状态、报文特征、下一状态及处理方式之间的对应关系。According to the message characteristics and message processing mode configured by the user, set the TCP state machine and the preset state transition table in the TCP state machine. The state transition table includes multiple groups of initial states, message characteristics, and next states and the corresponding relationship between processing methods. 4.根据权利要求3所述的报文处理方法,其特征在于,所述按照所述报文处理方式处理所述TCP报文,包括:4. The message processing method according to claim 3, wherein said processing said TCP message according to said message processing method comprises: 对所述TCP报文进行透传处理或者丢弃处理。Perform transparent transmission processing or discard processing on the TCP message. 5.一种报文处理装置,其特征在于,包括:5. A message processing device, characterized in that, comprising: 接收模块,用于接收待处理的TCP报文;A receiving module, configured to receive pending TCP messages; 确定模块,用于根据所述TCP报文的报文头以及所述状态机的起始状态确定报文处理方式以及所述状态机的下一状态;A determination module, configured to determine a message processing method and a next state of the state machine according to the header of the TCP message and the initial state of the state machine; 处理模块,用于按照所述报文处理方式处理所述TCP报文,并将状态机的起始状态更新为所述下一状态。A processing module, configured to process the TCP message according to the message processing manner, and update the initial state of the state machine to the next state. 6.根据权利要求5所述的报文处理装置,其特征在于,所述确定模块,包括:6. The message processing device according to claim 5, wherein the determining module comprises: 第一确定单元,用于根据所述TCP报文的报文头确定所述TCP报文的报文特征;A first determining unit, configured to determine the message characteristics of the TCP message according to the message header of the TCP message; 第二确定单元,用于将所述报文特征输入至所述状态机,以使所述状态机根据预设的状态转移表及当前的所述起始状态,确定对所述TCP报文的处理方式及所述下一状态。The second determining unit is configured to input the message characteristics into the state machine, so that the state machine determines the TCP message according to the preset state transition table and the current initial state. Processing method and the next state. 7.根据权利要求5所述的报文处理装置,其特征在于,所述接收模块之前还包括:7. The message processing device according to claim 5, wherein the receiving module also includes: 设置模块,用于根据用户配置的报文特征及报文处理方式,设置TCP状态机,以及TCP状态机中预设的状态转移表,所述状态转移表中包含多组起始状态、报文特征、下一状态及处理方式之间的对应关系。The setting module is used to set the TCP state machine and the state transition table preset in the TCP state machine according to the message characteristics and the message processing mode configured by the user, and the state transition table includes multiple groups of initial states, message Correspondence between features, next state, and processing methods. 8.根据权利要求7所述的报文处理装置,其特征在于,所述处理模块,包括:8. The message processing device according to claim 7, wherein the processing module includes: 处理单元,用于对所述TCP报文进行透传处理或者丢弃处理。A processing unit, configured to perform transparent transmission processing or discard processing on the TCP message. 9.一种电子设备,包括存储器、处理器,所述存储器中存储有可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现上述权利要求1至4任一项所述的方法的步骤。9. An electronic device, comprising a memory and a processor, wherein a computer program that can run on the processor is stored in the memory, wherein the above-mentioned claim 1 is realized when the processor executes the computer program to the step of the method described in any one of 4. 10.一种具有处理器可执行的非易失的程序代码的计算机可读介质,其特征在于,所述程序代码使所述处理器执行所述权利要求1-4任一所述方法。10. A computer-readable medium having a non-volatile program code executable by a processor, wherein the program code causes the processor to execute the method according to any one of claims 1-4.
CN201810647318.7A 2018-06-21 2018-06-21 Message processing method and device Active CN108924200B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810647318.7A CN108924200B (en) 2018-06-21 2018-06-21 Message processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810647318.7A CN108924200B (en) 2018-06-21 2018-06-21 Message processing method and device

Publications (2)

Publication Number Publication Date
CN108924200A true CN108924200A (en) 2018-11-30
CN108924200B CN108924200B (en) 2021-11-23

Family

ID=64420941

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810647318.7A Active CN108924200B (en) 2018-06-21 2018-06-21 Message processing method and device

Country Status (1)

Country Link
CN (1) CN108924200B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114340012A (en) * 2021-12-31 2022-04-12 杭州涂鸦信息技术有限公司 Data transmission method and related device

Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101252444A (en) * 2008-04-03 2008-08-27 华为技术有限公司 Message feature detection method and device
CN101547210A (en) * 2009-05-14 2009-09-30 福建星网锐捷网络有限公司 Method and device for processing TCP connection
CN101771585A (en) * 2010-03-02 2010-07-07 北京网康科技有限公司 Network delay measuring equipment and method thereof
CN102215231A (en) * 2011-06-03 2011-10-12 华为软件技术有限公司 Data forwarding method and gateway
CN102457980A (en) * 2010-10-14 2012-05-16 中国移动通信集团公司 Data transmission method and system in sensor network
CN102546363A (en) * 2010-12-21 2012-07-04 深圳市恒扬科技有限公司 Message processing method, device and equipment
CN102710524A (en) * 2012-06-15 2012-10-03 大连梯耐德网络技术有限公司 A realization method of a multi-protocol network message transmission order guarantee system
EP2750338A1 (en) * 2012-12-28 2014-07-02 Sybase, Inc. Facility for message-based conversations
US20140280850A1 (en) * 2013-03-15 2014-09-18 Lantronix, Inc. Collaborative State Machine Management
CN104202206A (en) * 2014-07-25 2014-12-10 汉柏科技有限公司 Message processing device and method
CN104836753A (en) * 2015-03-27 2015-08-12 清华大学 Software-defined networking (SDN) data plane strip state exchange device, SDN exchange system and SDN data plane strip state forwarding and processing method
CN104836749A (en) * 2015-03-27 2015-08-12 清华大学 Software-defined networking (SDN) data plane strip state forwarding processor
CN106385409A (en) * 2016-09-08 2017-02-08 杭州迪普科技有限公司 TCP message processing method and device
CN106713348A (en) * 2017-01-17 2017-05-24 深圳市西迪特科技有限公司 OLT multicast uplink protocol message forwarding method and system
CN107404505A (en) * 2016-05-19 2017-11-28 北京金山云网络技术有限公司 A kind of processing method of message, gateway device and connection storage device

Patent Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101252444A (en) * 2008-04-03 2008-08-27 华为技术有限公司 Message feature detection method and device
CN101547210A (en) * 2009-05-14 2009-09-30 福建星网锐捷网络有限公司 Method and device for processing TCP connection
CN101771585A (en) * 2010-03-02 2010-07-07 北京网康科技有限公司 Network delay measuring equipment and method thereof
CN102457980A (en) * 2010-10-14 2012-05-16 中国移动通信集团公司 Data transmission method and system in sensor network
CN102546363A (en) * 2010-12-21 2012-07-04 深圳市恒扬科技有限公司 Message processing method, device and equipment
CN102215231A (en) * 2011-06-03 2011-10-12 华为软件技术有限公司 Data forwarding method and gateway
CN102710524A (en) * 2012-06-15 2012-10-03 大连梯耐德网络技术有限公司 A realization method of a multi-protocol network message transmission order guarantee system
US20140187275A1 (en) * 2012-12-28 2014-07-03 Gabriel Thendean Facility for message-based conversations
EP2750338A1 (en) * 2012-12-28 2014-07-02 Sybase, Inc. Facility for message-based conversations
US20140280850A1 (en) * 2013-03-15 2014-09-18 Lantronix, Inc. Collaborative State Machine Management
CN104202206A (en) * 2014-07-25 2014-12-10 汉柏科技有限公司 Message processing device and method
CN104836753A (en) * 2015-03-27 2015-08-12 清华大学 Software-defined networking (SDN) data plane strip state exchange device, SDN exchange system and SDN data plane strip state forwarding and processing method
CN104836749A (en) * 2015-03-27 2015-08-12 清华大学 Software-defined networking (SDN) data plane strip state forwarding processor
CN107404505A (en) * 2016-05-19 2017-11-28 北京金山云网络技术有限公司 A kind of processing method of message, gateway device and connection storage device
CN106385409A (en) * 2016-09-08 2017-02-08 杭州迪普科技有限公司 TCP message processing method and device
CN106713348A (en) * 2017-01-17 2017-05-24 深圳市西迪特科技有限公司 OLT multicast uplink protocol message forwarding method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
见晓春等: "同源SYN报文两次接收法防御SYN Flood攻击", 《计算机工程与设计》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114340012A (en) * 2021-12-31 2022-04-12 杭州涂鸦信息技术有限公司 Data transmission method and related device

Also Published As

Publication number Publication date
CN108924200B (en) 2021-11-23

Similar Documents

Publication Publication Date Title
EP2957085B1 (en) Service layer resource propagation across domains
US20150003449A1 (en) Path maximum transmission unit learning
CN105915658B (en) Obtain data calling method, the data transmission method of client ip address
CN108418884A (en) A kind of method, apparatus and electronic equipment of transmission services data
CN103297390A (en) Method for enabling server to be connected with client-sides reversely
CN108665249A (en) Digital asset processing method and processing device
Smirnova et al. Protocols over things: A decentralized programming model for the Internet of Things
CN108924200A (en) A kind of message processing method and device
WO2017092489A1 (en) Method and device for device management for use in cloud wireless local area network and cloud wireless local area network
CN108306934A (en) A kind of cross-server document transmission method and system
CN111385068B (en) Data transmission method, device, electronic equipment and communication system
CN106131039A (en) The processing method and processing device of SYN flood attack
CN110324302B (en) IOT equipment communication method
CN108989157A (en) Method, apparatus for smart machine control
CN104184729B (en) A kind of message processing method and device
CN104518959A (en) Method and device for communication between devices
CN109936566A (en) A kind of data transmission method system, device and computer readable storage medium
CN106597873A (en) Method, device and system for carrying out remote maintenance of automation equipment
CN105072148A (en) Method and device for building connection with terminal
CN104333872A (en) Method and system for establishing session based on bidirectional forwarding detection technology
JP2017017587A (en) Router device, connection establishment method, communication system and communication terminal
CN107294812B (en) Network detection method, network detection device and intelligent terminal
CN105991629B (en) TCP connection method for building up and device
CN109714135A (en) A kind of data pack transmission method and device
CN103346961A (en) Method and system for data packaging exchanging

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