[go: up one dir, main page]

CN116668385A - A message processing method, device, electronic equipment and storage medium - Google Patents

A message processing method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116668385A
CN116668385A CN202310685977.0A CN202310685977A CN116668385A CN 116668385 A CN116668385 A CN 116668385A CN 202310685977 A CN202310685977 A CN 202310685977A CN 116668385 A CN116668385 A CN 116668385A
Authority
CN
China
Prior art keywords
message
field information
data
target
original
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.)
Pending
Application number
CN202310685977.0A
Other languages
Chinese (zh)
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 Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202310685977.0A priority Critical patent/CN116668385A/en
Publication of CN116668385A publication Critical patent/CN116668385A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9057Arrangements for supporting packet reassembly or resequencing

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本公开提供了一种报文处理方法、装置、电子设备及存储介质,涉及数据处理技术领域,具体涉及报文数据处理技术以及网络设备技术领域,可应用于智能云场景中,报文处理方法应用于报文处理芯片,包括:获取原始报文输入数据;对原始报文输入数据截取目标关键字段信息;其中,目标关键字段信息包括目标原始字段信息;根据目标关键字段信息生成目标结果报文数据;根据原始报文输入数据和目标结果报文数据生成原始报文输出数据。本公开实施例能够提高报文处理芯片的适配效率,进而提高报文处理的效率。

The disclosure provides a message processing method, device, electronic equipment, and storage medium, which relate to the technical field of data processing, and specifically relate to the technical fields of message data processing technology and network equipment, and can be applied in intelligent cloud scenarios. The message processing method Applied to the message processing chip, including: obtaining the original message input data; intercepting the target key field information for the original message input data; wherein, the target key field information includes the target original field information; generating the target key field information according to the target key field information Result message data; generate original message output data according to original message input data and target result message data. The embodiments of the present disclosure can improve the adaptation efficiency of the message processing chip, and further improve the efficiency of message processing.

Description

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

技术领域technical field

本公开涉及数据处理技术领域,具体涉及报文数据处理技术以及网络设备技术领域,可应用于智能云场景中。The present disclosure relates to the field of data processing technology, in particular to the field of message data processing technology and network equipment technology, and can be applied in intelligent cloud scenarios.

背景技术Background technique

随着网络的发展,在网关设备等网络设备对报文进行转发时,一般包括软件转发和硬件转发两种方式。在通过软件进行报文转发时,可以由处理器执行软件算法,对报文进行处理和转发;在通过硬件进行报文转发时,可以由报文处理芯片等逻辑芯片对报文进行处理和转发。通过软件转发报文能够实现更丰富的功能,而通过硬件转发报文具有更高的转发速度。在智能云场景中,如何提高报文的处理效率对于智能云业务的影响较为显著。With the development of the network, when network devices such as gateway devices forward packets, there are generally two modes of software forwarding and hardware forwarding. When the message is forwarded by software, the processor can execute the software algorithm to process and forward the message; when the message is forwarded by hardware, the message can be processed and forwarded by a logic chip such as a message processing chip . Forwarding packets through software can achieve richer functions, while forwarding packets through hardware has a higher forwarding speed. In the smart cloud scenario, how to improve packet processing efficiency has a significant impact on smart cloud services.

发明内容Contents of the invention

本公开实施例提供了一种报文处理方法、装置、电子设备及存储介质,能够提高报文处理芯片的适配效率,进而提高报文处理的效率。Embodiments of the present disclosure provide a message processing method, device, electronic equipment, and storage medium, which can improve the adaptation efficiency of a message processing chip, and further improve the message processing efficiency.

第一方面,本公开实施例提供了一种报文处理方法,包括:In a first aspect, an embodiment of the present disclosure provides a message processing method, including:

获取原始报文输入数据;Obtain the original message input data;

对所述原始报文输入数据截取目标关键字段信息;其中,所述目标关键字段信息包括目标原始字段信息;Intercepting target key field information for the original message input data; wherein, the target key field information includes target original field information;

根据所述目标关键字段信息生成目标结果报文数据;Generate target result message data according to the target key field information;

根据所述原始报文输入数据和所述目标结果报文数据生成原始报文输出数据。Generating original message output data according to the original message input data and the target result message data.

第二方面,本公开实施例提供了一种报文处理装置,包括:In a second aspect, an embodiment of the present disclosure provides a message processing device, including:

原始报文输入数据获取模块,用于获取原始报文输入数据;The original message input data acquisition module is used to obtain the original message input data;

目标关键字段信息截取模块,用于对所述原始报文输入数据截取目标关键字段信息;其中,所述目标关键字段信息包括目标原始字段信息;A target key field information intercepting module, configured to intercept target key field information for the original message input data; wherein, the target key field information includes target original field information;

目标结果报文数据生成模块,用于根据所述目标关键字段信息生成目标结果报文数据;A target result message data generating module, configured to generate target result message data according to the target key field information;

原始报文输出数据生成模块,用于根据所述原始报文输入数据和所述目标结果报文数据生成原始报文输出数据。An original message output data generating module, configured to generate original message output data according to the original message input data and the target result message data.

第三方面,本公开实施例提供了一种电子设备,包括:In a third aspect, an embodiment of the present disclosure provides an electronic device, including:

至少一个处理器;以及at least one processor; and

与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein,

所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行第一方面实施例所提供的报文处理方法。The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can perform the packet processing provided in the embodiment of the first aspect method.

第四方面,本公开实施例还提供了一种存储有计算机指令的非瞬时计算机可读存储介质,所述计算机指令用于使所述计算机执行第一方面实施例所提供的报文处理方法。In a fourth aspect, the embodiments of the present disclosure further provide a non-transitory computer-readable storage medium storing computer instructions, the computer instructions are used to cause the computer to execute the message processing method provided in the embodiments of the first aspect.

第五方面,本公开实施例还提供了一种计算机程序产品,包括计算机程序,所述计算机程序在被处理器执行时实现第一方面实施例所提供的报文处理方法。In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the packet processing method provided in the embodiment of the first aspect is implemented.

本公开实施例通过获取原始报文输入数据,从而对原始报文输入数据截取包括目标原始字段信息的目标关键字段信息,以根据目标关键字段信息生成目标结果报文数据,从而根据原始报文输入数据和目标结果报文数据生成原始报文输出数据。基于原始报文输入数据截取的目标关键字段信息对原始报文输入数据在线进行报文处理,可以解决报文处理芯片需要线下更新信息提取功能的问题,能够提高报文处理芯片的适配效率,进而提高报文处理的效率。The embodiment of the present disclosure obtains the original message input data, thereby intercepting the target key field information including the target original field information from the original message input data, so as to generate the target result message data according to the target key field information, so that according to the original message Raw message output data is generated from text input data and target result message data. Based on the target key field information intercepted from the original message input data, the original message input data is processed online, which can solve the problem that the message processing chip needs to update the information extraction function offline, and can improve the adaptation of the message processing chip Efficiency, thereby improving the efficiency of packet processing.

应当理解,本部分所描述的内容并非旨在标识本公开的实施例的关键或重要特征,也不用于限制本公开的范围。本公开的其它特征将通过以下的说明书而变得容易理解。It should be understood that what is described in this section is not intended to identify key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will be readily understood through the following description.

附图说明Description of drawings

附图用于更好地理解本方案,不构成对本公开的限定。其中:The accompanying drawings are used to better understand the present solution, and do not constitute a limitation to the present disclosure. in:

图1是本公开实施例提供的一种报文处理方法的流程图;FIG. 1 is a flowchart of a message processing method provided by an embodiment of the present disclosure;

图2是本公开实施例提供的一种报文处理方法的流程图;FIG. 2 is a flow chart of a message processing method provided by an embodiment of the present disclosure;

图3是本公开实施例提供的一种报文处理方法的流程示意图;FIG. 3 is a schematic flowchart of a message processing method provided by an embodiment of the present disclosure;

图4是本公开实施例所适用的一种提取关键字段信息的流程示意图;FIG. 4 is a schematic flow diagram of extracting key field information applicable to an embodiment of the present disclosure;

图5是本公开实施例所适用的一种可配置交换网络的示意图;FIG. 5 is a schematic diagram of a configurable switching network to which an embodiment of the present disclosure is applicable;

图6是本公开实施例所适用的一种替换关键字段信息的流程示意图;FIG. 6 is a schematic flow diagram of replacing key field information applicable to an embodiment of the present disclosure;

图7是本公开实施例所适用的另一种可配置交换网络的示意图;FIG. 7 is a schematic diagram of another configurable switching network to which an embodiment of the present disclosure is applicable;

图8是本公开实施例提供的一种报文处理装置的结构图;FIG. 8 is a structural diagram of a message processing device provided by an embodiment of the present disclosure;

图9是用来实现本公开实施例的报文处理方法的电子设备的结构示意图。Fig. 9 is a schematic structural diagram of an electronic device used to implement the message processing method of the embodiment of the present disclosure.

具体实施方式Detailed ways

以下结合附图对本公开的示范性实施例做出说明,其中包括本公开实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本公开的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and they should be regarded as exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.

随着网络对带宽需求的不断增长,对网关设备的处理能力的要求也越来越高,正在朝着Tbps(百万兆位)稳步迈进,传统通过X86 CPU(Central Processing Unit,中央处理器)以软件方式处理的带宽在百Gbps(千兆位)级别,在性能、成本和运维等方面遇到很大的挑战。可编程交换芯片的出现,可以满足网关对于Tbps级别带宽的高吞吐要求和根据业务需求灵活定义转发行为的高灵活要求,但是由于ASIC(Application Specific IntegratedCircuit,专用继承电路)资源的限制,使得网关在支持并发会话的能力上面存在瓶颈。引入额外的报文处理芯片如FPGA(Field Programmable Gate Array,现场可编程逻辑门阵列)扩展可编程交换芯片的查找表项规模可以满足大容量场景的需求,加上高性能CPU来处理表项的新建和下发,这种异构融合网关的解决方案可以很好的应对未来网关场景的各类需求。With the continuous growth of the bandwidth demand of the network, the processing capability of the gateway equipment is also higher and higher, and it is steadily moving towards Tbps (trillion megabits). The traditional X86 CPU (Central Processing Unit, central processing unit) The bandwidth processed by software is at the level of hundreds of Gbps (gigabits), which encounters great challenges in terms of performance, cost, and operation and maintenance. The emergence of programmable switching chips can meet the gateway's high throughput requirements for Tbps-level bandwidth and the high flexibility of forwarding behaviors according to business requirements. However, due to the limitation of ASIC (Application Specific Integrated Circuit, dedicated inheritance circuit) There is a bottleneck in the ability to support concurrent sessions. The introduction of additional message processing chips such as FPGA (Field Programmable Gate Array, Field Programmable Logic Gate Array) to expand the scale of lookup table items of programmable switching chips can meet the needs of large-capacity scenarios, and high-performance CPUs are used to process table items. Newly built and distributed, this heterogeneous fusion gateway solution can well meet various needs of future gateway scenarios.

可编程交换芯片作为网关设备外挂的查找引擎,将需要查找的关键字发送给报文处理芯片,报文处理芯片完成查表动作之后将结果返回给可编程交换芯片。通常,可编程交换芯片将查找关键字插入到整个报文的头部,称为metadata。也即,metadata可以为报文处理芯片所在设备处理生成的报文头部数据,其包括关键字段信息,如查找关键字等。报文处理芯片则按照预设的格式从metadata中提取出查找关键字,然后将查找结果替换掉metadata中的查找关键字返回给可编程交换芯片。由于大多数的业务都比较复杂,可编程交换芯片可能需要通过流水线折叠的方式来满足业务的需求,此时报文处理芯片需要作为查找表嵌入到流水线处理当中,使得metadata中除了包含查找关键字之外,还会有后级流水线所需要的信息。而且由于业务的不断变化以及可编程交换芯片的编译限制和约束,使得可编程交换芯片和报文处理芯片约定的metadata的长度、格式以及关键字信息的位置等可能需要不断的调整才能最终满足业务的需求。但由于报文处理芯片无法实现在线更新的功能,当metadata变更时,提取关键字的预设格式也会变更,无法实现线上在线更新的报文处理芯片则需要重新综合、布局和布线。也即,报文处理芯片需要线下完成更新后,才能重新参与报文处理流程,无疑影响了网关设备中报文处理芯片的适配效率,进而降低了报文处理的效率。The programmable switch chip acts as a search engine plugged into the gateway device, and sends the keywords to be searched to the message processing chip, and the message processing chip returns the result to the programmable switch chip after completing the table lookup action. Usually, the programmable switching chip inserts the search keyword into the header of the entire message, which is called metadata. That is, the metadata may be the header data of the message generated by the processing of the device where the message processing chip is located, which includes key field information, such as search keywords. The message processing chip extracts the search keyword from the metadata according to the preset format, and then replaces the search keyword in the metadata with the search result and returns it to the programmable switching chip. Since most services are relatively complex, the programmable switching chip may need to meet the needs of the service through pipeline folding. At this time, the message processing chip needs to be embedded in the pipeline as a lookup table, so that the In addition, there will be information required by the post-stage pipeline. Moreover, due to the constant changes in the business and the compilation limitations and constraints of the programmable switching chip, the length, format, and location of keyword information agreed by the programmable switching chip and the message processing chip may need to be continuously adjusted to finally meet the requirements of the business. demand. However, since the message processing chip cannot implement the online update function, when the metadata changes, the preset format for extracting keywords will also change, and the message processing chip that cannot implement online update needs to be re-synthesized, laid out, and wired. That is to say, the message processing chip needs to be updated offline before it can participate in the message processing process again, which undoubtedly affects the adaptation efficiency of the message processing chip in the gateway device, thereby reducing the efficiency of message processing.

在一个示例中,图1是本公开实施例提供的一种报文处理方法的流程图,本实施例可适用于根据原始报文输入数据截取的字段信息按需处理原始报文输入数据的情况,该方法应用于报文处理芯片,可以由报文处理装置来执行,该装置可以由软件和/或硬件的方式来实现,并一般可集成在电子设备中。该电子设备可以是终端设备,也可以是服务器设备,电子设备例如可以是网关设备或交换机设备等具有报文处理和转发功能的网络设备等,本公开实施例并不对电子设备的具体设备类型进行限定。相应的,如图1所示,该方法包括如下操作:In an example, FIG. 1 is a flow chart of a message processing method provided by an embodiment of the present disclosure. This embodiment is applicable to the case where the original message input data is processed on demand according to field information intercepted from the original message input data. , the method is applied to a message processing chip, and can be executed by a message processing device, which can be implemented by software and/or hardware, and can generally be integrated in electronic equipment. The electronic device may be a terminal device or a server device. For example, the electronic device may be a network device such as a gateway device or a switch device with message processing and forwarding functions. limited. Correspondingly, as shown in Figure 1, the method includes the following operations:

S110、获取原始报文输入数据。S110. Obtain original packet input data.

其中,原始报文输入数据可以是输入至报文处理芯片的报文数据,可以包括但不限于原始报文数据和经处理加工的关键信息等报文数据。原始报文数据则可以理解为未经过任何处理的报文数据,即网络设备初始接收的报文数据。Wherein, the original message input data may be message data input to the message processing chip, and may include but not limited to original message data and processed key information and other message data. The original packet data can be understood as the packet data without any processing, that is, the packet data initially received by the network device.

在本公开实施例中,报文处理芯片可以获取原始报文输入数据,作为报文处理芯片的报文输入。可以理解的是,报文处理芯片接收的原始报文输入数据可能与报文处理芯片所在设备接收的原始报文数据并不同。报文处理芯片接收的原始报文输入数据可以为原始报文数据经过一定的处理流程后得到的报文数据。可选的,报文处理芯片可以包括FPGA或其他无法实现在线功能更新的可处理报文数据的芯片类型。In the embodiment of the present disclosure, the message processing chip can obtain the original message input data as the message input of the message processing chip. It can be understood that the original message input data received by the message processing chip may be different from the original message data received by the device where the message processing chip is located. The original message input data received by the message processing chip may be message data obtained after the original message data undergoes a certain processing procedure. Optionally, the message processing chip may include an FPGA or other chip types capable of processing message data that cannot implement online function updates.

示例性的,原始报文输入数据可以包括但不限于原始报文数据和包含key(关键字)的metadata等报文数据。Exemplarily, the original message input data may include but not limited to original message data and message data including key (keyword) metadata.

S120、对原始报文输入数据截取目标关键字段信息;其中,目标关键字段信息可以包括目标原始字段信息等。S120. Intercept target key field information from the input data of the original message; wherein, the target key field information may include target original field information and the like.

其中,目标关键字段信息可以理解为当前在原始报文输入数据中需要提取的关键字段信息。目标原始字段信息可以包括原始报文输入数据中的全部预处理的字段信息,这些预处理的字段信息需要进一步经报文处理芯片机芯查找替换处理。例如,目标原始字段信息可以是原始报文输入数据中的metadata的字段信息等。Wherein, the target key field information can be understood as the key field information that currently needs to be extracted from the input data of the original message. The target original field information may include all preprocessed field information in the original message input data, and these preprocessed field information needs to be further searched and replaced by the message processing chip core. For example, the target original field information may be metadata field information in the input data of the original message.

相应的,报文处理芯片在获取到原始报文输入数据之后,可以对原始报文输入数据截取包含有目标原始字段信息的目标关键字段信息。Correspondingly, after obtaining the original message input data, the message processing chip can intercept the target key field information including the target original field information from the original message input data.

可以理解的是,目标关键字段信息如果采用现有报文处理方法需要按照预设格式提取原始报文输入数据中的关键字段信息,可能会出现因为原始报文输入数据格式发生变化导致预设格式发生变化,进而需要对报文处理芯片进行重新编码、综合、布局和布线等问题。It is understandable that if the target key field information needs to be extracted according to the preset format by using the existing message processing method, the key field information in the input data of the original message may appear due to changes in the format of the input data of the original message. If the design format changes, the message processing chip needs to be recoded, synthesized, placed and wired.

本公开实施例通过对原始报文输入数据采用截取的方式获取其目标关键字段信息,因此无论原始报文输入数据的格式如何变化,报文处理芯片对原始报文输入数据所截取的目标关键字段信息也能够包括全部的目标原始字段信息。相应的,报文处理芯片后续可以从全部的目标原始字段信息中进一步获取所需处理的关键字段信息并继续处理。The embodiment of the present disclosure obtains the target key field information by intercepting the original message input data, so no matter how the format of the original message input data changes, the message processing chip intercepts the target key field of the original message input data. Field information can also include all target original field information. Correspondingly, the message processing chip can further obtain key field information to be processed from all target original field information and continue processing.

由此可见,当原始报文输入数据的格式发生变化时,即使报文处理芯片无法实现在线功能更新,也同样能够获取到完整的目标原始字段信息,进而根据获取的完整的目标原始字段信息不间断地进行后续的报文处理流程,提高了报文处理芯片的适配效率,进而保证了报文处理的效率。It can be seen that when the format of the input data of the original message changes, even if the message processing chip cannot realize the online function update, it can also obtain the complete target original field information, and then according to the acquired complete target original field information The follow-up message processing process is performed intermittently, which improves the adaptation efficiency of the message processing chip, thereby ensuring the efficiency of message processing.

S130、根据目标关键字段信息生成目标结果报文数据。S130. Generate target result message data according to target key field information.

其中,目标结果报文数据可以是报文处理芯片按照预期的报文处理方式对目标关键字段信息进行处理所生成的结果数据。Wherein, the target result message data may be the result data generated by the message processing chip processing the target key field information according to the expected message processing mode.

相应的,报文处理芯片可以根据从原始报文输入数据中截取到的目标关键字段信息,按照预期的报文处理方式对其进行处理,如查找替换字段并对其进行替换等,从而生成目标结果报文数据。Correspondingly, the message processing chip can process it according to the expected message processing method according to the target key field information intercepted from the input data of the original message, such as searching for the replacement field and replacing it, etc., thereby generating Target result message data.

S140、根据原始报文输入数据和目标结果报文数据生成原始报文输出数据。S140. Generate original message output data according to the original message input data and the target result message data.

其中,原始报文输出数据可以是原始报文数据经过报文处理芯片完整的报文处理流程处理后所得到的报文数据。Wherein, the original message output data may be the message data obtained after the original message data is processed by the complete message processing flow of the message processing chip.

相应的,报文处理芯片可以根据原始报文输入数据和目标结果报文数据生成原始报文输出数据。例如,报文处理芯片可以对原始报文输入数据和目标结果报文数据进行组合或拼接等,从而生成原始报文输出数据。Correspondingly, the message processing chip can generate original message output data according to the original message input data and the target result message data. For example, the message processing chip can combine or concatenate the original message input data and the target result message data to generate the original message output data.

本公开实施例通过获取原始报文输入数据,从而对原始报文输入数据截取包括目标原始字段信息的目标关键字段信息,以根据目标关键字段信息生成目标结果报文数据,从而根据原始报文输入数据和目标结果报文数据生成原始报文输出数据。基于原始报文输入数据截取的目标关键字段信息对原始报文输入数据在线进行报文处理,可以解决报文处理芯片需要线下更新信息提取功能的问题,能够提高报文处理芯片的适配效率,进而提高报文处理的效率。The embodiment of the present disclosure obtains the original message input data, thereby intercepting the target key field information including the target original field information from the original message input data, so as to generate the target result message data according to the target key field information, so that according to the original message Raw message output data is generated from text input data and target result message data. Based on the target key field information intercepted from the original message input data, the original message input data is processed online, which can solve the problem that the message processing chip needs to update the information extraction function offline, and can improve the adaptation of the message processing chip Efficiency, thereby improving the efficiency of packet processing.

在一个示例中,图2是本公开实施例提供的一种报文处理方法的流程图,本公开实施例在上述各实施例的技术方案的基础上,进行了优化改进,给出了对原始报文输入数据截取目标关键字段信息、根据目标关键字段信息生成目标结果报文数据以及根据原始报文输入数据和目标结果报文数据生成原始报文输出数据的多种具体实现方式。In an example, FIG. 2 is a flow chart of a message processing method provided by an embodiment of the present disclosure. On the basis of the technical solutions of the above-mentioned embodiments, the embodiments of the present disclosure have optimized and improved the original The message input data intercepts the target key field information, generates the target result message data according to the target key field information, and generates the original message output data according to the original message input data and the target result message data.

如图2所示的一种报文处理方法,包括:A message processing method as shown in Figure 2, comprising:

S210、获取原始报文输入数据。S210. Obtain original message input data.

S220、确定原始报文输入数据的预设报文截取方向和报文截取长度。S220. Determine the preset message interception direction and message interception length of the original message input data.

其中,预设报文截取方向可以是预先设置的对报文数据进行截取的方向,例如可以从原始报文输入数据的头部、中间部分或尾部等方向进行报文截取。报文截取长度可以是截取的报文数据的长度。Wherein, the preset message interception direction may be a preset direction for intercepting message data, for example, the message may be intercepted from the head, middle or tail of the original message input data. The packet interception length may be the length of the intercepted packet data.

在本公开实施例中,报文处理芯片在获取到原始报文输入数据之后,可以根据原始报文输入数据确定原始报文输入数据的预设报文截取方向和报文截取长度。可以理解的是,预设报文截取方向可以根据目标原始字段信息在原始报文输入数据中的位置来确定。报文截取长度则可以根据目标原始字段信息的长度来确定。In the embodiment of the present disclosure, after acquiring the original message input data, the message processing chip may determine the preset message interception direction and message interception length of the original message input data according to the original message input data. It can be understood that the preset message interception direction may be determined according to the position of the target original field information in the input data of the original message. The message interception length can be determined according to the length of the target original field information.

在本公开的一个可选实施例中,确定原始报文输入数据的预设报文截取方向,可以包括:确定原始报文输入数据的起始截取字段和终止截取字段;将起始截取字段的位置到终止截取字段的位置之间的方向作为预设报文截取方向。In an optional embodiment of the present disclosure, determining the preset message interception direction of the original message input data may include: determining the start interception field and the end interception field of the original message input data; The direction between the location and the location where the interception field is terminated is used as the preset packet interception direction.

其中,起始截取字段可以是原始报文输入数据头部的第一个字段,也可以是原始报文输入数据头部的最后一个字段,或者还可以是原始报文输入数据中间部分的任意一个字段。终止截取字段可以包括但不限于头部、中间部分和尾部的某个字段等。可以理解的是,起始截取字段和终止截取字段不是相同的字段。本公开实施例并不对起始截取字段和终止截取字段在原始报文输入数据中的位置进行限定。Among them, the initial interception field can be the first field of the input data header of the original message, or the last field of the input data header of the original message, or any one of the middle part of the input data of the original message field. The terminating interception field may include, but not limited to, a certain field in the header, middle part, and tail. It can be understood that the start intercept field and the end intercept field are not the same field. The embodiment of the present disclosure does not limit the positions of the start truncation field and the end truncation field in the input data of the original message.

相应的,报文处理芯片可以确定原始报文输入数据的起始截取字段和终止截取字段,以将起始截取字段的位置到终止截取字段的位置之间的方向作为预设报文截取方向。Correspondingly, the message processing chip can determine the start interception field and the end interception field of the input data of the original message, and use the direction between the position of the start interception field and the position of the end interception field as the preset message interception direction.

上述技术方案,通过将原始报文输入数据的起始截取字段到终止截取字段的方向作为预设报文截取方向,可以提高报文截取方向的灵活性,满足各种位置分布的目标原始字段信息的截取需求。In the above technical solution, by using the direction from the initial interception field to the termination interception field of the input data of the original message as the preset message interception direction, the flexibility of the message interception direction can be improved, and the target original field information distributed in various positions can be satisfied. interception requirements.

在本公开的一个可选实施例中,确定原始报文输入数据的报文截取长度,可以包括:确定原始报文输入数据的关键字段信息的字段总体长度;计算字段总体长度与预留长度的和值,作为报文截取长度。In an optional embodiment of the present disclosure, determining the message interception length of the original message input data may include: determining the total field length of the key field information of the original message input data; calculating the total field length and the reserved length The sum value is used as the packet interception length.

其中,关键字段信息可以是需要提取的关键的字段信息,例如可以是原始报文输入数据中需要提取的与key相关的字段。关键字段信息的字段总体长度可以是需要替换的字段信息的总长度。The key field information may be key field information that needs to be extracted, for example, it may be a key-related field that needs to be extracted in the input data of the original message. The total field length of the key field information may be the total length of the field information to be replaced.

可选的,报文处理芯片可以通过确定原始报文输入数据的关键字段信息的字段总体长度,从而计算字段总体长度与预留长度的和值,以作为报文截取长度。Optionally, the message processing chip may calculate the sum of the total field length and the reserved length by determining the total field length of the key field information of the input data of the original message as the message interception length.

可选的,为了提高字段信息截取的准确性,即能够截取到全部的目标原始字段信息,可以将关键字段信息的字段总体长度设置为metadata的长度。相应的,报文截取长度可以为metadata的长度与预留长度的和值,以保证能够截取到全部的metdata字段信息。Optionally, in order to improve the accuracy of field information interception, that is, to be able to intercept all target original field information, the overall field length of key field information may be set to the length of metadata. Correspondingly, the message interception length may be the sum of the metadata length and the reserved length, so as to ensure that all the metdata field information can be intercepted.

上述技术方案,通过将原始报文输入数据的关键字段信息的字段总体长度与预留长度的和值,作为报文截取长度,可以保证字段信息截取的完整性。In the above technical solution, by using the sum of the total field length and the reserved length of the key field information of the original message input data as the message interception length, the integrity of the field information interception can be guaranteed.

S230、按照预设报文截取方向对原始报文输入数据截取报文截取长度的信息,得到截取报文字段信息。S230. According to the preset message interception direction, the original message input data intercepts the message interception length information to obtain the intercepted message field information.

其中,截取报文字段信息可以是按照预设报文截取方向对原始报文输入数据截取报文截取长度得到的部分报文字段信息。Wherein, the intercepted message field information may be partial message field information obtained by intercepting the message intercepted length from the original message input data according to the preset message intercepting direction.

相应的,报文处理芯片可以按照预设报文截取方向对原始报文输入数据截取报文截取长度的信息,以得到截取报文字段信息。Correspondingly, the message processing chip can intercept the message interception length information from the original message input data according to the preset message interception direction, so as to obtain the intercepted message field information.

S240、根据截取报文字段信息获取目标关键字段信息。S240. Acquire target key field information according to the field information of the intercepted message.

相应的,报文处理芯片可以对截取报文字段信息进行信息定位和提取等,以获取目标关键字段信息。Correspondingly, the message processing chip can perform information location and extraction on the field information of the intercepted message to obtain target key field information.

上述技术方案,通过预设报文截取方向和报文截取长度对原始报文输入数据截取目标关键字段信息,可以保证截取到的目标关键字段信息包括完整的目标原始字段信息,进而保证报文处理的可靠性和准确性。The above technical solution, by presetting the message interception direction and the message interception length, intercepts the target key field information of the original message input data, which can ensure that the intercepted target key field information includes the complete target original field information, thereby ensuring that the report Reliability and accuracy of document processing.

在本公开的一个可选实施例中,根据截取报文字段信息获取目标关键字段信息,可以包括:在确定截取报文字段信息中的关键字段信息为离散字段信息的情况下,对截取报文字段信息中的关键字段信息进行汇聚处理;提取汇聚处理后的截取报文字段信息中的关键字段信息,得到目标关键字段信息。In an optional embodiment of the present disclosure, obtaining the target key field information according to the intercepted message field information may include: when it is determined that the key field information in the intercepted message field information is discrete field information, the intercepted The key field information in the message field information is aggregated; the key field information in the intercepted message field information after the aggregation process is extracted to obtain the target key field information.

其中,离散字段信息可以理解为离散分布的字段信息。汇聚处理可以理解为将离散字段信息汇聚在一起得到一段连续分布的字段信息的处理操作。Wherein, discrete field information can be understood as discretely distributed field information. Aggregation processing can be understood as a processing operation that gathers discrete field information together to obtain a piece of continuously distributed field information.

可以理解的,报文处理芯片需要提取的关键信息在截取报文字段信息中可以是离散分布的,也还可以是集中分布的。可选的,当根据截取报文字段信息获取目标关键字段信息时,报文处理芯片可以判断截取报文字段信息中的关键字段信息是否为离散字段信息。如果报文处理芯片确定截取报文字段信息中的关键字段信息为离散字段信息,为了便于关键字段信息的信息提取过程,可以对截取报文字段信息中的关键字段信息进行汇聚处理,也即将离散分布的关键字段信息汇聚成连续分布的关键字段信息,从而提取连续分布的关键字段信息,以得到目标关键字段信息。如果报文处理芯片确定截取报文字段信息中的关键字段信息为连续分布的字段信息,表明截取报文字段信息中的关键字段信息已经为汇聚状态,则不需要再对关键字段信息进行汇聚处理,可以直接从关键字段信息中提取目标关键字段信息。It can be understood that the key information to be extracted by the message processing chip may be discretely distributed or centrally distributed in the field information of the intercepted message. Optionally, when the target key field information is obtained according to the intercepted message field information, the message processing chip may determine whether the key field information in the intercepted message field information is discrete field information. If the message processing chip determines that the key field information in the intercepted message field information is discrete field information, in order to facilitate the information extraction process of the key field information, the key field information in the intercepted message field information can be aggregated, That is to say, the discretely distributed key field information is aggregated into the continuously distributed key field information, thereby extracting the continuously distributed key field information to obtain the target key field information. If the message processing chip determines that the key field information in the intercepted message field information is continuously distributed field information, it indicates that the key field information in the intercepted message field information has already been in an aggregated state, and then there is no need to update the key field information The aggregation process can directly extract the target key field information from the key field information.

上述技术方案,通过对离散字段信息进行汇聚处理,可以将截取报文字段信息中的关键字段信息组成连续的关键字段信息,可以提高关键字段信息的处理效率。In the above technical solution, by performing aggregation processing on the discrete field information, the key field information in the intercepted message field information can be formed into continuous key field information, which can improve the processing efficiency of the key field information.

S250、根据目标关键字段信息查找预设表格数据,以获取目标关键字段信息匹配的结果替换字段信息。S250. Search the preset table data according to the target key field information, so as to obtain the replacement field information of a matching result of the target key field information.

其中,预设表格数据可以是预先设置的可用于查找关键字段信息的表格数据。结果替换字段信息可以理解为需要对目标关键字段信息进行替换的字段信息。Wherein, the preset form data may be pre-set form data that can be used to search key field information. The result replacement field information can be understood as the field information that needs to be replaced with the target key field information.

相应的,报文处理芯片在提取到目标关键字段信息之后,即可以根据目标关键字段信息查找预设表格数据,以获取目标关键字段信息匹配的结果替换字段信息。Correspondingly, after the message processing chip extracts the target key field information, it can search the preset table data according to the target key field information, so as to obtain the result of matching the target key field information to replace the field information.

S260、根据结果替换字段信息替换目标原始字段信息中的目标字段信息,得到目标结果报文数据。S260. Replace the target field information in the target original field information according to the result replacement field information to obtain target result message data.

其中,目标字段信息可以理解为目标原始字段信息中当前需要进行替换的字段信息。Wherein, the target field information can be understood as field information that currently needs to be replaced in the target original field information.

相应的,报文处理芯片在获取到目标关键字段信息匹配的结果替换字段信息之后,可以根据结果替换字段信息替换目标原始字段信息中的目标字段信息,以得到目标结果报文数据。Correspondingly, after the message processing chip obtains the result replacement field information matching the target key field information, it can replace the target field information in the target original field information according to the result replacement field information to obtain the target result message data.

上述技术方案,通过查找预设表格数据,可以将与目标关键字段信息匹配的结果替换字段信息替换目标原始字段信息中的目标字段信息,从而得到目标结果报文数据,提高了结果替换字段信息的处理效率,从而提高报文处理的效率。In the above technical solution, by searching the preset table data, the result replacement field information matching the target key field information can replace the target field information in the target original field information, thereby obtaining the target result message data, and improving the result replacement field information. processing efficiency, thereby improving the efficiency of packet processing.

在本公开的一个可选实施例中,根据结果替换字段信息替换目标原始字段信息中的目标字段信息,得到目标结果报文数据,可以包括:将结果替换字段信息的长度扩展至目标长度,得到扩展替换字段信息;其中,目标长度可以为目标原始字段信息的长度;根据扩展替换字段信息和目标原始字段信息生成替换结果报文数据;根据替换结果报文数据替换目标原始字段信息中的目标字段信息,得到目标结果报文数据。In an optional embodiment of the present disclosure, replacing the target field information in the target original field information according to the result replacement field information to obtain the target result message data may include: extending the length of the result replacement field information to the target length, obtaining Extended replacement field information; wherein, the target length can be the length of the target original field information; generate replacement result message data according to the extended replacement field information and target original field information; replace the target field in the target original field information according to the replacement result message data information to get the target result message data.

其中,目标长度可以是结果替换字段信息经过扩展后需要达到的长度。可选的,当将目标原始字段信息作为报文处理芯片的处理对象时,目标长度可以是metadata的长度。扩展替换字段信息可以是结果替换字段信息将长度扩展至目标长度后得到的字段信息。替换结果报文数据可以是需要替换原始报文输入数据中部分报文数据的参考报文数据。目标字段信息可以理解为目标原始字段信息中当前需要进行替换的字段信息。Wherein, the target length may be the length that needs to be achieved after the result replacement field information is expanded. Optionally, when the target original field information is used as the processing object of the message processing chip, the target length may be the length of metadata. The extended replacement field information may be field information obtained by extending the length of the result replacement field information to the target length. The replacement result message data may be reference message data that needs to replace part of the message data in the original message input data. The target field information can be understood as the field information that currently needs to be replaced in the target original field information.

在生成目标结果报文数据之前,报文处理芯片可以首先将结果替换字段信息的长度扩展至目标原始字段信息的长度,以得到扩展替换字段信息,使得扩展替换字段信息能够与原始报文输入数据中的目标原始字段信息保持长度统一,便于后续对扩展替换字段信息和原始报文输入数据中的目标原始字段信息进行一一比对。进一步的,报文处理芯片可以根据扩展替换字段信息和目标原始字段信息的比对结果生成最终可用的替换结果报文数据,并利用替换结果报文数据替换目标原始字段信息中的目标字段信息,以得到目标结果报文数据。可以理解的是,目标结果报文数据可以是报文处理芯片对目标原始字段信息中的目标字段信息进行处理后得到的部分报文数据,例如可以是包括替换信息的metadata。Before generating the target result message data, the message processing chip can first extend the length of the result replacement field information to the length of the target original field information to obtain the extended replacement field information, so that the extended replacement field information can be compared with the original message input data The length of the target original field information in is kept uniform, which is convenient for subsequent one-to-one comparison between the extended replacement field information and the target original field information in the input data of the original message. Further, the message processing chip can generate the final available replacement result message data according to the comparison result of the extended replacement field information and the target original field information, and use the replacement result message data to replace the target field information in the target original field information, To get the target result message data. It can be understood that the target result message data may be part of the message data obtained after the message processing chip processes the target field information in the target original field information, for example, it may be metadata including replacement information.

上述技术方案,通过根据替换结果报文数据替换目标原始字段信息中的目标字段信息,从而得到目标结果报文数据,能够实现对目标字段信息的在线实时替换,可以提高报文处理芯片的适配效率。In the above technical solution, by replacing the target field information in the target original field information according to the replacement result message data, the target result message data can be obtained, which can realize online real-time replacement of the target field information, and can improve the adaptation of the message processing chip. efficiency.

在本公开的一个可选实施例中,根据扩展替换字段信息和目标原始字段信息生成替换结果报文数据,可以包括:确定扩展替换字段信息在目标原始字段信息中的信息插入位置;按照信息插入位置对扩展替换字段信息中的数据进行调整,得到替换结果报文数据。In an optional embodiment of the present disclosure, generating the replacement result message data according to the extended replacement field information and the target original field information may include: determining the information insertion position of the extended replacement field information in the target original field information; The position adjusts the data in the extended replacement field information to obtain the replacement result message data.

其中,信息插入位置可以是当前需要插入扩展替换字段信息的位置。Wherein, the information insertion position may be the position where the extended replacement field information needs to be inserted currently.

具体的,在生成替换结果报文数据时,报文处理芯片可以通过确定扩展替换字段信息在目标原始字段信息中的信息插入位置,从而按照信息插入位置对扩展替换字段信息中的数据进行调整,以得到替换结果报文数据。示例性的,扩展替换字段信息中的result0在目标原始字段信息中的信息插入位置为第二个字节,则可以将result0调整为扩展替换字段信息的第二字节的数据。Specifically, when generating the replacement result message data, the message processing chip can adjust the data in the extended replacement field information according to the information insertion position by determining the information insertion position of the extended replacement field information in the target original field information, to obtain the replacement result message data. Exemplarily, the information insertion position of result0 in the extended replacement field information in the target original field information is the second byte, then result0 may be adjusted to the data of the second byte of the extended replacement field information.

上述技术方案,通过确定扩展替换字段信息在目标原始字段信息中的信息插入位置,将扩展替换字段信息中的数据按照信息插入位置进行调整,可以保证得到的替换结果报文数据中的字段数据的准确性和合理性。In the above technical solution, by determining the information insertion position of the extended replacement field information in the target original field information, and adjusting the data in the extended replacement field information according to the information insertion position, the accuracy of the field data in the obtained replacement result message data can be guaranteed. accuracy and reasonableness.

在本公开的一个可选实施例中,根据替换结果报文数据替换目标原始字段信息中的目标字段信息,得到目标结果报文数据,可以包括:根据替换结果报文数据生成有效比特向量;根据有效比特向量从替换结果报文数据中确定有效替换字段数据,并从目标原始字段信息中确定有效原始报文数据;将有效替换字段数据和有效原始报文数据进行组合,得到目标结果报文数据。In an optional embodiment of the present disclosure, replacing the target field information in the target original field information according to the replacement result message data to obtain the target result message data may include: generating an effective bit vector according to the replacement result message data; The effective bit vector determines the effective replacement field data from the replacement result message data, and determines the effective original message data from the target original field information; combines the effective replacement field data and the effective original message data to obtain the target result message data .

其中,有效比特向量可以用于作为参考基准对替换结果报文数据和目标原始字段信息进行组合。可选的,有效比特向量可以由若干数量的0和若干数量的1组成。有效替换字段数据可以是替换结果报文数据中需要保留的字段数据。有效原始报文数据可以是目标原始字段信息中需要保留的字段数据。Wherein, the effective bit vector can be used as a reference to combine the replacement result message data and the target original field information. Optionally, the valid bit vector may consist of a number of 0s and a number of 1s. The effective replacement field data may be field data that needs to be retained in the replacement result message data. The valid original message data may be the field data that needs to be kept in the original field information of the target.

相应的,报文处理芯片可以根据替换结果报文数据生成有效比特向量,从而根据有效比特向量从替换结果报文数据中确定有效替换字段数据,并从目标原始字段信息中确定有效原始报文数据,进而将有效替换字段数据和有效原始报文数据进行组合,以得到目标结果报文数据。Correspondingly, the message processing chip can generate a valid bit vector according to the message data of the replacement result, so as to determine the valid replacement field data from the message data of the replacement result according to the valid bit vector, and determine the valid original message data from the target original field information , and then combine the valid replacement field data with the valid original message data to obtain the target result message data.

上述技术方案,通过引入有效比特向量的应用,可以提高从替换结果报文数据中确定有效替换字段数据的效率。The above technical solution can improve the efficiency of determining the effective replacement field data from the replacement result message data by introducing the application of the effective bit vector.

在本公开的一个可选实施例中,根据替换结果报文数据生成有效比特向量,可以包括;根据替换结果报文数据的长度生成初始比特向量;其中,初始比特向量的各个比特取值可以为初始默认值;根据替换结果报文数据中替换字段信息的分布情况更新初始比特向量的各个比特取值,得到有效比特向量。In an optional embodiment of the present disclosure, generating an effective bit vector according to the replacement result message data may include; generating an initial bit vector according to the length of the replacement result message data; wherein, each bit value of the initial bit vector may be The initial default value; according to the distribution of the replacement field information in the replacement result message data, each bit value of the initial bit vector is updated to obtain a valid bit vector.

其中,初始比特向量也即初始状态下的有效比特向量。初始默认值可以是初始设定的数值,例如可以是0或1。替换字段信息可以理解为替换结果报文数据中可以用于对目标原始字段信息中的字段信息进行替换的字段信息。Wherein, the initial bit vector is also the effective bit vector in the initial state. The initial default value may be an initially set value, such as 0 or 1. The replacement field information can be understood as the field information in the replacement result message data that can be used to replace the field information in the target original field information.

具体的,处理报文芯片可以根据替换结果报文数据的长度生成各个比特取值为初始默认值的初始比特向量,从而根据替换结果报文数据中替换字段信息的分布情况更新初始比特向量的各个比特取值,以得到有效比特向量。Specifically, the message processing chip can generate an initial bit vector with each bit value as an initial default value according to the length of the replacement result message data, so as to update each of the initial bit vectors according to the distribution of the replacement field information in the replacement result message data. Bit values to get a valid bit vector.

可选的,初始比特向量的长度可以与替换结果报文数据的长度相同,即初始比特向量的比特数与替换结果报文数据的比特数相同,为一对一(一个比特位对应一个比特位)的关系。也即,替换结果报文数据的比特数量为n时,初始比特向量的比特数量也为n。初始比特向量的长度还可以与替换结果报文数据的长度不同,如初始比特向量的比特数与替换结果报文数据的字节数相同,为一对多(一个比特位对应一个字节位,也即一个比特位对应多个比特位)的关系。也即,替换结果报文数据的字节数量为n时,初始比特向量的比特数量也为n。可以理解的是,有效比特向量的长度与初始比特向量的长度相同。Optionally, the length of the initial bit vector can be the same as the length of the replacement result message data, that is, the bit number of the initial bit vector is the same as the bit number of the replacement result message data, which is one-to-one (one bit corresponds to one bit )Relationship. That is, when the number of bits of the replacement result message data is n, the number of bits of the initial bit vector is also n. The length of the initial bit vector can also be different from the length of the replacement result message data, as the bit number of the initial bit vector is the same as the byte number of the replacement result message data, which is one-to-many (one bit corresponds to one byte, That is, one bit corresponds to multiple bits). That is, when the number of bytes of the replacement result message data is n, the number of bits of the initial bit vector is also n. It can be understood that the effective bit vector has the same length as the initial bit vector.

上述技术方案,通过根据替换结果报文数据的长度生成初始比特向量,从而根据替换结果报文数据中替换字段信息的分布情况更新初始比特向量的各个比特取值,以得到有效比特向量,可以保证有效比特向量的准确性。The above technical solution generates an initial bit vector according to the length of the replacement result message data, thereby updating each bit value of the initial bit vector according to the distribution of the replacement field information in the replacement result message data to obtain an effective bit vector, which can ensure The accuracy of the effective bit vector.

在本公开的一个可选实施例中,根据有效比特向量从替换结果报文数据中确定有效替换字段数据,并从目标原始字段信息中确定有效原始报文数据,可以包括:确定有效比特向量中当前比特的当前相对位置;在确定有效比特向量的当前比特的取值为第一数值的情况下,从替换结果报文数据中获取当前相对位置处的比特数据作为有效替换字段数据;在确定有效比特向量的当前比特的取值为第二数值的情况下,从目标原始字段信息中获取当前相对位置处的比特数据作为有效原始报文数据。In an optional embodiment of the present disclosure, determining the valid replacement field data from the replacement result message data according to the valid bit vector, and determining the valid original message data from the target original field information may include: determining the effective bit vector The current relative position of the current bit; in the case of determining that the value of the current bit of the effective bit vector is the first value, obtain the bit data at the current relative position from the replacement result message data as the effective replacement field data; When the value of the current bit of the bit vector is the second value, the bit data at the current relative position is obtained from the target original field information as valid original message data.

其中,当前相对位置可以理解为当前比特在有效比特向量中的相对位置。第一数值可以用于确定是否需要从替换结果报文数据中获取当前相对位置处的比特数据作为有效替换字段数据。第二数值可以用于确定是否需要从目标原始字段信息中获取当前相对位置处的比特数据作为有效原始报文数据。Wherein, the current relative position can be understood as the relative position of the current bit in the effective bit vector. The first value may be used to determine whether to obtain the bit data at the current relative position from the replacement result message data as valid replacement field data. The second value may be used to determine whether to obtain the bit data at the current relative position from the target original field information as valid original message data.

相应的,报文处理芯片可以确定有效比特向量中当前比特的当前相对位置,如果确定有效比特向量的当前比特的取值为第一数值,表明在目标结果报文数据的当前位置处需要保留替换结果报文数据对应位置处的数据,则可以从替换结果报文数据中获取当前相对位置处的比特数据作为有效替换字段数据。如果确定有效比特向量的当前比特的取值为第二数值,表明在目标结果报文数据的当前位置处需要保留目标原始字段信息对应位置处的数据,则可以从目标原始字段信息中获取当前相对位置处的比特数据作为有效原始报文数据。Correspondingly, the message processing chip can determine the current relative position of the current bit in the valid bit vector. If it is determined that the value of the current bit of the valid bit vector is the first value, it indicates that the current position of the target result message data needs to be reserved and replaced. For the data at the corresponding position of the result message data, the bit data at the current relative position can be obtained from the replacement result message data as effective replacement field data. If it is determined that the value of the current bit of the effective bit vector is the second value, indicating that the data at the corresponding position of the target original field information needs to be retained at the current position of the target result message data, then the current relative position can be obtained from the target original field information. The bit data at the position is regarded as valid original message data.

上述技术方案,通过根据有效比特向量每个比特位的具体取值确定有效替换字段数据和有效原始报文数据,可以提高有效替换字段数据和有效原始报文数据确定的效率和准确率。In the above technical solution, by determining the effective replacement field data and the effective original message data according to the specific value of each bit of the effective bit vector, the efficiency and accuracy of determining the effective replacement field data and the effective original message data can be improved.

S270、获取原始报文输入数据中包括的原始报文数据,将原始报文数据与目标结果报文数据进行组合,得到原始报文输出数据。S270. Obtain the original message data included in the original message input data, combine the original message data and the target result message data, and obtain the original message output data.

相应的,当报文处理芯片生成目标结果报文数据之后,即可获取原始报文输入数据中包括的原始报文数据,并将原始报文数据与目标结果报文数据进行拼接组合,如将目标结果报文数据与原始报文数据进行首尾相接,以得到原始报文输出数据。Correspondingly, after the message processing chip generates the target result message data, the original message data included in the original message input data can be obtained, and the original message data and the target result message data can be spliced and combined, such as The target result message data is connected end-to-end with the original message data to obtain the original message output data.

上述技术方案,通过将原始报文输入数据中包括的原始报文数据与目标结果报文数据进行组合,从而得到原始报文输出数据,可以实现在线更新处理报文芯片的原始报文输出数据,提高了报文处理芯片的适配效率,从而提高了报文处理的效率。In the above technical solution, the original message output data is obtained by combining the original message data included in the original message input data and the target result message data, and the original message output data of the message chip can be updated online, The adaptation efficiency of the message processing chip is improved, thereby improving the efficiency of message processing.

在本公开的一个可选实施例中,在上述各实施例的基础上,原始报文输入数据可以为关联报文处理芯片对原始报文数据进行处理后生成的报文数据;上述报文处理方法还可以包括:将原始报文输出数据发送至关联报文处理芯片,以通过关联报文处理芯片根据原始报文输出数据生成转发报文。In an optional embodiment of the present disclosure, on the basis of the above-mentioned embodiments, the original message input data may be the message data generated after the associated message processing chip processes the original message data; the above-mentioned message processing The method may further include: sending the output data of the original message to the associated message processing chip, so as to generate a forwarding message according to the output data of the original message through the associated message processing chip.

其中,关联报文处理芯片可以是与报文处理芯片相配合共同处理报文的芯片,例如可以包括但不限于可编程交换芯片等。转发报文可以是将原始报文输出数据经过关联报文处理芯片处理后可以用于转发的报文数据。Wherein, the associated message processing chip may be a chip that cooperates with the message processing chip to jointly process messages, for example, may include but not limited to a programmable switching chip and the like. The forwarded message may be the message data that can be used for forwarding after the output data of the original message is processed by the associated message processing chip.

在本公开实施例中,关联报文处理芯片可以接收原始报文数据并对其进行处理生成原始报文输入数据,并将生成的原始报文输入数据方式至报文处理芯片。报文处理芯片采用上述流程对原始报文输入数据进行处理得到原始报文输出数据,并将得到的原始报文输出数据发送至关联报文处理芯片。关联报文处理芯片则可以根据原始报文输出数据生成转发报文,并对外发送转发报文,完成报文的整体处理流程。In the embodiment of the present disclosure, the associated message processing chip can receive the original message data and process it to generate original message input data, and send the generated original message input data to the message processing chip. The message processing chip uses the above process to process the original message input data to obtain the original message output data, and sends the obtained original message output data to the associated message processing chip. The associated message processing chip can generate a forwarding message according to the output data of the original message, and send the forwarding message externally to complete the overall processing process of the message.

本公开实施例的技术方案,通过获取原始报文输入数据,从而确定原始报文输入数据的预设报文截取方向和报文截取长度,按照预设报文截取方向对原始报文输入数据截取报文截取长度的信息,以得到截取报文字段信息,从而根据截取报文字段信息获取目标关键字段信息,并根据目标关键字段信息查找预设表格数据,以获取目标关键字段信息匹配的结果替换字段信息,进而根据结果替换字段信息替换目标原始字段信息中的目标字段信息,以得到目标结果报文数据,可以实现实时在线更新报文处理芯片的关键字段信息,可以从报文头任意位置提取和插入关键信息,提高了报文处理芯片的适配效率,从而提高了报文处理的效率。In the technical solution of the embodiment of the present disclosure, by obtaining the original message input data, the preset message interception direction and the message interception length of the original message input data are determined, and the original message input data is intercepted according to the preset message interception direction Message interception length information to obtain intercepted message field information, so as to obtain target key field information according to intercepted message field information, and search preset table data according to target key field information to obtain target key field information matching The result replaces the field information, and then replaces the target field information in the target original field information according to the result replacement field information to obtain the target result message data, which can realize real-time online update of the key field information of the message processing chip, and can be obtained from the message Key information can be extracted and inserted at any position of the header, which improves the adaptation efficiency of the message processing chip, thereby improving the efficiency of message processing.

图3是本公开实施例提供的一种报文处理方法的流程示意图,在一个具体的例子中,以FPGA作为报文处理芯片,以可编程交换芯片作为关联报文处理芯片为例进行说明,如图3所示,本公开实施例所提供的报文处理方法可以包括下述步骤流程:FIG. 3 is a schematic flow diagram of a message processing method provided by an embodiment of the present disclosure. In a specific example, an FPGA is used as a message processing chip, and a programmable switching chip is used as an associated message processing chip as an example for illustration. As shown in Figure 3, the message processing method provided by the embodiment of the present disclosure may include the following steps:

步骤①:原始报文数据可以通过可编程交换芯片的网络端口A输入,并由可编程交换芯片内部的处理流水线1进行报文解析、提取报文头部和生成metadata等处理。Step ①: The original message data can be input through the network port A of the programmable switch chip, and processed by the processing pipeline 1 inside the programmable switch chip to analyze the message, extract the message header, and generate metadata.

步骤②:可编程交换芯片通过处理流水线1将后续用于FPGA查表所需的关键字key以及其他信息提取后增加到原始报文的头部作为metadata,并通过可编程交换芯片的网络端口B发送至FPGA。Step ②: The programmable switch chip extracts the keyword key and other information required for the FPGA lookup table through the processing pipeline 1 and adds them to the head of the original message as metadata, and passes through the network port B of the programmable switch chip sent to the FPGA.

步骤③:FPGA从网络端口C接收到metadata和原始报文数据之后由报文输入模块从metadata中提取出key。Step ③: After the FPGA receives the metadata and the original message data from the network port C, the message input module extracts the key from the metadata.

图4是本公开实施例所适用的一种提取关键字段信息的流程示意图,在一个具体的例子中,如图4所示,从metadata中提取出key的提取流程可以包括以下流程:FIG. 4 is a schematic flow diagram of extracting key field information applicable to the embodiments of the present disclosure. In a specific example, as shown in FIG. 4 , the extraction process for extracting a key from metadata may include the following process:

步骤一:将包含有key的metadata和原始报文作为原始报文输入数据输入FPGA。Step 1: Input the metadata containing the key and the original message into the FPGA as the original message input data.

步骤二:截取固定长度的报文头,在截取前需要预估metadata中key的长度,进而设定截取的固定长度确保所有与key相关的字段全都包含在该固定长度的metadata之内,应避免截取的固定长度过短。Step 2: Intercept the fixed-length message header. Before intercepting, it is necessary to estimate the length of the key in the metadata, and then set the fixed length for interception to ensure that all fields related to the key are included in the fixed-length metadata, which should be avoided The intercepted fixed length is too short.

步骤三:截取之后的metadata和报文其他数据输入至报文输入模块的可配置交换网络。Step 3: The intercepted metadata and other data of the message are input to the configurable switching network of the message input module.

步骤四:报文输入模块的可配置交换网络将分布在metadata中不同位置的key的片段汇聚到报文数据的高位,以组成连续的可用于查表的key。Step 4: The configurable switching network of the message input module aggregates the key fragments distributed in different positions in the metadata to the high bits of the message data to form continuous keys that can be used for table lookup.

步骤五:FPGA将连续的可用于查表的key发送给查表模块用于查表。Step 5: FPGA sends continuous keys that can be used for table lookup to the table lookup module for table lookup.

需要说明的是,报文输入模块的可配置交换网络的参数可以由主机CPU通过PCIe(peripheral component interconnect express,高速串行计算机扩展总线标准)或者其他方式在线且动态地下发给管理模块,并由管理模块通过在线的方式实时更改相应的参数。It should be noted that the parameters of the configurable switching network of the message input module can be sent to the management module online and dynamically by the host CPU through PCIe (peripheral component interconnect express, a high-speed serial computer expansion bus standard) or other methods, and the The management module changes the corresponding parameters in real time online.

可选的,报文输入模块中的可配置交换网络可以采用inverse butterflynetwork(逆蝶网络)。inverse butterfly network可以在任意有效数据的输出节点序号小于等于其输入节点序号的情况下完成数据的汇聚,即可以按照key的序号大小关系提取key同时对key进行排序,并将key集中显示在头部的前序或需要集中显示的其他区域。在一个具体的例子中,图5是本公开实施例所适用的一种可配置交换网络的示意图,如图5所示,输入报文输入模块的可配置交换网络的报文数据顺序为metadata-p0(元数据-p0)、key-p0(关键字段-p0)、metadata-p1、key-p1、metadata-p2、key-p2、metadata-p3和key-p3,经过可配置交换网络后可以将key-p0、key-p1、key-p2和key-p3汇聚到报文数据的头部,metadata-p0、metadata-p1、metadata-p2和metadata-p3顺次显示在key-p3的后序。Optionally, the configurable switching network in the message input module may use an inverse butterfly network (inverse butterfly network). The inverse butterfly network can complete the aggregation of data when the serial number of the output node of any valid data is less than or equal to the serial number of its input node, that is, the key can be extracted according to the serial number of the key, and the keys can be sorted at the same time, and the keys are displayed in the head or other areas that need to be displayed intensively. In a specific example, FIG. 5 is a schematic diagram of a configurable switching network applicable to an embodiment of the present disclosure. As shown in FIG. 5 , the sequence of message data input to the configurable switching network of the message input module is metadata- p0 (metadata-p0), key-p0 (key field-p0), metadata-p1, key-p1, metadata-p2, key-p2, metadata-p3 and key-p3, can be configured after switching the network Aggregate key-p0, key-p1, key-p2, and key-p3 to the header of the packet data, and display metadata-p0, metadata-p1, metadata-p2, and metadata-p3 in sequence after key-p3 .

步骤④:将从metadata中提取出的key输出给查表模块。Step ④: Output the key extracted from the metadata to the table lookup module.

步骤⑤:将metadata和原始报文数据存入缓存模块中。Step ⑤: Store the metadata and original message data into the cache module.

步骤⑥:查表模块通过读取外部存储器的数据获取查表结果,并将查表结果输出给报文输出模块。Step ⑥: The table lookup module obtains the table lookup result by reading the data of the external memory, and outputs the table lookup result to the message output module.

步骤⑦:报文输出模块将查表结果替换掉metadata中需要进行替换的字段信息替换为result。Step ⑦: The message output module replaces the field information that needs to be replaced in the metadata with the result of the table lookup and replaces it with result.

图6是本公开实施例所适用的一种替换关键字段信息的流程示意图,在一个具体的例子中,如图6所示,metadata中字段信息的替换流程可以包括以下步骤流程:Fig. 6 is a schematic diagram of a process for replacing key field information applicable to embodiments of the present disclosure. In a specific example, as shown in Fig. 6, the process for replacing field information in metadata may include the following steps:

步骤一:将查表获得的结果输入报文输出模块之后,将查表结果扩展到与报文输入模块截取数据的长度相同。Step 1: After inputting the table lookup result into the message output module, expand the table lookup result to the same length as the data intercepted by the message input module.

步骤二:将扩展后的报文数据输入至报文输出模块的可配置交换网络。Step 2: Input the expanded message data to the configurable switching network of the message output module.

步骤三:报文输出模块的可配置交换网络将result按照期望的格式被拆分到metadata中的不同位置,从而生成替换结果报文数据。Step 3: The configurable switching network of the message output module splits the result into different positions in the metadata according to the desired format, thereby generating replacement result message data.

步骤四:将替换结果报文数据输入至Valid bitmap(有效比特向量)模块,有效比特向量由若干0和1组成,有效比特向量的长度与目标结果报文数据相同。Step 4: Input the replacement result message data into the Valid bitmap (valid bit vector) module, the valid bit vector is composed of several 0s and 1s, and the length of the valid bit vector is the same as the target result message data.

步骤五:将替换结果报文数据中需要进行替换的字段信息进行替换,示例性的,替换的方法可以为有效比特向量中为1的比特表示在最终输出的metadata中该位置使用替换结果报文数据对应位置的比特数据(即有效替换字段数据),有效比特向量中为0的比特表示在最终输出的metadata中该位置使用原始metadata对应位置的比特数据(即有效原始报文数据)。Step 5: Replace the field information that needs to be replaced in the replacement result message data. Exemplarily, the replacement method can be that a bit of 1 in the effective bit vector indicates that the replacement result message is used at this position in the final output metadata The bit data corresponding to the position of the data (i.e. effective replacement field data), and the bit of 0 in the effective bit vector indicates that the bit data corresponding to the position of the original metadata (i.e. effective original message data) is used at this position in the final output metadata.

步骤六:报文输出模块的可配置交换网络的参数和valid bitmap可由主机CPU通过PCIe或者其他方式在线且动态地下发给管理模块,并由管理模块通过在线的方式实时更改相应的参数。Step 6: The parameters and valid bitmap of the configurable switching network of the message output module can be sent online and dynamically to the management module by the host CPU through PCIe or other methods, and the management module can change the corresponding parameters in real time online.

可选的,报文输出模块中的可配置交换网络可以采用butterfly network(蝴蝶网络)。butterfly network可以实现连续报文数据的分离,并将拆分后的报文数据放置到预先设定的位置。在一个具体的例子中,图7是本公开实施例所适用的另一种可配置交换网络的示意图,如图7所示,输入至butterfly network的报文数据顺序为result-p0(结果-p0)、result-p1、result-p2和result-p3,并且输入的报文数据长度和截取数据的长度相同,经过butterfly network后连续的result数据实现了分离,再将经过分离的报文数据经过origin metadata(原始元数据)后,会将有效比特向量中为1的数据替换为相应的result数据,有效比特向量中为0的数据不进行替换保持原始metadata数据不变。Optionally, the configurable switching network in the message output module may use a butterfly network (butterfly network). The butterfly network can realize the separation of continuous message data, and place the split message data in a preset location. In a specific example, FIG. 7 is a schematic diagram of another configurable switching network applicable to embodiments of the present disclosure. As shown in FIG. 7 , the sequence of message data input to the butterfly network is result-p0 (result-p0 ), result-p1, result-p2, and result-p3, and the length of the input message data is the same as the length of the intercepted data. After the butterfly network, the continuous result data is separated, and then the separated message data is passed through the origin After metadata (original metadata), the data of 1 in the effective bit vector will be replaced with the corresponding result data, and the data of 0 in the effective bit vector will not be replaced and the original metadata data will remain unchanged.

步骤⑧:将替换后metadata和原始报文数据从FPGA的网络端口C发给可编程交换芯片的网络端口B。Step ⑧: Send the replaced metadata and original message data from the network port C of the FPGA to the network port B of the programmable switch chip.

步骤⑨:可编程交换芯片的报文处理流水线2根据metadata中的result等信息对报文进行封装和修改等处理,并最终产生转发报文,通过可编程交换芯片的网络端口A输出生成转发报文。Step 9: The message processing pipeline 2 of the programmable switching chip encapsulates and modifies the message according to the result and other information in the metadata, and finally generates a forwarding message, which is output through the network port A of the programmable switching chip to generate a forwarding message arts.

上述技术方案,基于参数可配的交换网络可以实现从报文头任意位置提取和插入关键信息,避免可编程交换芯片和FPGA之间报文头格式变更后FPGA需要重新编码、综合、布局和布线的问题,降低应用需求变更后FPGA的适配工作量,提高FPGA的适配效率,进而提升异构融合网关的使用便利性。The above technical solution, based on the switch network with configurable parameters, can realize the extraction and insertion of key information from any position of the message header, avoiding the recoding, synthesis, layout and wiring of the FPGA after the change of the message header format between the programmable switching chip and the FPGA It reduces the workload of FPGA adaptation after the application requirements change, improves the adaptation efficiency of FPGA, and improves the convenience of using heterogeneous fusion gateway.

需要说明的是,以上各实施例中各技术特征之间的任意排列组合也属于本公开的保护范围。It should be noted that any permutation and combination of the technical features in the above embodiments also falls within the protection scope of the present disclosure.

在一个示例中,图8是本公开实施例提供的一种报文处理装置的结构图,本公开实施例可适用于根据原始报文输入数据截取的字段信息按需处理原始报文输入数据的情况,该装置配置于报文处理芯片,可以通过软件和/或硬件实现,并具体配置于电子设备中。该电子设备可以是终端设备,也可以是服务器设备,电子设备例如可以是网关设备或交换机设备等具有报文处理和转发功能的设备等,本公开实施例并不对电子设备的具体设备类型进行限定。In an example, FIG. 8 is a structural diagram of a message processing device provided by an embodiment of the present disclosure, and this embodiment of the present disclosure is applicable to processing original message input data on demand according to the field information intercepted from the original message input data In some cases, the device is configured in a message processing chip, which can be realized by software and/or hardware, and is specifically configured in an electronic device. The electronic device may be a terminal device or a server device. For example, the electronic device may be a device with message processing and forwarding functions such as a gateway device or a switch device. Embodiments of the present disclosure do not limit the specific device type of the electronic device. .

如图8所示的一种报文处理装置300,包括:原始报文输入数据获取模块310、目标关键字段信息截取模块320、目标结果报文数据生成模块330和原始报文输出数据生成模块340。A message processing device 300 as shown in Figure 8, comprising: an original message input data acquisition module 310, a target key field information interception module 320, a target result message data generation module 330 and an original message output data generation module 340.

其中,原始报文输入数据获取模块310,用于获取原始报文输入数据;目标关键字段信息截取模块320,用于对原始报文输入数据截取目标关键字段信息;其中,目标关键字段信息包括目标原始字段信息;目标结果报文数据生成模块330,用于根据目标关键字段信息生成目标结果报文数据;原始报文输出数据生成模块340,用于根据原始报文输入数据和目标结果报文数据生成原始报文输出数据。Wherein, the original message input data acquisition module 310 is used to obtain the original message input data; the target key field information interception module 320 is used to intercept the target key field information to the original message input data; wherein, the target key field Information includes target original field information; target result message data generation module 330, for generating target result message data according to target key field information; original message output data generation module 340, for according to original message input data and target Result message data generates raw message output data.

本公开实施例通过获取原始报文输入数据,从而对原始报文输入数据截取包括目标原始字段信息的目标关键字段信息,以根据目标关键字段信息生成目标结果报文数据,从而根据原始报文输入数据和目标结果报文数据生成原始报文输出数据。基于原始报文输入数据截取的目标关键字段信息对原始报文输入数据在线进行报文处理,可以解决报文处理芯片需要线下更新信息提取功能的问题,能够提高报文处理芯片的适配效率,进而提高报文处理的效率。The embodiment of the present disclosure obtains the original message input data, thereby intercepting the target key field information including the target original field information from the original message input data, so as to generate the target result message data according to the target key field information, so that according to the original message Raw message output data is generated from text input data and target result message data. Based on the target key field information intercepted from the original message input data, the original message input data is processed online, which can solve the problem that the message processing chip needs to update the information extraction function offline, and can improve the adaptation of the message processing chip Efficiency, thereby improving the efficiency of packet processing.

可选的,目标关键字段信息截取模块320,具体用于:确定原始报文输入数据的预设报文截取方向和报文截取长度;按照预设报文截取方向对原始报文输入数据截取报文截取长度的信息,得到截取报文字段信息;根据截取报文字段信息获取目标关键字段信息。Optionally, the target key field information interception module 320 is specifically used to: determine the preset message interception direction and message interception length of the original message input data; intercept the original message input data according to the preset message interception direction Information about the intercepted length of the message is obtained to obtain field information of the intercepted message; and information about key fields of the target is obtained according to the field information of the intercepted message.

可选的,目标关键字段信息截取模块320,具体用于:确定原始报文输入数据的起始截取字段和终止截取字段;将起始截取字段的位置到终止截取字段的位置之间的方向作为预设报文截取方向。Optionally, the target key field information interception module 320 is specifically used to: determine the initial interception field and the termination interception field of the input data of the original message; As the default packet interception direction.

可选的,目标关键字段信息截取模块320,具体用于:确定原始报文输入数据的关键字段信息的字段总体长度;计算字段总体长度与预留长度的和值,作为报文截取长度。Optionally, the target key field information interception module 320 is specifically used to: determine the total field length of the key field information of the original message input data; calculate the sum of the total field length and the reserved length as the message interception length .

可选的,目标关键字段信息截取模块320,具体用于:在确定截取报文字段信息中的关键字段信息为离散字段信息的情况下,对截取报文字段信息中的关键字段信息进行汇聚处理;提取汇聚处理后的截取报文字段信息中的关键字段信息,得到目标关键字段信息。Optionally, the target key field information intercepting module 320 is specifically used for: when it is determined that the key field information in the intercepted message field information is discrete field information, the key field information in the intercepted message field information Aggregation processing is performed; key field information in the field information of the intercepted message after the aggregation processing is extracted to obtain target key field information.

可选的,目标结果报文数据生成模块330,具体用于:根据目标关键字段信息查找预设表格数据,以获取目标关键字段信息匹配的结果替换字段信息;根据结果替换字段信息替换目标原始字段信息中的目标字段信息,得到目标结果报文数据。Optionally, the target result message data generation module 330 is specifically used to: search preset form data according to the target key field information to obtain the result replacement field information matched by the target key field information; replace the target result replacement field information according to the result The target field information in the original field information is used to obtain the target result message data.

可选的,目标结果报文数据生成模块330,具体用于:将结果替换字段信息的长度扩展至目标长度,得到扩展替换字段信息;其中,目标长度为目标原始字段信息的长度;根据扩展替换字段信息和目标原始字段信息生成替换结果报文数据;根据替换结果报文数据替换目标原始字段信息中的目标字段信息,得到目标结果报文数据。Optionally, the target result message data generation module 330 is specifically used to: extend the length of the result replacement field information to the target length to obtain the extended replacement field information; wherein, the target length is the length of the target original field information; The field information and the target original field information generate replacement result message data; the target field information in the target original field information is replaced according to the replacement result message data to obtain the target result message data.

可选的,目标结果报文数据生成模块330,具体用于:确定扩展替换字段信息在目标原始字段信息中的信息插入位置;按照信息插入位置对扩展替换字段信息中的数据进行调整,得到替换结果报文数据。Optionally, the target result message data generation module 330 is specifically used to: determine the information insertion position of the extended replacement field information in the target original field information; adjust the data in the extended replacement field information according to the information insertion position to obtain the replacement Result message data.

可选的,目标结果报文数据生成模块330,具体用于:根据替换结果报文数据生成有效比特向量;根据有效比特向量从替换结果报文数据中确定有效替换字段数据,并从目标原始字段信息中确定有效原始报文数据;将有效替换字段数据和有效原始报文数据进行组合,得到目标结果报文数据。Optionally, the target result message data generation module 330 is specifically used to: generate an effective bit vector according to the replacement result message data; determine effective replacement field data from the replacement result message data according to the effective bit vector, and obtain the target original field The effective original message data is determined in the information; the effective replacement field data and the effective original message data are combined to obtain the target result message data.

可选的,目标结果报文数据生成模块330,具体用于:根据替换结果报文数据的长度生成初始比特向量;其中,初始比特向量的各个比特取值为初始默认值;根据替换结果报文数据中替换字段信息的分布情况更新初始比特向量的各个比特取值,得到有效比特向量。Optionally, the target result message data generation module 330 is specifically used to: generate an initial bit vector according to the length of the replacement result message data; wherein, each bit value of the initial bit vector is an initial default value; The distribution of the replacement field information in the data updates the value of each bit of the initial bit vector to obtain an effective bit vector.

可选的,目标结果报文数据生成模块330,具体用于:确定有效比特向量中当前比特的当前相对位置;在确定有效比特向量的当前比特的取值为第一数值的情况下,从替换结果报文数据中获取当前相对位置处的比特数据作为有效替换字段数据;在确定有效比特向量的当前比特的取值为第二数值的情况下,从目标原始字段信息中获取当前相对位置处的比特数据作为有效原始报文数据。Optionally, the target result message data generation module 330 is specifically used to: determine the current relative position of the current bit in the effective bit vector; when it is determined that the value of the current bit of the effective bit vector is the first value, replace Obtain the bit data at the current relative position in the result message data as effective replacement field data; in the case of determining that the value of the current bit of the effective bit vector is the second value, obtain the current relative position from the original field information of the target Bit data is used as effective original message data.

可选的,所述原始报文输入数据为关联报文处理芯片对原始报文数据进行处理后生成的报文数据,原始报文输出数据生成模块340,具体用于:获取原始报文输入数据中包括的原始报文数据;将原始报文数据与目标结果报文数据进行组合,得到原始报文输出数据。该装置还包括转发报文生成模块,用于:将原始报文输出数据发送至关联报文处理芯片,以通过关联报文处理芯片根据原始报文输出数据生成转发报文。Optionally, the original message input data is the message data generated after the associated message processing chip processes the original message data, and the original message output data generation module 340 is specifically used for: obtaining the original message input data The original message data included in ; the original message data and the target result message data are combined to obtain the original message output data. The device also includes a forwarding message generation module, configured to: send the original message output data to the associated message processing chip, so that the associated message processing chip generates a forwarding message according to the original message output data.

可选的,在上述各实施例的基础上,报文处理芯片可以包括FPGA。Optionally, on the basis of the foregoing embodiments, the packet processing chip may include an FPGA.

上述报文处理装置可执行本公开任意实施例所提供的报文处理方法,具备执行方法相应的功能模块和有益效果。未在本实施例中详尽描述的技术细节,可参见本公开任意实施例提供的报文处理方法。The above packet processing device can execute the packet processing method provided by any embodiment of the present disclosure, and has corresponding functional modules and beneficial effects for executing the method. For technical details not exhaustively described in this embodiment, refer to the packet processing method provided in any embodiment of the present disclosure.

由于上述所介绍的报文处理装置为可以执行本公开实施例中的报文处理方法的装置,故而基于本公开实施例中所介绍的报文处理方法,本领域所属技术人员能够了解本实施例的报文处理装置的具体实施方式以及其各种变化形式,所以在此对于该报文处理装置如何实现本公开实施例中的报文处理方法不再详细介绍。只要本领域所属技术人员实施本公开实施例中报文处理方法所采用的装置,都属于本公开所欲保护的范围。Since the message processing device described above is a device that can execute the message processing method in the embodiment of the present disclosure, based on the message processing method introduced in the embodiment of the present disclosure, those skilled in the art can understand this embodiment The specific implementation manners of the packet processing apparatus and various variations thereof, so how the packet processing apparatus implements the packet processing method in the embodiment of the present disclosure will not be described in detail here. As long as those skilled in the art implement the device used by the message processing method in the embodiment of the present disclosure, they all belong to the protection scope of the present disclosure.

在一个示例中,本公开还提供了一种电子设备、一种可读存储介质和一种计算机程序产品。In one example, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

图9示出了可以用来实施本公开的实施例的示例电子设备400的示意性框图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本公开的实现。FIG. 9 shows a schematic block diagram of an example electronic device 400 that may be used to implement embodiments of the present disclosure. Electronic device is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. Electronic devices may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are by way of example only, and are not intended to limit implementations of the disclosure described and/or claimed herein.

如图9所示,设备400包括计算单元401,其可以根据存储在只读存储器(ROM)402中的计算机程序或者从存储单元408加载到随机访问存储器(RAM)403中的计算机程序,来执行各种适当的动作和处理。在RAM 403中,还可存储设备400操作所需的各种程序和数据。计算单元401、ROM 402以及RAM 403通过总线404彼此相连。输入/输出(I/O)接口405也连接至总线404。As shown in FIG. 9, the device 400 includes a computing unit 401 that can execute according to a computer program stored in a read-only memory (ROM) 402 or loaded from a storage unit 408 into a random access memory (RAM) 403. Various appropriate actions and treatments. In the RAM 403, various programs and data necessary for the operation of the device 400 can also be stored. The computing unit 401 , ROM 402 and RAM 403 are connected to each other through a bus 404 . An input/output (I/O) interface 405 is also connected to bus 404 .

设备400中的多个部件连接至I/O接口405,包括:输入单元406,例如键盘、鼠标等;输出单元407,例如各种类型的显示器、扬声器等;存储单元408,例如磁盘、光盘等;以及通信单元409,例如网卡、调制解调器、无线通信收发机等。通信单元409允许设备400通过诸如因特网的计算机网络和/或各种电信网络与其他设备交换信息/数据。Multiple components in the device 400 are connected to the I/O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a magnetic disk, an optical disk, etc. ; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, and the like. The communication unit 409 allows the device 400 to exchange information/data with other devices over a computer network such as the Internet and/or various telecommunication networks.

计算单元401可以是各种具有处理和计算能力的通用和/或专用处理组件。计算单元401的一些示例包括但不限于中央处理单元(CPU)、图形处理单元(GPU)、各种专用的人工智能(AI)计算芯片、各种运行机器学习模型算法的计算单元、数字信号处理器(DSP)、以及任何适当的处理器、控制器、微控制器等。计算单元401执行上文所描述的各个方法和处理,例如报文处理方法。The computing unit 401 may be various general-purpose and/or special-purpose processing components having processing and computing capabilities. Some examples of computing units 401 include, but are not limited to, central processing units (CPUs), graphics processing units (GPUs), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processing processor (DSP), and any suitable processor, controller, microcontroller, etc. The calculation unit 401 executes various methods and processes described above, such as a message processing method.

例如,在一些实施例中,报文处理方法可被实现为计算机软件程序,其被有形地包含于机器可读介质,例如存储单元408。在一些实施例中,计算机程序的部分或者全部可以经由ROM 402和/或通信单元409而被载入和/或安装到设备400上。当计算机程序加载到RAM403并由计算单元401执行时,可以执行上文描述的报文处理方法的一个或多个步骤。备选地,在其他实施例中,计算单元401可以通过其他任何适当的方式(例如,借助于固件)而被配置为执行报文处理方法。For example, in some embodiments, the message processing method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 408 . In some embodiments, part or all of the computer program may be loaded and/or installed on the device 400 via the ROM 402 and/or the communication unit 409 . When the computer program is loaded into RAM 403 and executed by computing unit 401, one or more steps of the message processing method described above can be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to execute the packet processing method in any other suitable manner (for example, by means of firmware).

本文中以上描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、芯片上系统的系统(SOC)、复杂可编程逻辑设备(CPLD)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips Implemented in a system of systems (SOC), complex programmable logic device (CPLD), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include being implemented in one or more computer programs executable and/or interpreted on a programmable system including at least one programmable processor, the programmable processor Can be special-purpose or general-purpose programmable processor, can receive data and instruction from storage system, at least one input device, and at least one output device, and transmit data and instruction to this storage system, this at least one input device, and this at least one output device an output device.

用于实施本公开的方法的程序代码可以采用一个或多个编程语言的任何组合来编写。这些程序代码可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理器或控制器,使得程序代码当由处理器或控制器执行时使流程图和/或框图中所规定的功能/操作被实施。程序代码可以完全在机器上执行、部分地在机器上执行,作为独立软件包部分地在机器上执行且部分地在远程机器上执行或完全在远程机器或服务器上执行。Program codes for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special purpose computer, or other programmable data processing devices, so that the program codes, when executed by the processor or controller, make the functions/functions specified in the flow diagrams and/or block diagrams Action is implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.

在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include one or more wire-based electrical connections, portable computer discs, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.

为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。To provide for interaction with the user, the systems and techniques described herein can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user. ); and a keyboard and pointing device (eg, a mouse or a trackball) through which a user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and can be in any form (including Acoustic input, speech input or, tactile input) to receive input from the user.

可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)、区块链网络和互联网。The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., as a a user computer having a graphical user interface or web browser through which a user can interact with embodiments of the systems and techniques described herein), or including such backend components, middleware components, Or any combination of front-end components in a computing system. The components of the system can be interconnected by any form or medium of digital data communication, eg, a communication network. Examples of communication networks include: local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

计算机系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。服务器可以是云服务器,又称为云计算服务器或云主机,是云计算服务体系中的一项主机产品,以解决了传统物理主机与VPS服务中,存在的管理难度大,业务扩展性弱的缺陷。服务器还可以分布式系统的服务器,或者是结合了区块链的服务器。A computer system may include clients and servers. Clients and servers are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or a cloud host. It is a host product in the cloud computing service system to solve the problems of difficult management and weak business expansion in traditional physical hosts and VPS services. defect. The server can also be a server of a distributed system, or a server combined with a blockchain.

本公开实施例通过获取原始报文输入数据,从而对原始报文输入数据截取包括目标原始字段信息的目标关键字段信息,以根据目标关键字段信息生成目标结果报文数据,从而根据原始报文输入数据和目标结果报文数据生成原始报文输出数据。基于原始报文输入数据截取的目标关键字段信息对原始报文输入数据在线进行报文处理,可以解决报文处理芯片需要线下更新信息提取功能的问题,能够提高报文处理芯片的适配效率,进而提高报文处理的效率。The embodiment of the present disclosure obtains the original message input data, thereby intercepting the target key field information including the target original field information from the original message input data, so as to generate the target result message data according to the target key field information, so that according to the original message Raw message output data is generated from text input data and target result message data. Based on the target key field information intercepted from the original message input data, the original message input data is processed online, which can solve the problem that the message processing chip needs to update the information extraction function offline, and can improve the adaptation of the message processing chip Efficiency, thereby improving the efficiency of packet processing.

应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本发公开中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本公开公开的技术方案所期望的结果,本文在此不进行限制。It should be understood that steps may be reordered, added or deleted using the various forms of flow shown above. For example, each step described in the present disclosure may be executed in parallel, sequentially, or in a different order, as long as the desired result of the technical solution disclosed in the present disclosure can be achieved, no limitation is imposed herein.

上述具体实施方式,并不构成对本公开保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本公开的精神和原则之内所作的修改、等同替换和改进等,均应包含在本公开保护范围之内。The specific implementation manners described above do not limit the protection scope of the present disclosure. It should be apparent to those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made depending on design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present disclosure shall be included within the protection scope of the present disclosure.

Claims (29)

1.一种报文处理方法,应用于报文处理芯片,包括:1. A message processing method applied to a message processing chip, comprising: 获取原始报文输入数据;Obtain the original message input data; 对所述原始报文输入数据截取目标关键字段信息;其中,所述目标关键字段信息包括目标原始字段信息;Intercepting target key field information for the original message input data; wherein, the target key field information includes target original field information; 根据所述目标关键字段信息生成目标结果报文数据;Generate target result message data according to the target key field information; 根据所述原始报文输入数据和所述目标结果报文数据生成原始报文输出数据。Generating original message output data according to the original message input data and the target result message data. 2.根据权利要求1所述的方法,其中,对所述原始报文输入数据截取目标关键字段信息,包括:2. The method according to claim 1, wherein intercepting target key field information for the original message input data comprises: 确定所述原始报文输入数据的预设报文截取方向和报文截取长度;Determine the preset message interception direction and message interception length of the original message input data; 按照所述预设报文截取方向对所述原始报文输入数据截取所述报文截取长度的信息,得到截取报文字段信息;Intercepting the message interception length information for the original message input data according to the preset message interception direction to obtain the intercepted message field information; 根据所述截取报文字段信息获取所述目标关键字段信息。Acquiring the target key field information according to the intercepted message field information. 3.根据权利要求2所述的方法,其中,确定所述原始报文输入数据的预设报文截取方向,包括:3. The method according to claim 2, wherein determining the preset message interception direction of the original message input data comprises: 确定所述原始报文输入数据的起始截取字段和终止截取字段;Determine the initial interception field and the termination interception field of the input data of the original message; 将所述起始截取字段的位置到所述终止截取字段的位置之间的方向作为所述预设报文截取方向。The direction between the position of the start truncation field and the position of the end truncation field is taken as the preset message truncation direction. 4.根据权利要求2或3所述的方法,其中,确定所述原始报文输入数据的报文截取长度,包括:4. The method according to claim 2 or 3, wherein determining the message interception length of the original message input data comprises: 确定所述原始报文输入数据的关键字段信息的字段总体长度;Determine the overall field length of the key field information of the original message input data; 计算所述字段总体长度与预留长度的和值,作为所述报文截取长度。Calculate the sum of the overall length of the field and the reserved length as the intercepted length of the message. 5.根据权利要求2所述的方法,其中,根据所述截取报文字段信息获取所述目标关键字段信息,包括:5. The method according to claim 2, wherein obtaining the target key field information according to the intercepted message field information comprises: 在确定所述截取报文字段信息中的关键字段信息为离散字段信息的情况下,对所述截取报文字段信息中的关键字段信息进行汇聚处理;In the case of determining that the key field information in the intercepted message field information is discrete field information, perform aggregation processing on the key field information in the intercepted message field information; 提取汇聚处理后的截取报文字段信息中的关键字段信息,得到所述目标关键字段信息。Key field information in the intercepted message field information after aggregation processing is extracted to obtain the target key field information. 6.根据权利要求1所述的方法,其中,根据所述目标关键字段信息生成目标结果报文数据,包括:6. The method according to claim 1, wherein generating target result message data according to the target key field information comprises: 根据所述目标关键字段信息查找预设表格数据,以获取所述目标关键字段信息匹配的结果替换字段信息;Searching for preset table data according to the target key field information, so as to obtain the matching result replacement field information of the target key field information; 根据所述结果替换字段信息替换所述目标原始字段信息中的目标字段信息,得到所述目标结果报文数据。The target result message data is obtained by replacing the target field information in the target original field information according to the result replacement field information. 7.根据权利要求6所述的方法,其中,根据所述结果替换字段信息替换所述目标原始字段信息中的目标字段信息,得到所述目标结果报文数据,包括:7. The method according to claim 6, wherein, replacing the target field information in the target original field information according to the result replacement field information to obtain the target result message data includes: 将所述结果替换字段信息的长度扩展至目标长度,得到扩展替换字段信息;其中,所述目标长度为所述目标原始字段信息的长度;Extending the length of the result replacement field information to a target length to obtain the extended replacement field information; wherein the target length is the length of the target original field information; 根据所述扩展替换字段信息和所述目标原始字段信息生成替换结果报文数据;generating replacement result message data according to the extended replacement field information and the target original field information; 根据所述替换结果报文数据替换所述目标原始字段信息中的目标字段信息,得到所述目标结果报文数据。The target result message data is obtained by replacing the target field information in the target original field information according to the replacement result message data. 8.根据权利要求7所述的方法,其中,根据所述扩展替换字段信息和所述目标原始字段信息生成替换结果报文数据,包括:8. The method according to claim 7, wherein generating the replacement result message data according to the extended replacement field information and the target original field information comprises: 确定所述扩展替换字段信息在所述目标原始字段信息中的信息插入位置;determining an information insertion position of the extended replacement field information in the target original field information; 按照所述信息插入位置对所述扩展替换字段信息中的数据进行调整,得到所述替换结果报文数据。The data in the extended replacement field information is adjusted according to the information insertion position to obtain the replacement result message data. 9.根据权利要求7所述的方法,其中,根据所述替换结果报文数据替换所述目标原始字段信息中的目标字段信息,得到所述目标结果报文数据,包括:9. The method according to claim 7, wherein, replacing the target field information in the target original field information according to the replacement result message data to obtain the target result message data includes: 根据所述替换结果报文数据生成有效比特向量;generating an effective bit vector according to the replacement result message data; 根据所述有效比特向量从所述替换结果报文数据中确定有效替换字段数据,并从所述目标原始字段信息中确定有效原始报文数据;determining valid replacement field data from the replacement result message data according to the valid bit vector, and determining valid original message data from the target original field information; 将所述有效替换字段数据和所述有效原始报文数据进行组合,得到所述目标结果报文数据。Combining the valid replacement field data and the valid original message data to obtain the target result message data. 10.根据权利要求9所述的方法,其中,根据所述替换结果报文数据生成有效比特向量,包括;10. The method according to claim 9, wherein generating an effective bit vector according to the replacement result message data comprises; 根据所述替换结果报文数据的长度生成初始比特向量;其中,所述初始比特向量的各个比特取值为初始默认值;Generate an initial bit vector according to the length of the replacement result message data; wherein each bit value of the initial bit vector is an initial default value; 根据所述替换结果报文数据中替换字段信息的分布情况更新所述初始比特向量的各个比特取值,得到所述有效比特向量。Updating each bit value of the initial bit vector according to the distribution of the replacement field information in the replacement result message data to obtain the effective bit vector. 11.根据权利要求9或10所述的方法,其中,根据所述有效比特向量从所述替换结果报文数据中确定有效替换字段数据,并从所述目标原始字段信息中确定有效原始报文数据,包括:11. The method according to claim 9 or 10, wherein the valid replacement field data is determined from the replacement result message data according to the valid bit vector, and the valid original message is determined from the target original field information data, including: 确定所述有效比特向量中当前比特的当前相对位置;determining the current relative position of the current bit in the active bit vector; 在确定所述有效比特向量的当前比特的取值为第一数值的情况下,从所述替换结果报文数据中获取所述当前相对位置处的比特数据作为所述有效替换字段数据;When it is determined that the value of the current bit of the effective bit vector is the first value, acquiring the bit data at the current relative position from the replacement result message data as the effective replacement field data; 在确定所述有效比特向量的当前比特的取值为第二数值的情况下,从所述目标原始字段信息中获取所述当前相对位置处的比特数据作为所述有效原始报文数据。In a case where it is determined that the value of the current bit of the effective bit vector is the second value, bit data at the current relative position is acquired from the target original field information as the effective original message data. 12.根据权利要求1所述的方法,其中,所述原始报文输入数据为关联报文处理芯片对原始报文数据进行处理后生成的报文数据;根据所述原始报文输入数据和所述目标结果报文数据生成原始报文输出数据,包括:12. The method according to claim 1, wherein the original message input data is the message data generated after the associated message processing chip processes the original message data; according to the original message input data and the Generate raw message output data from the target result message data, including: 获取所述原始报文输入数据中包括的原始报文数据;acquiring original message data included in the original message input data; 将所述原始报文数据与所述目标结果报文数据进行组合,得到所述原始报文输出数据;combining the original message data with the target result message data to obtain the original message output data; 所述方法还包括:The method also includes: 将所述原始报文输出数据发送至所述关联报文处理芯片,以通过所述关联报文处理芯片根据所述原始报文输出数据生成转发报文。Sending the original message output data to the associated message processing chip, so that the associated message processing chip generates a forwarding message according to the original message output data. 13.根据权利要求1所述的方法,其中,所述报文处理芯片包括现场可编程逻辑门阵列FPGA。13. The method according to claim 1, wherein the message processing chip comprises a Field Programmable Logic Gate Array (FPGA). 14.一种报文处理装置,配置于报文处理芯片,包括:14. A message processing device configured on a message processing chip, comprising: 原始报文输入数据获取模块,用于获取原始报文输入数据;The original message input data acquisition module is used to obtain the original message input data; 目标关键字段信息截取模块,用于对所述原始报文输入数据截取目标关键字段信息;其中,所述目标关键字段信息包括目标原始字段信息;A target key field information intercepting module, configured to intercept target key field information for the original message input data; wherein, the target key field information includes target original field information; 目标结果报文数据生成模块,用于根据所述目标关键字段信息生成目标结果报文数据;A target result message data generating module, configured to generate target result message data according to the target key field information; 原始报文输出数据生成模块,用于根据所述原始报文输入数据和所述目标结果报文数据生成原始报文输出数据。An original message output data generating module, configured to generate original message output data according to the original message input data and the target result message data. 15.根据权利要求14所述的装置,其中,所述目标关键字段信息截取模块具体用于:15. The device according to claim 14, wherein the target key field information interception module is specifically used for: 确定所述原始报文输入数据的预设报文截取方向和报文截取长度;Determine the preset message interception direction and message interception length of the original message input data; 按照所述预设报文截取方向对所述原始报文输入数据截取所述报文截取长度的信息,得到截取报文字段信息;Intercepting the message interception length information for the original message input data according to the preset message interception direction to obtain the intercepted message field information; 根据所述截取报文字段信息获取所述目标关键字段信息。Acquiring the target key field information according to the intercepted message field information. 16.根据权利要求15所述的装置,其中,所述目标关键字段信息截取模块具体用于:16. The device according to claim 15, wherein the target key field information interception module is specifically used for: 确定所述原始报文输入数据的起始截取字段和终止截取字段;Determine the initial interception field and the termination interception field of the input data of the original message; 将所述起始截取字段的位置到所述终止截取字段的位置之间的方向作为所述预设报文截取方向。The direction between the position of the start truncation field and the position of the end truncation field is taken as the preset message truncation direction. 17.根据权利要求15或16所述的装置,其中,所述目标关键字段信息截取模块具体用于:17. The device according to claim 15 or 16, wherein the target key field information interception module is specifically used for: 确定所述原始报文输入数据的关键字段信息的字段总体长度;Determine the overall field length of the key field information of the original message input data; 计算所述字段总体长度与预留长度的和值,作为所述报文截取长度。Calculate the sum of the overall length of the field and the reserved length as the intercepted length of the message. 18.根据权利要求15所述的装置,其中,所述目标关键字段信息截取模块具体用于:18. The device according to claim 15, wherein the target key field information interception module is specifically used for: 在确定所述截取报文字段信息中的关键字段信息为离散字段信息的情况下,对所述截取报文字段信息中的关键字段信息进行汇聚处理;In the case of determining that the key field information in the intercepted message field information is discrete field information, perform aggregation processing on the key field information in the intercepted message field information; 提取汇聚处理后的截取报文字段信息中的关键字段信息,得到所述目标关键字段信息。Key field information in the intercepted message field information after aggregation processing is extracted to obtain the target key field information. 19.根据权利要求14所述的装置,其中,所述目标结果报文数据生成模块具体用于:19. The device according to claim 14, wherein the target result message data generating module is specifically used for: 根据所述目标关键字段信息查找预设表格数据,以获取所述目标关键字段信息匹配的结果替换字段信息;Searching for preset table data according to the target key field information, so as to obtain the matching result replacement field information of the target key field information; 根据所述结果替换字段信息替换所述目标原始字段信息中的目标字段信息,得到所述目标结果报文数据。The target result message data is obtained by replacing the target field information in the target original field information according to the result replacement field information. 20.根据权利要求19所述的装置,其中,所述目标结果报文数据生成模块具体用于:20. The device according to claim 19, wherein the target result message data generating module is specifically used for: 将所述结果替换字段信息的长度扩展至目标长度,得到扩展替换字段信息;其中,所述目标长度为所述目标原始字段信息的长度;Extending the length of the result replacement field information to a target length to obtain the extended replacement field information; wherein the target length is the length of the target original field information; 根据所述扩展替换字段信息和所述目标原始字段信息生成替换结果报文数据;generating replacement result message data according to the extended replacement field information and the target original field information; 根据所述替换结果报文数据替换所述目标原始字段信息中的目标字段信息,得到所述目标结果报文数据。The target result message data is obtained by replacing the target field information in the target original field information according to the replacement result message data. 21.根据权利要求20所述的装置,其中,所述目标结果报文数据生成模块具体用于:21. The device according to claim 20, wherein the target result message data generating module is specifically used for: 确定所述扩展替换字段信息在所述目标原始字段信息中的信息插入位置;determining an information insertion position of the extended replacement field information in the target original field information; 按照所述信息插入位置对所述扩展替换字段信息中的数据进行调整,得到所述替换结果报文数据。The data in the extended replacement field information is adjusted according to the information insertion position to obtain the replacement result message data. 22.根据权利要求20所述的装置,其中,所述目标结果报文数据生成模块具体用于:22. The device according to claim 20, wherein the target result message data generating module is specifically used for: 根据所述替换结果报文数据生成有效比特向量;generating an effective bit vector according to the replacement result message data; 根据所述有效比特向量从所述替换结果报文数据中确定有效替换字段数据,并从所述目标原始字段信息中确定有效原始报文数据;determining valid replacement field data from the replacement result message data according to the valid bit vector, and determining valid original message data from the target original field information; 将所述有效替换字段数据和所述有效原始报文数据进行组合,得到所述目标结果报文数据。Combining the valid replacement field data and the valid original message data to obtain the target result message data. 23.根据权利要求22所述的装置,其中,所述目标结果报文数据生成模块具体用于:23. The device according to claim 22, wherein the target result message data generation module is specifically used for: 根据所述替换结果报文数据的长度生成初始比特向量;其中,所述初始比特向量的各个比特取值为初始默认值;Generate an initial bit vector according to the length of the replacement result message data; wherein each bit value of the initial bit vector is an initial default value; 根据所述替换结果报文数据中替换字段信息的分布情况更新所述初始比特向量的各个比特取值,得到所述有效比特向量。Updating each bit value of the initial bit vector according to the distribution of the replacement field information in the replacement result message data to obtain the effective bit vector. 24.根据权利要求22或23所述的装置,其中,所述目标结果报文数据生成模块具体用于:24. The device according to claim 22 or 23, wherein the target result message data generating module is specifically used for: 确定所述有效比特向量中当前比特的当前相对位置;determining the current relative position of the current bit in the active bit vector; 在确定所述有效比特向量的当前比特的取值为第一数值的情况下,从所述替换结果报文数据中获取所述当前相对位置处的比特数据作为所述有效替换字段数据;When it is determined that the value of the current bit of the effective bit vector is the first value, acquiring the bit data at the current relative position from the replacement result message data as the effective replacement field data; 在确定所述有效比特向量的当前比特的取值为第二数值的情况下,从所述目标原始字段信息中获取所述当前相对位置处的比特数据作为所述有效原始报文数据。In a case where it is determined that the value of the current bit of the effective bit vector is the second value, bit data at the current relative position is acquired from the target original field information as the effective original packet data. 25.根据权利要求14所述的装置,其中,所述原始报文输入数据为关联报文处理芯片对原始报文数据进行处理后生成的报文数据;所述原始报文输出数据生成模块具体用于:25. The device according to claim 14, wherein, the original message input data is the message data generated after the associated message processing chip processes the original message data; the original message output data generation module specifically Used for: 获取所述原始报文输入数据中包括的原始报文数据;acquiring original message data included in the original message input data; 将所述原始报文数据与所述目标结果报文数据进行组合,得到所述原始报文输出数据;combining the original message data with the target result message data to obtain the original message output data; 所述报文处理装置还包括转发报文生成模块,用于:将所述原始报文输出数据发送至所述关联报文处理芯片,以通过所述关联报文处理芯片根据所述原始报文输出数据生成转发报文。The message processing device also includes a forwarding message generating module, configured to: send the original message output data to the associated message processing chip, so that the associated message processing chip The output data generates a forwarding message. 26.根据权利要求14所述的装置,其中,所述报文处理芯片包括FPGA。26. The apparatus of claim 14, wherein the packet processing chip comprises an FPGA. 27.一种电子设备,包括:27. An electronic device comprising: 至少一个处理器;以及at least one processor; and 与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein, 所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1-13中任一项所述的报文处理方法。The memory stores instructions executable by the at least one processor, the instructions are executed by the at least one processor, so that the at least one processor can perform any one of claims 1-13 message processing method. 28.一种存储有计算机指令的非瞬时计算机可读存储介质,所述计算机指令用于使计算机执行权利要求1-13中任一项所述的报文处理方法。28. A non-transitory computer-readable storage medium storing computer instructions, the computer instructions being used to cause a computer to execute the message processing method according to any one of claims 1-13. 29.一种计算机程序产品,包括计算机程序/指令,其中,该计算机程序/指令被处理器执行时实现权利要求1-13中任一项所述的报文处理方法。29. A computer program product, comprising a computer program/instruction, wherein, when the computer program/instruction is executed by a processor, the message processing method according to any one of claims 1-13 is implemented.
CN202310685977.0A 2023-06-09 2023-06-09 A message processing method, device, electronic equipment and storage medium Pending CN116668385A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310685977.0A CN116668385A (en) 2023-06-09 2023-06-09 A message processing method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310685977.0A CN116668385A (en) 2023-06-09 2023-06-09 A message processing method, device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116668385A true CN116668385A (en) 2023-08-29

Family

ID=87713512

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310685977.0A Pending CN116668385A (en) 2023-06-09 2023-06-09 A message processing method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116668385A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102831235A (en) * 2012-09-03 2012-12-19 苏州雄立科技有限公司 Range match and lookup method
CN108055202A (en) * 2017-12-07 2018-05-18 锐捷网络股份有限公司 A kind of message processor and method
CN112929281A (en) * 2021-02-04 2021-06-08 恒安嘉新(北京)科技股份公司 Message processing method, device and equipment of network equipment based on FPGA
WO2021217588A1 (en) * 2020-04-30 2021-11-04 华为技术有限公司 Message parsing method and apparatus
CN114363258A (en) * 2022-03-17 2022-04-15 中国人民解放军国防科技大学 Message processing device
CN115733790A (en) * 2021-09-02 2023-03-03 华为技术有限公司 Message forwarding method, device, equipment and storage medium
CN116156026A (en) * 2023-04-20 2023-05-23 中国人民解放军国防科技大学 RMT-supporting parser, reverse parser, parsing method and switch

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102831235A (en) * 2012-09-03 2012-12-19 苏州雄立科技有限公司 Range match and lookup method
CN108055202A (en) * 2017-12-07 2018-05-18 锐捷网络股份有限公司 A kind of message processor and method
WO2021217588A1 (en) * 2020-04-30 2021-11-04 华为技术有限公司 Message parsing method and apparatus
CN112929281A (en) * 2021-02-04 2021-06-08 恒安嘉新(北京)科技股份公司 Message processing method, device and equipment of network equipment based on FPGA
CN115733790A (en) * 2021-09-02 2023-03-03 华为技术有限公司 Message forwarding method, device, equipment and storage medium
CN114363258A (en) * 2022-03-17 2022-04-15 中国人民解放军国防科技大学 Message processing device
CN116156026A (en) * 2023-04-20 2023-05-23 中国人民解放军国防科技大学 RMT-supporting parser, reverse parser, parsing method and switch

Similar Documents

Publication Publication Date Title
CN108287877A (en) A kind of RIB renders compressed file FPGA compression/decompression compression systems and hardware decompressing method
CN108959128A (en) The accelerator and method of Crypt-SHA512 Encryption Algorithm
CN114565105B (en) Data processing method and training method and device of deep learning model
CN118052282A (en) Large language reasoning system and method
CN112799840B (en) Method, apparatus, device and storage medium for transmitting data
CN112929183B (en) Intelligent network card, message transmission method, device, equipment and storage medium
CN114866533A (en) File uploading method and device and electronic equipment
CN115633037B (en) Data packet forwarding method, device, virtual gateway equipment, medium and system
CN113905040B (en) File transfer methods, devices, systems, equipment and storage media
CN114065784B (en) Training method, translation method, device, electronic device and storage medium
CN118509485B (en) Method, device, equipment, medium and product for processing transmission data
CN113344074B (en) Model training method, device, equipment and storage medium
CN116668385A (en) A message processing method, device, electronic equipment and storage medium
KR20230029502A (en) Edge computing network, data transmission method, device, electronic equipment and storage medium
CN112329919B (en) Model training method and device
CN117395211A (en) A data forwarding method, device, switch and medium
CN115860121B (en) Text reasoning method, device, equipment and storage medium
CN118337629A (en) Data transmission system, method, device, equipment and medium
CN117793038A (en) Message processing method, device, electronic equipment, computer-readable storage medium
CN105727556A (en) Image drawing method, related equipment and system
CN117354383A (en) Highly reliable control instruction transmission method and device
CN117544587A (en) Message generation method and device, electronic equipment and storage medium
CN117056968A (en) Data processing method, device, equipment and storage medium
CN116959405A (en) Speech synthesis method, device, electronic equipment and storage medium
CN115801237A (en) Information encryption/decryption device, information encryption method, and information decryption method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination