Data packet editing method and device for target test environment

By analyzing and configuration target protocols and ports of various levels of network protocols, the problem that the data packet cannot be edited in the existing technology can be solved, and the data packet that meets the requirements of the target test environment is realized, and the test efficiency of the test environment in the vehicle test environment is improved. Essence

CN119383239APending Publication Date: 2025-01-28NEUSOFT REACH AUTOMOBILE TECH (SHENYANG) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411418343.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

The prior art cannot re-edit the data packets according to actual project requirements, which makes it very troublesome to implement specific test requirements in a vehicle testing environment.

Method used

By analyzing the levels of the network protocol, obtain and configure the target protocol and target port of the transmission layer, use the preset agreement to analyze the current data packet, extract and edit the target field content of each protocol layer to generate the requirements of the target test environment requirements The target data packet.

Benefits of technology

The flexible editing of the data packet can generate data packets that meet the requirements of the target test environment, which is convenient for investigation and testing of communication problems in the vehicle test environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119383239A_ABST
    Figure CN119383239A_ABST
Patent Text Reader

Abstract

The invention provides a data packet editing method and device for a target test environment, and relates to the technical field of data packet re-editing of a vehicle test environment, and the method comprises the steps: obtaining and opening a current data packet, and configuring a target protocol and a target port of a transmission layer according to the target test environment; determining a preset protocol analysis code corresponding to the application layer based on the target port, and analyzing the current data packet under the action of the viewing tool and the preset protocol analysis code; according to the protocol layer distribution of the network protocol, extracting target field contents from each protocol layer of the analyzed current data packet in sequence; editing the target field content of each protocol layer in response to an input operation instruction to generate a target data packet; by analyzing each level of the network protocol, the technical problem that the data packet cannot be re-edited according to actual project requirements is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data packet re-editing in a vehicle test environment, and in particular to a data packet editing method and device for a target test environment. Background Art

[0002] The most widely used communication protocol in vehicle communication transmits data packets to a specific vehicle test environment to achieve vehicle abnormality testing. The current data packet viewing tool can be used to capture data packets and view data packets to facilitate the study of communication problems.

[0003] However, in actual project applications, the data package needs to be edited according to specific requirements, which cannot be achieved by current data package viewing tools. In order to obtain a data package that meets the actual project requirements, the existing data package is often used to construct a target data package according to the actual project requirements, and then the target data package is sent manually, which is very troublesome. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a data packet editing method and device for a target test environment, which can parse each layer of the network protocol to alleviate the technical problem that the data packet cannot be edited according to actual project requirements.

[0005] In a first aspect, an embodiment provides a data packet editing method for a target test environment, the method comprising:

[0006] Acquire and open the current data packet, and configure the target protocol and target port of the transport layer according to the target test environment; wherein the transport layer is a protocol layer in the network protocol used to transmit the current data packet;

[0007] Determine a preset protocol parsing code corresponding to the application layer based on the target port, and parse the current data packet under the action of the viewing tool and the preset protocol parsing code; wherein the application layer is a protocol layer above the transport layer in the network protocol;

[0008] Extracting the target field content from each protocol layer of the parsed current data packet in turn according to the protocol layer distribution of the network protocol;

[0009] The target field content of each protocol layer is edited in response to an input operation instruction to generate a target data packet; wherein the operation instruction corresponds to the requirements of the target test environment.

[0010] In an optional implementation, the step of obtaining and opening the current data packet and configuring the target protocol and target port of the transport layer according to the target test environment includes:

[0011] Obtaining a current data packet, and opening the current data packet through a preset viewing tool;

[0012] Determine whether the protocol and port of the transport layer in the network protocol of the current data packet are inconsistent with the target test environment;

[0013] If it does not exist, no configuration is required;

[0014] If any, the unmatched protocol and / or port are configured to a target protocol and a target port that meet the requirements of the target test environment.

[0015] In an optional implementation, the step of determining a preset protocol parsing code corresponding to the application layer based on the target port, and parsing the current data packet under the action of a viewing tool and the preset protocol parsing code includes:

[0016] Acquire the current data packet based on the target port, and determine the communication protocol type of the application layer above the transport layer;

[0017] According to the communication protocol type of the application layer, a corresponding preset protocol parsing code is determined, and the application layer of the current data packet is parsed.

[0018] In an optional implementation, before the step of acquiring the current data packet based on the target port and determining the type of communication protocol of the application layer above the transport layer, the method further includes:

[0019] Converting the current data packet into a target format through the viewing tool; wherein the target format is used to display and edit the current data packet;

[0020] Based on the viewing tool, each protocol layer below the transport layer of the current data packet is parsed respectively.

[0021] In an optional implementation, the step of extracting the target field content from each protocol layer of the parsed current data packet in turn according to the protocol layer distribution of the network protocol includes:

[0022] According to the distribution order of each protocol layer of the network protocol, the target field content of each protocol layer is extracted and displayed in turn.

[0023] In an optional embodiment, the step of editing the target field content of each protocol layer in response to the input operation instruction to generate a target data packet includes:

[0024] In response to the first operation instruction, the target field content of the application layer is edited to determine the application data content that matches the requirements of the target test environment;

[0025] and / or,

[0026] In response to the second operation instruction, the target field content of the network layer is edited to determine an IP address for transmitting the target data packet that matches the requirements of the target test environment;

[0027] and / or,

[0028] In response to the third operation instruction, the target field content of the transport layer is edited to determine a port for target data packet transmission that matches the requirements of the target test environment.

[0029] In an optional embodiment, the method further comprises:

[0030] Editing the transmission strategy of the target data packet in response to a fourth operation instruction to determine a transmission strategy of the target data packet that matches the requirements of the target test environment;

[0031] At least one of the target data packets is sent to a target end according to the transmission strategy, so that the target end performs a safety test on a target vehicle in a target test environment according to the target data packet.

[0032] In a second aspect, an embodiment provides a data packet editing device for a target test environment, the device comprising:

[0033] A configuration module is used to obtain and open the current data packet, and configure the target protocol and target port of the transport layer according to the target test environment; wherein the transport layer is a protocol layer in the network protocol used to transmit the current data packet;

[0034] A parsing module, which determines a preset protocol parsing code corresponding to an application layer based on the target port, and parses the current data packet under the action of a viewing tool and the preset protocol parsing code; wherein the application layer is a protocol layer above the transport layer in the network protocol;

[0035] An extraction module extracts the target field content from each protocol layer of the parsed current data packet in turn according to the protocol layer distribution of the network protocol;

[0036] The editing module edits the target field content of each protocol layer in response to an input operation instruction to generate a target data packet; wherein the operation instruction corresponds to the requirements of the target test environment.

[0037] In a third aspect, an embodiment provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the steps of the method described in any of the aforementioned implementation methods are implemented.

[0038] In a fourth aspect, an embodiment provides a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the steps of the method described in any one of the aforementioned implementations.

[0039] The embodiment of the present invention provides a data packet editing method and device for a target test environment. By configuring the target protocol and target port that meet the requirements of the target test environment at the transport layer, the current data packet obtained based on the target port can be obtained, and the preset protocol parsing code corresponding to the current data packet at this time can be known, thereby realizing the parsing of the current data packet including the application layer data above the transport layer, and then extracting the target field in each protocol layer. In response to the requirements of the target test environment, the corresponding operation instructions are input to change the target field in the corresponding protocol layer, thereby realizing the generation of a target data packet that can meet the requirements of the target test environment, and facilitating the investigation of communication problems in the target test environment.

[0040] Other features and advantages of the present disclosure will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present disclosure.

[0041] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 A flow chart of a data packet editing method for a target test environment provided by an embodiment of the present invention;

[0044] Figure 2 A schematic diagram of a network protocol layer provided by an embodiment of the present invention;

[0045] Figure 3 A schematic diagram of a configuration window provided by an embodiment of the present invention;

[0046] Figure 4 A schematic diagram of the IP protocol content of the transport layer of a PDML format data packet provided by an embodiment of the present invention;

[0047] Figure 5 A schematic diagram of a transmission strategy editing window provided by an embodiment of the present invention;

[0048] Figure 6 A flow chart of another data packet editing method for a target test environment provided by an embodiment of the present invention;

[0049] Figure 7 A functional module diagram of a data packet editing device for a target test environment provided by an embodiment of the present invention;

[0050] Figure 8 A schematic diagram of the hardware architecture of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0052] Someip is a communication protocol widely used in vehicle communications, and Wirsark is a data packet viewing tool. Here we take Someip and Wirsark as examples to illustrate respectively.

[0053] The current packet viewing tool wirsark can capture and view packets, but it cannot re-edit packets and cannot send packets from a specified network card according to the specific requirements of the test environment (for example, expecting a packet to be sent from the eth0 network every ten seconds). However, in the actual project development process, it is often necessary to edit the specified someip packet and then send the edited someip packet out; but currently, it can only be built according to project requirements, imitating the existing packet, and then manually sending it out, which is very troublesome.

[0054] Based on this, an embodiment of the present invention provides a data packet editing method and device for a target test environment, which parses the protocol layer in the network protocol that cannot be parsed using a data packet viewing tool, and then edits the field content in the corresponding protocol layer according to the requirements of the target test environment, so as to generate a data packet that meets the requirements of the target test environment.

[0055] To facilitate understanding of this embodiment, a data packet editing method for a target test environment disclosed in an embodiment of the present invention is first introduced in detail. This method can be applied to intelligent control devices such as host computers, controllers, and servers as a data packet editing tool.

[0056] Figure 1 A flow chart of a data packet editing method for a target test environment provided by an embodiment of the present invention.

[0057] like Figure 1 As shown, the method comprises the following steps:

[0058] Step S102, obtaining and opening the current data packet, and configuring the target protocol and target port of the transport layer according to the target test environment.

[0059] Here, the data packet can be opened through a preset data packet viewing tool, such as wirsark; it should be noted that the data packet editing tool provided in the embodiment of the present invention can only edit a single data packet at the same time; as an optional embodiment, multiple data packet editing tools provided in the embodiments of the present invention can be started at the same time to realize the synchronous editing of multiple different data packets.

[0060] The transport layer is a protocol layer in the network protocol used to transmit the current data packet; the network protocol is hierarchical, and the embodiment of the present invention parses the network protocol in each layer in turn according to the hierarchy; the five-layer model of the network protocol is as follows: Figure 2 As shown in the figure, the various layers of the network protocol are shown from top to bottom according to the direction of the arrows. The layers from bottom to top are: physical layer, data link layer, network layer, transport layer and application layer. In actual applications, only after parsing the lower layer protocol can the upper layer protocol be parsed. The target protocol and target port configured here match the target test environment requirements.

[0061] Step S104, determining a preset protocol parsing code corresponding to the application layer based on the target port, and parsing the current data packet under the action of the viewing tool and the preset protocol parsing code.

[0062] Among them, according to Figure 2 It can be seen that the application layer is a protocol layer above the transport layer in the network protocol; it should be noted that the protocol layer below the transport layer including the transport layer can be parsed through a preset data packet viewing tool, and for the application layer that cannot be parsed by the prior art, the embodiment of the present invention obtains the application layer data through the target port pre-configured by the aforementioned embodiment, and then determines its corresponding preset parsing protocol code, thereby achieving the purpose of parsing the current data packet.

[0063] Here, the application layer may apply multiple protocols, so the preset parsing protocol code includes multiple protocols corresponding to the types and quantities of protocols that may be applied in the application layer.

[0064] Step S106 , extracting the target field content from each protocol layer of the parsed current data packet in turn according to the protocol layer distribution of the network protocol.

[0065] Here, according to Figure 2 The protocol layer distribution of the network protocol shown in the figure extracts the target field content from each protocol layer of the parsed data packet in a bottom-up order to achieve a streamlined effect; the target field content can be understood as a key field required by the target test environment, and is a key field that needs to be re-edited and displayed according to the target test environment.

[0066] Step S108, editing the target field content of each protocol layer in response to the input operation instruction to generate a target data packet.

[0067] Among them, the operation instructions correspond to the requirements of the target test environment, that is, the corresponding operation instructions are generated according to the corresponding requirements of the target test environment; as an embodiment, different target field contents of different protocol layers are edited based on different operation instructions, and the target data packet generated at this time can meet the requirements of the target test environment.

[0068] In a preferred embodiment of actual application, the target protocol and target port that meet the requirements of the target test environment are configured through the transport layer, so that the current data packet obtained based on this target port can be obtained, and then the preset protocol parsing code corresponding to the current data packet at this time can be known, so as to realize the parsing of the current data packet including the application layer data above the transport layer, and then extract the target field in each protocol layer, and input the corresponding operation instructions in response to the requirements of the target test environment to change the target field in the corresponding protocol layer, so as to realize the generation of the target data packet that can meet the requirements of the target test environment, and facilitate the investigation of communication problems in the target test environment.

[0069] In practical applications, it is necessary to pre-configure the target protocol and target port that meet the requirements of the target test environment at the transport layer, so that the subsequent steps can parse the network protocol layer that the data packet viewing tool in the prior art cannot parse based on the configured target protocol and target port; illustratively, the step S102 includes:

[0070] Step 1.1), obtain the current data package, and open the current data package through the preset viewing tool.

[0071] The data packet may include data packet A that causes an abnormal situation in the vehicle during actual use, and the data packet A may be captured from the vehicle in actual use; the data packet may also include data packet B that is pre-made to meet specific test requirements of the target test environment, and the data packet B is generated by making;

[0072] For example, the current data packet is a vehicle speed of 110 km / h. At this time, the vehicle is in abnormal condition C. The embodiment of the present invention parses and re-edits the vehicle speed data packet that causes the vehicle abnormality, and provides it to the target test environment to verify that the current vehicle can overcome the abnormal impact of the data packet.

[0073] Step 1.2), determine whether the transport layer protocol and port in the network protocol of the current data packet are inconsistent with the target test environment.

[0074] Among them, based on the data packet viewing tool, the protocol and port of the transport layer in the network protocol of the current data packet can be viewed, and the TCP protocol or UDP protocol used by the transport layer of the existing data packet can be viewed, and which port each protocol uses; Figure 3 The parameter configuration window is shown; before step 1.2), it also includes determining an applicable target network card that meets the requirements of the target test environment, and under the action of the target network card, the target data packet generated in the subsequent steps is transmitted to the target test environment based on the target network card.

[0075] Here, the protocol and port are matched with the protocol and port required by the target test environment.

[0076] Step 1.3), if it does not exist, no configuration is required.

[0077] Here, we check that the transport layer protocol and port of the data packet match the requirements of the target test environment, so no additional configuration is required.

[0078] Step 1.4), if any, configure the unmatched protocol and / or port to a target protocol and target port that meet the requirements of the target test environment.

[0079] Here, the transport layer protocol and / or port of the data packet is checked. If they do not match the requirements of the target test environment, the specific mismatching protocol and / or port information is filled in the configuration window.

[0080] In some embodiments, step S104 parses the current data packet under the action of the viewing tool and the preset protocol parsing code, specifically including:

[0081] Step 2.1), convert the current data packet into the target format through the viewing tool.

[0082] The viewing tool may also convert the current data packet into a target format that can be used to display and edit the current data packet; for example, the current data packet is generally in pcap or pcapng format in actual applications, and the target format is PDML format.

[0083] Step 2.2), based on the viewing tool, parse each protocol layer below the transport layer of the current data packet.

[0084] The data packet in PDML format is a derivative format of XML format. The viewing tool can directly identify and parse the data of each protocol layer below the transport layer in the network protocol.

[0085] Step 2.3), obtain the current data packet based on the target port, and determine the communication protocol type of the application layer above the transport layer.

[0086] Here, in the implementation of the prior art, the protocols above the transport layer cannot identify the specific protocol format. The embodiment of the present invention obtains the current data packet based on the target port configured in the above embodiment, and then determines the corresponding communication protocol type based on the current data packet. Among them, the communication protocol types that may be used in the application layer include the on-board diagnostic communication protocol doit, the vehicle-to-cloud communication protocol mqtt, someip protocol, DDS protocol, etc.

[0087] Step 2.4), according to the communication protocol type of the application layer, determine the corresponding preset protocol parsing code, and parse the application layer of the current data packet.

[0088] Here, the corresponding preset parsing protocol code is pre-configured according to the communication protocol type that may be adopted by the application layer. Here, the corresponding preset parsing protocol code is determined according to the identified communication protocol type, and the application layer of the data packet can be parsed according to the preset parsing protocol code; for example, the communication protocol type is someip, and the someip parsing protocol format code is used to parse the current data packet; specifically, the viewing tool reads the someip current data packet in pcap format, and parses each layer of data content of the current data packet in sequence from bottom to top until it is parsed to the application layer, that is, the protocol layer where someip is located, and then it is parsed according to the someip parsing protocol format code according to the data content transmitted in the port direction of the target port.

[0089] In some embodiments, step S106 may display and re-edit the target field content of each protocol layer, including:

[0090] Step 3.1), according to the distribution order of each protocol layer of the network protocol, extract the target field content of each protocol layer in turn and display it.

[0091] In actual applications, the target field contents of each protocol layer can be edited according to the target test environment; as another possible application, the physical layer and the data link layer do not need to be edited, that is, only the target field contents of the network layer, the transport layer and the application layer are edited and displayed according to the target test environment;

[0092] Specifically, the viewing tool reads and edits the current data packet of someip; according to the protocol layer content, the current data packet in PDML format filters out the interpretation fields except the target field content, only extracts the target field content, and displays the extracted target field content according to the network protocol layer.

[0093] For a clearer understanding, the target field content of the transport layer is used as an example. Generally speaking, the target field content of each protocol layer is of the same category, namely, field name, shown name, and value. Figure 4 Shows the IP protocol content of the transport layer of the current data packet in PDML format; for example, the current Figure 4 The target field contents corresponding to the IP protocol content in the transport layer are: field name = "ip.version", shown name = "0100...", value = "45"; field name = "ip.hdr_len", shown name = "...0101", value = "45"; field name = "ip.defield", shown name = "Differentiated Services Field", value = "00".

[0094] In some embodiments, different operation instructions may be determined according to different target test environment requirements, and corresponding operation instruction inputs correspond to the editing of target fields of each protocol layer; specifically, step S108 includes:

[0095] Step 4.1), in response to the first operation instruction, edit the target field content of the application layer to determine the application data content that matches the requirements of the target test environment.

[0096] Among them, if the target test environment has requirements for the content of the application data, such as the vehicle speed of 110km / h needs to be adjusted, a first operation instruction is issued. When the first operation instruction is received, the application data content of the application layer is re-edited to meet the requirements of the target test environment; the first operation instruction can be input by the user based on the target test environment and the graphical interactive interface, or it can be sent by the upper device of the current executing main device or the opponent.

[0097] and / or,

[0098] Step 4.2), in response to the second operation instruction, the target field content of the network layer is edited to determine an IP address for target data packet transmission that matches the requirements of the target test environment.

[0099] Among them, if the target test environment has a requirement for the IP address of the network layer used to transmit the target data packet, a second operation instruction is issued. When the second operation instruction is received, the IP address content of the network layer is re-edited to meet the requirements of the target test environment; the source of the second operation instruction is similar to the first operation instruction and will not be repeated again.

[0100] and / or,

[0101] Step 4.3), in response to the third operation instruction, the target field content of the transport layer is edited to determine a port for target data packet transmission that matches the requirements of the target test environment.

[0102] Among them, if the target test environment has requirements for the port of the transport layer, a third operation instruction will be issued. When the third operation instruction is received, the port of the transport layer will be re-edited to meet the requirements of the target test environment; the source of the third operation instruction is similar to the first operation instruction and will not be repeated again.

[0103] As an optional embodiment, the method further includes:

[0104] Step 5.1), in response to the fourth operation instruction, the transmission strategy of the target data packet is edited to determine the transmission strategy of the target data packet that matches the requirements of the target test environment.

[0105] According to Figure 5 In the window shown, after the target data packet is edited, the transmission strategy of the target data packet can be edited according to the needs of the target test relief, or before the target data packet is generated, Figure 5 The window shown implements the editing of the data packet transmission strategy; the editing of the transmission strategy may include the settings of the sending time, number of data packets, sending end time, sending mode, etc.; for example, edit how long it takes to send a certain number of target data packets, when to stop sending the target data packets, and whether the target data packets are sent in a cycle or in sequence.

[0106] Here, if you do not want to send the edited target data packet, you can also save the target data packet as a preset file type through the viewing tool. At this time, the viewing tool can view such files; the viewing tool supports saving the target data packet as files in pcap format and PDML format.

[0107] Step 5.2), sending at least one target data packet to the target end according to the transmission strategy, so that the target end performs a safety test on the target vehicle in the target test environment according to the target data packet.

[0108] It should be noted that the target vehicle in the target test environment is the object to be tested and verified. Based on the effect of the target data packet on the object, it can be determined whether there is any abnormality in the operating result produced by the target vehicle; if there is an abnormality, the target vehicle does not meet the test of the target test environment; otherwise; the target data packet is a test sample used to exert an adverse abnormal effect on the target vehicle to be tested in the target test environment.

[0109] Figure 6 A flow chart of another data packet editing method for a target test environment provided by an embodiment of the present invention.

[0110] like Figure 6 As shown, it mainly includes:

[0111] Configure the port for someip import parsing in the interface; convert someip PCAP data packets into someip PDML format, and parse according to the data obtained by the port; read someip PDML format files, obtain network data packet contents by level, and import them into the parsing tool; edit and modify someip data packet format contents; edit data packet sending policies; automatically send data packets, or save data packet contents in the specified format.

[0112] The embodiment of the present invention can convert the pcap data packet of the SomeIP protocol into the PDML format, then read the PDML format, display and edit the data packet through a viewing tool, and send the edited data packet according to the set sending strategy, thereby realizing the re-editing, display and automatic sending of the pcap data packet of the SomeIP protocol, facilitating the investigation and research of project development performance testing and communication problems, and improving development and testing efficiency.

[0113] In some embodiments, Figure 7 As shown, the embodiment of the present invention further provides a data packet editing device 200 for a target test environment, the device comprising:

[0114] Configuration module 201, obtains and opens the current data packet, and configures the target protocol and target port of the transport layer according to the target test environment; wherein the transport layer is a protocol layer in the network protocol used to transmit the current data packet;

[0115] The parsing module 202 determines a preset protocol parsing code corresponding to the application layer based on the target port, and parses the current data packet under the action of the viewing tool and the preset protocol parsing code; wherein the application layer is a protocol layer above the transport layer in the network protocol;

[0116] The extraction module 203 extracts the target field content from each protocol layer of the parsed current data packet in turn according to the protocol layer distribution of the network protocol;

[0117] The editing module 204 edits the target field content of each protocol layer in response to the input operation instruction to generate a target data packet; wherein the operation instruction corresponds to the requirements of the target test environment.

[0118] Furthermore, the configuration module 201 is also specifically used to obtain the current data packet and open the current data packet through a preset viewing tool; determine whether the protocol and port of the transport layer in the network protocol of the current data packet do not match the target test environment; if not, no configuration is required; if so, the mismatched protocol and / or port are configured to a target protocol and target port that meet the requirements of the target test environment.

[0119] Furthermore, the parsing module 202 is also specifically used to obtain the current data packet based on the target port, determine the communication protocol type of the application layer above the transport layer; according to the communication protocol type of the application layer, determine the corresponding preset protocol parsing code, and parse the application layer of the current data packet.

[0120] Furthermore, before the step of obtaining the current data packet based on the target port and determining the communication protocol type of the application layer above the transport layer, the parsing module 202 is also specifically used to convert the current data packet into a target format through the viewing tool; wherein the target format is used to display and edit the current data packet; and based on the viewing tool, each protocol layer below the transport layer of the current data packet is parsed separately.

[0121] Furthermore, the extraction module 203 is also specifically used to extract and display the target field content of each protocol layer in sequence according to the distribution order of each protocol layer of the network protocol.

[0122] Furthermore, the editing module 204 is also specifically used to edit the target field content of the application layer in response to the first operation instruction, and determine the application data content that matches the requirements of the target test environment; and / or, in response to the second operation instruction, edit the target field content of the network layer, and determine the IP address for transmitting the target data packet that matches the requirements of the target test environment; and / or, in response to the third operation instruction, edit the target field content of the transport layer, and determine the port for transmitting the target data packet that matches the requirements of the target test environment.

[0123] Furthermore, the device is also used to edit the transmission strategy of the target data packet in response to a fourth operation instruction, determine a transmission strategy of the target data packet that matches the requirements of the target test environment; and send at least one of the target data packets to the target end according to the transmission strategy, so that the target end performs a safety test on the target vehicle in the target test environment according to the target data packet.

[0124] Figure 8 Schematic diagram of the hardware architecture of the electronic device 300 provided in an embodiment of the present invention. Figure 8 As shown, the electronic device 300 includes: a machine-readable storage medium 301 and a processor 302, and may also include a non-volatile storage medium 303, a communication interface 304 and a bus 305; wherein the machine-readable storage medium 301, the processor 302, the non-volatile storage medium 303 and the communication interface 304 communicate with each other through the bus 305. The processor 302 can execute the data packet editing method for the target test environment described in the above embodiment by reading and executing the machine executable instructions for data packet editing for the target test environment in the machine-readable storage medium 301.

[0125] The machine-readable storage medium mentioned in this article can be any electronic, magnetic, optical or other physical storage device that can contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium can be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), any type of storage disk (such as CD, DVD, etc.), or similar storage medium, or a combination thereof.

[0126] The non-volatile medium may be a non-volatile memory, a flash memory, a storage drive (such as a hard drive), any type of storage disk (such as a CD, DVD, etc.), or a similar non-volatile storage medium, or a combination thereof.

[0127] It can be understood that the specific operation methods of each functional module in this embodiment can refer to the detailed description of the corresponding steps in the above method embodiment, and will not be repeated here.

[0128] The computer-readable storage medium provided in the embodiment of the present invention stores a computer program. When the computer program code is executed, the data packet editing method for the target test environment described in any of the above embodiments can be implemented. The specific implementation can be found in the method embodiment, which will not be repeated here.

[0129] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0130] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0131] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0132] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present invention, which are used to illustrate the technical solutions of the present invention rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the aforementioned embodiments, those of ordinary skill in the art should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the aforementioned embodiments within the technical scope disclosed by the present invention, or can easily conceive of changes, or make equivalent replacements for some of the technical features therein. Such modifications, changes or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the protection scope of the present invention.

Claims

1. A data packet editing method for a target test environment, characterized in that: The method comprises: Acquire and open the current data packet, and configure the target protocol and target port of the transport layer according to the target test environment; wherein the transport layer is a protocol layer in the network protocol used to transmit the current data packet; Determine a preset protocol parsing code corresponding to the application layer based on the target port, and parse the current data packet under the action of the viewing tool and the preset protocol parsing code; wherein the application layer is a protocol layer above the transport layer in the network protocol; Extracting the target field content from each protocol layer of the parsed current data packet in turn according to the protocol layer distribution of the network protocol; The target field content of each protocol layer is edited in response to an input operation instruction to generate a target data packet; wherein the operation instruction corresponds to the requirements of the target test environment.

2. The method according to claim 1, characterized in that: The steps of obtaining and opening the current data packet and configuring the target protocol and target port of the transport layer according to the target test environment include: Obtaining a current data packet, and opening the current data packet through a preset viewing tool; Determine whether the protocol and port of the transport layer in the network protocol of the current data packet are inconsistent with the target test environment; If it does not exist, no configuration is required; If any, the unmatched protocol and / or port are configured to a target protocol and a target port that meet the requirements of the target test environment.

3. The method according to claim 1, characterized in that: The step of determining a preset protocol parsing code corresponding to the application layer based on the target port, and parsing the current data packet under the action of a viewing tool and the preset protocol parsing code comprises: Acquire the current data packet based on the target port, and determine the communication protocol type of the application layer above the transport layer; According to the communication protocol type of the application layer, a corresponding preset protocol parsing code is determined, and the application layer of the current data packet is parsed.

4. The method according to claim 3, characterized in that Before the step of obtaining the current data packet based on the target port and determining the communication protocol type of the application layer above the transport layer, the method further includes: Converting the current data packet into a target format by using the viewing tool; wherein the target format is used to display and edit the current data packet; Based on the viewing tool, each protocol layer below the transport layer of the current data packet is parsed respectively.

5. The method according to claim 1, characterized in that: The step of extracting the target field content from each protocol layer of the parsed current data packet in turn according to the protocol layer distribution of the network protocol comprises: According to the distribution order of each protocol layer of the network protocol, the target field content of each protocol layer is extracted and displayed in turn.

6. The method according to claim 1, characterized in that The step of editing the target field content of each protocol layer in response to the input operation instruction to generate a target data packet includes: In response to the first operation instruction, the target field content of the application layer is edited to determine the application data content that matches the requirements of the target test environment; and / or, In response to the second operation instruction, the target field content of the network layer is edited to determine an IP address for transmitting the target data packet that matches the requirements of the target test environment; and / or, In response to the third operation instruction, the target field content of the transport layer is edited to determine a port for target data packet transmission that matches the requirements of the target test environment.

7. The method according to claim 1, characterized in that The method further comprises: In response to a fourth operation instruction, the transmission strategy of the target data packet is edited to determine a transmission strategy of the target data packet that matches the requirements of the target test environment; At least one of the target data packets is sent to a target end according to the transmission strategy, so that the target end performs a safety test on a target vehicle in a target test environment according to the target data packet.

8. A data packet editing device for a target test environment, characterized in that: The device comprises: A configuration module is used to obtain and open the current data packet, and configure the target protocol and target port of the transport layer according to the target test environment; wherein the transport layer is a protocol layer in the network protocol used to transmit the current data packet; A parsing module, which determines a preset protocol parsing code corresponding to an application layer based on the target port, and parses the current data packet under the action of a viewing tool and the preset protocol parsing code; wherein the application layer is a protocol layer above the transport layer in the network protocol; An extraction module, which extracts the target field content from each protocol layer of the parsed current data packet in turn according to the protocol layer distribution of the network protocol; The editing module edits the target field content of each protocol layer in response to an input operation instruction to generate a target data packet; wherein the operation instruction corresponds to the requirements of the target test environment.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the steps of the method described in any one of claims 1 to 7.