CN113595931B - Message processing method, device, equipment and storage medium - Google Patents
Message processing method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN113595931B CN113595931B CN202110772783.5A CN202110772783A CN113595931B CN 113595931 B CN113595931 B CN 113595931B CN 202110772783 A CN202110772783 A CN 202110772783A CN 113595931 B CN113595931 B CN 113595931B
- Authority
- CN
- China
- Prior art keywords
- message
- determining
- type
- label information
- target
- 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
Links
- 238000003860 storage Methods 0.000 title claims abstract description 21
- 238000003672 processing method Methods 0.000 title claims abstract description 16
- 238000004891 communication Methods 0.000 claims abstract description 82
- 238000000034 method Methods 0.000 claims abstract description 66
- 230000005540 biological transmission Effects 0.000 claims abstract description 45
- 238000012545 processing Methods 0.000 claims description 47
- 230000006870 function Effects 0.000 claims description 37
- 238000004590 computer program Methods 0.000 claims description 12
- 230000008569 process Effects 0.000 description 20
- 238000010586 diagram Methods 0.000 description 10
- 238000007726 management method Methods 0.000 description 5
- 230000003287 optical effect Effects 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000004044 response Effects 0.000 description 3
- 230000002776 aggregation Effects 0.000 description 2
- 238000004220 aggregation Methods 0.000 description 2
- 238000013528 artificial neural network Methods 0.000 description 2
- 230000003190 augmentative effect Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 238000013468 resource allocation Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 230000001960 triggered effect Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 1
- 239000003795 chemical substances by application Substances 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000001537 neural effect Effects 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 238000007639 printing Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/24—Traffic characterised by specific attributes, e.g. priority or QoS
- H04L47/2441—Traffic characterised by specific attributes, e.g. priority or QoS relying on flow classification, e.g. using integrated services [IntServ]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/24—Traffic characterised by specific attributes, e.g. priority or QoS
- H04L47/2483—Traffic characterised by specific attributes, e.g. priority or QoS involving identification of individual flows
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/30—Definitions, standards or architectural aspects of layered protocol stacks
- H04L69/32—Architecture of open systems interconnection [OSI] 7-layer type protocol stacks, e.g. the interfaces between the data link level and the physical level
- H04L69/322—Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions
- H04L69/324—Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions in the data link layer [OSI layer 2], e.g. HDLC
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/30—Definitions, standards or architectural aspects of layered protocol stacks
- H04L69/32—Architecture of open systems interconnection [OSI] 7-layer type protocol stacks, e.g. the interfaces between the data link level and the physical level
- H04L69/322—Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions
- H04L69/326—Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions in the transport layer [OSI layer 4]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Computer And Data Communications (AREA)
Abstract
The application relates to a message processing method, device, equipment and storage medium. Relates to the technical field of communication. The method and the device can solve the problem that the integrated equipment cannot identify whether the received message is a message of a transmission layer protocol or a message of a data link layer protocol. The method comprises the following steps: acquiring a first message; the first message is derived based on an initial message from the communication device. Determining the type of the first message based on a linked list rule; the type includes a message of a transport layer protocol or a message of a data link layer protocol; the linked list rule comprises the corresponding relation between the characteristic information and the type of the message; the characteristic information comprises at least one of a source address used for representing the message, a target address of the message and a network type. And determining a target message according to the type of the first message, and transmitting the target message.
Description
Technical Field
The present disclosure relates to the field of communications technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing a message.
Background
The terminal device generally uses messages of transport layer protocols such as transmission control protocol/internet protocol (transmission control protocol/internet protocol, TCP/IP); the switch device typically uses messages of data link layer protocols such as link layer discovery protocol (link layer discovery protocol, LLDP), link aggregation control protocol (Link Aggregation Control Protocol, LACP), and the like.
However, the data switching function provided by the switch device is indispensable for the transmission of the messages of the transport layer protocol or the transmission of the messages of the data link layer protocol. Therefore, in order to reduce the number of devices, the data exchange function of the switch device and the function of the terminal device may be integrated in one device. However, the integrated device cannot identify whether the received message is a message of the transport layer protocol or a message of the data link layer protocol, so that the message cannot be accurately transmitted.
Disclosure of Invention
The application provides a message processing method, a device, equipment and a storage medium, which can solve the problem that an integrated equipment cannot identify whether a received message is a message of a transmission layer protocol or a message of a data link layer protocol.
In order to achieve the above purpose, the present application adopts the following technical scheme:
in a first aspect, a method for configuring resources is provided, the method comprising: acquiring a first message; the first message is derived based on an initial message from the communication device. Determining the type of the first message based on a linked list rule; the type includes a message of a transport layer protocol or a message of a data link layer protocol; the linked list rule comprises the corresponding relation between the characteristic information and the type of the message; the characteristic information comprises at least one of a source address used for representing the message, a target address of the message and a network type. And determining a target message according to the type of the first message, and transmitting the target message.
Optionally, determining the type of the first message based on the linked list rule includes: determining label information of a first message; the tag information is at least used for identifying the port of the communication device transmitting the initial message and the network to which the port belongs. And deleting the label information to generate a second message. And determining the type of the second message based on the rule of the linked list, and taking the type of the second message as the type of the first message.
Optionally, determining the target message according to the type of the first message includes: and adding tag information into the second message to generate a target message under the condition that the type of the first message is a message of a transport layer protocol. And/or determining the second message as the target message under the condition that the type of the first message is the message of the data link layer protocol.
Optionally, determining the tag information of the first message includes: and calling a hook function to analyze the second message and determining the label information.
Optionally, determining the type of the second message based on the linked list rule includes: matching the linked list rule with the second message. If the matching is successful, determining that the type of the second message is the message of the data link layer protocol. And/or if the matching fails, determining that the type of the second message is a message of a transport layer protocol.
Optionally, the tag information includes: the number of the communication device, the port number of the communication device, the network to which the port of the communication device belongs, and the priority setting of the network.
Optionally, acquiring the first packet includes: an initial message is received from a communication device. It is determined whether the initial message contains tag information. If the initial message is included and the label information is accurate, determining that the initial message is the first message. And/or if the initial message is included and the label information is wrong, determining new label information according to the transmission information of the initial message, updating the label information in the initial message by using the new label information, and determining the updated initial message as the first message. And/or if the initial message does not contain the tag information, determining the tag information according to the transmission information of the initial message, adding the tag information into the initial message, and determining the initial message added with the tag information as the first message.
Optionally, determining the target message according to the type of the first message includes: and under the condition that the type of the first message is a message of a transmission layer protocol, determining the label information of the first message, deleting the label information in the first message, and generating a target message. And/or determining the first message as the target message under the condition that the type of the first message is a message of a data link layer protocol.
Optionally, before receiving the first message from the communication device, the method includes: receiving debugging parameters input by a user; the debug parameters are used for indicating to grasp the messages received and transmitted by the MAC layer. After receiving the first message from the communication device, the method includes: and grabbing the first message and the target message based on the debugging parameters. And determining the difference between the first message and the target message.
In a second aspect, a message processing apparatus is provided, the apparatus comprising: the switching chip and the processor. The exchange chip is used for acquiring a first message; the first message is derived based on an initial message from the communication device. The processor is used for determining the type of the first message acquired by the exchange chip based on the linked list rule; the type includes a message of a transport layer protocol or a message of a data link layer protocol; the linked list rule comprises the corresponding relation between the characteristic information and the type of the message; the characteristic information comprises at least one of a source address used for representing the message, a target address of the message and a network type. And the processor is also used for determining a target message according to the type of the first message and transmitting the target message.
Optionally, the processor is specifically configured to: determining label information of a first message; the label information is at least used for identifying a port of the communication equipment for transmitting the initial message and a network to which the port belongs; deleting the label information to generate a second message; and determining the type of the second message based on the rule of the linked list, and taking the type of the second message as the type of the first message.
Optionally, the processor is specifically configured to: under the condition that the type of the first message is a message of a transmission layer protocol, adding tag information into the second message to generate a target message; and/or determining the second message as the target message under the condition that the type of the first message is the message of the data link layer protocol.
Optionally, the processor is specifically configured to call the hook function to parse the second message, and determine tag information.
Optionally, the processor is specifically configured to: matching the linked list rule with the second message; if the matching is successful, determining that the type of the second message is a message of a data link layer protocol; and/or if the matching fails, determining that the type of the second message is a message of a transport layer protocol.
Optionally, the tag information includes: the number of the communication device, the port number of the communication device, the network to which the port of the communication device belongs, and the priority setting of the network.
Optionally, the exchange chip is specifically configured to: receiving an initial message from a communication device; determining whether the initial message contains label information; if the initial message is included and the label information is accurate, determining that the initial message is a first message; and/or if the information is included and the label information is wrong, determining new label information according to the transmission information of the initial message, updating the label information in the initial message by using the new label information, and determining the updated initial message as a first message; and/or if the initial message does not contain the tag information, determining the tag information according to the transmission information of the initial message, adding the tag information into the initial message, and determining the initial message added with the tag information as the first message.
Optionally, the processor is specifically configured to: under the condition that the type of the first message is a message of a transmission layer protocol, determining the label information of the first message, deleting the label information in the first message, and generating a target message; and/or determining the first message as the target message under the condition that the type of the first message is a message of a data link layer protocol.
Optionally, the processor is further configured to: receiving debugging parameters input by a user; the debug parameters are used for indicating to grasp the messages received and transmitted by the MAC layer. And grabbing the first message and the target message based on the debugging parameters. And determining the difference between the first message and the target message.
In a third aspect, a network device is provided, the network device comprising a processor in an architecture for executing program instructions, such that the network device performs the method of the first aspect.
In a fourth aspect, there is provided a computer readable storage medium having stored therein computer program code which, when run on a network device, causes the network device to perform the method of the first aspect described above.
In a fifth aspect, there is provided a computer program product storing computer software instructions as described above that, when run on a network device, cause the network device to perform a program as the method of the first aspect described above.
The message processing method, the device, the equipment and the storage medium can accurately identify the message which is required to be uploaded by the user as the message of the link layer protocol or the message of the transmission layer protocol of the network layer standard through the link rule matching mode. The method solves the problem that the existing integrated equipment cannot identify whether the received message is a message of a transmission layer protocol or a message of a data link layer protocol. So as to realize the accurate shunting processing of the message under the corresponding type through the type of the message.
Drawings
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
Fig. 1 is a schematic structural diagram of a communication system to which a message processing method provided in an embodiment of the present application is applied;
fig. 2 is a schematic hardware structure of a network device according to an embodiment of the present application;
Fig. 3 is a schematic hardware structure of an electronic device according to an embodiment of the present application;
fig. 4 is a schematic diagram of a network architecture according to an embodiment of the present application;
fig. 5 is a schematic flow chart of a message receiving process according to an embodiment of the present application;
FIG. 6 is a flow chart of a message processing method according to an embodiment of the present application;
fig. 7 is a schematic flow chart of initializing a network card driver according to an embodiment of the present application;
fig. 8 is a schematic diagram of a rule configuration driving framework of a linked list according to an embodiment of the present application;
FIG. 9 is a second flow chart of a message processing method according to the embodiment of the present application;
fig. 10 is a schematic diagram of a message structure provided in an embodiment of the present application;
FIG. 11 is a schematic diagram of another message structure according to an embodiment of the present disclosure;
FIG. 12 is a schematic diagram of a message processing apparatus according to an embodiment of the present disclosure;
fig. 13 is a schematic structural diagram of a computer program product of a resource allocation method according to an embodiment of the present application.
Detailed Description
The following describes in detail a method, an apparatus, and a storage medium for processing a message according to embodiments of the present application with reference to the accompanying drawings.
The term "and/or" is herein merely an association relationship describing an associated object, meaning that there may be three relationships, e.g., a and/or B, may represent: a exists alone, A and B exist together, and B exists alone.
The terms "first" and "second" and the like in the description and in the drawings are used for distinguishing between different objects or for distinguishing between different processes of the same object and not for describing a particular sequential order of objects.
Furthermore, references to the terms "comprising" and "having" and any variations thereof in the description of the present application are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or modules is not limited to only those steps or modules but may include other steps or modules not listed or inherent to such process, method, article, or apparatus.
It should be noted that, in the embodiments of the present application, words such as "exemplary" or "such as" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
In the description of the present application, unless otherwise indicated, the meaning of "a plurality" means two or more.
It can be understood that, in practical application, the sequence of steps of a specific method may be adjusted according to the message processing method provided in the embodiment of the present application, which is not limited in this embodiment.
Before explaining the embodiments of the present application in detail, some terms related to the embodiments of the present application are explained.
1. Network card driver
The network card driver is matched software for enabling the network card to work normally. The network card is used as a hardware device to bear a network card drive. Without the network card driver, the network card cannot be used normally.
2. Switching chip drive
The switch chip drives a driver program running on the switch chip and is used for completing data transceiving of a data link layer. Is a software module that communicates the processor and the switch chip.
3. MAC layer
The MAC layer is located in the data link layer in the open system interconnection communication reference model (open system interconnection reference model, OSI), and the data link layer is divided into an upper LLC (logical links control, logical link control) and a lower MAC (medium access control), which is mainly responsible for controlling and interfacing with the physical medium of the physical layer.
4. Message of data link layer protocol
The messages of the data link layer protocol are protocol messages running on the switch device, and the protocol messages are mainly generated by taking the data link layer protocol as a standard. And is therefore also referred to as a two-layer protocol message. The protocols adopted by the method comprise the common LLDP protocol, the LACP protocol and the like.
5. Character device driver
The character device driver is one of the drive types of a linux operating system. The method has a fixed frame form, is used for abstracting specific device operations into a file set, provides a complete file handle operation set for a user, and can shield hardware interaction.
In order to reduce the number of devices, the data exchange function of the switch device and the function of the terminal device may be integrated in one device. However, the integrated device cannot identify whether the received message is a message of the transport layer protocol or a message of the data link layer protocol, so that the message cannot be accurately transmitted.
In view of this, the embodiment of the present application provides a message processing method to solve the problems existing in the prior art. First, a system architecture to which a message processing method provided by an embodiment of the present disclosure is applied is described.
Referring to fig. 1, a schematic diagram of a communication system architecture applied to a technical solution provided in an embodiment of the present application is shown. Wherein, the system can comprise: a communication device 01 and a network device 02.
The communication device 01 and the network device 02 may be terminal devices, computers or servers; the terminal device may be a device having a transceiving function. The terminal device may be of different names, such as User Equipment (UE), access device, terminal unit, terminal station, mobile station, remote terminal, mobile device, wireless communication device, terminal agent, or terminal apparatus, etc. Terminal devices may be deployed on land, including indoors or outdoors, hand-held or vehicle-mounted; may also be deployed on the surface of water (e.g., a ship, etc.); but may also be deployed in the air (e.g., on aircraft, balloon, satellite, etc.). The terminal device includes a handheld device, an in-vehicle device, a wearable device, or a computing device with communication capabilities. For example, the terminal device may be a mobile phone (mobile phone), a tablet computer, or a computer with a transceiver function. The terminal device may also be a Virtual Reality (VR) device, an augmented reality (augmented reality, AR) device, a terminal of an industrial control terminal, a terminal in an unmanned, a terminal in telemedicine, a terminal in a smart grid, a terminal in a smart city, a terminal in a smart home (smart home), etc. In this embodiment of the present application, the means for implementing the function of the communication device 01 may be the communication device, and the means for implementing the function of the network device 02 may be the network device, or may be a device capable of supporting the communication device 01 or the network device 02 to implement the corresponding function of the communication device 01 or the network device 02, for example, a network card or a chip system. In this application, the chip system may be formed by a chip, and may also include a chip and other discrete devices. The network card may be a network transmission device, such as a network adapter, for transmitting data with other devices on an electronic device, such as a terminal device, a server, or a computer.
In addition, the communication device 01 and the network device 02 in the embodiments of the present application may be a switch or a gateway device (such as an internet of things gateway device or a wireless gateway device, etc.) in practical applications.
In one implementation, an embodiment of the present application provides a schematic hardware architecture of a network device (taking the network card 02 shown in fig. 2 as an example). The network card 02 includes: processor cpu, mac controller, and switch chip. The switching chip is responsible for receiving a message sent by the terminal equipment 01 through a physical port xn (n is more than or equal to 2) and sending the message to the mac controller through a management port x 1; the mac controller is used for sending the received message to the processor; so that the processor can recognize and process the message. Here, the management port x1 and the mac controller are connected by a link, and the message arrives at the mac controller according to the link connection. The physical port xn belongs to an extended physical port of a switch chip. In addition, the sending process and the receiving process of the message are reverse, the sending process of the message is mainly to package the message, and the network card 02 is to passively receive the message transmitted by the protocol layer, so that no special processing is needed, and the message can be directly sent to the corresponding terminal device through the physical port xn of the switch chip, and the technology will not be described in detail.
Alternatively, the devices mentioned in the embodiments of the present application, such as the communication device 01 and the network device 02, may be implemented by the electronic device shown in fig. 3.
The electronic device comprises a processor 31, a communication bus 34 and at least one transceiver (illustrated in fig. 3 by way of example only as comprising a transceiver 33).
The processor 31 may include one or more processing units, such as: the processor 31 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a video processing unit (video processing unit, VPU) controller, memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors.
The controller may be a neural hub and a command center of the communication device. The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution.
A memory may also be provided in the processor 31 for storing instructions and data. In some embodiments, the memory in the processor 31 is a cache memory. The memory may hold instructions or data that the processor 31 has just used or recycled. If the processor 31 needs to reuse the instruction or data, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 31 is reduced, thus improving the efficiency of the system.
In some embodiments, the processor 31 may include one or more interfaces. The interfaces may include an integrated circuit (inter-integrated circuit, I2C) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, and/or a universal serial bus (universal serial bus, USB) interface, a serial peripheral interface (serial peripheral interface, SPI) interface, and the like.
Communication bus 34 may include a path to transfer information between the aforementioned components.
The transceiver 33 uses any transceiver-like device for communicating with other devices or communication networks, such as ethernet, radio access network (radio access network, RAN), wireless local area network (wireless local area networks, WLAN), etc.
Optionally, the communication device may also include a memory 32.
The memory 32 may be, but is not limited to, a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (random access memory, RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (electrically erasable programmable read-only memory, EEPROM), a compact disc read-only memory (compact disc read-only memory) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory may be stand alone and be coupled to the processor via a communication bus 34. The memory may also be integrated with the processor.
The memory 32 is used for storing computer-executable instructions for executing the embodiments of the present application, and is controlled by the processor 31 to execute the instructions. The processor 31 is configured to execute computer-executable instructions stored in the memory 32, thereby implementing the message processing method provided in the following embodiments of the present application.
Alternatively, the computer-executable instructions in the embodiments of the present application may be referred to as application program codes, which are not specifically limited in the embodiments of the present application.
In a particular implementation, as one embodiment, processor 31 may include one or more CPUs, such as CPU0 and CPU1 of FIG. 3.
In a particular implementation, as one embodiment, the communication device may include a plurality of processors, such as processor 31 and processor 35 in FIG. 3. Each of these processors may be a single-core (single-CPU) processor or may be a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
In the following, with reference to the drawings in the specification, the network device uses a network card as an example, and the network card is taken as an execution body to specifically describe the technical scheme provided by the embodiment of the application.
Referring to fig. 4, a schematic diagram of a network architecture is provided in an embodiment of the present application, where the network architecture includes a data link layer to which the embodiment of the present application is applied. The system also comprises a physical layer, a network layer, a transmission layer, a session layer, a presentation layer and an application layer. Of course, fig. 4 shows only one seven-layer network architecture schematic. Other network architectures may include only the physical layer, the data link layer, the network layer, the transport layer, and the application layer. Accordingly, embodiments of the present application are not limited to the network architecture involved.
The technical principle of the embodiment of the application is as follows: when the network card driver receives the message from the communication equipment, the communication equipment can remind the network card driver to receive the message by triggering the hard interrupt of the network card, and when the network card driver detects that the hard interrupt of the network card is triggered, the corresponding interrupt response is executed. In the embodiment of the application, a hook function is added in the program of the network card driver. When the network card driver detects that the hard interrupt of the network card is triggered, the hook function is immediately scheduled to execute after receiving the message from the communication equipment, and the network card driver analyzes and shunts the type of the message based on a linked list rule by calling the hook function. If the message is the message of the transmission layer protocol, the network card drive pushes the message to the protocol stack to finish the processing of the subsequent network layer; if the message is the message of the data link layer protocol, the network card driver pushes the message to the protocol stack to be directly transmitted to the user layer. Therefore, the embodiment of the application can realize message identification and distribution at the data link layer through the hook function.
In addition, the method provided by the embodiment of the application also provides a debugging and printing principle of the message. In fact, in the process of message processing through the technical principle, the network card driver grabs messages before hook function call and after shunting processing according to the indication corresponding to the debug parameter determined in advance, so that the two messages are compared, and debugging and application of products are facilitated.
Referring to fig. 5, in an exemplary manner, in combination with the above principle, a packet receiving process flow is provided in an embodiment of the present application. The message receiving process is mainly carried out at the mac layer and the protocol stack layer. The receiving process of the message in the mac layer comprises the following steps: when the terminal equipment has a message and needs to be received by the network card, triggering the hardware interrupt of the network card to inform the network card to receive the message. Then, the network card driver responds to the hard interrupt of the network card to receive the message, and calls the hook function to identify the type of the message (the purpose of identifying the type of the message is to perform shunting processing on the message based on the type of the message). At this time, messages before the hook function call and after the shunt processing can be grabbed according to the debugging parameters. And then, reporting the shunted message to a kernel protocol stack (namely a protocol stack) of the protocol stack layer for corresponding processing. And finally, informing the user layer to receive the message. It should be noted that fig. 5 only briefly outlines the content of the message receiving flow, and the above description is in particular taken into consideration.
Referring to fig. 6, the method for processing a message provided in the embodiment of the present application is applied to the network device 02 shown in fig. 1, and the method in the embodiment of the present application is described in detail below with a network card as an exemplary execution body to replace the network device. The method specifically comprises the following steps.
S11, the network card acquires the first message.
Wherein the first message is derived based on an initial message from the communication device.
Optionally, before the network card acquires the message, an initialization process of the network card driver needs to be performed in a network platform of the operating system. Referring to fig. 7, the device registration of the network platform of the network card is first performed. And then, carrying out drive registration of the network platform. And initializing a rule chain header of the network card drive and configuring a tag function. After the configuration is completed, the initialization of the network card driver is completed. Specifically, the rule list head initialization is to add a single list management function in the network card driver for taking over the list rule configured by the user layer, wherein the list rule is mainly used for carrying out rule matching processing on the message of the data link layer, the processing user layer can call another driving interface to send the list rule of the message expected to be received by the user to the network card driver, and the list rule comprises the corresponding relation between the characteristic information and the type of the message; the characteristic information comprises at least one of a source address used for representing the message, a target address of the message and a network type; such as mac address, IP address, or protocol. The network card driver compares the field information contained in the linked list rule with the field information in the current received message, and if the field information in the current received message contains the field information contained in the linked list rule, the matching is successful; otherwise, the matching fails. Secondly, the label function of the network card driver is configured to realize that the network card adds label information in the message. The specific content of the tag information can refer to various types of switches of the current mainstream manufacturer, is not limited to a specific switch, and is configured by referring to a data manual thereof. The tag information is added in the message by a switch chip in the network card. It should be noted that, fig. 7 only briefly outlines the initialization process flow of the network card driver, and the above description is in particular followed.
Optionally, the network card obtaining the first report specifically includes: the network card receives an initial message from the communication equipment; it is determined whether the initial message contains tag information.
If the initial message is included and the label information is accurate, determining that the initial message is the first message.
And/or if the initial message is included and the label information is wrong, determining new label information according to the transmission information of the initial message, updating the label information in the initial message by using the new label information, and determining the updated initial message as the first message. Wherein the transmission information includes new tag information.
And/or if the initial message does not contain the tag information, determining the tag information according to the transmission information of the initial message, adding the tag information into the initial message, and determining the initial message added with the tag information as the first message.
In practice, the first message acquisition manner includes the following two methods:
the first way is: the communication device adds tag information itself in the process of generating the initial message. Therefore, when the network card receives the initial message, firstly determining whether the label information in the initial message is accurate or not, namely determining whether the content of the label information is consistent with the transmission information of the initial message or not; for example, by comparing whether the port number in the tag information is consistent with the port number at the time of the initial message transmission. If the initial message is accurate, the initial message is a first message; if the information is inaccurate, determining new label information at least according to the port of the communication equipment for transmitting the initial message and the network (namely transmission information) to which the port belongs, and updating the label information in the initial message by using the new label information. And determining the updated initial message as a first message. It should be noted that, the above is not limited to determining whether the label information in the initial message is accurate or not by comparing whether the port number in the label information is consistent with the port number in the initial message transmission. For example, whether the label information in the initial message is accurate or not can be determined by comparing whether the network to which the port in the label information belongs is consistent with the network to which the port in the initial message transmission belongs. Therefore, the embodiment of the present application does not limit any way to determine whether the tag information in the initial packet is accurate or not.
The second way is: the communication device does not add tag information in the process of generating the first message. The network card determines a piece of label information at least according to the port of the communication equipment transmitting the first message and the network to which the port belongs, adds the label information into the initial message, and determines the added initial message as the first message.
It should be noted that, referring to fig. 2, for the above two manners, the process of obtaining the first packet in the network card includes: the Switch chip receives an initial message sent by the communication equipment through the physical port Xn, and determines the first message according to the two modes from the initial message.
S12, the network card determines the type of the first message based on the linked list rule.
Wherein the type comprises a message of a transport layer protocol or a message of a data link layer protocol; the linked list rule comprises the corresponding relation between the characteristic information and the type of the message; the characteristic information comprises at least one of a source address used for representing the message, a target address of the message and a network type.
Optionally, determining the type of the first message based on the linked list rule specifically includes: matching the linked list rule with the first message, wherein the matching result comprises: if the matching is successful, determining that the type of the first message is a message of a data link layer protocol; if the matching fails, determining that the type of the first message is a message of a transport layer protocol. It should be noted that, in the embodiment of the present application, the linked list rule is configured for a packet of the data link layer protocol.
Specifically, the network card determines the type of the first message based on the linked list rule, mainly by inquiring and matching the linked list rule issued by the user layer (namely, the attribute field of the message expected to be received by the user), and if the configured linked list rule is inquired, the successful matching is indicated. For example, if the linked list rule issued by the dest_mac user is the same as the dest_mac address field extracted from the received message, the matching is successful. And grouping the successfully matched messages according to the message group of the data link layer protocol, and adding configuration information based on a mac layer. Otherwise, directly reporting the mac layer message in TCP/IP format to the kernel protocol stack, namely the mac layer packet format of the standard TCP/IP,
further, the linked list rule is generated by another driver, and the linked list rule is configured with a driving framework as shown in fig. 8, wherein the driver is a character device driver which is irrelevant to a physical layer and comprises a user layer and a driving layer from top to bottom. The user layer is used for providing interfaces for adding and deleting linked list rules for users, and the driving layer provides and processes functions of adding linked list rules, deleting linked list rules and the like for the user layer through registering character equipment and packaging operation sets. Wherein the linked list rules include, but are not limited to, one or more of the items shown in table 1 below.
TABLE 1
Source address 6 bytes |
Source code address mask length |
6 bytes of destination address |
Destination address mask length |
Network type |
Network type mask length |
Source IP address |
Source IP address mask length |
Destination IP address |
Destination IP address mask length |
Custom tag type |
S13, the network card determines a target message according to the type of the first message and transmits the target message.
Specifically, under the condition that the type of the first message is a message of a transport layer protocol, determining the label information of the first message, deleting the label information in the first message, and generating a target message. And/or determining the first message as the target message under the condition that the type of the first message is a message of a data link layer protocol.
In the application, under the condition that the target message is a message of a data link layer protocol, the data link layer is subjected to receiving and transmitting treatment, the generated target message is not required to be processed again, and the generated target message is transmitted to the user layer through a protocol stack. In the case that the target message is a message of a transport layer protocol, the target message needs to be transmitted to a network layer for processing through a data link layer.
It should be noted that, in the embodiment of the present application, the format of the first packet is the same as the format of the packet of the data link layer protocol. The format of the second message is the same as that of the message of the transmission layer protocol; however, after the second message is matched based on the rule of the linked list, the type of the second message may be a message of the data link layer protocol or a message of the transport layer protocol. When the type of the second message is a message of the data link layer protocol, the label information deleted from the first message is required to be added into the second message again to generate a target message, and the format of the target message is the message format of the data link layer protocol; when the type of the second message is a message of the transport layer protocol, the second message is the target message, and the format of the target message is the message format of the transport layer protocol.
In the method, the message required to be uploaded by the user can be accurately identified as the message of the data link layer protocol or the message of the transmission layer protocol of the network layer standard by the link rule matching mode. The method solves the problem that the existing integrated equipment cannot identify whether the received message is a message of a transmission layer protocol or a message of a data link layer protocol. So as to realize the accurate shunting processing of the message under the corresponding type through the type of the message.
In one implementation, referring to fig. 9 in conjunction with fig. 6, S12 specifically includes the following implementations:
s121, the network card determines the label information of the first message; the tag information is at least used for identifying the port of the communication device transmitting the initial message and the network to which the port belongs.
The network card determines the label information of the first message; the tag information is at least used for identifying a port of the communication device transmitting the first message and a network to which the port belongs.
Optionally, the network card calls a hook function to analyze the first message and determine the tag information.
Wherein the tag information includes: the number of the communication device, the port number of the communication device, the network to which the port of the communication device belongs, and the priority setting of the network.
The tag information is typically 6 bytes in length in the message, for example. Which may contain 2 bytes of tag id (e.g., 0x 9126) and 4 bytes of tag data information. the tag data information includes a source device number of 1byte, a source device port number of 1byte, a priority of 1byte, and high 4 bits of a VLAN Identification (VID), low 8 bits of a VID of 1 byte. Wherein the source device number indicates from which device the message was received; the source device port number indicates which port of the message was received from the device; priority indicates the priority setting of the virtual local area network (Virtual Local Area Network, VLAN) of the port; the upper 4 bits and the lower 8 bits of the VID indicate to which VLAN the port receiving the message belongs.
S122, deleting the tag information by the network card, and generating a second message.
Further, after determining the tag information in the first message, the network card firstly stores and manages the tag information, and then deletes the tag information in the first message.
Specifically, the network card deletes the tag information in the first message by calling the hook function to generate a second message.
S123, the network card determines the type of the second message based on the linked list rule, and takes the type of the second message as the type of the first message.
Optionally, determining the type of the second message based on the linked list rule specifically includes: matching the linked list rule with the second message, wherein the matching result comprises: if the matching is successful, determining that the type of the second message is a message of a data link layer protocol; if the matching fails, determining that the type of the second message is the message of the transport layer protocol. It should be noted that, in the embodiment of the present application, the linked list rule is configured for a packet of the data link layer protocol.
Specifically, the network card determines the type of the second message based on the linked list rule, mainly by inquiring and matching the linked list rule issued by the user layer (namely, the attribute field of the message expected to be received by the user), and if the configured linked list rule is inquired, the successful matching is indicated. For example, if the address field contained in the linked list rule issued by the dest_mac user is identical to the dest_mac address field extracted from the received message, the matching is successful. And grouping the successfully matched messages according to the message group of the data link layer protocol, and adding configuration information based on a mac layer. Otherwise, directly reporting the mac layer message in TCP/IP format to the kernel protocol stack, namely the mac layer packet format of the standard TCP/IP,
on the basis of S121-S123, confirm the goal message according to the type of the first message, including: and adding tag information into the second message to generate a target message under the condition that the type of the first message is a message of a transport layer protocol. And/or determining the second message as the target message under the condition that the type of the first message is the message of the data link layer protocol.
Further, a hook function is called to analyze the second message, and tag information is determined.
In this implementation manner, considering that the message types of the transport layer protocol occupy a majority, by deleting the tag information from the first message and then performing the link rule matching, the message that the user needs to upload can be accurately identified as the message of the transport layer protocol or the message of the transport layer protocol of the network layer standard. The method solves the problem that the existing integrated equipment cannot identify whether the received message is a message of a transmission layer protocol or a message of a data link layer protocol. So as to realize the accurate shunting processing of the message under the corresponding type through the type of the message.
In one implementation, referring to fig. 9, if the second packet is of the data link layer protocol type. The method specifically comprises the following steps:
s101, a network card transmits a target message to a user layer through a protocol stack; the target message is a first message.
Specifically, a user layer provided by a character device driver adds a required linked list rule, and the character device driver transmits the linked list rule to a network card driver through a preset interface between the character device driver and the network card driver. And then, when the network card driver executes recv receiving messages through the socket, acquiring the first message, determining the label information of the first message and storing the label information. And then deleting the label information in the first message to generate a second message. Matching the linked list rule with the second message, and determining that the second message contains data corresponding to linked list elements in the linked list rule, and then successful matching. At this time, the deleted tag information needs to be added again in the second message, so as to generate a target message of the type of the message of the data link layer protocol, which needs to be transmitted. And then transmitting the target message to the user layer through the protocol stack.
The format of the first packet including the tag information is shown in fig. 10, and the first packet includes tag information with a length of 6 bytes, a preamble with a length of 7 bytes, a revealing delimiter with a length of 1 byte, a source mac address with a length of 6 bytes, a destination mac address with a length of 6 bytes, a length/type with a length of 2 bytes, user data with a length of 4 bytes, a PAD with a length of 4 bytes, and a frame check sequence FSC with a length of 4 bytes. It should be noted that the data specifically included in the tag information of 6 bytes may refer to the above, and will not be described herein.
In the implementation manner, tag information is added in the second message to generate a target message of a message type of a data link layer protocol, and the target message is directly transmitted to a user layer through a protocol stack. So as to realize the accurate transmission of the target message.
In another implementation, referring to fig. 9, if the type of the first packet is a packet of a transport layer protocol; the method specifically comprises the following steps:
s102, the network card transmits the second message to a network layer; the second message is a target message.
Illustratively, the control message protocol (Internet control message protocol, ICMP) Internet link ping packet needs to be received. The communication device sends a request message (i.e., a first message) of the internet group management protocol (Internet Group Management Protocol, IGMP), and the request message is received by the switch chip and forwarded to the network card according to the hardware connection relationship shown in fig. 2. At this time, the hook function is called by the network card, and the physical layer tag is stripped (i.e. tag information is deleted, and the tag information is different from manufacturer to manufacturer and can be determined by the respective data manual, which is not described in detail), so that the message is integrated into a second message in the standard network mac message format (i.e. the message format of the transport layer protocol) as shown in fig. 11. And then matching the linked list rule with the second message. And if the matching fails, determining the type of the second message as the message of the transport layer protocol. And uploading the second message to a network layer of the protocol stack, and receiving the second message by the network layer of the protocol stack, replying a response message, thereby realizing the process of link ping.
The matching failure condition may be that the user does not generate a linked list rule through the character device driver. It is also possible that a linked list rule is generated, but the data of the linked list rule cannot correspond to the data in the second message. If the filled message type=0x8899 is inconsistent with the actual type 0x0800 of the received message, the protocol stack is reported according to the standard format.
According to the implementation mode, the second message which fails to be matched is uploaded to the network layer without any processing, so that accurate transmission of the target message is realized.
In one implementation, before receiving a first message from a communication device, the method includes: receiving debugging parameters input by a user; the debugging parameters are used for indicating the message which is received and transmitted by the grabbing MAC layer; after receiving the first message from the communication device, the method includes: and grabbing the first message and the target message based on the debugging parameters. And determining the difference between the first message and the target message.
It should be noted that, the description of the present implementation refers to the description corresponding to fig. 7, and is not repeated here.
According to the implementation mode, the message received by the mac layer and the transmitted message are grabbed through the preset adjustment parameters, so that the information change condition of the front message and the rear message is determined through comparison of the front message and the rear message.
The method may divide the function modules of the resource allocation device according to the embodiment of the method, for example, each function module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The integrated modules may be implemented in hardware or in software functional modules. It should be noted that, in the embodiment of the present application, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation.
As shown in fig. 12, a schematic structural diagram of a message processing apparatus 120 according to an embodiment of the present application is provided, where the message processing apparatus 120 specifically includes a switch chip 121 and a processor 122.
A switch chip 121, configured to obtain a first packet; the first message is derived based on an initial message from the communication device. For example, the switch chip 121 may be used to implement S11 as shown in fig. 6.
A processor 122, configured to determine, based on the linked list rule, a type of the first message acquired by the switch chip 121; the type includes a message of a transport layer protocol or a message of a data link layer protocol; the linked list rule comprises the corresponding relation between the characteristic information and the type of the message; the characteristic information comprises at least one of a source address used for representing the message, a target address of the message and a network type. For example, the processor 122 may be used to implement S12 as shown in fig. 6.
The processor 122 is further configured to determine a target message according to the type of the first message, and transmit the target message. For example, the processor 122 may be used to implement S13 as shown in fig. 6.
Optionally, the processor 122 is specifically configured to: determining label information of a first message; the label information is at least used for identifying a port of the communication equipment for transmitting the initial message and a network to which the port belongs; deleting the label information to generate a second message; and determining the type of the second message based on the rule of the linked list, and taking the type of the second message as the type of the first message.
Optionally, the processor 122 is specifically configured to: under the condition that the type of the first message is a message of a transmission layer protocol, adding tag information into the second message to generate a target message; and/or determining the second message as the target message under the condition that the type of the first message is the message of the data link layer protocol.
Optionally, the processor 122 is specifically configured to call the hook function to parse the second message, and determine tag information.
Optionally, the processor 122 is specifically configured to: matching the linked list rule with the second message; if the matching is successful, determining that the type of the second message is a message of a data link layer protocol; and/or if the matching fails, determining that the type of the second message is a message of a transport layer protocol.
Optionally, the tag information includes: the number of the communication device, the port number of the communication device, the network to which the port of the communication device belongs, and the priority setting of the network.
Optionally, the switch chip 121 is specifically configured to: receiving an initial message from a communication device; determining whether the initial message contains label information; if the initial message is included and the label information is accurate, determining that the initial message is a first message; and/or if the information is included and the label information is wrong, determining new label information according to the transmission information of the initial message, updating the label information in the initial message by using the new label information, and determining the updated initial message as a first message; and/or if the initial message does not contain the tag information, determining the tag information according to the transmission information of the initial message, adding the tag information into the initial message, and determining the initial message added with the tag information as the first message.
Optionally, the processor 122 is specifically configured to: under the condition that the type of the first message is a message of a transmission layer protocol, determining the label information of the first message, deleting the label information in the first message, and generating a target message; and/or determining the first message as the target message under the condition that the type of the first message is a message of a data link layer protocol.
Optionally, the processor 122 is further configured to: receiving debugging parameters input by a user; the debug parameters are used for indicating to grasp the messages received and transmitted by the MAC layer.
And grabbing the first message and the target message based on the debugging parameters. And determining the difference between the first message and the target message.
The system architecture and the service scenario described in the embodiments of the present invention are for more clearly describing the technical solution of the embodiments of the present application, and do not constitute a limitation on the technical solution provided in the embodiments of the present application, and those skilled in the art can know that, with the evolution of the network architecture and the appearance of the new service scenario, the technical solution provided in the embodiments of the present application is equally applicable to similar technical problems.
Another embodiment of the present invention also provides a computer-readable storage medium having stored therein instructions which, when executed on a computer, cause the computer to perform the method shown in the above-described method embodiment.
In some embodiments, the disclosed methods may be implemented as computer program instructions encoded on a computer-readable storage medium in a machine-readable format or encoded on other non-transitory media or articles of manufacture.
Fig. 13 schematically illustrates a conceptual partial view of a computer program product provided by an embodiment of the invention, the computer program product comprising a computer program for executing a computer process on a computing device.
In one embodiment, a computer program product is provided using signal bearing medium 410. The signal bearing medium 410 may include one or more program instructions that when executed by one or more processors may provide the functionality or portions of the functionality described above with respect to fig. 6. Thus, for example, referring to the embodiment shown in FIG. 6, one or more features of S11-S13 may be carried by one or more instructions associated with signal bearing medium 410. Further, the program instructions in fig. 13 also describe example instructions.
In some examples, signal bearing medium 410 may comprise a computer readable medium 411 such as, but not limited to, a hard disk drive, compact Disk (CD), digital Video Disk (DVD), digital tape, memory, read-only memory (ROM), or random access memory (random access memory, RAM), among others.
In some implementations, the signal bearing medium 410 may include a computer recordable medium 412 such as, but not limited to, memory, read/write (R/W) CD, R/W DVD, and the like.
In some implementations, the signal bearing medium 410 may include a communication medium 413 such as, but not limited to, a digital and/or analog communication medium (e.g., fiber optic cable, waveguide, wired communications link, wireless communications link, etc.).
The signal bearing medium 410 may be conveyed by a communication medium 413 in wireless form (e.g., a wireless communication medium conforming to the IEEE802.41 standard or other transmission protocol). The one or more program instructions may be, for example, computer-executable instructions or logic-implemented instructions.
In some examples, a processor such as that described with respect to fig. 12 may be configured to provide various operations, functions, or actions in response to program instructions through one or more of computer readable medium 411, computer recordable medium 412, and/or communication medium 413.
From the foregoing description of the embodiments, it will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of functional modules is illustrated, and in practical application, the above-described functional allocation may be implemented by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to implement all or part of the functions described above.
In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another apparatus, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and the parts displayed as units may be one physical unit or a plurality of physical units, may be located in one place, or may be distributed in a plurality of different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a readable storage medium. Based on such understanding, the technical solution of the embodiments of the present invention may be essentially or a part contributing to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, including several instructions for causing a device (may be a single-chip microcomputer, a chip or the like) or a processor (processor) to perform all or part of the steps of the method described in the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk, etc.
The foregoing is merely illustrative of specific embodiments of the present invention, and the scope of the present invention is not limited thereto, but any changes or substitutions within the technical scope of the present invention should be covered by the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (18)
1. The message processing method is characterized by being applied to network equipment; the method comprises the following steps:
Acquiring a first message; the first message is obtained based on an initial message from the communication device;
determining the type of the first message based on a linked list rule; the type comprises a message of a transmission layer protocol or a message of a data link layer protocol; the linked list rule comprises a corresponding relation between characteristic information and types of the message; the characteristic information comprises at least one of a source address used for representing the message, a target address of the message and a network type;
determining a target message according to the type of the first message, and transmitting the target message;
the transmitting the target message includes:
transmitting the target message to a user layer through a protocol stack under the condition that the target message is a message of a data link layer protocol;
transmitting the target message to a network layer for processing through a data link layer under the condition that the target message is a message of a transmission layer protocol;
the determining the type of the first message based on the linked list rule includes:
determining label information of the first message; the label information is at least used for identifying a port of the communication equipment for transmitting the initial message and a network to which the port belongs;
Deleting the label information to generate a second message;
and determining the type of the second message based on a linked list rule, and taking the type of the second message as the type of the first message.
2. The method for processing a message according to claim 1, wherein determining the target message according to the type of the first message comprises:
adding the label information in the second message to generate the target message under the condition that the type of the first message is a message of a transport layer protocol;
and/or the number of the groups of groups,
and determining the second message as the target message under the condition that the type of the first message is the message of the data link layer protocol.
3. The method for processing a message according to claim 1 or 2, wherein determining the tag information of the first message includes:
and calling a hook function to analyze the second message and determining the label information.
4. The method for processing a message according to claim 1 or 2, wherein determining the type of the second message based on the linked list rule includes:
matching the linked list rule with the second message;
if the matching is successful, determining that the type of the second message is the message of the data link layer protocol;
And/or the number of the groups of groups,
if the matching fails, determining that the type of the second message is the message of the transport layer protocol.
5. The message processing method according to claim 1 or 2, wherein the tag information includes: the number of the communication equipment, the port number of the communication equipment, the network to which the port of the communication equipment belongs and the priority of the network are set.
6. The method for processing a message according to claim 1, wherein the obtaining the first message includes:
receiving the initial message from the communication equipment;
determining whether the initial message contains the label information;
if the initial message is included and the label information is accurate, determining that the initial message is the first message;
and/or the number of the groups of groups,
if the initial message contains the label information, determining new label information according to the transmission information of the initial message, updating the label information in the initial message by using the new label information, and determining the updated initial message as the first message;
and/or the number of the groups of groups,
if the initial message does not contain the label information, determining the label information according to the transmission information of the initial message, adding the label information into the initial message, and determining the initial message added with the label information as the first message.
7. The method for processing a message according to claim 1, wherein determining the target message according to the type of the first message comprises:
determining the label information of the first message under the condition that the type of the first message is a message of a transport layer protocol, deleting the label information in the first message, and generating the target message;
and/or the number of the groups of groups,
and determining the first message as the target message under the condition that the type of the first message is the message of the data link layer protocol.
8. The method for processing a message according to claim 1, wherein before the first message is acquired, the method comprises:
receiving debugging parameters input by a user; the debugging parameters are used for indicating to grasp messages received and transmitted by the MAC layer;
after the first message is acquired, the method includes:
grabbing the first message and the target message based on the debugging parameters;
and determining the difference between the first message and the target message.
9. A message processing apparatus, the apparatus comprising: a switching chip and a processor;
the exchange chip is used for acquiring a first message; the first message is obtained based on an initial message from the communication device;
The processor is used for determining the type of the first message acquired by the exchange chip based on a linked list rule; the type comprises a message of a transmission layer protocol or a message of a data link layer protocol; the linked list rule comprises a corresponding relation between characteristic information and types of the message; the characteristic information comprises at least one of a source address used for representing the message, a target address of the message and a network type;
the processor is further configured to determine a target message according to the type of the first message, and transmit the target message;
the processor is specifically configured to:
transmitting the target message to a user layer through a protocol stack under the condition that the target message is a message of a data link layer protocol;
transmitting the target message to a network layer for processing through a data link layer under the condition that the target message is a message of a transmission layer protocol;
the processor is specifically configured to:
determining label information of the first message; the label information is at least used for identifying a port of the communication equipment for transmitting the initial message and a network to which the port belongs;
deleting the label information to generate a second message;
And determining the type of the second message based on a linked list rule, and taking the type of the second message as the type of the first message.
10. The message processing apparatus according to claim 9, wherein the processor is specifically configured to:
adding the label information in the second message to generate the target message under the condition that the type of the first message is a message of a transport layer protocol;
and/or the number of the groups of groups,
and determining the second message as the target message under the condition that the type of the first message is the message of the data link layer protocol.
11. The message processing apparatus according to claim 9 or 10, wherein,
the processor is specifically configured to call a hook function to parse the second message, and determine the tag information.
12. The message processing apparatus according to claim 9 or 10, wherein the processor is specifically configured to:
matching the linked list rule with the second message;
if the matching is successful, determining that the type of the second message is the message of the data link layer protocol;
and/or the number of the groups of groups,
if the matching fails, determining that the type of the second message is the message of the transport layer protocol.
13. The message processing apparatus according to claim 9 or 10, wherein the tag information includes: the number of the communication equipment, the port number of the communication equipment, the network to which the port of the communication equipment belongs and the priority of the network are set.
14. The message processing apparatus according to claim 9, wherein the switching chip is specifically configured to:
receiving the initial message from the communication equipment;
determining whether the initial message contains the label information;
if the initial message is included and the label information is accurate, determining that the initial message is the first message;
and/or the number of the groups of groups,
if the initial message contains the label information, determining new label information according to the transmission information of the initial message, updating the label information in the initial message by using the new label information, and determining the updated initial message as the first message;
and/or the number of the groups of groups,
if the initial message does not contain the label information, determining the label information according to the transmission information of the initial message, adding the label information into the initial message, and determining the initial message added with the label information as the first message.
15. The message processing apparatus according to claim 9, wherein the processor is specifically configured to:
determining the label information of the first message under the condition that the type of the first message is a message of a transport layer protocol, deleting the label information in the first message, and generating the target message;
and/or the number of the groups of groups,
and determining the first message as the target message under the condition that the type of the first message is the message of the data link layer protocol.
16. The message processing apparatus of claim 9, wherein the processor is further configured to:
receiving debugging parameters input by a user; the debugging parameters are used for indicating to grasp messages received and transmitted by the MAC layer;
grabbing the first message and the target message based on the debugging parameters;
and determining the difference between the first message and the target message.
17. A network device, comprising: a memory for storing a computer program and a processor for executing the computer program to perform the message processing method of any of claims 1-8.
18. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when run on a network device, causes the network device to perform the message processing method according to any of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110772783.5A CN113595931B (en) | 2021-07-08 | 2021-07-08 | Message processing method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110772783.5A CN113595931B (en) | 2021-07-08 | 2021-07-08 | Message processing method, device, equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113595931A CN113595931A (en) | 2021-11-02 |
CN113595931B true CN113595931B (en) | 2024-01-16 |
Family
ID=78246458
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110772783.5A Active CN113595931B (en) | 2021-07-08 | 2021-07-08 | Message processing method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113595931B (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113810428B (en) * | 2021-09-30 | 2023-07-18 | 深圳市九洲电器有限公司 | Security control system and security control method for edge computing device |
CN114244916B (en) * | 2021-11-19 | 2022-11-18 | 国网经济技术研究院有限公司 | A port identification method of an intelligent electronic device, electronic device and storage medium |
CN114336962B (en) * | 2021-12-14 | 2025-01-24 | 江苏未来智慧信息科技有限公司 | Monitoring system and monitoring method for power plant operating conditions |
CN115052054B (en) * | 2022-08-15 | 2022-10-25 | 江西联创精密机电有限公司 | Communication message configuration method, device, readable storage medium and equipment |
CN115550250B (en) * | 2022-11-17 | 2023-04-07 | 鹏城实验室 | Small flow packet retransmission method, system, electronic device and storage medium |
CN116192713B (en) * | 2023-02-21 | 2024-10-01 | 中银金融科技有限公司 | Message transmission link problem detection method, device, equipment and medium |
CN116781798A (en) * | 2023-05-16 | 2023-09-19 | 中兴通讯股份有限公司 | Data transmission method, device and storage medium |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1816008A (en) * | 2005-02-04 | 2006-08-09 | 华为技术有限公司 | Route, signal and control protocol message transmission method in network transmission |
WO2013059991A1 (en) * | 2011-10-25 | 2013-05-02 | 华为技术有限公司 | Data message processing method and system, message forwarding device |
WO2015096409A1 (en) * | 2013-12-24 | 2015-07-02 | 中兴通讯股份有限公司 | Method, device and system for discovering link in software-defined network |
CN106533890A (en) * | 2016-12-30 | 2017-03-22 | 华为技术有限公司 | Message processing method, device and system |
WO2020093737A1 (en) * | 2018-11-09 | 2020-05-14 | 深圳市中兴微电子技术有限公司 | Message processing method and device, storage medium and optical network terminal |
CN111818041A (en) * | 2020-07-06 | 2020-10-23 | 桦蓥(上海)信息科技有限责任公司 | Real-time message processing system and method based on network layer message analysis |
CN112152927A (en) * | 2019-06-26 | 2020-12-29 | 杭州海康威视数字技术股份有限公司 | Message forwarding method, system, network card and storage medium |
CN112235266A (en) * | 2020-09-29 | 2021-01-15 | 腾讯科技(深圳)有限公司 | Data processing method, device, equipment and storage medium |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8228908B2 (en) * | 2006-07-11 | 2012-07-24 | Cisco Technology, Inc. | Apparatus for hardware-software classification of data packet flows |
US9191209B2 (en) * | 2013-06-25 | 2015-11-17 | Google Inc. | Efficient communication for devices of a home network |
US20190190811A1 (en) * | 2017-12-14 | 2019-06-20 | Lenovo Enterprise Solutions (Singapore) Pte. Ltd. | Automatic sharing of routing information between neighboring routers using a link-local address |
-
2021
- 2021-07-08 CN CN202110772783.5A patent/CN113595931B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1816008A (en) * | 2005-02-04 | 2006-08-09 | 华为技术有限公司 | Route, signal and control protocol message transmission method in network transmission |
WO2013059991A1 (en) * | 2011-10-25 | 2013-05-02 | 华为技术有限公司 | Data message processing method and system, message forwarding device |
CN103181129A (en) * | 2011-10-25 | 2013-06-26 | 华为技术有限公司 | Data message processing method and system, message forwarding device |
WO2015096409A1 (en) * | 2013-12-24 | 2015-07-02 | 中兴通讯股份有限公司 | Method, device and system for discovering link in software-defined network |
CN106533890A (en) * | 2016-12-30 | 2017-03-22 | 华为技术有限公司 | Message processing method, device and system |
WO2020093737A1 (en) * | 2018-11-09 | 2020-05-14 | 深圳市中兴微电子技术有限公司 | Message processing method and device, storage medium and optical network terminal |
CN112152927A (en) * | 2019-06-26 | 2020-12-29 | 杭州海康威视数字技术股份有限公司 | Message forwarding method, system, network card and storage medium |
CN111818041A (en) * | 2020-07-06 | 2020-10-23 | 桦蓥(上海)信息科技有限责任公司 | Real-time message processing system and method based on network layer message analysis |
CN112235266A (en) * | 2020-09-29 | 2021-01-15 | 腾讯科技(深圳)有限公司 | Data processing method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113595931A (en) | 2021-11-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113595931B (en) | Message processing method, device, equipment and storage medium | |
US10986171B2 (en) | Method for unified communication of server, baseboard management controller, and server | |
EP3771169B1 (en) | Message processing method and related device | |
US7830882B2 (en) | Switch scaling for virtualized network interface controllers | |
CN104579695B (en) | A kind of data forwarding device and method | |
EP3828709A1 (en) | Communication method and network card | |
CN106034084B (en) | Data transmission method and device | |
US10609633B2 (en) | Method for triggering registrar protocol interaction, access point, and station | |
CN114745255B (en) | Hardware chip, DPU, server, communication method and related device | |
CN113228567B (en) | Information processing method and device and information processing system | |
CN108347392B (en) | Cross-board processing method, device and system for service message | |
CN115065637B (en) | Method and device for transmitting computing power resource information and electronic equipment | |
US20230091501A1 (en) | Port status configuration method, apparatus, and system, and storage medium | |
US20230370899A1 (en) | Packet forwarding method, packet processing method, and device | |
CN109739786A (en) | A DMA Controller and Heterogeneous Acceleration System | |
CN109379269A (en) | Virtual swap device data forwarding method, device and computer equipment | |
CN114050998A (en) | Method, device, electronic equipment and medium for realizing remote direct memory access | |
CN113014627A (en) | Message forwarding method and device, intelligent terminal and computer readable storage medium | |
CN112714075A (en) | Method for limiting speed of data packet forwarding by bridge | |
WO2023124427A1 (en) | Data processing method, network node, computer readable storage medium | |
CN115550104B (en) | AXI bus expansion method, device, electronic equipment and storage medium | |
WO2020048355A1 (en) | User interface (ui) display control method and apparatus | |
CN113923113A (en) | Cache configuration method and switching equipment | |
CN117354867A (en) | Data transmission method, device and storage medium | |
CN105512075A (en) | High-speed output interface circuit, high-speed input interface circuit and data transmission 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 |