[go: up one dir, main page]

CN113595931B - Message processing method, device, equipment and storage medium - Google Patents

Message processing method, device, equipment and storage medium Download PDF

Info

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
type
label information
target
layer protocol
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110772783.5A
Other languages
Chinese (zh)
Other versions
CN113595931A (en
Inventor
张宏艳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Shangxin Technology Co.,Ltd.
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN202110772783.5A priority Critical patent/CN113595931B/en
Publication of CN113595931A publication Critical patent/CN113595931A/en
Application granted granted Critical
Publication of CN113595931B publication Critical patent/CN113595931B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/24Traffic characterised by specific attributes, e.g. priority or QoS
    • H04L47/2441Traffic characterised by specific attributes, e.g. priority or QoS relying on flow classification, e.g. using integrated services [IntServ]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/24Traffic characterised by specific attributes, e.g. priority or QoS
    • H04L47/2483Traffic characterised by specific attributes, e.g. priority or QoS involving identification of individual flows
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/30Definitions, standards or architectural aspects of layered protocol stacks
    • H04L69/32Architecture of open systems interconnection [OSI] 7-layer type protocol stacks, e.g. the interfaces between the data link level and the physical level
    • H04L69/322Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions
    • H04L69/324Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions in the data link layer [OSI layer 2], e.g. HDLC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/30Definitions, standards or architectural aspects of layered protocol stacks
    • H04L69/32Architecture of open systems interconnection [OSI] 7-layer type protocol stacks, e.g. the interfaces between the data link level and the physical level
    • H04L69/322Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions
    • H04L69/326Intralayer 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

一种报文处理方法、装置、设备及存储介质A message processing method, device, equipment and storage medium

技术领域Technical field

本申请涉及通信技术领域,尤其涉及一种报文处理方法、装置、设备及存储介质。The present application relates to the field of communication technology, and in particular, to a message processing method, device, equipment and storage medium.

背景技术Background technique

终端设备通常使用的是传输控制协议/网际协议(transmission controlprotocol/internet protocol,TCP/IP)等传输层协议的报文;交换机设备通常使用的是链路层发现协议(link layer discovery protocol,LLDP)、链路汇聚控制协议(LinkAggregation Control Protocol,LACP)等数据链路层协议的报文。Terminal devices usually use messages from transport layer protocols such as Transmission Control Protocol/Internet Protocol (TCP/IP); switch devices usually use Link Layer Discovery Protocol (LLDP) , Link Aggregation Control Protocol (LACP) and other data link layer protocol messages.

然而,无论是对传输层协议的报文的传输或是数据链路层协议的报文的传输,交换机设备所提供的数据交换功能不可或缺。因此,为了减少设备的数量,可以将交换机设备的数据交换功能与终端设备的功能集成在一个设备中。但是,集成的设备并不能识别接收到的报文是传输层协议的报文,还是数据链路层协议的报文,从而导致无法准确的传输报文。However, whether it is the transmission of packets of the transport layer protocol or the transmission of packets of the data link layer protocol, the data exchange function provided by the switch device is indispensable. Therefore, in order to reduce the number of devices, the data exchange function of the switch device and the function of the terminal device can be integrated into one device. However, the integrated device cannot identify whether the received message is a transport layer protocol message or a data link layer protocol message, resulting in the inability to accurately transmit the message.

发明内容Contents of the invention

本申请提供一种报文处理方法、装置、设备及存储介质,能够解决集成的设备无法识别接收到的报文是传输层协议的报文或是数据链路层协议的报文的问题。This application provides a message processing method, device, equipment and storage medium, which can solve the problem that the integrated device cannot identify whether the received message is a transport layer protocol message or a data link layer protocol message.

为达到上述目的,本申请采用如下技术方案:In order to achieve the above purpose, this application adopts the following technical solutions:

第一方面,提供一种资源配置方法,该方法包括:获取第一报文;第一报文是基于来自通信设备的初始报文得到的。基于链表规则,确定第一报文的类型;类型包括传输层协议的报文或数据链路层协议的报文;链表规则包括报文的特征信息与类型的对应关系;特征信息包括用于表征报文的源地址、报文的目标地址、网络类型中的至少一个。根据第一报文的类型,确定目标报文,并传输目标报文。In a first aspect, a resource configuration method is provided, which method includes: obtaining a first message; the first message is obtained based on an initial message from a communication device. Based on the linked list rules, the type of the first message is determined; the type includes a message of a transport layer protocol or a message of a data link layer protocol; the linked list rule includes the correspondence between the characteristic information of the message and the type; the characteristic information includes the characteristics used to characterize At least one of the source address of the message, the destination address of the message, and the network type. According to the type of the first message, the target message is determined and the target message is transmitted.

可选的,基于链表规则,确定第一报文的类型,包括:确定第一报文的标签信息;标签信息至少用于标识通信设备传输初始报文的端口和端口所属的网络。删除标签信息,生成第二报文。基于链表规则,确定第二报文的类型,并将第二报文的类型作为第一报文的类型。Optionally, 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 to identify the port through which the communication device transmits the initial message and the network to which the port belongs. Delete the label information and generate a second message. Based on the linked list rule, the type of the second message is determined, and the type of the second message is used as the type of the first message.

可选的,根据第一报文的类型,确定目标报文,包括:在第一报文的类型为传输层协议的报文的情况下,在第二报文中添加标签信息,生成目标报文。和/或,在第一报文的类型为数据链路层协议的报文的情况下,将第二报文确定为目标报文。Optionally, determining the target message according to the type of the first message includes: when the type of the first message is a transport layer protocol message, adding label information to the second message to generate the target message. arts. And/or, when the type of the first message is a data link layer protocol message, determine the second message as the target message.

可选的,确定第一报文的标签信息,包括:调用钩子函数解析第二报文,确定标签信息。Optionally, determining the label information of the first message includes: calling a hook function to parse the second message and determining the label information.

可选的,基于链表规则,确定第二报文的类型,包括:匹配链表规则与第二报文。若匹配成功,则确定第二报文的类型为数据链路层协议的报文。和/或,若匹配失败,则确定第二报文的类型为传输层协议的报文。Optionally, the type of the second message is determined based on the linked list rule, including: matching the linked list rule and the second message. If the match is successful, it is determined that the type of the second message is a data link layer protocol message. And/or, if the match fails, determine that the type of the second message is a transport layer protocol message.

可选的,标签信息包括:通信设备的编号、通信设备的端口编号、通信设备的端口所属的网络以及网络的优先级设定。Optionally, the label 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, obtaining the first message includes: receiving an initial message from the communication device. Determine whether the initial message contains label information. If it is included and the label information is accurate, the initial message is determined to be the first message. and/or, if included and the label information is wrong, determine the new label information based on the transmission information of the initial message, use the new label information to update the label information in the initial message, and determine that the updated initial message is the One message. And/or, if it is not included, determine the label information based on the transmission information of the initial message, add the label information to the initial message, and determine that the initial message after adding the label information is the first message.

可选的,根据第一报文的类型,确定目标报文,包括:在第一报文的类型为传输层协议的报文的情况下,确定第一报文的标签信息,并在第一报文中删除标签信息,生成目标报文。和/或,在第一报文的类型为数据链路层协议的报文的情况下,将第一报文确定为目标报文。Optionally, determining the target message according to the type of the first message includes: when the type of the first message is a transport layer protocol message, determining the label information of the first message, and Delete the label information from the message and generate the target message. And/or, when the type of the first message is a data link layer protocol message, determine the first message as the target message.

可选的,接收来自通信设备的第一报文之前,包括:接收用户输入的调试参数;调试参数用于指示抓取MAC层接收和传输的报文。接收来自通信设备的第一报文之后,包括:基于调试参数,抓取第一报文以及目标报文。确定第一报文以及目标报文的差异。Optionally, before receiving the first message from the communication device, the method includes: receiving debugging parameters input by the user; the debugging parameters are used to instruct the capture of messages received and transmitted by the MAC layer. After receiving the first message from the communication device, the process includes: capturing the first message and the target message based on the debugging parameters. Determine the difference between the first message and the target message.

第二方面,提供一种报文处理装置,该装置包括:交换芯片以及处理器。交换芯片,用于获取第一报文;第一报文是基于来自通信设备的初始报文得到的。处理器,用于基于链表规则,确定交换芯片获取的第一报文的类型;类型包括传输层协议的报文或数据链路层协议的报文;链表规则包括报文的特征信息与类型的对应关系;特征信息包括用于表征报文的源地址、报文的目标地址、网络类型中的至少一个。处理器,还用于根据第一报文的类型,确定目标报文,并传输目标报文。In a second aspect, a message processing device is provided, which includes: a switching chip and a processor. The switching chip is used to obtain the first message; the first message is obtained based on the initial message from the communication device. The processor is configured to determine the type of the first message obtained by the switching chip based on the linked list rules; the type includes a message of a transport layer protocol or a message of a data link layer protocol; the linked list rule includes characteristic information and type of the message Correspondence; the characteristic information includes at least one of the source address used to characterize the message, the destination address of the message, and the network type. The processor is also used to determine the target message according to the type of the first message and transmit the target message.

可选的,处理器,具体用于:确定第一报文的标签信息;标签信息至少用于标识通信设备传输初始报文的端口和端口所属的网络;删除标签信息,生成第二报文;基于链表规则,确定第二报文的类型,并将第二报文的类型作为第一报文的类型。Optionally, the processor is specifically configured to: determine the label information of the first message; the label information is at least used to identify the port through which the communication device transmits the initial message and the network to which the port belongs; delete the label information and generate the second message; Based on the linked list rule, the type of the second message is determined, and the type of the second message is used as the type of the first message.

可选的,处理器,具体用于:在第一报文的类型为传输层协议的报文的情况下,在第二报文中添加标签信息,生成目标报文;和/或,在第一报文的类型为数据链路层协议的报文的情况下,将第二报文确定为目标报文。Optionally, the processor is specifically configured to: when the type of the first message is a transport layer protocol message, add label information to the second message to generate a target message; and/or, in the first When the type of the first message is a data link layer protocol message, the second message is determined as the target message.

可选的,处理器,具体用于调用钩子函数解析第二报文,确定标签信息。Optionally, the processor is specifically used to call a hook function to parse the second message and determine the label information.

可选的,处理器,具体用于:匹配链表规则与第二报文;若匹配成功,则确定第二报文的类型为数据链路层协议的报文;和/或,若匹配失败,则确定第二报文的类型为传输层协议的报文。Optional, the processor is specifically used to: match the linked list rule with the second message; if the match is successful, determine the type of the second message to be a data link layer protocol message; and/or, if the match fails, Then it is determined that the type of the second message is a transport layer protocol message.

可选的,标签信息包括:通信设备的编号、通信设备的端口编号、通信设备的端口所属的网络以及网络的优先级设定。Optionally, the label 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, a switching chip is specifically used to: receive an initial message from a communication device; determine whether the initial message contains label information; if it does and the label information is accurate, determine that the initial message is the first message; and /Or, if included and the label information is wrong, determine the new label information based on the transmission information of the initial message, use the new label information to update the label information in the initial message, and determine that the updated initial message is the first message; and/or, if not included, determine the label information based on the transmission information of the initial message, add the label information to the initial message, and determine that the initial message after adding the label information is the first message.

可选的,处理器,具体用于:在第一报文的类型为传输层协议的报文的情况下,确定第一报文的标签信息,并在第一报文中删除标签信息,生成目标报文;和/或,在第一报文的类型为数据链路层协议的报文的情况下,将第一报文确定为目标报文。Optionally, the processor is specifically configured to: when the type of the first message is a transport layer protocol message, determine the label information of the first message, delete the label information in the first message, and generate The target message; and/or, when the type of the first message is a data link layer protocol message, determine the first message as the target message.

可选的,处理器,还被配置为:接收用户输入的调试参数;调试参数用于指示抓取MAC层接收和传输的报文。基于调试参数,抓取第一报文以及目标报文。确定第一报文以及目标报文的差异。Optionally, the processor is also configured to: receive debugging parameters input by the user; the debugging parameters are used to instruct the capture of messages received and transmitted by the MAC layer. Based on the debugging parameters, capture the first message and the target message. Determine the difference between the first message and the target message.

第三方面,提供了一种网络设备,该网络设备的结构中包括处理器,处理器用于执行程序指令,使得该网络设备执行第一方面的方法。In a third aspect, a network device is provided. The structure of the network device includes a processor, and the processor is used to execute program instructions, so that the network device executes the method of the first aspect.

第四方面,提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序代码,当计算机程序代码在网络设备上运行时,使得该网络设备执行上述第一方面的方法。In a fourth aspect, a computer-readable storage medium is provided. Computer program code is stored in the computer-readable storage medium. When the computer program code is run on a network device, it causes the network device to execute the method of the first aspect.

第五方面,提供一种计算机程序产品,该计算机程序产品储存有上述计算机软件指令,当计算机软件指令在网络设备上运行时,使得该网络设备执行如上述第一方面的方法的程序。In a fifth aspect, a computer program product is provided. The computer program product stores the above-mentioned computer software instructions. When the computer software instructions are run on a network device, the network device causes the network device to execute the program of the method of the first aspect.

本申请提供的报文处理方法、装置、设备及存储介质,通过链路规则匹配的方式,能够准确的识别出用户所需要上传的报文为数据链路层协议的报文或是网络层标准的传输层协议的报文。从而解决现有集成的设备无法识别接收到的报文是传输层协议的报文,还是数据链路层协议的报文的问题。以便通过该报文的类型,实现报文在对应类型下的精确分流处理。The message processing methods, devices, equipment and storage media provided by this application can accurately identify the messages that users need to upload as data link layer protocol messages or network layer standards through link rule matching. Transport layer protocol messages. This solves the problem that the existing integrated equipment cannot identify whether the received message is a transport layer protocol message or a data link layer protocol message. In order to achieve accurate offload processing of messages under the corresponding type through the type of the message.

附图说明Description of the drawings

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of this application.

图1为本申请实施例提供的一种报文处理方法应用于的通信系统的结构示意图;Figure 1 is a schematic structural diagram of a communication system applied to a message processing method provided by an embodiment of the present application;

图2为本申请实施例提供的一种网络设备的硬件结构示意图;Figure 2 is a schematic diagram of the hardware structure of a network device provided by an embodiment of the present application;

图3为本申请实施例提供的一种电子设备的硬件结构示意图;Figure 3 is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application;

图4为本申请实施例提供的一种网络架构示意图;Figure 4 is a schematic diagram of a network architecture provided by an embodiment of the present application;

图5为本申请实施例提供的一种报文接收处理的流程示意图;Figure 5 is a schematic flow chart of message reception processing provided by an embodiment of the present application;

图6为本申请实施例提供的一种报文处理方法的流程示意图之一;Figure 6 is one of the schematic flow diagrams of a message processing method provided by an embodiment of the present application;

图7为本申请实施例提供的一种网卡驱动初始化的流程示意图;Figure 7 is a schematic flow chart of a network card driver initialization provided by an embodiment of the present application;

图8为本申请实施例提供的一种链表规则配置驱动框架示意图;Figure 8 is a schematic diagram of a linked list rule configuration driving framework provided by an embodiment of the present application;

图9为本申请实施例提供的一种报文处理方法的流程示意图之二;Figure 9 is a second schematic flowchart of a message processing method provided by an embodiment of the present application;

图10为本申请实施例提供的一种报文结构示意图;Figure 10 is a schematic diagram of a message structure provided by an embodiment of the present application;

图11为本申请实施例提供的另一种报文结构示意图;Figure 11 is a schematic diagram of another message structure provided by an embodiment of the present application;

图12为本申请实施例提供的一种报文处理装置的结构示意图之一;Figure 12 is one of the structural schematic diagrams of a message processing device provided by an embodiment of the present application;

图13为本申请实施例提供的资源配置方法的计算机程序产品的结构示意图。Figure 13 is a schematic structural diagram of a computer program product of the resource allocation method provided by an embodiment of the present application.

具体实施方式Detailed ways

下面结合附图对本申请实施例提供的一种报文处理方法、装置及存储介质进行详细地描述。A message processing method, device and storage medium provided by embodiments of the present application will be described in detail below with reference to the accompanying drawings.

本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。The term "and/or" in this article is just an association relationship that describes related objects, indicating that three relationships can exist. For example, A and/or B can mean: A exists alone, A and B exist simultaneously, and they exist alone. B these three situations.

本申请的说明书以及附图中的术语“第一”和“第二”等是用于区别不同的对象,或者用于区别对同一对象的不同处理,而不是用于描述对象的特定顺序。The terms “first” and “second” in the description of this application and the drawings are used to distinguish different objects, or to distinguish different processes on the same object, rather than to describe a specific order of objects.

此外,本申请的描述中所提到的术语“包括”和“具有”以及它们的任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或模块的过程、方法、系统、产品或设备没有限定于已列出的步骤或模块,而是可选地还包括其他没有列出的步骤或模块,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或模块。Furthermore, references to the terms "including" and "having" and any variations thereof in the description of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or modules is not limited to the listed steps or modules, but optionally also includes other unlisted steps or modules, or optionally also Includes other steps or modules that are inherent to such processes, methods, products, or devices.

需要说明的是,本申请实施例中,“示例性地”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性地”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性地”或者“例如”等词旨在以具体方式呈现相关概念。It should be noted that in the embodiments of this application, words such as "exemplarily" or "for example" are used to represent examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "such as" in the embodiments of the present application is not to be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of the words "exemplarily" or "for example" is intended to present the relevant concepts in a concrete manner.

在本申请的描述中,除非另有说明,“多个”的含义是指两个或两个以上。In the description of this application, unless otherwise stated, the meaning of "plurality" means two or more.

可以理解的是,本申请实施例提供的报文处理方法在实际应用中,具体方法的步骤顺序可以做以调整,本申请实施例对此不做限定。It can be understood that in actual application of the message processing method provided by the embodiments of the present application, the sequence of steps of the specific method can be adjusted, and the embodiments of the present application do not limit this.

在对本申请实施例进行详细地解释说明之前,先对本申请实施例涉及到的一些名词进行解释。Before explaining the embodiments of the present application in detail, some terms involved in the embodiments of the present application will be explained first.

1、网卡驱动1. Network card driver

网卡驱动就是使网卡正常工作的配套软件。网卡作为硬件设备承载网卡驱动。没有网卡驱动,就会导致网卡无法正常使用。The network card driver is the supporting software that makes the network card work normally. The network card serves as a hardware device that hosts the network card driver. Without a network card driver, the network card will not work properly.

2、交换芯片驱动2. Swap chip driver

交换芯片驱动运行在交换switch芯片上驱动程序,用于完成数据链路层的数据收发。是连通处理器和switch芯片的软件模块。The switch chip driver runs on the switch chip driver and is used to complete data sending and receiving at the data link layer. It is a software module that connects the processor and the switch chip.

3、MAC层3. MAC layer

MAC层位于开放式系统互联通信参考模型(open system interconnectionreference model,OSI)中的数据链路层,数据链路层分为上层LLC(logical linkscontrol,逻辑链路控制)和下层MAC(媒体访问控制),MAC主要负责控制与连接物理层的物理介质。The MAC layer is located in the data link layer in the open system interconnection reference model (OSI). The data link layer is divided into upper layer LLC (logical links control, logical link control) and lower layer MAC (media access control). , MAC is mainly responsible for controlling and connecting the physical medium of the physical layer.

4、数据链路层协议的报文4. Data link layer protocol messages

数据链路层协议的报文是运行在交换机设备上的协议报文,此类协议报文主要以数据链路层协议为标准生成的。因此也称作二层协议报文。其所采用的协议包括如常见的LLDP协议、LACP协议等。Data link layer protocol messages are protocol messages that run on switch devices. Such protocol messages are mainly generated based on the data link layer protocol. Therefore, it is also called a Layer 2 protocol message. The protocols used include common LLDP protocols, LACP protocols, etc.

5、字符设备驱动5. Character device driver

字符设备驱动是一种linux操作系统的其中一种驱动类型。有固定的框架形式,是将特定的设备操作抽象成文件集合,为用户提供完整的文件句柄的操作集合,能够屏蔽硬件交互。Character device driver is one of the driver types in the Linux operating system. There is a fixed framework form, which abstracts specific device operations into a file collection, provides users with a complete set of file handle operations, and can shield hardware interactions.

为了减少设备的数量,可以将交换机设备的数据交换功能与终端设备的功能集成在一个设备中。但是,集成的设备并不能识别接收到的报文是传输层协议的报文,还是数据链路层协议的报文,从而导致无法准确的传输报文。In order to reduce the number of devices, the data exchange function of the switch device and the function of the terminal device can be integrated into one device. However, the integrated device cannot identify whether the received message is a transport layer protocol message or a data link layer protocol message, resulting in the inability to accurately transmit the message.

鉴于此,本申请实施例提供了一种报文处理方法,以解决现有技术中存在的问题。首先对本公开实施例提供的一种报文处理方法应用的系统架构进行介绍。In view of this, embodiments of the present application provide a message processing method to solve problems existing in the prior art. First, the system architecture of the application of a message processing method provided by the embodiment of the present disclosure is introduced.

参照图1,为应用于本申请实施例所提供技术方案的一种通信系统架构的示意图。其中,该系统中可以包括:通信设备01和网络设备02。Refer to FIG. 1 , which is a schematic diagram of a communication system architecture applied to the technical solution provided by the embodiment of the present application. Among them, the system may include: communication device 01 and network device 02.

其中,通信设备01以及网络设备02均可以是终端设备、计算机或者服务器;终端设备可以是一种具有收发功能的设备。该终端设备可以有不同的名称,例如用户设备(userequipment,UE)、接入设备、终端单元、终端站、移动站、移动台、远方站、远程终端、移动设备、无线通信设备、终端代理或终端装置等。终端设备可以被部署在陆地上,包括室内或室外、手持或车载;也可以被部署在水面上(如轮船等);还可以被部署在空中(例如飞机、气球和卫星上等)。终端设备包括具有通信功能的手持式设备、车载设备、可穿戴设备或者计算设备。例如,终端设备可以是手机(mobile phone)、平板电脑或带有收发功能的电脑。终端设备还可以是虚拟现实(virtual reality,VR)设备、增强现实(augmented reality,AR)设备、工业控制终端的终端、无人驾驶中的终端、远程医疗中的终端、智能电网中的终端、智慧城市(smart city)中的终端、智慧家庭(smart home)中的终端等。本申请实施例中,用于实现通信设备01的功能的装置可以是通信设备以及用于实现网络设备02的功能的装置可以是网络设备,也可以是能够支持通信设备01或网络设备02实现通信设备01或网络设备02对应功能的装置,例网卡或芯片系统等。本申请中,芯片系统可以由芯片构成,也可以包括芯片和其他分立器件。该网卡可以为终端设备、服务器或计算机等电子设备上与其他设备进行数据传输的网络传输设备,如网络适配器等。Among them, the communication device 01 and the network device 02 can both be a terminal device, a computer or a server; the terminal device can be a device with a transceiver function. The terminal equipment may have different names, such as user equipment (UE), access equipment, terminal unit, terminal station, mobile station, mobile station, remote station, remote terminal, mobile device, wireless communication device, terminal agent or Terminal devices, etc. Terminal devices can be deployed on land, including indoors or outdoors, handheld or vehicle-mounted; they can also be deployed on water (such as ships, etc.); they can also be deployed in the air (such as aircraft, balloons, satellites, etc.). Terminal devices include handheld devices, vehicle-mounted devices, wearable devices or computing devices with communication functions. For example, the terminal device may be a mobile phone, a tablet computer, or a computer with sending and receiving functions. The terminal device can also be a virtual reality (VR) device, an augmented reality (AR) device, a terminal of an industrial control terminal, a terminal in driverless driving, a terminal in telemedicine, a terminal in a smart grid, Terminals in smart cities, terminals in smart homes, etc. In the embodiment of the present application, the device used to implement the functions of the communication device 01 may be a communication device, and the device used to implement the functions of the network device 02 may be a network device, or may be capable of supporting the communication device 01 or the network device 02 to implement communication. Device 01 or network device 02 has a corresponding function, such as a network card or chip system, etc. In this application, the chip system may be composed of chips, or may include chips and other discrete devices. The network card can be a network transmission device, such as a network adapter, for data transmission with other devices on electronic equipment such as terminal equipment, servers or computers.

另外,本申请实施例中的通信设备01和网络设备02在实际应用中可以是交换机、网关设备(如物联网关设备或无线网关设备等)。In addition, the communication device 01 and the network device 02 in the embodiment of the present application may be switches and gateway devices (such as Internet of Things gateway devices or wireless gateway devices, etc.) in practical applications.

在一种实现方式中,本申请实施例提供一种网络设备(以图2中示出的网卡02为例)的硬件结构示意图。其中,网卡02包括:处理器cpu、mac控制器以及交换(switch)芯片。其中,交换(switch)芯片负责接收终端设备01通过物理端口xn(n≥2)发送的报文,并将该报文通过管理口x1发送至mac控制器;mac控制器用于将接收到的报文发送至处理器;以便处理器对报文进行识别和处理。这里,管理口x1和mac控制器通过链路连接,报文根据链路连接到达mac控制器。需要说明的是,物理端口xn属于交换(switch)芯片的扩展物理口。另外,报文的发送过程和接收过程是反向,报文的发送处理过程主要是对报文的组包,网卡02是被动接收由协议层传输的报文,故无需做特殊处理,可直接通过交换(switch)芯片的物理端口xn发送至对应的终端设备中即可,本技术将不做详细描述。In an implementation manner, this embodiment of the present application provides a schematic diagram of the hardware structure of a network device (taking the network card 02 shown in Figure 2 as an example). Among them, the network card 02 includes: processor cpu, mac controller and switch chip. Among them, the switch chip is responsible for receiving the message sent by the terminal device 01 through the physical port xn (n≥2), and sending the message to the mac controller through the management port x1; the mac controller is used to convert the received message The message is sent to the processor so that the processor can identify and process the message. Here, the management port x1 and the mac controller are connected through a link, and the packets reach the mac controller according to the link connection. It should be noted that the physical port xn is an extended physical port of the switch chip. In addition, the sending process and receiving process of the message are reverse. The sending process of the message is mainly to package the message. The network card 02 passively receives the message transmitted by the protocol layer, so there is no need to do special processing and can be directly It just needs to be sent to the corresponding terminal device through the physical port xn of the switch chip. This technology will not be described in detail.

可选的,本申请实施例所提及的设备,例如通信设备01和网络设备02等,均可以由图3所示的电子设备来实现。Optionally, the devices mentioned in the embodiments of this application, such as the communication device 01 and the network device 02 , can be implemented by the electronic device shown in FIG. 3 .

该电子设备包括处理器31,通信总线34以及至少一个收发器(图3中仅是示例性的以包括收发器33为例进行说明)。The electronic device includes a processor 31, a communication bus 34 and at least one transceiver (FIG. 3 is only an example of including the transceiver 33 for illustration).

处理器31可以包括一个或多个处理单元,例如:处理器31可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processingunit,GPU),图像信号处理器(image signal processor,ISP),视频处理单元(videoprocessing unit,VPU)控制器,存储器,视频编解码器,数字信号处理器(digital signalprocessor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 31 may include one or more processing units. For example, the processor 31 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), an image signal processor ( image signal processor (ISP), video processing unit (VPU) controller, memory, video codec, digital signal processor (DSP), baseband processor, and/or neural network processor (neural network processor) -network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors.

其中,控制器可以是通信设备的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。Among them, the controller can be the nerve center and command center of the communication device. The controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.

处理器31中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器31中的存储器为高速缓冲存储器。该存储器可以保存处理器31刚用过或循环使用的指令或数据。如果处理器31需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器31的等待时间,因而提高了系统的效率。The processor 31 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in processor 31 is cache memory. This memory can store instructions or data that have just been used or are used repeatedly by the processor 31 . If the processor 31 needs to use the instructions or data again, it can be called directly from the memory. Repeated access is avoided and the waiting time of the processor 31 is reduced, thereby improving the efficiency of the system.

在一些实施例中,处理器31可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,通用异步收发传输器(universal asynchronousreceiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processorinterface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serialbus,USB)接口,串行外设接口(serial peripheral interface,SPI)接口等。In some embodiments, processor 31 may include one or more interfaces. Interfaces may include integrated circuit (inter-integrated circuit, I2C) interface, universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), general-purpose input and output (general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and/or universal serial bus (USB) interface, serial peripheral interface (SPI) interface, etc.

通信总线34可包括一通路,在上述组件之间传送信息。Communication bus 34 may include a path that carries information between the above-mentioned components.

收发器33,使用任何收发器一类的装置,用于与其他设备或通信网络通信,如以太网,无线接入网(radio access network,RAN),无线局域网(wireless local areanetworks,WLAN)等。The transceiver 33 uses any transceiver-like device for communicating with other devices or communication networks, such as Ethernet, wireless access network (radio access network, RAN), wireless local area networks (WLAN), etc.

可选的,该通信设备还可以包括存储器32。Optionally, the communication device may also include a memory 32.

存储器32可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(electricallyerasable programmable read-only memory,EEPROM)、只读光盘(compact disc read-only memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器可以是独立存在,通过通信总线34与处理器相连接。存储器也可以和处理器集成在一起。The memory 32 may be 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 that can store information and instructions. The dynamic storage device can also be electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disk storage, optical disc storage ( Including compressed optical discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be stored by a computer. any other medium, but not limited to this. The memory may exist independently and be connected to the processor through the communication bus 34 . Memory can also be integrated with the processor.

其中,存储器32用于存储执行本申请方案的计算机执行指令,并由处理器31来控制执行。处理器31用于执行存储器32中存储的计算机执行指令,从而实现本申请下述实施例提供的报文处理方法。Among them, the memory 32 is used to store computer execution instructions for executing the solution of the present application, and is controlled by the processor 31 for execution. The processor 31 is configured to execute computer execution instructions stored in the memory 32, thereby implementing the message processing method provided in the following embodiments of the present application.

可选的,本申请实施例中的计算机执行指令也可以称之为应用程序代码,本申请实施例对此不作具体限定。Optionally, the computer-executed instructions in the embodiments of the present application may also be called application codes, which are not specifically limited in the embodiments of the present application.

在具体实现中,作为一种实施例,处理器31可以包括一个或多个CPU,例如图3中的CPU0和CPU1。In specific implementation, as an embodiment, the processor 31 may include one or more CPUs, such as CPU0 and CPU1 in FIG. 3 .

在具体实现中,作为一种实施例,通信设备可以包括多个处理器,例如图3中的处理器31和处理器35。这些处理器中的每一个可以是一个单核(single-CPU)处理器,也可以是一个多核(multi-CPU)处理器。这里的处理器可以指一个或多个设备、电路、和/或用于处理数据(例如计算机程序指令)的处理核。In specific implementation, as an embodiment, the communication device may include multiple processors, such as the processor 31 and the processor 35 in FIG. 3 . Each of these processors may be a single-CPU processor or a multi-CPU processor. A processor here may refer to one or more devices, circuits, and/or processing cores for processing data (eg, computer program instructions).

下面结合说明书附图,网络设备以网卡为例,将网卡为执行主体对本申请实施例所提供的技术方案进行具体阐述。The technical solutions provided by the embodiments of the present application will be described in detail below with reference to the accompanying drawings of the description, taking the network card as an example of the network device, and using the network card as the execution subject.

参照图4,本申请实施例提供了一种网络架构示意图,其中包含本申请实施例应用于的数据链路层。还包括物理层、网络层、传输层、会话层与,表示层以及应用层。当然,图4仅示出了一种七层网络架构示意图。其他的网络架构可以只包括物理层、数据链路层、网络层、传输层以及应用层。因此,本申请实施例对涉及的网络架构不作限定。Referring to Figure 4, an embodiment of the present application provides a schematic diagram of a network architecture, which includes the data link layer to which the embodiment of the present application is applied. It also includes the physical layer, network layer, transport layer, session layer, presentation layer and application layer. Of course, Figure 4 only shows a schematic diagram of a seven-layer network architecture. Other network architectures may include only the physical layer, data link layer, network layer, transport layer and application layer. Therefore, the embodiments of this application do not limit the network architecture involved.

本申请实施例的技术原理为:网卡驱动在接收到来自通信设备的报文时,通信设备会通过触发网卡的硬中断提醒网卡驱动接收报文,当网卡驱动检测到网卡的硬中断的被触发后,执行相应的中断响应。而本申请实施例在在网卡驱动的程序中增加了钩子函数。当网卡驱动检测到网卡的硬中断被触发,接收来自通信设备的报文后,钩子函数立即被调度执行,网卡驱动通过调用此钩子函数基于链表规则对报文的类型做解析分流。如是传输层协议的报文,则网卡驱动将该报文推送至协议栈完成后续网络层的处理;如是数据链路层协议的报文,则网卡驱动将该报文推送至协议栈直接传输至用户层。因此,本申请实施例能够通过钩子函数在数据链路层实现报文识别和分流。The technical principle of the embodiment of this application is: when the network card driver receives a message from the communication device, the communication device will remind the network card driver to receive the message by triggering a hard interrupt of the network card. When the network card driver detects that the hard interrupt of the network card is triggered, After that, execute the corresponding interrupt response. In the embodiment of the present application, a hook function is added to the network card driver program. When the network card driver detects that the hard interrupt of the network card is triggered and receives a message from the communication device, the hook function is immediately scheduled for execution. The network card driver calls this hook function to analyze and shunt the message type based on the linked list rules. If it is a packet of the transport layer protocol, the network card driver will push the packet to the protocol stack to complete subsequent network layer processing; if it is a packet of the data link layer protocol, the network card driver will push the packet to the protocol stack and transmit it directly to user layer. Therefore, the embodiments of the present application can realize packet identification and offloading at the data link layer through hook functions.

另外,本申请实施例所提供方法还提供了一种报文的调试打印原理。实际上是通过上述技术原理进行报文处理的过程中,网卡驱动根据提前确定好的调试参数对应的指示来抓取钩子函数调用前和分流处理之后的报文,以便将两个报文进行对比,方便产品的调试应用。In addition, the method provided by the embodiment of this application also provides a principle of debugging and printing of messages. In fact, during the packet processing based on the above technical principles, the network card driver captures the packets before the hook function is called and after the offload processing according to the instructions corresponding to the debugging parameters determined in advance, so as to compare the two packets. , to facilitate product debugging and application.

示例性的,参照图5,结合上述原理,本申请实施例提供一种报文接收处理流程。报文接收处理主要在mac层和协议栈层。mac层中对报文的接收处理包括:当终端设备有报文需要网卡接收时,会触发网卡的硬件中断通知网卡接收报文。之后,网卡驱动响应网卡的硬中断接收该报文,并同时调用钩子函数对该报文进行类型识别(这里,对报文类型识别的目的是为了基于报文的类型对报文做分流处理)。此时,可根据调试参数抓取钩子函数调用前和分流处理之后的报文。而后,将分流后的报文上报至协议栈层的内核协议栈(即协议栈)进行对应处理。最后,通知用户层接收报文。需要说明的是,图5中仅简单概括了报文接收流程的内容,具体以上述描述为准。Illustratively, referring to Figure 5, combined with the above principles, an embodiment of the present application provides a message receiving processing flow. Message reception and processing are mainly at the mac layer and protocol stack layer. The reception processing of messages in the mac layer includes: when the terminal device has a message that needs to be received by the network card, the hardware interrupt of the network card will be triggered to notify the network card to receive the message. After that, the network card driver responds to the hard interrupt of the network card to receive the message, and at the same time calls the hook function to identify the type of the message (here, the purpose of identifying the message type is to shunt the message based on the type of the message) . At this time, the messages before the hook function is called and after the offload processing can be captured based on the debugging parameters. Then, the offloaded message is reported to the kernel protocol stack (i.e., protocol stack) at the protocol stack layer for corresponding processing. Finally, notify the user layer to receive the message. It should be noted that Figure 5 only briefly summarizes the contents of the message receiving process, and the specific description shall prevail.

参照图6所示,本申请实施例提供的报文处理方法应用于图1所示的网络设备02中,下面以网卡作为示例性的执行主体替代网络设备对本申请实施例的方法进行详细说明。该方法具体包括如下步骤。Referring to FIG. 6 , the message processing method provided by the embodiment of the present application is applied to the network device 02 shown in FIG. 1 . The method of the embodiment of the present application is described in detail below using a network card as an exemplary execution subject instead of the network device. The method specifically includes the following steps.

S11、网卡获取第一报文。S11. The network card obtains the first message.

其中,第一报文是基于来自通信设备的初始报文得到的。Wherein, the first message is obtained based on the initial message from the communication device.

可选的,在网卡获取报文之前,需要在操作系统的网络平台中进行网卡驱动的初始化处理。具体流程参照图7所示,首先进行网卡的网络平台的设备注册。之后,进行网络平台的驱动注册。而后,进行网卡驱动的规则链表头初始化以及标签功能配置。配置完成后,网卡驱动初始化完成。具体的,规则链表头初始化是在网卡驱动中添加了单项链表管理功能,用于接管用户层配置的链表规则,该链表规则主要针对数据链路层的报文做规则匹配处理,此处理用户层会调用另外的驱动接口向本网卡驱动下发用户期望接收的报文的链表规则,该链表规则包括报文的特征信息与类型的对应关系;特征信息包括用于表征报文的源地址、报文的目标地址、网络类型中的至少一个;如mac地址、IP地址、或者协议等字段信息。而本网卡驱动会根据链表规则中所包含的字段信息与当前接收的报文中的字段信息进行比对,若当前接收的报文中的字段信息包含了链表规则中所包含的字段信息,则匹配成功;否则,匹配失败。其次,网卡驱动的标签功能配置用于实现网卡在报文中添加标签信息。而标签信息的具体内容可参考目前主流厂家的各种型号的交换机,不局限于特定交换机,参照其数据手册配置。这些标签信息是由网卡中的switch芯片在报文中添加。需要说明的是,图7中仅简单概括了网卡驱动的初始化处理流程,具体以上述描述为准。Optionally, before the network card obtains the packet, the network card driver needs to be initialized in the network platform of the operating system. The specific process is shown in Figure 7. First, the device registration of the network platform of the network card is performed. After that, perform driver registration for the network platform. Then, initialize the rule list header of the network card driver and configure the label function. After the configuration is completed, the network card driver initialization is completed. Specifically, the rule list header initialization adds a single-link list management function to the network card driver, which is used to take over the linked list rules configured by the user layer. The linked list rules are mainly used for rule matching processing of data link layer packets. This processing user layer Another driver interface will be called to deliver to the network card driver the linked list rules of the packets that the user expects to receive. The linked list rules include the correspondence between the feature information and types of the packets; the feature information includes the source address and packet type used to characterize the packets. At least one of the destination address and network type of the document; such as mac address, IP address, or protocol and other field information. The network card driver will compare the field information contained in the linked list rule with the field information in the currently received message. If the field information in the currently received message contains the field information contained in the linked list rule, then The match is successful; otherwise, the match fails. Secondly, the label function configuration of the network card driver is used to enable the network card to add label information to the packet. The specific content of the label information can refer to various types of switches from current mainstream manufacturers. It is not limited to specific switches. Please refer to its data manual for configuration. These label information are added to the packet by the switch chip in the network card. It should be noted that Figure 7 only briefly summarizes the initialization process of the network card driver, and the specific description shall prevail.

可选的,网卡获取第一报文具体包括:网卡接收来自通信设备的初始报文;确定初始报文中是否包含标签信息。Optionally, the network card obtaining the first message specifically includes: the network card receives the initial message from the communication device; and determines whether the initial message contains label information.

若包含,且标签信息准确,则确定初始报文为第一报文。If it is included and the label information is accurate, the initial message is determined to be the first message.

和/或,若包含,且标签信息错误,则根据初始报文的传输信息确定新的标签信息,并利用新的标签信息更新初始报文中的标签信息,确定更新后的初始报文为第一报文。其中,传输信息包括新的标签信息。and/or, if included and the label information is wrong, determine the new label information based on the transmission information of the initial message, use the new label information to update the label information in the initial message, and determine that the updated initial message is the One message. Among them, the transmission information includes new label information.

和/或,若不包含,则根据初始报文的传输信息确定标签信息,将标签信息添加至初始报文中,确定添加标签信息后的初始报文为第一报文。And/or, if it is not included, determine the label information based on the transmission information of the initial message, add the label information to the initial message, and determine that the initial message after adding the label information is the first message.

实际上,第一报文的获取方式包含以下两种:In fact, there are two ways to obtain the first message:

第一种方式:通信设备在生成初始报文的过程中自行添加了标签信息。因此,网卡在接收到该初始报文时,首先确定初始报文中的标签信息准确与否,即就是通过确定标签信息的内容与初始报文的传输信息是否一致来确定;例如,通过对比标签信息中的端口编号与初始报文传输时的端口编号是否一致。若准确,则该初始报文即为第一报文;若不准确,则至少根据通信设备传输初始报文的端口以及端口所属的网络(即传输信息)确定一个新标签信息,利用新标签信息更新初始报文中的标签信息。并将更新后的初始报文确定为第一报文。需要说明的是,上述不限于通过对比标签信息中的端口编号与初始报文传输时的端口编号是否一致,确定初始报文中的标签信息准确与否。例如,还可以通过对比标签信息中的端口所属的网络与初始报文传输时的端口所属的网络是否一致,确定初始报文中的标签信息准确与否。因此,本申请实施例对确定初始报文中的标签信息准确与否的方式不作任何限定。The first method: the communication device adds label information by itself during the process of generating the initial message. Therefore, when the network card receives the initial message, it first determines whether the label information in the initial message is accurate, that is, by determining whether the content of the label information is consistent with the transmission information of the initial message; for example, by comparing the labels Check whether the port number in the information is consistent with the port number when the initial message was transmitted. If it is accurate, then the initial message is the first message; if it is inaccurate, then at least determine a new label information based on the port through which the communication device transmits the initial message and the network to which the port belongs (ie, the transmission information), and use the new label information Update the label information in the initial message. and determine the updated initial message as the first message. It should be noted that the above is not limited to determining whether the label information in the initial message is accurate by comparing whether the port number in the label information is consistent with the port number when the initial message is transmitted. For example, you can also determine whether the label information in the initial message is accurate by comparing whether the network to which the port in the label information belongs is consistent with the network to which the port belongs when the initial message is transmitted. Therefore, the embodiment of the present application does not place any limitation on the method of determining whether the label information in the initial message is accurate.

第二种方式:通信设备在生成第一报文的过程中未添加标签信息。网卡则至少根据通信设备传输第一报文的端口以及端口所属的网络确定一个标签信息,将标签信息添加至初始报文中,并将添加后的初始报文确定为第一报文。The second method: the communication device does not add label information in the process of generating the first message. The network card at least determines a label information based on the port through which the communication device transmits the first message and the network to which the port belongs, adds the label information to the initial message, and determines the added initial message as the first message.

需要说明的是,结合图2,针对上述两种方式,在网卡中第一报文的获取过程包括:Switch芯片通过物理端口Xn接收通信设备发送的初始报文,Switch芯片将初始报文根据上述两种方式确定第一报文。It should be noted that, combined with Figure 2, for the above two methods, the process of obtaining the first message in the network card includes: the Switch chip receives the initial message sent by the communication device through the physical port Xn, and the Switch chip converts the initial message according to the above There are two ways to determine the first message.

S12、网卡基于链表规则,确定第一报文的类型。S12. The network card determines the type of the first message based on the linked list rules.

其中,该类型包括传输层协议的报文或数据链路层协议的报文;链表规则包括报文的特征信息与类型的对应关系;特征信息包括用于表征报文的源地址、报文的目标地址、网络类型中的至少一个。Among them, the type includes the packets of the transport layer protocol or the packets of the data link layer protocol; the linked list rules include the correspondence between the characteristic information of the message and the type; the characteristic information includes the source address used to characterize the message, the At least one of destination address and network type.

可选的,基于链表规则,确定第一报文的类型具体包括:将链表规则与第一报文进行匹配,匹配的结果包括:若匹配成功,则确定第一报文的类型为数据链路层协议的报文;若匹配失败,则确定第一报文的类型为传输层协议的报文。需要说明的是,本申请实施例中的链表规则是针对数据链路层协议的报文配置的。Optionally, based on the linked list rule, determining the type of the first message specifically includes: matching the linked list rule with the first message, and the matching results include: if the match is successful, determining the type of the first message is data link. A packet of a transport layer protocol; if the match fails, the type of the first packet is determined to be a packet of a transport layer protocol. It should be noted that the linked list rules in the embodiment of this application are configured for packets of the data link layer protocol.

具体的,网卡基于链表规则确定第一报文的类型,主要是通过对用户层下发链表规则(即为用户期望接收的报文的属性字段)进行查询匹配,若查询到配置的链表规则,则说明匹配成功。例如dest_mac用户下发的链表规则和接收报文中提取的dest_mac地址字段是一样的,则匹配成功。将匹配成功的报文按照数据链路层协议的报文组包,基于mac层增加配置信息。否则,直接上报TCP/IP格式的mac层报文到内核协议栈,也就是标准的TCP/IP的mac层组包格式,Specifically, the network card determines the type of the first message based on the linked list rules, mainly by querying and matching the linked list rules issued by the user layer (that is, the attribute fields of the messages that the user expects to receive). If the configured linked list rules are queried, It means the match is successful. 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, then the match is successful. The successfully matched packets are packaged according to the packets of the data link layer protocol, and the configuration information is added based on the mac layer. Otherwise, directly report the mac layer message in TCP/IP format to the kernel protocol stack, which is the standard TCP/IP mac layer packet format.

进一步的,链表规则通过另外一个驱动来生成,如图8所示的链表规则配置驱动框架,该驱动是和物理层无关的字符设备驱动,自上而下,包括用户层和驱动层。用户层用于为用户提供链表规则添加和删除的接口,驱动层通过注册字符设备,封装操作集合,为用户层提供并处理添加的链表规则和删除的链表规则等功能。其中,链表规则包括但不限于如下表1所示的一项或多项。Furthermore, the linked list rules are generated through another driver. The linked list rule configuration driver framework shown in Figure 8 is a character device driver that has nothing to do with the physical layer. From top to bottom, it includes the user layer and the driver layer. The user layer is used to provide users with an interface for adding and deleting linked list rules. The driver layer registers character devices and encapsulates operation sets to provide and process the added linked list rules and deleted linked list rules for the user layer. Among them, the linked list rules include but are not limited to one or more items as shown in Table 1 below.

表1Table 1

源码地址6字节Source code address 6 bytes 源码地址屏蔽长度Source code address masking length 目码地址6字节Object code address 6 bytes 目的地址屏蔽长度Destination address mask length 网络类型Network Type 网络类型屏蔽长度Network type mask length 源IP地址Source IP address 源IP地址屏蔽长度Source IP address mask length 目的IP地址Destination IP address 目的IP地址屏蔽长度Destination IP address mask length 自定义标签类型tag typeCustom tag type tag type

S13、网卡根据第一报文的类型,确定目标报文,并传输目标报文。S13. The network card determines the target message according to the type of the first message and transmits the target message.

具体的,在第一报文的类型为传输层协议的报文的情况下,确定第一报文的标签信息,并在第一报文中删除标签信息,生成目标报文。和/或,在第一报文的类型为数据链路层协议的报文的情况下,将第一报文确定为目标报文。Specifically, when the type of the first message is a transport layer protocol message, the label information of the first message is determined, the label information is deleted from the first message, and the target message is generated. And/or, when the type of the first message is a data link layer protocol message, determine the first message as the target message.

应用中,对于目标报文为数据链路层协议的报文的情况下,是在数据链路层进行收发处理,生成的目标报文无需再处理,通过协议栈传输至用户层即可。对于目标报文为传输层协议的报文的情况,需要通过数据链路层传输至网络层进行处理。In the application, when the target message is a data link layer protocol message, the sending and receiving processing is performed at the data link layer. The generated target message does not need to be processed anymore and can be transmitted to the user layer through the protocol stack. If the target message is a transport layer protocol message, it needs to be transmitted to the network layer through the data link layer for processing.

需要说明的是,本申请实施例中涉及的第一报文的格式与数据链路层协议的报文的格式相同。第二报文的格式与传输层协议的报文的格式相同;但基于链表规则匹配第二报文后,第二报文的类型可以是数据链路层协议的报文或者传输层协议的报文。当第二报文的类型为数据链路层协议的报文时,需要将之前第一报文中删除的标签信息重新添加到第二报文中,以生成目标报文,这时该目标报文的格式为数据链路层协议的报文格式;当第二报文的类型为传输层协议的报文时,第二报文即为目标报文,这时目标报文的格式为传输层协议的报文格式。It should be noted that the format of the first message involved in the embodiment of this application is the same as the format of the message of the data link layer protocol. The format of the second message is the same as the format of the transport layer protocol message; but after matching the second message based on the linked list rule, the type of the second message can be a data link layer protocol message or a transport layer protocol message. arts. When the type of the second message is a data link layer protocol message, the previously deleted label information in the first message needs to be re-added to the second message to generate the target message. At this time, the target message The format of the message is the message format of the data link layer protocol; when the type of the second message is the message of the transport layer protocol, the second message is the target message, and the format of the target message is the transport layer protocol. The message format of the protocol.

上述方法中,通过链路规则匹配的方式,能够准确的识别出用户所需要上传的报文为数据链路层协议的报文或是网络层标准的传输层协议的报文。从而解决现有集成的设备无法识别接收到的报文是传输层协议的报文,还是数据链路层协议的报文的问题。以便通过该报文的类型,实现报文在对应类型下的精确分流处理。In the above method, through link rule matching, it can be accurately identified that the message that the user needs to upload is a data link layer protocol message or a network layer standard transport layer protocol message. This solves the problem that the existing integrated equipment cannot identify whether the received message is a transport layer protocol message or a data link layer protocol message. In order to achieve accurate offload processing of messages under the corresponding type through the type of the message.

在一种是实现方式中,结合图6,参照图9,S12具体包括以下实现方式:In one implementation, with reference to Figure 6 and Figure 9, S12 specifically includes the following implementation:

S121、网卡确定第一报文的标签信息;标签信息至少用于标识通信设备传输初始报文的端口和端口所属的网络。S121. The network card determines the label information of the first message; the label information is at least used to identify the port through which the communication device transmits the initial message and the network to which the port belongs.

网卡确定第一报文的标签信息;标签信息至少用于标识通信设备传输第一报文的端口和端口所属的网络。The network card determines the label information of the first message; the label information is at least used to identify the port through which the communication device transmits the first message and the network to which the port belongs.

可选的,网卡调用钩子函数解析第一报文,确定标签信息。Optionally, the network card calls a hook function to parse the first message and determine the label information.

其中,标签信息包括:通信设备的编号、通信设备的端口编号、通信设备的端口所属的网络以及网络的优先级设定。The label 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.

示例性的,标签tag信息在报文中的长度一般为6字节。其中可以包含2字节tag_id(如0x9126)以及4字节的tag数据信息。tag数据信息包括1byte的源设备编号、1byte的源设备端口编号、1byte的优先级和VLAN标识(VID)的高4位bit、1byte的VID的低8位。其中,源设备编号表示报文从哪一个设备被接收;源设备端口编号表示报文从此设备的第几个端口被接收;优先级表示端口的虚拟局域网(Virtual Local Area Network,VLAN)的优先级设定;VID的高4位以及低8位表示接收报文的端口隶属于哪个VLAN。For example, the length of the tag information in the message is generally 6 bytes. It can contain 2-byte tag_id (such as 0x9126) and 4-byte tag data information. The tag data information includes 1 byte of source device number, 1 byte of source device port number, 1 byte of priority and the high 4 bits of VLAN identification (VID), and the low 8 bits of 1 byte of VID. Among them, the source device number indicates which device the packet was received from; the source device port number indicates which port of the device the packet was received from; and the priority indicates the priority of the virtual local area network (VLAN) of the port. Setting; the high 4 bits and low 8 bits of VID indicate which VLAN the port receiving the packet belongs to.

S122、网卡删除标签信息,生成第二报文。S122. The network card deletes the label information and generates a second message.

进一步的,网卡确定第一报文中的标签信息后,首先将该标签信息进行存储管理,再对第一报文中的标签信息进行删除。Further, after determining the label information in the first message, the network card first stores and manages the label information, and then deletes the label information in the first message.

具体的,网卡通过调用钩子函数删除第一报文中的标签信息,生成第二报文。Specifically, the network card deletes the label information in the first message by calling a hook function and generates the second message.

S123、网卡基于链表规则,确定第二报文的类型,并将第二报文的类型作为第一报文的类型。S123. The network card determines the type of the second message based on the linked list rule, and uses the type of the second message as the type of the first message.

可选的,基于链表规则,确定第二报文的类型具体包括:将链表规则与第二报文进行匹配,匹配的结果包括:若匹配成功,则确定第二报文的类型为数据链路层协议的报文;若匹配失败,则确定第二报文的类型为传输层协议的报文。需要说明的是,本申请实施例中的链表规则是针对数据链路层协议的报文配置的。Optionally, based on the linked list rule, determining the type of the second message specifically includes: matching the linked list rule with the second message, and the matching results include: if the match is successful, determining the type of the second message is data link. If the match fails, the type of the second packet is determined to be a packet of the transport layer protocol. It should be noted that the linked list rules in the embodiment of this application are configured for packets of the data link layer protocol.

具体的,网卡基于链表规则确定第二报文的类型,主要是通过对用户层下发链表规则(即为用户期望接收的报文的属性字段)进行查询匹配,若查询到配置的链表规则,则说明匹配成功。例如dest_mac用户下发的链表规则中包含的地址字段和接收报文中提取的dest_mac地址字段是一样的,则匹配成功。将匹配成功的报文按照数据链路层协议的报文组包,基于mac层增加配置信息。否则,直接上报TCP/IP格式的mac层报文到内核协议栈,也就是标准的TCP/IP的mac层组包格式,Specifically, the network card determines the type of the second message based on the linked list rules, mainly by querying and matching the linked list rules issued by the user layer (that is, the attribute fields of the messages that the user expects to receive). If the configured linked list rules are queried, It means the match is successful. For example, if the address field contained in 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 match is successful. The successfully matched packets are packaged according to the packets of the data link layer protocol, and the configuration information is added based on the mac layer. Otherwise, directly report the mac layer message in TCP/IP format to the kernel protocol stack, which is the standard TCP/IP mac layer packet format.

在S121-S123的基础上,根据第一报文的类型,确定目标报文,包括:在第一报文的类型为传输层协议的报文的情况下,在第二报文中添加标签信息,生成目标报文。和/或,在第一报文的类型为数据链路层协议的报文的情况下,将第二报文确定为目标报文。On the basis of S121-S123, determine the target message according to the type of the first message, including: when the type of the first message is a transport layer protocol message, add label information to the second message , generate the target message. And/or, when the type of the first message is a data link layer protocol message, determine the second message as the target message.

进一步的,调用钩子函数解析第二报文,确定标签信息。Further, the hook function is called to parse the second message and determine the label information.

在本实现方式中,考虑到传输层协议的报文类型占据多数,因此通过先第一报文删除标签信息,后进行链路规则匹配的方式,能够准确的识别出用户所需要上传的报文为数据链路层协议的报文或是网络层标准的传输层协议的报文。从而解决现有集成的设备无法识别接收到的报文是传输层协议的报文,还是数据链路层协议的报文的问题。以便通过该报文的类型,实现报文在对应类型下的精确分流处理。In this implementation, considering that the packet types of transport layer protocols account for the majority, by deleting the label information from the first packet and then matching the link rules, the packets that the user needs to upload can be accurately identified. It is a packet of a data link layer protocol or a packet of a standard transport layer protocol of the network layer. This solves the problem that the existing integrated equipment cannot identify whether the received message is a transport layer protocol message or a data link layer protocol message. In order to achieve accurate offload processing of messages under the corresponding type through the type of the message.

在一种实现方式中,参照图9,若第二报文的类型为数据链路层协议的报文。具体包括:In one implementation, referring to Figure 9, if the type of the second message is a data link layer protocol message. Specifically include:

S101、网卡通过协议栈传输目标报文至用户层;目标报文为第一报文。S101. The network card transmits the target message to the user layer through the protocol stack; the target message is the first message.

具体的,先通过字符设备驱动提供的用户层添加所需链表规则,字符设备驱动通过与网卡驱动之间预设的接口将链表规则传输至网卡驱动。之后,当网卡驱动通过socket执行recv接收报文,则获取到第一报文,确定第一报文的标签信息并存储。之后,删除第一报文中的标签信息生成第二报文。匹配链表规则与第二报文,确定第二报文中存在有链表规则中的链表元素对应的数据,则匹配成功。此时需要在第二报文中将删除的标签信息重新添加,以便生成需要传输的类型为数据链路层协议的报文的目标报文。之后通过协议栈传输目标报文至用户层。Specifically, the required linked list rules are first added through the user layer provided by the character device driver. The character device driver transmits the linked list rules to the network card driver through a preset interface with the network card driver. After that, when the network card driver executes recv to receive the message through the socket, it obtains the first message, determines the label information of the first message, and stores it. Afterwards, the label information in the first message is deleted to generate a second message. Match the linked list rule with the second message, and determine that the second message contains data corresponding to the linked list element in the linked list rule, then the match is successful. At this time, the deleted label information needs to be re-added to the second message in order to generate a target message that is a data link layer protocol message that needs to be transmitted. The target message is then transmitted to the user layer through the protocol stack.

示例性的,第一报文中包含有标签信息的格式如下图10所示,第一报文包括长度为6字节的标签信息、长度为7byte的前导码、长度为1字节的启示定界符、长度为6字节的源mac地址、长度为6字节的目的mac地址、长度为2字节的长度/类型、长度为用户数据、长度为4字节的填充字段PAD以及长度为4字节的帧校验序列FSC。需要说明的是6字节的标签信息具体所包含的数据可参照上述,此处不作赘述。For example, the format of the label information contained in the first message is as shown in Figure 10 below. The first message includes label information with a length of 6 bytes, a preamble with a length of 7 bytes, and a revelation definition with a length of 1 byte. Delimiter, source mac address with length of 6 bytes, destination mac address with length of 6 bytes, length/type with length of 2 bytes, user data with length, padding field PAD with length of 4 bytes and length of 4-byte frame check sequence FSC. It should be noted that the specific data contained in the 6-byte tag information can be referred to the above, and will not be described again here.

本实现方式,在第二报文中添加标签信息,生成为数据链路层协议的报文类型的目标报文,通过协议栈直接传输至用户层。以便实现目标报文的精准传输。In this implementation, label information is added to the second message, a target message is generated as a message type of the data link layer protocol, and is directly transmitted to the user layer through the protocol stack. In order to achieve accurate transmission of target messages.

在另一种实现方式中,参照图9,若第一报文的类型为传输层协议的报文;具体包括:In another implementation, referring to Figure 9, if the type of the first message is a transport layer protocol message; specifically:

S102、网卡向网络层传输所述第二报文;第二报文为目标报文。S102. The network card transmits the second message to the network layer; the second message is the target message.

示例性的,以控制报文协议(internet control message protocol,ICMP)Internet链路ping包需要接收为例。通信设备发送因特网组管理协议(Internet GroupManagement Protocol,IGMP)的请求报文(即第一报文),按照图2所示的硬件连接关系,被switch芯片接收,并转发至网卡。此时钩子函数被网卡调起,执行剥离物理层tag(即删除tag信息,tag信息各厂家不同,可通过各自数据手册确定,不做详述),将报文整合为如图11所示的标准网络mac报文格式(即传输层协议的报文格式)的第二报文。之后,匹配链表规则与第二报文。假设匹配失败,确定第二报文的类型为传输层协议的报文。则将第二报文上传至协议栈的网络层,协议栈的网络层接收第二报文,回复响应报文,实现链路ping通的过程。As an example, take the control message protocol (internet control message protocol, ICMP) Internet link ping packet that needs to be received. The communication device sends an Internet Group Management Protocol (IGMP) request message (i.e., the first message). According to the hardware connection relationship shown in Figure 2, it is received by the switch chip and forwarded to the network card. At this time, the hook function is called up by the network card, and the physical layer tag is stripped (that is, the tag information is deleted. The tag information is different for each manufacturer and can be determined through the respective data manual, so no details are given), and the message is integrated as shown in Figure 11. The second message of the standard network mac message format (that is, the message format of the transport layer protocol). Afterwards, match the linked list rules with the second message. Assuming that the match fails, it is determined that the type of the second packet is a transport layer protocol packet. Then the second message is uploaded to the network layer of the protocol stack, and the network layer of the protocol stack receives the second message and replies with a response message to realize the process of link pinging.

其中,匹配失败情况可能是用户未通过字符设备驱动生成链表规则。也可能是生成了链表规则,但链表规则的数据与第二报文中的数据无法对应。如填充的报文类型type=0x8899和接收报文实际类型0x0800不一致,则按照标准格式上报协议栈。Among them, matching failure may be caused by the user not generating linked list rules through the character device driver. It is also possible that a linked list rule is generated, but the data in the linked list rule cannot correspond to the data in the second message. If the filled message type type=0x8899 is inconsistent with the actual type of the received message 0x0800, it will be reported to the protocol stack according to the standard format.

本实现方式,将匹配失败的第二报文不作任何处理上传至网络层,实现了目标报文的准确传输。In this implementation, the second message that fails to match is uploaded to the network layer without any processing, thereby achieving accurate transmission of the target message.

在一种实现方式中,接收来自通信设备的第一报文之前,包括:接收用户输入的调试参数;调试参数用于指示抓取MAC层的接收和传输的报文;接收来自通信设备的第一报文之后,包括:基于调试参数,抓取第一报文以及目标报文。确定第一报文以及目标报文的差异。In one implementation, before receiving the first message from the communication device, the process includes: receiving debugging parameters input by the user; the debugging parameters are used to instruct the capture of the received and transmitted messages of the MAC layer; receiving the third message from the communication device. After one message, it includes: capturing the first message and the target message based on the debugging parameters. Determine the difference between the first message and the target message.

需要说明的是,针对本实现方式的说明参照上述图7对应的描述,此处不再赘述。It should be noted that for the description of this implementation, refer to the description corresponding to Figure 7 above, and will not be described again here.

本实现方式,通过提前设定的调整参数对mac层接收的报文以及传输的报文进行抓取,以便通过对前后报文的对比,确定前后报文的信息变化情况。In this implementation, the packets received by the mac layer and the packets transmitted are captured by adjusting parameters set in advance, so as to determine the information changes of the previous and later packets by comparing the previous and later packets.

本申请实施例可以根据上述方法实施例对资源配置装置进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。Embodiments of the present application can divide the resource configuration device into functional modules according to the above method embodiments. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or software function modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. In actual implementation, there may be other division methods.

如图12所示,为本申请实施例提供的一种报文处理装置120的结构示意图,该一种报文处理装置120具体包括交换芯片121以及处理器122。As shown in FIG. 12 , it is a schematic structural diagram of a message processing device 120 provided by an embodiment of the present application. The message processing device 120 specifically includes a switching chip 121 and a processor 122 .

交换芯片121,用于获取第一报文;第一报文是基于来自通信设备的初始报文得到的。例如,该交换芯片121可用于实现如图6所示的S11。The switching chip 121 is used to obtain the first message; the first message is obtained based on the initial message from the communication device. For example, the switching chip 121 can be used to implement S11 as shown in FIG. 6 .

处理器122,用于基于链表规则,确定交换芯片121获取的第一报文的类型;类型包括传输层协议的报文或数据链路层协议的报文;链表规则包括报文的特征信息与类型的对应关系;特征信息包括用于表征报文的源地址、报文的目标地址、网络类型中的至少一个。例如,该处理器122可用于实现如图6所示的S12。The processor 122 is configured to determine the type of the first message obtained by the switching chip 121 based on the linked list rules; the type includes a message of a transport layer protocol or a message of a data link layer protocol; the linked list rule includes characteristic information of the message and Correspondence between types; the characteristic information includes at least one of the source address used to characterize the message, the destination address of the message, and the network type. For example, the processor 122 can be used to implement S12 as shown in FIG. 6 .

处理器122,还用于根据第一报文的类型,确定目标报文,并传输目标报文。例如,该处理器122可用于实现如图6所示的S13。The processor 122 is also configured to determine the target message according to the type of the first message, and transmit the target message. For example, the processor 122 can be used to implement S13 as shown in FIG. 6 .

可选的,处理器122,具体用于:确定第一报文的标签信息;标签信息至少用于标识通信设备传输初始报文的端口和端口所属的网络;删除标签信息,生成第二报文;基于链表规则,确定第二报文的类型,并将第二报文的类型作为第一报文的类型。Optionally, the processor 122 is specifically configured to: determine the label information of the first message; the label information is at least used to identify the port through which the communication device transmits the initial message and the network to which the port belongs; delete the label information and generate the second message ; Based on the linked list rule, determine the type of the second message, and use the type of the second message as the type of the first message.

可选的,处理器122,具体用于:在第一报文的类型为传输层协议的报文的情况下,在第二报文中添加标签信息,生成目标报文;和/或,在第一报文的类型为数据链路层协议的报文的情况下,将第二报文确定为目标报文。Optionally, the processor 122 is specifically configured to: when the type of the first message is a transport layer protocol message, add tag information to the second message to generate a target message; and/or, in If the type of the first message is a data link layer protocol message, the second message is determined as the target message.

可选的,处理器122,具体用于调用钩子函数解析第二报文,确定标签信息。Optionally, the processor 122 is specifically configured to call a hook function to parse the second message and determine the tag information.

可选的,处理器122,具体用于:匹配链表规则与第二报文;若匹配成功,则确定第二报文的类型为数据链路层协议的报文;和/或,若匹配失败,则确定第二报文的类型为传输层协议的报文。Optionally, the processor 122 is specifically configured to: match the linked list rule with the second message; if the match is successful, determine that the type of the second message is a data link layer protocol message; and/or, if the match fails , then it is determined that the type of the second message is a transport layer protocol message.

可选的,标签信息包括:通信设备的编号、通信设备的端口编号、通信设备的端口所属的网络以及网络的优先级设定。Optionally, the label 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.

可选的,交换芯片121,具体用于:接收来自通信设备的初始报文;确定初始报文中是否包含标签信息;若包含,且标签信息准确,则确定初始报文为第一报文;和/或,若包含,且标签信息错误,则根据初始报文的传输信息确定新的标签信息,并利用新的标签信息更新初始报文中的标签信息,确定更新后的初始报文为第一报文;和/或,若不包含,则根据初始报文的传输信息确定标签信息,将标签信息添加至初始报文中,确定添加标签信息后的初始报文为第一报文。Optionally, the switching chip 121 is specifically used to: receive an initial message from the communication device; determine whether the initial message contains tag information; if it does, and the tag information is accurate, determine that the initial message is the first message; and/or, if included and the label information is wrong, determine the new label information based on the transmission information of the initial message, use the new label information to update the label information in the initial message, and determine that the updated initial message is the A message; and/or, if it is not included, determine the label information based on the transmission information of the initial message, add the label information to the initial message, and determine that the initial message after adding the label information is the first message.

可选的,处理器122,具体用于:在第一报文的类型为传输层协议的报文的情况下,确定第一报文的标签信息,并在第一报文中删除标签信息,生成目标报文;和/或,在第一报文的类型为数据链路层协议的报文的情况下,将第一报文确定为目标报文。Optionally, the processor 122 is specifically configured to: when the type of the first message is a transport layer protocol message, determine the label information of the first message, and delete the label information in the first message, Generate a target message; and/or, when the type of the first message is a data link layer protocol message, determine the first message as the target message.

可选的,处理器122,还被配置为:接收用户输入的调试参数;调试参数用于指示抓取MAC层接收和传输的报文。Optionally, the processor 122 is also configured to: receive debugging parameters input by the user; the debugging parameters are used to instruct the capture of messages received and transmitted by the MAC layer.

基于调试参数,抓取第一报文以及目标报文。确定第一报文以及目标报文的差异。Based on the debugging parameters, capture the first message and the target message. Determine the difference between the first message and the target message.

这里,本发明实施例描述的系统架构以及业务场景是为了更加清楚的说明本申请实施例的技术方案,并不构成对于本申请实施例提供的技术方案的限定,本领域普通技术人员可知,随着网络架构的演变和新业务场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。Here, the system architecture and business scenarios described in the embodiments of the present invention are to more clearly explain the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those of ordinary skill in the art will know that, With the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.

本发明另一实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当指令在计算机上运行时,使得计算机执行上述方法实施例所示的方法。Another embodiment of the present invention also provides a computer-readable storage medium. The computer-readable storage medium stores instructions. When the instructions are run on a computer, they cause the computer to execute the method shown in the above method embodiment.

在一些实施例中,所公开的方法可以实施为以机器可读格式被编码在计算机可读存储介质上的或者被编码在其它非瞬时性介质或者制品上的计算机程序指令。In some embodiments, the disclosed methods may be implemented as computer program instructions encoded on a computer-readable storage medium or on other non-transitory media or articles in a machine-readable format.

图13示意性地示出本发明实施例提供的计算机程序产品的概念性局部视图,所述计算机程序产品包括用于在计算设备上执行计算机进程的计算机程序。Figure 13 schematically illustrates a conceptual partial view of a computer program product provided by an embodiment of the present invention, the computer program product including a computer program for executing a computer process on a computing device.

在一个实施例中,计算机程序产品是使用信号承载介质410来提供的。所述信号承载介质410可以包括一个或多个程序指令,其当被一个或多个处理器运行时可以提供以上针对图6描述的功能或者部分功能。因此,例如,参考图6中所示的实施例,S11-S13的一个或多个特征可以由与信号承载介质410相关联的一个或多个指令来承担。此外,图13中的程序指令也描述示例指令。In one embodiment, the 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 undertaken by one or more instructions associated with signal bearing medium 410 . Additionally, the program instructions in Figure 13 also describe example instructions.

在一些示例中,信号承载介质410可以包含计算机可读介质411,诸如但不限于,硬盘驱动器、紧密盘(CD)、数字视频光盘(DVD)、数字磁带、存储器、只读存储记忆体(read-only memory,ROM)或随机存储记忆体(random access memory,RAM)等等。In some examples, signal bearing media 410 may include computer readable media 411 such as, but not limited to, a hard drive, a compact disk (CD), a digital video disc (DVD), a digital tape, memory, a read-only memory (read-only memory), -only memory, ROM) or random access memory (random access memory, RAM), etc.

在一些实施方式中,信号承载介质410可以包含计算机可记录介质412,诸如但不限于,存储器、读/写(R/W)CD、R/W DVD、等等。In some implementations, signal bearing media 410 may include computer recordable media 412 such as, but not limited to, memory, read/write (R/W) CDs, R/W DVDs, and the like.

在一些实施方式中,信号承载介质410可以包含通信介质413,诸如但不限于,数字和/或模拟通信介质(例如,光纤电缆、波导、有线通信链路、无线通信链路、等等)。In some implementations, signal bearing medium 410 may include communication media 413, such as, but not limited to, digital and/or analog communication media (eg, fiber optic cables, waveguides, wired communication links, wireless communication links, etc.).

信号承载介质410可以由无线形式的通信介质413(例如,遵守IEEE802.41标准或者其它传输协议的无线通信介质)来传达。一个或多个程序指令可以是,例如,计算机可执行指令或者逻辑实施指令。The signal bearing medium 410 may be conveyed by a wireless form of communication medium 413 (eg, a wireless communication medium complying with the IEEE 802.41 standard or other transmission protocol). One or more program instructions may be, for example, computer-executable instructions or logic-implemented instructions.

在一些示例中,诸如针对图12描述的处理器可以被配置为,响应于通过计算机可读介质411、计算机可记录介质412、和/或通信介质413中的一个或多个程序指令,提供各种操作、功能、或者动作。In some examples, a processor such as that described with respect to FIG. 12 may be configured to provide various An operation, function, or action.

通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。Through the above description of the embodiments, those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be allocated as needed. It is completed by different functional modules, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.

在本发明所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be The combination can either be integrated into another device, or some features can be omitted, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated. The components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place, or they may be distributed to multiple different places. . Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or software functional units.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention is essentially or contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the software product is stored in a storage medium , including several instructions to cause a device (which can be a microcontroller, a chip, etc.) or a processor to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include: U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk and other media that can store program codes.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何在本发明揭露的技术范围内的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present invention should be covered by the protection scope of the present invention. . Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims (18)

1.一种报文处理方法,其特征在于,应用于网络设备;该方法包括:1. A message processing method, characterized in that it is applied to network equipment; the method includes: 获取第一报文;所述第一报文是基于来自通信设备的初始报文得到的;Obtain the first message; the first message is obtained based on the initial message from the communication device; 基于链表规则,确定所述第一报文的类型;所述类型包括传输层协议的报文或数据链路层协议的报文;所述链表规则包括报文的特征信息与类型的对应关系;特征信息包括用于表征报文的源地址、报文的目标地址、网络类型中的至少一个;Based on the linked list rules, determine the type of the first message; the type includes a transport layer protocol message or a data link layer protocol message; the linked list rule includes a correspondence between the characteristic information of the message and the type; The characteristic information includes at least one of a source address used to characterize the message, a destination address of the message, and a network type; 根据所述第一报文的类型,确定目标报文,并传输所述目标报文;Determine a target message according to the type of the first message, and transmit the target message; 所述传输所述目标报文包括:The transmission of the target message includes: 在所述目标报文为数据链路层协议的报文的情况下,将所述目标报文通过协议栈传输至用户层;If the target message is a data link layer protocol message, transmit the target message to the user layer through the protocol stack; 在所述目标报文为传输层协议的报文的情况下,将所述目标报文通过数据链路层传输至网络层进行处理;When the target message is a transport layer protocol message, transmit the target message to the network layer through the data link layer for processing; 所述基于链表规则,确定所述第一报文的类型,包括:Determining the type of the first message based on linked list rules includes: 确定所述第一报文的标签信息;所述标签信息至少用于标识所述通信设备传输所述初始报文的端口和所述端口所属的网络;Determine the label information of the first message; the label information is at least used to identify the port through which the communication device transmits the initial message and the network to which the port belongs; 删除所述标签信息,生成第二报文;Delete the label information and generate a second message; 基于链表规则,确定所述第二报文的类型,并将所述第二报文的类型作为第一报文的类型。Based on the linked list rule, the type of the second message is determined, and the type of the second message is used as the type of the first message. 2.根据权利要求1所述的报文处理方法,其特征在于,所述根据所述第一报文的类型,确定目标报文,包括:2. The message processing method according to claim 1, characterized in that determining the target message according to the type of the first message includes: 在所述第一报文的类型为传输层协议的报文的情况下,在所述第二报文中添加所述标签信息,生成所述目标报文;When the type of the first message is a transport layer protocol message, add the label information to the second message to generate the target message; 和/或,and / or, 在所述第一报文的类型为所述数据链路层协议的报文的情况下,将所述第二报文确定为所述目标报文。If the type of the first message is a message of the data link layer protocol, the second message is determined to be the target message. 3.根据权利要求1或2所述的报文处理方法,其特征在于,所述确定所述第一报文的标签信息,包括:3. The message processing method according to claim 1 or 2, characterized in that determining the label information of the first message includes: 调用钩子函数解析所述第二报文,确定所述标签信息。Call a hook function to parse the second message and determine the tag information. 4.根据权利要求1或2所述的报文处理方法,其特征在于,所述基于链表规则,确定所述第二报文的类型,包括:4. The message processing method according to claim 1 or 2, characterized in that determining the type of the second message based on linked list rules includes: 匹配所述链表规则与所述第二报文;Match the linked list rule and the second message; 若匹配成功,则确定所述第二报文的类型为所述数据链路层协议的报文;If the match is successful, it is determined that the type of the second message is a message of the data link layer protocol; 和/或,and / or, 若匹配失败,则确定所述第二报文的类型为所述传输层协议的报文。If the matching fails, it is determined that the type of the second packet is a packet of the transport layer protocol. 5.根据权利要求1或2所述的报文处理方法,其特征在于,所述标签信息包括:所述通信设备的编号、所述通信设备的端口编号、所述通信设备的端口所属的网络以及所述网络的优先级设定。5. The message processing method according to claim 1 or 2, characterized in that the label information includes: the number of the communication device, the port number of the communication device, and the network to which the port of the communication device belongs. and priority settings for said network. 6.根据权利要求1所述的报文处理方法,其特征在于,所述获取第一报文,包括:6. The message processing method according to claim 1, characterized in that said obtaining the first message includes: 接收来自所述通信设备的所述初始报文;receiving the initial message from the communication device; 确定所述初始报文中是否包含所述标签信息;Determine whether the initial message contains the label information; 若包含,且所述标签信息准确,则确定所述初始报文为所述第一报文;If included, and the label information is accurate, it is determined that the initial message is the first message; 和/或,and / or, 若包含,且所述标签信息错误,则根据所述初始报文的传输信息确定新的标签信息,并利用所述新的标签信息更新所述初始报文中的所述标签信息,确定更新后的初始报文为所述第一报文;If it is included and the label information is wrong, new label information is determined based on the transmission information of the initial message, and the new label information is used to update the label information in the initial message, and the updated label information is determined. The initial message is the first message; 和/或,and / or, 若不包含,则根据所述初始报文的传输信息确定所述标签信息,将所述标签信息添加至所述初始报文中,确定添加所述标签信息后的所述初始报文为所述第一报文。If it is not included, determine the label information according to the transmission information of the initial message, add the label information to the initial message, and determine that the initial message after adding the label information is the First message. 7.根据权利要求1所述的报文处理方法,其特征在于,所述根据所述第一报文的类型,确定目标报文,包括:7. The message processing method according to claim 1, characterized in that determining the target message according to the type of the first message includes: 在所述第一报文的类型为传输层协议的报文的情况下,确定所述第一报文的标签信息,并在所述第一报文中删除所述标签信息,生成所述目标报文;When the type of the first message is a transport layer protocol message, determine the label information of the first message, delete the label information in the first message, and generate the target message; 和/或,and / or, 在所述第一报文的类型为所述数据链路层协议的报文的情况下,将所述第一报文确定为所述目标报文。If the type of the first message is a message of the data link layer protocol, the first message is determined to be the target message. 8.根据权利要求1所述的报文处理方法,其特征在于,所述获取第一报文之前,包括:8. The message processing method according to claim 1, characterized in that before obtaining the first message, it includes: 接收用户输入的调试参数;所述调试参数用于指示抓取MAC层接收和传输的报文;Receive debugging parameters input by the user; the debugging parameters are used to instruct the capture of messages received and transmitted by the MAC layer; 所述获取第一报文之后,包括:After obtaining the first message, the process includes: 基于所述调试参数,抓取所述第一报文以及所述目标报文;Based on the debugging parameters, capture the first message and the target message; 确定所述第一报文以及所述目标报文的差异。Determine the difference between the first packet and the target packet. 9.一种报文处理装置,其特征在于,该装置包括:交换芯片以及处理器;9. A message processing device, characterized in that the device includes: a switching chip and a processor; 所述交换芯片,用于获取第一报文;所述第一报文是基于来自通信设备的初始报文得到的;The switching chip is used to obtain the first message; the first message is obtained based on the initial message from the communication device; 所述处理器,用于基于链表规则,确定所述交换芯片获取的所述第一报文的类型;所述类型包括传输层协议的报文或数据链路层协议的报文;所述链表规则包括报文的特征信息与类型的对应关系;特征信息包括用于表征报文的源地址、报文的目标地址、网络类型中的至少一个;The processor is configured to determine the type of the first message obtained by the switching chip based on linked list rules; the type includes a message of a transport layer protocol or a message of a data link layer protocol; the linked list The rules include a correspondence between the characteristic information and the type of the message; the characteristic information includes at least one of the source address used to characterize the message, the destination address of the message, and the network type; 所述处理器,还用于根据所述第一报文的类型,确定目标报文,并传输所述目标报文;The processor is also configured to determine a target message according to the type of the first message, and transmit the target message; 所述处理器具体用于:The processor is specifically used for: 在所述目标报文为数据链路层协议的报文的情况下,将所述目标报文通过协议栈传输至用户层;If the target message is a data link layer protocol message, transmit the target message to the user layer through the protocol stack; 在所述目标报文为传输层协议的报文的情况下,将所述目标报文通过数据链路层传输至网络层进行处理;When the target message is a transport layer protocol message, transmit the target message to the network layer through the data link layer for processing; 所述处理器,具体用于:The processor is specifically used for: 确定所述第一报文的标签信息;所述标签信息至少用于标识所述通信设备传输所述初始报文的端口和所述端口所属的网络;Determine the label information of the first message; the label information is at least used to identify the port through which the communication device transmits the initial message and the network to which the port belongs; 删除所述标签信息,生成第二报文;Delete the label information and generate a second message; 基于链表规则,确定所述第二报文的类型,并将所述第二报文的类型作为第一报文的类型。Based on the linked list rule, the type of the second message is determined, and the type of the second message is used as the type of the first message. 10.根据权利要求9所述的报文处理装置,其特征在于,所述处理器,具体用于:10. The message processing device according to claim 9, characterized in that the processor is specifically used to: 在所述第一报文的类型为传输层协议的报文的情况下,在所述第二报文中添加所述标签信息,生成所述目标报文;When the type of the first message is a transport layer protocol message, add the label information to the second message to generate the target message; 和/或,and / or, 在所述第一报文的类型为所述数据链路层协议的报文的情况下,将所述第二报文确定为所述目标报文。If the type of the first message is a message of the data link layer protocol, the second message is determined to be the target message. 11.根据权利要求9或10所述的报文处理装置,其特征在于,11. The message processing device according to claim 9 or 10, characterized in that, 所述处理器,具体用于调用钩子函数解析所述第二报文,确定所述标签信息。The processor is specifically configured to call a hook function to parse the second message and determine the tag information. 12.根据权利要求9或10所述的报文处理装置,其特征在于,所述处理器,具体用于:12. The message processing device according to claim 9 or 10, characterized in that the processor is specifically used for: 匹配所述链表规则与所述第二报文;Match the linked list rule and the second message; 若匹配成功,则确定所述第二报文的类型为所述数据链路层协议的报文;If the match is successful, it is determined that the type of the second message is a message of the data link layer protocol; 和/或,and / or, 若匹配失败,则确定所述第二报文的类型为所述传输层协议的报文。If the matching fails, it is determined that the type of the second packet is a packet of the transport layer protocol. 13.根据权利要求9或10所述的报文处理装置,其特征在于,所述标签信息包括:所述通信设备的编号、所述通信设备的端口编号、所述通信设备的端口所属的网络以及所述网络的优先级设定。13. The message processing device according to claim 9 or 10, characterized in that the label information includes: the number of the communication device, the port number of the communication device, and the network to which the port of the communication device belongs. and priority settings for said network. 14.根据权利要求9所述的报文处理装置,其特征在于,所述交换芯片,具体用于:14. The message processing device according to claim 9, characterized in that the switching chip is specifically used for: 接收来自所述通信设备的所述初始报文;receiving the initial message from the communication device; 确定所述初始报文中是否包含所述标签信息;Determine whether the initial message contains the label information; 若包含,且所述标签信息准确,则确定所述初始报文为所述第一报文;If included, and the label information is accurate, it is determined that the initial message is the first message; 和/或,and / or, 若包含,且所述标签信息错误,则根据所述初始报文的传输信息确定新的标签信息,并利用所述新的标签信息更新所述初始报文中的所述标签信息,确定更新后的初始报文为所述第一报文;If it is included and the label information is wrong, new label information is determined based on the transmission information of the initial message, and the new label information is used to update the label information in the initial message, and the updated label information is determined. The initial message is the first message; 和/或,and / or, 若不包含,则根据所述初始报文的传输信息确定所述标签信息,将所述标签信息添加至所述初始报文中,确定添加所述标签信息后的所述初始报文为所述第一报文。If it is not included, determine the label information according to the transmission information of the initial message, add the label information to the initial message, and determine that the initial message after adding the label information is the First message. 15.根据权利要求9所述的报文处理装置,其特征在于,所述处理器,具体用于:15. The message processing device according to claim 9, characterized in that the processor is specifically used to: 在所述第一报文的类型为传输层协议的报文的情况下,确定所述第一报文的标签信息,并在所述第一报文中删除所述标签信息,生成所述目标报文;When the type of the first message is a transport layer protocol message, determine the label information of the first message, delete the label information in the first message, and generate the target message; 和/或,and / or, 在所述第一报文的类型为所述数据链路层协议的报文的情况下,将所述第一报文确定为所述目标报文。If the type of the first message is a message of the data link layer protocol, the first message is determined to be the target message. 16.根据权利要求9所述的报文处理装置,其特征在于,所述处理器,还被配置为:16. The message processing device according to claim 9, wherein the processor is further configured to: 接收用户输入的调试参数;所述调试参数用于指示抓取MAC层接收和传输的报文;Receive debugging parameters input by the user; the debugging parameters are used to instruct the capture of messages received and transmitted by the MAC layer; 基于所述调试参数,抓取所述第一报文以及所述目标报文;Based on the debugging parameters, capture the first message and the target message; 确定所述第一报文以及所述目标报文的差异。Determine the difference between the first packet and the target packet. 17.一种网络设备,其特征在于,包括:存储器和处理器,所述存储器用于存储计算机程序,所述处理器用于执行所述计算机程序,以执行权利要求1-8中任一项所述的报文处理方法。17. A network device, characterized in that it includes: a memory and a processor, the memory is used to store a computer program, and the processor is used to execute the computer program to execute any one of claims 1-8. The message processing method described above. 18.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机程序,当所述计算机程序在网络设备上运行时,使得所述网络设备执行权利要求1-8中任一项所述的报文处理方法。18. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is run on a network device, it causes the network device to execute claims 1-8 The message processing method described in any one of the above.
CN202110772783.5A 2021-07-08 2021-07-08 Message processing method, device, equipment and storage medium Active CN113595931B (en)

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 (9)

* Cited by examiner, † Cited by third party
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
CN116073993A (en) * 2022-12-28 2023-05-05 中国联合网络通信集团有限公司 A data message transmission method, device, electronic equipment 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
CN119728226A (en) * 2024-12-17 2025-03-28 北京天融信网络安全技术有限公司 PowerLink protocol message processing method, device, storage medium and program product

Citations (8)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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

Patent Citations (9)

* Cited by examiner, † Cited by third party
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
CN104243265B (en) A kind of gateway control method, apparatus and system based on virtual machine (vm) migration
CN111405684A (en) Method for connecting to network access device, terminal and computer readable storage medium
CN104937896B (en) Address resolution protocol message processing method and forwarder and controller
CN104125191B (en) Processing method, equipment and the system of point-to-point protocol based on Ethernet
CN114745255B (en) Hardware chip, DPU, server, communication method and related device
EP3828709A1 (en) Communication method and network card
JP7644246B2 (en) Packet forwarding method, packet processing method, and device
WO2020181486A1 (en) Information processing method, apparatus, and system
CN110535812B (en) Message transmission method, communication device and system
CN114422614B (en) Method, device, equipment and storage medium for controlling multilink equipment to transmit data
CN115065637A (en) Method and device for transmitting computing power resource information and electronic equipment
US20230283694A1 (en) Data transmission method and apparatus, device, and computer-readable storage medium
CN107483369B (en) Message processing method and virtual switch
US12003417B2 (en) Communication method and apparatus
CN118300994A (en) Virtual network management method, device, equipment and storage medium based on cloud mobile phone
US20230017306A1 (en) Communication method and apparatus
WO2023173876A1 (en) Data communication method and apparatus, device and medium
TWI701925B (en) Method for providing network service through edge computing
CN110943896B (en) PPPoE data message transmission method, device, equipment and storage medium
CN115766556B (en) MAC address learning method, device, electronic device and readable storage medium
EP4622226A1 (en) Data transmission method and related apparatus
CN119854380A (en) Data transmission method, apparatus, device, storage medium, and program product
CN115038138B (en) Data forwarding method, device, computer equipment and storage medium
US12388746B2 (en) Packet processing method, apparatus, and system, device, and computer-readable storage medium

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
TR01 Transfer of patent right

Effective date of registration: 20250803

Address after: Rooms 602 and 605, No. 85 Xiangxue Avenue Middle, Huangpu District, Guangzhou City, Guangdong Province 510000

Patentee after: Guangzhou Gaohang Technology Transfer Co.,Ltd.

Country or region after: China

Address before: Hangzhou City, Zhejiang province 310051 Binjiang District Qianmo Road No. 555

Patentee before: Hangzhou Hikvision Digital Technology Co.,Ltd.

Country or region before: China

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20250827

Address after: 100176 Beijing City, Daxing District, Beijing Economic and Technological Development Zone, KeChuang Wu Street No. 38, Yard 2, Building 12, 12th Floor, Room 1208-27

Patentee after: Beijing Shangxin Technology Co.,Ltd.

Country or region after: China

Address before: Rooms 602 and 605, No. 85 Xiangxue Avenue Middle, Huangpu District, Guangzhou City, Guangdong Province 510000

Patentee before: Guangzhou Gaohang Technology Transfer Co.,Ltd.

Country or region before: China

TR01 Transfer of patent right