WO2017132911A1 - Data transmission method and apparatus - Google Patents

Data transmission method and apparatus Download PDF

Info

Publication number
WO2017132911A1
WO2017132911A1 PCT/CN2016/073381 CN2016073381W WO2017132911A1 WO 2017132911 A1 WO2017132911 A1 WO 2017132911A1 CN 2016073381 W CN2016073381 W CN 2016073381W WO 2017132911 A1 WO2017132911 A1 WO 2017132911A1
Authority
WO
WIPO (PCT)
Prior art keywords
bit
header
data
ipv4
option
Prior art date
Application number
PCT/CN2016/073381
Other languages
French (fr)
Chinese (zh)
Inventor
贺恩华
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201680048976.3A priority Critical patent/CN107925516A/en
Priority to PCT/CN2016/073381 priority patent/WO2017132911A1/en
Publication of WO2017132911A1 publication Critical patent/WO2017132911A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received

Definitions

  • Embodiments of the present invention relate to communication technologies, and in particular, to a data transmission method and apparatus.
  • LTE Long Term Evolution
  • LTE-A Long Term Evolution-Advance
  • IP Internet Protocol
  • IPv4 Internet Protocol Version 4
  • each intermediate device (such as a base station, a core network, a router, etc.) has a Maximum Transmission Unit (MTU) limit. If the size of the transmitted data packet exceeds the MTU, The data packet is divided into a plurality of fragmented packets that do not exceed the MTU size. The value of the identifier Flg of each fragmented packet is 1, indicating that the packet is a fragmented packet.
  • a 16-bit Internet Protocol Identity (IPID) field is defined in the header of each IPv4 data packet. The decimal value corresponding to the IPID is 0 to 65535. .
  • the packet is considered to be the fragmented packet of the same data packet. If the IPIDs are different, It is considered not to be the same data message.
  • the receiver When using IPv4 for high-speed data transmission, in the certain period, the receiver often has two or more data packets that are not the same data packet.
  • the IPID of the fragmented packet is the same, and the packets with the same IPID are erroneously reorganized, resulting in errors in data transmission and even service interruption.
  • the present invention provides a data transmission method and apparatus, which avoids that two or more fragmented packets that are not the same IPv4 data packet have the same IPID in a certain period, and thus The case of incorrect combination of IPv4 data messages satisfies the business needs of high-speed transmission of wired or wireless data in the future.
  • an embodiment of the present invention provides a data transmission method, including: adding an option Option field at a tail of an IPv4 data header of a fourth Internet Protocol version 4 to generate a second IPv4 data header; the Option field includes an identifier bit, a length bit and a data bit, the Internet Protocol Identity IPID of the second IPv4 data message is a sum of an IPID of the first IPv4 data header and a bit number of data bits of the Option field; according to the second IPv4 data The header and the transmission data generate an IPv4 data message; and the IPv4 data message is sent.
  • the IP address of the second IPv4 data packet is the sum of the IPID of the first IPv4 data header and the number of bits of the data bit of the Option field, because the Option field is added in the header of the standard IPv4 data packet. That is, the maximum value of the IPID in the finally generated IPv4 data packet exceeds 65535.
  • the IPID of the IPv4 data packet exceeds 65535, the IPID can continue to increase, and the update will not start from 0, so that the receiver will appear in a certain period. Two or more fragmented packets that are not the same IPv4 data packet have the same IPID, so that the IPv4 data packets are incorrectly combined, which satisfies the future high-speed transmission of wired or wireless data.
  • the option Option field is added after the end of the first IPv4 data header.
  • the method further includes adding a padding field after the data bit of the Option field, such that the sum of the data bits of the Option field and the number of bits of the padding field is 16.
  • the padding field is added after the data bit of the Option field, so that the sum of the data bits of the Option field and the number of bits of the padding field is 16, not only making IPv4
  • the maximum IPID of the data packet exceeds 65535, which avoids the situation where the IPID of two or more fragmented packets that are not the same data packet is the same at the receiving end, meeting the needs of future wired and wireless network services.
  • the problem of inaccurate calculation caused by the fact that the Option field does not occupy 4 bytes is calculated when calculating the header checksum, and the operation is simple and the efficiency is high.
  • the method further includes: updating a length of the second IPv4 data header, corresponding IPv4 data The total length of the message and the header checksum.
  • the value of other fields is adaptively updated to ensure the accuracy and reliability of the IPv4 data packet.
  • the identifier bit of the Option field includes a copy bit, a function option bit, and an option number.
  • the sending the IPv4 data packet includes:
  • the header checksum of the two IPv4 data headers includes: 16-bit aligning the values of the fields of the second IPv4 data header, and setting the header checksum to 0; the aligned fields Summing the value, obtaining a first header checksum; re-aligning the first header checksum with 16 values of other fields to obtain a second header checksum; The partial checksum performs a bit flip to obtain an updated header checksum.
  • an embodiment of the present invention provides a data transmission method, including: receiving an IPv4 data packet of an Internet Protocol version 4.
  • the header of the IPv4 data packet includes an Option field, and the Option field includes an identifier bit and a length bit. And a data bit; parsing the IPv4 data packet according to a sum of an IPID of the IPv4 data header and a bit number of data bits of the Option field.
  • the Option field is added to the header of the IPv4 data packet, so that the maximum value of the IPID exceeds 65535, that is, when the IPID of the IPv4 data packet exceeds 65535, the value can continue to increase, and the update does not start from 0. The situation that two or more fragmented packets that are not the same data packet have the same IPID at the receiving end is avoided, which satisfies the business requirement of high-speed transmission of wired or wireless data in the future.
  • the identifier bit of the Option field includes a copy bit, a function option bit, and an option number.
  • an embodiment of the present invention provides a data transmission apparatus, including:
  • the Internet Protocol Identity IPID is the sum of the IPID of the first IPv4 data header and the number of bits of the data bits of the Option field;
  • a generating module configured to generate an IPv4 data packet according to the second IPv4 data header and the transmission data
  • a sending module configured to send the IPv4 data packet.
  • the adding module is further configured to add a padding field after the data bit of the Option field, so that the data bit of the Option field and the number of bits of the padding field are Is 16.
  • the device further includes:
  • an update module configured to update a length of the second IPv4 data header, a total length of the corresponding IPv4 data packet, and a header checksum.
  • the identifier bit of the Option field includes a copy bit, a function option bit, and an option number.
  • the adding module updates a header checksum of the second IPv4 data header ,include:
  • the adding module performs 16-bit alignment on the values of the fields of the second IPv4 data header, and sets the header checksum to 0; sums the values of the aligned fields to obtain the first header. a checksum; re-aligning the first header checksum with 16 values of other fields to obtain a second header checksum; and performing bit flipping on the second header checksum to obtain Updated header checksum.
  • the apparatus provided by the third aspect is used to perform the data transmission method provided by the first aspect, and the implementation principle and the beneficial effects are similar, and details are not described herein again.
  • an embodiment of the present invention provides a data transmission apparatus, including:
  • a receiving module configured to receive an IPv4 data packet of the Internet Protocol version 4; the header of the IPv4 data packet includes an Option field, where the Option field includes an identifier bit, a length bit, and a data bit;
  • a parsing module configured to parse the IPv4 data packet according to a sum of an IPID of the IPv4 data header and a bit number of data bits of the Option field.
  • the identifier bit of the Option field includes a copy bit, a function option bit, and an option number.
  • the apparatus provided in the fourth aspect is used to perform the data transmission method provided by the second aspect, and the implementation principle and the beneficial effects are similar, and details are not described herein again.
  • FIG. 1 is a schematic diagram of an application scenario of a data transmission method provided by the present invention
  • FIG. 2 is a flowchart of a data transmission method according to Embodiment 1 of the present invention.
  • FIG. 3 is a flowchart of a data transmission method according to Embodiment 2 of the present invention.
  • FIG. 4 is a flowchart of a method for calculating a header checksum of an IPv4 data packet according to an embodiment of the present invention
  • FIG. 5 is a schematic structural diagram of a data transmission apparatus according to Embodiment 3 of the present invention.
  • FIG. 6 is a schematic structural diagram of a data transmission apparatus according to Embodiment 4 of the present invention.
  • FIG. 7 is a schematic structural diagram of a data transmission apparatus according to Embodiment 5 of the present invention.
  • FIG. 8 is a schematic structural diagram of a device according to Embodiment 6 of the present invention.
  • FIG. 1 is a schematic diagram of an application scenario of a data transmission method provided by the present invention.
  • the data transmission method is applicable to all networks using IPv4 technologies, such as a mobile network, a fixed network, and an Internet of Things.
  • the scenario includes a transmitting end 1, an intermediate device 2, an intermediate device 3, an intermediate device 4, and a receiving end 5.
  • the sending end 1 is configured to generate an IPv4 data packet according to the agreed protocol, and send the IPv4 data packet to the receiving end 5.
  • the receiving end 5 parses the packet according to the agreed protocol.
  • the sender 1 and the receiver 5 can be devices such as a server and a terminal.
  • the intermediate device is configured to forward the IPv4 data packet according to the agreed protocol.
  • the intermediate device may be a base station, a core network, a router, etc.
  • the intermediate device in the scenario is not required, and may include multiple or multiple intermediate devices.
  • the intermediate device may not be included, and only three intermediate devices are schematically illustrated in FIG.
  • FIG. 2 is a flowchart of a data transmission method according to Embodiment 1 of the present invention. As shown in FIG. 2, the method in this embodiment may include:
  • Step 101 Add an Option field at the end of the first IPv4 data header to generate a second IPv4 data header.
  • the Option field includes an identifier bit, a length bit, and a data bit.
  • the IPID of the second IPv4 data packet is the first IPv4 data.
  • the IPID of the header and the bits of the data bits of the Option field The sum of the numbers.
  • the IP address of the first Pv4 data header is a 16-bit IPID in a standard IPv4 packet, that is, an Identification field in a header of a standard IPv4 packet, and the Option field is used in a standard IPv4 packet.
  • the 16-bit IPID is extended, wherein the identifier field of the Option field indicates that the Option field is used to extend the IPID, the length bit indicates the length of the entire Option field, and the data bit indicates the length of the extended IPID.
  • the length of the IPID field of the standard IPv4 packet is 16 bits, that is, the maximum value of the IPID is 65535.
  • the sender adds an Option field to the end of the header of the IPv4 data packet to extend the IPID, that is, the 16-bit original.
  • the sum of the number of bits of the data bits of the IPID and the Option field is the IPID of the generated IPv4 data packet, so that the length of the IPID of the IPv4 data packet is greater than 16 bits, that is, the maximum value of the IPID exceeds 65535.
  • the data bit of the Option field can be set to 16 bits, and the IPID can be extended from 16 bits in the standard to 32 bits.
  • the identification range supported by the IPv4 protocol is extended from 65535 to 4294836225, which is equivalent to extending the IPID of the IPv4 data packet to The same range of IPv6 Identification.
  • Table 1 shows the format of an IPv4 data packet according to an embodiment of the present invention.
  • the length of the data bit of the Option field in Table 1 is 16 bits.
  • the second IPv4 data header includes the IPv4 protocol version (Ver) and the header length (Internet Header Length, Referred to as IHL), service type (Tos), total message length (total length), IP identification (Identification), fragmented message flag (Flg), fragmented packet offset (Fragment offset), lifetime (Time), protocol type (Protocol), Header Checksum, source address, destination address, Option field (Opt.code), length of the Option field (Opt.len), the Option field of the Option field, where the Identification is the 16-bit IPID defined in the standard IPv4 protocol.
  • Table 2 shows the format of a standard IPv4 data message. As shown in Table 2, the first IPv4 data header starts from the Ver field and ends at the destination address field.
  • the Identification field in the standard IPv4 data header is only 16 bits, the header length is 20 bytes, the total length of the IPv4 data packet is 1500 bytes, and the value of the Header Checksum is 0xc7a4.
  • the IPv4 data header in this embodiment includes not only the Identification field but also the Option field.
  • the second IPv4 data header starts from Ver and ends with the option value.
  • the header length is increased by 4 bytes, that is, 24 bytes, IPv4.
  • the total length of the data packet is 1504 Byte, and the value of the Header Checksum is 0x3c9c.
  • Step 102 Generate an IPv4 data packet according to the second IPv4 data header and the transmission data.
  • the transmission data is added in the data field. It can generate IPv4 data packets.
  • Step 103 Send an IPv4 data packet.
  • the sending end directly sends the IPv4 data packet to the receiving end, and the intermediate device forwards the IPv4 data packet to the receiving end, for example, forwarding the IPv4 data packet to the next hop in the forwarding path.
  • the router forwards the IPv4 data packet to other intermediate devices, and finally sends the packet to the receiving end after being forwarded multiple times.
  • the above steps 101-103 are performed by the transmitting end.
  • the receiving end specifically performs the following steps: receiving the Internet Protocol version 4 IPv4 data message; according to the sum of the IPID of the IPv4 data header and the number of bits of the data field of the Option field to the IPv4
  • the data packet is parsed; the header of the IPv4 data packet includes an Option field, and the Option field includes an identifier bit, a length bit, and a data bit.
  • the receiving end parses the data IPv4 data packet according to the Identification+Option value shown in Table 1, for example, if the receiving end identifies multiple IPv4 data. If the packets are all fragmented and the value of the Identification+Option value is the same, the IPv4 data packets are combined into one IPv4 data packet.
  • the data transmission method provided in this embodiment adds an Option field to the end of the first IPv4 data header, generates a second IPv4 data header, generates an IPv4 data packet according to the second IPv4 data header and the transmission data, and sends the IPv4 data packet.
  • the receiving end is configured to enable the receiving end to parse the IPv4 data packet according to the sum of the IPID of the IPv4 data header and the number of bits of the data bit of the Option field, because the Option field added in the header of the standard IPv4 data packet makes
  • the IP address of the second IPv4 data packet is the sum of the IPID of the first IPv4 data header and the number of bits of the data bit of the Option field, that is, the maximum value of the IPID in the finally generated IPv4 data packet exceeds 65535, when the IPv4 data packet If the IPID exceeds 65535, the IPID of the fragmented packet that is not the same IPv4 data packet will be the same, so that the IP address of the fragmented packet that is not the same IPv4 data packet will be the same.
  • the case of incorrectly combining IPv4 data packets satisfies the business needs of high-speed transmission of wired or wireless data in the future.
  • the method further includes: after the option Option field is added to the end of the first IPv4 data header, the method further includes: The padding field is added after the bit so that the sum of the data bits of the Option field and the number of bits of the padding field is 16.
  • Table 3 shows the format of an IPv4 data packet provided by another embodiment of the present invention. As shown in Table 3, When the data bit of the Option field is 8 bits, the Option field does not occupy 4 bytes. Therefore, an 8-bit padding field is added after the Option field of the Option field.
  • the Padding field is used for 16-bit alignment in order to calculate the Header Checksum. There is no practical meaning.
  • the number of bits of the data bit of the Option field may be set longer. For example, if the data bit of the Option field is set to 24 bits, the Padding field needs to be set after the Option field, if the Option is If the data bit of the field is set to 32bit, you do not need to add the Padding field.
  • FIG. 3 is a flowchart of a data transmission method according to Embodiment 2 of the present invention. As shown in FIG. 3, the method includes the following steps:
  • Step 201 Add an Option field at the end of the first IPv4 data header to generate a second IPv4 data header.
  • the Option field includes an identifier bit, a length bit, and a data bit.
  • the IPID of the second IPv4 data packet is an IPID of the first IPv4 data header. The sum of the number of bits of the data bits with the Option field.
  • the identifier bits of the Option field include a copy bit, a function option bit, and an option number.
  • the identifier bit Opt.code of the Option field contains 8 bits, where 1 bit is used to set a copy flag, and when the copied flag is 0, it means non-copy (not copied); when the copied flag is 1 When it is said, it is copied.
  • 2bits is used to set function option bits (option) Class), when the option class is 0, it indicates that the Option field is a control command (control); when the option class is 1 or 3, it indicates that the Option field is reserved for future use; when the option class is 1. , indicating that the Option field is debugging and measurement.
  • 5bits is used to set the option number (option number). The option number is used to indicate the type of the Option field. Different option numbers indicate Option fields for different purposes.
  • Table 4 shows the format of the Option field. As shown in Table 4, eight Option fields of other uses have been defined in the protocol, and the eight Option fields are clearly defined in the protocol. Let me repeat. This embodiment adds a ninth Option field for extending the IPID.
  • the copied flag of the ninth Option field provided in this embodiment is 1, indicating that the option is 0, indicating that the Option field is control, the option number is 10, and 10 indicates that the Option field is used for expansion.
  • IPID Preferably, any value of 11 to 32 that is not used in the current RFC791 protocol may be used as the option number value in this embodiment.
  • Step 202 Update the length of the second IPv4 data header, the total length of the corresponding IPv4 data packet, and the header checksum.
  • FIG. 4 is a flowchart of a method for calculating a header checksum of an IPv4 data packet according to an embodiment of the present invention.
  • the execution body of the method is a sender.
  • Table 5 shows the result of each step of calculating the Header Checksum in the standard IPv4 data message.
  • Table 6 shows the result of each step of calculating the Header Checksum in the IPv4 data message provided by the embodiment of the present invention.
  • the method includes the following steps:
  • Step 301 Perform 16-bit alignment on the values of the fields of the second IPv4 data header, and set the header checksum to 0.
  • the fields in the header of the IPv4 data packet are aligned 16 bits. Since the Header Checksum needs to be calculated, the Header Checksum is first set to 0.
  • opt.Value 16 bits is shown in Table 6. If the opt.Value is 8 bits, and the padding field is included, the value of opt.Value is the number of bits of opt.Value and padding. Sum.
  • Step 302 Summing the values of the aligned fields to obtain a first header checksum.
  • the standard IPv4 data message is summed and the hexadecimal first head is obtained.
  • the sum of the checksums is "23859”.
  • the hexadecimal first header checksum obtained by the summation is "2C361".
  • Step 303 Re-align the first header checksum with the values of other fields by 16 bits to obtain a second header checksum.
  • the 16 bits of each field in the header of the IPv4 data packet are aligned again. If the value of the first header checksum field exceeds 16 bits, the portion exceeding 16 bits and the lower 4 bits are If the bit is added, the value corresponding to the second header checksum of the standard IPv4 data packet is "385B", and the value corresponding to the second header checksum of the IPv4 data packet in this embodiment is "C363". ".
  • Step 304 Perform bit flipping on the second header checksum to obtain an updated header checksum.
  • Step 203 Generate an IPv4 data packet according to the second IPv4 data header and the transmission data.
  • Step 204 Send an IPv4 data packet.
  • the data transmission method provided in this embodiment adds an Option field to the end of the first IPv4 data header, generates a second IPv4 data header, and calculates and updates the length of the second IPv4 data header, the total length of the corresponding IPv4 data packet, and
  • the header checksum generates an IPv4 data packet according to the second IPv4 data header and the transmission data, and sends the IPv4 data packet to the receiving end, so that the receiving end compares the number of bits of the identification and the Option value to the IPv4 data packet. Performing an analysis to determine whether multiple IPv4 data packets are fragmented packets of the same IPv4 data packet.
  • the maximum value of the IPID exceeds 65535, that is, when When the IPID of an IPv4 data packet exceeds 65535, the IPID of the packet can continue to increase. It does not start from 0. This prevents the IPID of two or more fragmented packets that are not the same data packet from being the same at the receiving end. Meet the business needs of high-speed data transmission.
  • FIG. 5 is a schematic structural diagram of a data transmission apparatus according to Embodiment 3 of the present invention.
  • the apparatus includes an adding module 11, a generating module 12, and a sending module 13.
  • the adding module 11 adds an option Option field at the end of the first Internet Protocol version 4 IPv4 data header to generate a second IPv4 data header; the Option field includes an identifier bit, a length bit, and a data bit, and the second IPv4 data packet is in the Internet.
  • the protocol identifier IPID is the sum of the IPID of the first IPv4 data header and the number of bits of the data bits of the Option field.
  • the generating module 12 is configured to generate an IPv4 data packet according to the second IPv4 data header and the transmission data.
  • the sending module 13 is configured to send an IPv4 data message.
  • the device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 2, and the implementation principle and technical effects are similar, and details are not described herein again.
  • the adding module 11 is further configured to add a padding field after the data bit of the Option field, so that the sum of the data bit of the Option field and the number of bits of the padding field is 16.
  • FIG. 6 is a schematic structural diagram of a data transmission apparatus according to Embodiment 4 of the present invention. As shown in FIG. 6, the apparatus further includes an update module 14.
  • the update module 14 is configured to update the length of the second IPv4 data header, the total length of the corresponding IPv4 data message, and the header checksum.
  • the identifier bits of the Option field include a copy bit, a function option bit, and an option number.
  • the device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 2, and the implementation principle and technical effects are similar, and details are not described herein again.
  • the adding module 11 updates the header checksum of the second IPv4 data header, including: the adding module 11 performs 16-bit alignment on the values of the fields of the second IPv4 data header, and sets the header checksum to 0: summing the values of the aligned fields to obtain a first header checksum; re-aligning the first header checksum with the values of other fields by 16 bits to obtain a second header checksum; The second header checksum is bit flipped to obtain an updated header checksum.
  • the device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 3, and the implementation principle and technical effects are similar, and details are not described herein again.
  • FIG. 7 is a schematic structural diagram of a data transmission apparatus according to Embodiment 5 of the present invention.
  • the apparatus includes a receiving module 21 and a parsing module 22.
  • the receiving module 21 is configured to receive an IPv4 data packet of the Internet Protocol version 4.
  • the header of the IPv4 data packet includes an Option field, and the Option field includes an identifier bit, a length bit, and a data bit.
  • the parsing module 22 is configured to parse the IPv4 data packet according to the sum of the IPID of the IPv4 data header and the number of bits of the data bit of the Option field.
  • the identifier bits of the Option field include a copy bit, a function option bit, and an option number.
  • the device in this embodiment is a device at the receiving end corresponding to FIG. 5 and FIG. 6 , and the implementation principle and technical effects thereof are similar to the technical solutions in the method embodiment shown in FIG. 2 or FIG. 3 , and details are not described herein again.
  • the device includes a processor 31 and a sending interface 32.
  • the device may further include a receiving interface 33 and a memory 34, a sending interface 32, and a receiving interface. 33 is coupled to processor 31, respectively.
  • the sending interface 32 and the receiving interface 33 may be wired connection ports or wireless transceivers.
  • the sending interface 32 is a wireless transmitter
  • the receiving interface 33 is a wireless receiver.
  • Processor 31 may include one or more multi-core processors and/or memory 34.
  • the processor 31 can be a general purpose processor, an application specific integrated circuit (ASIC), or a digital signal processor (DSP).
  • ASIC application specific integrated circuit
  • DSP digital signal processor
  • Memory 34 can be a non-transitory storage medium coupled to processor 31 for storing different types of data.
  • the memory 34 may comprise a read only memory (ROM), a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or may be a disk storage.
  • ROM read only memory
  • RAM random access memory
  • Memory 34 can be used to store instructions that implement the related methods described in FIG. 2 or FIG.
  • the processor 31 adds an option Option field at the end of the first Internet Protocol version 4 IPv4 data header to generate a second IPv4 data header;
  • the Option field includes an identifier bit, a length bit, and a data bit, and an Internet Protocol identifier of the second IPv4 data packet.
  • the IPID is the sum of the IPID of the first IPv4 data header and the number of bits of the data bits of the Option field; and generates an IPv4 data packet according to the second IPv4 data header and the transmission data.
  • the sending interface 32 is configured to send an IPv4 data message.
  • the processor 31 is further configured to add a padding field after the data bit of the Option field, so that the sum of the data bit of the Option field and the number of bits of the padding field is 16.
  • the processor 31 is further configured to update a length of the second IPv4 data header, a total length of the corresponding IPv4 data message, and a header checksum.
  • the identifier bits of the Option field include a copy bit, a function option bit, and an option number.
  • the processor 31 updates the header checksum of the second IPv4 data header, including: the processor 31 performs 16-bit alignment on the values of the fields of the second IPv4 data header, and sets the header checksum to 0: summing the values of the aligned fields to obtain a first header checksum; re-aligning the first header checksum with the values of other fields by 16 bits to obtain a second header checksum; Will be second The header checksum performs a bit flip to obtain an updated header checksum.
  • the device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 2 or 3.
  • the implementation principle and technical effects are similar, and details are not described herein again.
  • the embodiment of the present invention further provides a device.
  • the structure of the device is the same as that of the device shown in FIG. 8.
  • the receiving interface is configured to receive the IPv4 data packet of the Internet Protocol version 4; and the IPv4 data packet.
  • the header includes an Option field, and the Option field includes an identifier bit, a length bit, and a data bit.
  • the processor parses the IPv4 data packet according to the sum of the IPID of the IPv4 data header and the number of bits of the data bit of the Option field.
  • the identifier bits of the Option field include a copy bit, a function option bit, and an option number.
  • the device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 2 or FIG. 3, and the implementation principle and technical effects are similar, and details are not described herein again.
  • the aforementioned program can be stored in a computer readable storage medium.
  • the steps of the foregoing method embodiments are performed; and the foregoing storage medium includes: Read-Only Memory (ROM), Random Access Memory (RAM), and Magnetic A variety of media that can store program code, such as a disc or a disc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The present invention provides a data transmission method and apparatus. The method comprises: adding an Option field into a tail part of a first Internet Protocol version 4 (IPv4) data packet header, and generating a second IPv4 data packet header, the Option field comprising a flag bit, a length bit and a data bit, and an Internet Protocol identifier (IPID) of a second IPv4 data packet being a sum between an IPID of the first IPv4 data packet header and the number of bits of data bits of the Option field; generating an IPv4 data packet according to the second IPv4 data packet header and transmitted data; and sending the IPv4 data packet. The situation of wrong combination of IPv4 data packets due to the fact that IPIDs of two or more segmented packets that are not a same IPv4 data packet are same on a reception end in a time period is avoided, thereby satisfying service demands of future wired or wireless high-speed data transmission.

Description

数据传输方法和装置Data transmission method and device 技术领域Technical field
本发明实施例涉及通信技术,尤其涉及一种数据传输方法和装置。Embodiments of the present invention relate to communication technologies, and in particular, to a data transmission method and apparatus.
背景技术Background technique
标准化组织第三代合作伙伴计划(Third Generation Partnership Project,简称3GPP)定义的长期演进(Long Term Evolution,简称LTE)及LTE的演进版本(Long Term Evolution-Advance,简称LTE-A)无线通信网络标准为第4代无线通信标准(the 4th Generation mobile communication,简称4G)。4G网络依赖于互联网协议(Internet Protocol,简称IP)技术进行数据传输,而且,目前4G网络数据传输大多数采用互联网协议第四版本(Internet Protocol Version 4,简称IPv4)。Long Term Evolution (LTE) defined by the Third Generation Partnership Project (3GPP) and the Long Term Evolution-Advance (LTE-A) wireless communication network standard defined by the Third Generation Partnership Project (3GPP) It is the 4th Generation mobile communication (4G). The 4G network relies on the Internet Protocol (IP) technology for data transmission. Moreover, most of the current 4G network data transmission adopts the Internet Protocol Version 4 (IPv4).
采用IPv4进行数据传输的过程中,每个中间设备(如基站,核心网,路由器等)都有最大传输单元(Maximum Transmission Unit,简称MTU)限制,若传输数据报文大小超过MTU,则会将数据报文分成多个不超过MTU大小的分片报文进行传输,其中,每个分片报文的标识Flg的值为1,表示该报文为分片报文。为了在接收端对分片的数据报文进行重组,每个IPv4数据报文的报头中都定义了16bit的互联网协议标识(Identification of IP,简称IPID)字段,IPID对应的十进制值为0~65535。在一定周期内,若接收端识别出多个报文均为分片报文、且这些分片报文的IPID相同,则认为是同一个数据报文的分片报文,若IPID不相同,则认为不是同一个数据报文。In the process of data transmission using IPv4, each intermediate device (such as a base station, a core network, a router, etc.) has a Maximum Transmission Unit (MTU) limit. If the size of the transmitted data packet exceeds the MTU, The data packet is divided into a plurality of fragmented packets that do not exceed the MTU size. The value of the identifier Flg of each fragmented packet is 1, indicating that the packet is a fragmented packet. In order to reassemble the fragmented data packets at the receiving end, a 16-bit Internet Protocol Identity (IPID) field is defined in the header of each IPv4 data packet. The decimal value corresponding to the IPID is 0 to 65535. . If the receiving end recognizes that multiple packets are fragmented packets and the IPIDs of the fragments are the same, the packet is considered to be the fragmented packet of the same data packet. If the IPIDs are different, It is considered not to be the same data message.
但是,随着未来有线或者无线网络的发展,数据传输速率越来越高,使用IPv4进行数据高速传输时,在一定周期内,接收端时常会出现两个或多个不是同一个数据报文的分片报文的IPID相同的情况,从而错误的将IPID相同的报文重组,导致数据传输出现差错,甚至出现业务中断。However, with the development of wired or wireless networks in the future, the data transmission rate is getting higher and higher. When using IPv4 for high-speed data transmission, in the certain period, the receiver often has two or more data packets that are not the same data packet. The IPID of the fragmented packet is the same, and the packets with the same IPID are erroneously reorganized, resulting in errors in data transmission and even service interruption.
发明内容Summary of the invention
本发明提供一种数据传输方法和装置,避免了在一定周期内,接收端会出现两个或多个不是同一个IPv4数据报文的分片报文的IPID相同、从而将 IPv4数据报文错误组合的情况,满足了未来有线或无线数据高速传输的业务需求。The present invention provides a data transmission method and apparatus, which avoids that two or more fragmented packets that are not the same IPv4 data packet have the same IPID in a certain period, and thus The case of incorrect combination of IPv4 data messages satisfies the business needs of high-speed transmission of wired or wireless data in the future.
第一方面,本发明实施例提供一种数据传输方法,包括:在第一互联网协议第4版本IPv4数据报头的尾部添加选项Option字段,生成第二IPv4数据报头;所述Option字段包括标识位、长度位和数据位,所述第二IPv4数据报文的互联网协议标识IPID为所述第一IPv4数据报头的IPID与所述Option字段的数据位的比特数之和;根据所述第二IPv4数据报头和传输数据生成IPv4数据报文;发送所述IPv4数据报文。本实施例中,由于在标准的IPv4数据报文的报头中添加的Option字段,使得第二IPv4数据报文的IPID为第一IPv4数据报头的IPID与Option字段的数据位的比特数之和,也即最终生成的IPv4数据报文中IPID的最大值超过65535,当IPv4数据报文的IPID超过65535时可以继续增大,不会从0开始更新,避免了在一定周期内,接收端会出现两个或多个不是同一个IPv4数据报文的分片报文的IPID相同、从而将IPv4数据报文错误组合的情况,满足了未来有线或者无线数据高速传输的业务需求。In a first aspect, an embodiment of the present invention provides a data transmission method, including: adding an option Option field at a tail of an IPv4 data header of a fourth Internet Protocol version 4 to generate a second IPv4 data header; the Option field includes an identifier bit, a length bit and a data bit, the Internet Protocol Identity IPID of the second IPv4 data message is a sum of an IPID of the first IPv4 data header and a bit number of data bits of the Option field; according to the second IPv4 data The header and the transmission data generate an IPv4 data message; and the IPv4 data message is sent. In this embodiment, the IP address of the second IPv4 data packet is the sum of the IPID of the first IPv4 data header and the number of bits of the data bit of the Option field, because the Option field is added in the header of the standard IPv4 data packet. That is, the maximum value of the IPID in the finally generated IPv4 data packet exceeds 65535. When the IPID of the IPv4 data packet exceeds 65535, the IPID can continue to increase, and the update will not start from 0, so that the receiver will appear in a certain period. Two or more fragmented packets that are not the same IPv4 data packet have the same IPID, so that the IPv4 data packets are incorrectly combined, which satisfies the future high-speed transmission of wired or wireless data.
结合第一方面,在第一方面的第一种可能实现方式中,若所述Option字段的数据位的比特数小于16,则所述在第一IPv4数据报头的尾部添加选项Option字段之后,所述方法还包括:在所述Option字段的数据位之后添加填充字段,以使所述Option字段的数据位与所述填充字段的比特数之和为16。本实施例中,若Option字段的数据位的比特数小于16,则在Option字段的数据位之后添加填充字段,以使Option字段的数据位与填充字段的比特数之和为16,不仅使得IPv4数据报文的IPID的最大值超过65535,避免了在接收端会出现两个或多个不是同一个数据报文的分片报文的IPID相同的情况,满足未来有线及无线网络业务发展的需要,而且,解决了计算头部校验和时由于Option字段未占满4Byte时造成的计算不准确的问题,操作简单,效率高。With reference to the first aspect, in a first possible implementation manner of the first aspect, if the number of bits of the data bit of the Option field is less than 16, the option Option field is added after the end of the first IPv4 data header. The method further includes adding a padding field after the data bit of the Option field, such that the sum of the data bits of the Option field and the number of bits of the padding field is 16. In this embodiment, if the number of bits of the data bit of the Option field is less than 16, the padding field is added after the data bit of the Option field, so that the sum of the data bits of the Option field and the number of bits of the padding field is 16, not only making IPv4 The maximum IPID of the data packet exceeds 65535, which avoids the situation where the IPID of two or more fragmented packets that are not the same data packet is the same at the receiving end, meeting the needs of future wired and wireless network services. Moreover, the problem of inaccurate calculation caused by the fact that the Option field does not occupy 4 bytes is calculated when calculating the header checksum, and the operation is simple and the efficiency is high.
结合第一方面或第一方面的第一种可能实现方式,在第一方面的第二种可能实现方式中,所述方法还包括:更新所述第二IPv4数据报头的长度、对应的IPv4数据报文的总长度和头部校验和。本实施例中,添加Option字段之后适应性的更新其它字段的值,保证了IPv4数据报文的准确性和可靠性。 With reference to the first aspect or the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, the method further includes: updating a length of the second IPv4 data header, corresponding IPv4 data The total length of the message and the header checksum. In this embodiment, after the Option field is added, the value of other fields is adaptively updated to ensure the accuracy and reliability of the IPv4 data packet.
结合第一方面的第一种或第二种可能实现方式,在第一方面的第三种可能实现方式中,所述Option字段的标识位包括复制位、功能选项位和选项编号。In conjunction with the first or second possible implementation of the first aspect, in a third possible implementation of the first aspect, the identifier bit of the Option field includes a copy bit, a function option bit, and an option number.
结合第一方面的第一种至第三种中的任一种可能实现方式,在第一方面的第四种可能实现方式中,所述发送所述IPv4数据报文,包括:所述更新第二IPv4数据报头的头部校验和,包括:将所述第二IPv4数据报头的各字段的值进行16比特对齐,并将所述头部校验和设置为0;将对齐后的各字段的值求和,获取第一头部校验和;重新将所述第一头部校验和与其它字段的值进行16比特对齐,获取第二头部校验和;将所述第二头部校验和进行比特翻转,获取更新的头部校验和。With reference to the possible implementation of any one of the first to the third aspects of the first aspect, in the fourth possible implementation of the first aspect, the sending the IPv4 data packet includes: The header checksum of the two IPv4 data headers includes: 16-bit aligning the values of the fields of the second IPv4 data header, and setting the header checksum to 0; the aligned fields Summing the value, obtaining a first header checksum; re-aligning the first header checksum with 16 values of other fields to obtain a second header checksum; The partial checksum performs a bit flip to obtain an updated header checksum.
第二方面,本发明实施例提供一种数据传输方法,包括:接收互联网协议第4版本IPv4数据报文;所述IPv4数据报文的报头包括Option字段,所述Option字段包括标识位、长度位和数据位;根据所述IPv4数据报头的IPID与所述Option字段的数据位的比特数之和对所述IPv4数据报文进行解析。本实施例中,由于在IPv4数据报文的报头中添加了Option字段,使得IPID的最大值超过65535,也即当IPv4数据报文的IPID超过65535时可以继续增大,不会从0开始更新,避免了在接收端会出现两个或多个不是同一个数据报文的分片报文的IPID相同的情况,满足了未来有线或无线数据高速传输的业务需求。In a second aspect, an embodiment of the present invention provides a data transmission method, including: receiving an IPv4 data packet of an Internet Protocol version 4. The header of the IPv4 data packet includes an Option field, and the Option field includes an identifier bit and a length bit. And a data bit; parsing the IPv4 data packet according to a sum of an IPID of the IPv4 data header and a bit number of data bits of the Option field. In this embodiment, the Option field is added to the header of the IPv4 data packet, so that the maximum value of the IPID exceeds 65535, that is, when the IPID of the IPv4 data packet exceeds 65535, the value can continue to increase, and the update does not start from 0. The situation that two or more fragmented packets that are not the same data packet have the same IPID at the receiving end is avoided, which satisfies the business requirement of high-speed transmission of wired or wireless data in the future.
结合第二方面,在第二方面的第一种可能实现方式中,所述Option字段的标识位包括复制位、功能选项位和选项编号。With reference to the second aspect, in a first possible implementation manner of the second aspect, the identifier bit of the Option field includes a copy bit, a function option bit, and an option number.
第三方面,本发明实施例提供一种数据传输装置,包括:In a third aspect, an embodiment of the present invention provides a data transmission apparatus, including:
添加模块,在第一互联网协议第4版本IPv4数据报头的尾部添加选项Option字段,生成第二IPv4数据报头;所述Option字段包括标识位、长度位和数据位,所述第二IPv4数据报文的互联网协议标识IPID为所述第一IPv4数据报头的IPID与所述Option字段的数据位的比特数之和;Adding a module, adding an option Option field at the end of the first Internet Protocol version 4 IPv4 data header to generate a second IPv4 data header; the Option field includes an identifier bit, a length bit, and a data bit, and the second IPv4 data packet The Internet Protocol Identity IPID is the sum of the IPID of the first IPv4 data header and the number of bits of the data bits of the Option field;
生成模块,用于根据所述第二IPv4数据报头和传输数据生成IPv4数据报文;a generating module, configured to generate an IPv4 data packet according to the second IPv4 data header and the transmission data;
发送模块,用于发送所述IPv4数据报文。And a sending module, configured to send the IPv4 data packet.
结合第三方面,在第三方面的第一种可能实现方式中,若所述Option字 段的数据位的比特数小于16,则所述添加模块还用于在所述Option字段的数据位之后添加填充字段,以使所述Option字段的数据位与所述填充字段的比特数之和为16。With reference to the third aspect, in the first possible implementation manner of the third aspect, if the Option word is The number of bits of the data bits of the segment is less than 16, the adding module is further configured to add a padding field after the data bit of the Option field, so that the data bit of the Option field and the number of bits of the padding field are Is 16.
结合第三方面或第三方面的第一种可能实现方式,在第三方面的第二种可能实现方式中,所述装置还包括:With reference to the third aspect, or the first possible implementation manner of the third aspect, in a second possible implementation manner of the third aspect, the device further includes:
更新模块,用于更新所述第二IPv4数据报头的长度、对应的IPv4数据报文的总长度和头部校验和。And an update module, configured to update a length of the second IPv4 data header, a total length of the corresponding IPv4 data packet, and a header checksum.
结合第三方面的第一种或第二种可能实现方式,在第三方面的第三种可能实现方式中,所述Option字段的标识位包括复制位、功能选项位和选项编号。With reference to the first or second possible implementation manner of the third aspect, in a third possible implementation manner of the third aspect, the identifier bit of the Option field includes a copy bit, a function option bit, and an option number.
结合第三方面的第一种至第三种中的任一种可能实现方式,在第三方面的第四种可能实现方式中,所述添加模块更新第二IPv4数据报头的头部校验和,包括:In conjunction with any one of the first to third aspects of the third aspect, in a fourth possible implementation of the third aspect, the adding module updates a header checksum of the second IPv4 data header ,include:
所述添加模块将所述第二IPv4数据报头的各字段的值进行16比特对齐,并将所述头部校验和设置为0;将对齐后的各字段的值求和,获取第一头部校验和;重新将所述第一头部校验和与其它字段的值进行16比特对齐,获取第二头部校验和;将所述第二头部校验和进行比特翻转,获取更新的头部校验和。The adding module performs 16-bit alignment on the values of the fields of the second IPv4 data header, and sets the header checksum to 0; sums the values of the aligned fields to obtain the first header. a checksum; re-aligning the first header checksum with 16 values of other fields to obtain a second header checksum; and performing bit flipping on the second header checksum to obtain Updated header checksum.
第三方面提供的装置用于执行第一方面提供的数据传输方法,其实现原理和有益效果类似,此处不再赘述。The apparatus provided by the third aspect is used to perform the data transmission method provided by the first aspect, and the implementation principle and the beneficial effects are similar, and details are not described herein again.
第四方面,本发明实施例提供一种数据传输装置,包括:In a fourth aspect, an embodiment of the present invention provides a data transmission apparatus, including:
接收模块,用于接收互联网协议第4版本IPv4数据报文;所述IPv4数据报文的报头包括Option字段,所述Option字段包括标识位、长度位和数据位;a receiving module, configured to receive an IPv4 data packet of the Internet Protocol version 4; the header of the IPv4 data packet includes an Option field, where the Option field includes an identifier bit, a length bit, and a data bit;
解析模块,用于根据所述IPv4数据报头的IPID与所述Option字段的数据位的比特数之和对所述IPv4数据报文进行解析。And a parsing module, configured to parse the IPv4 data packet according to a sum of an IPID of the IPv4 data header and a bit number of data bits of the Option field.
结合第四方面,在第四方面的第一种可能实现方式中,所述Option字段的标识位包括复制位、功能选项位和选项编号。With reference to the fourth aspect, in a first possible implementation manner of the fourth aspect, the identifier bit of the Option field includes a copy bit, a function option bit, and an option number.
第四方面提供的装置用于执行第二方面提供的数据传输方法,其实现原理和有益效果类似,此处不再赘述。 The apparatus provided in the fourth aspect is used to perform the data transmission method provided by the second aspect, and the implementation principle and the beneficial effects are similar, and details are not described herein again.
附图说明DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief description of the drawings used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description It is a certain embodiment of the present invention, and other drawings can be obtained from those skilled in the art without any inventive labor.
图1为本发明提供的数据传输方法的应用场景示意图;FIG. 1 is a schematic diagram of an application scenario of a data transmission method provided by the present invention;
图2为本发明实施例一提供的数据传输方法的流程图;2 is a flowchart of a data transmission method according to Embodiment 1 of the present invention;
图3为本发明实施例二提供的数据传输方法的流程图;3 is a flowchart of a data transmission method according to Embodiment 2 of the present invention;
图4为本发明实施例提供的计算IPv4数据报文的头部校验和的方法流程图;4 is a flowchart of a method for calculating a header checksum of an IPv4 data packet according to an embodiment of the present invention;
图5为本发明实施例三提供的数据传输装置的结构示意图;FIG. 5 is a schematic structural diagram of a data transmission apparatus according to Embodiment 3 of the present invention; FIG.
图6为本发明实施例四提供的数据传输装置的结构示意图;FIG. 6 is a schematic structural diagram of a data transmission apparatus according to Embodiment 4 of the present invention; FIG.
图7为本发明实施例五提供的数据传输装置的结构示意图;FIG. 7 is a schematic structural diagram of a data transmission apparatus according to Embodiment 5 of the present invention; FIG.
图8为本发明实施例六提供的设备的结构示意图。FIG. 8 is a schematic structural diagram of a device according to Embodiment 6 of the present invention.
具体实施方式detailed description
图1为本发明提供的数据传输方法的应用场景示意图,该数据传输方法适应于移动网络,固网,物联网等所有使用IPv4技术的网络。如图1所示,该场景包括发送端1、中间设备2、中间设备3、中间设备4、和接收端5。其中,发送端1用于按照约定的协议生成IPv4数据报文,并将IPv4数据报文发送给接收端5,接收端5接收到IPv4数据报文之后按照约定的协议对该报文进行解析,发送端1和接收端5可以为服务器、终端等设备。中间设备用于按照约定的协议对IPv4数据报文进行转发,中间设备可以为基站,核心网,路由器等,另外,该场景中中间设备不是必须的,可以包括多个或者多层中间设备,也可以不包括中间设备,图1中仅示意性的示出3个中间设备。FIG. 1 is a schematic diagram of an application scenario of a data transmission method provided by the present invention. The data transmission method is applicable to all networks using IPv4 technologies, such as a mobile network, a fixed network, and an Internet of Things. As shown in FIG. 1, the scenario includes a transmitting end 1, an intermediate device 2, an intermediate device 3, an intermediate device 4, and a receiving end 5. The sending end 1 is configured to generate an IPv4 data packet according to the agreed protocol, and send the IPv4 data packet to the receiving end 5. After receiving the IPv4 data packet, the receiving end 5 parses the packet according to the agreed protocol. The sender 1 and the receiver 5 can be devices such as a server and a terminal. The intermediate device is configured to forward the IPv4 data packet according to the agreed protocol. The intermediate device may be a base station, a core network, a router, etc. In addition, the intermediate device in the scenario is not required, and may include multiple or multiple intermediate devices. The intermediate device may not be included, and only three intermediate devices are schematically illustrated in FIG.
图2为本发明实施例一提供的数据传输方法的流程图,如图2所示,本实施例的方法可以包括:2 is a flowchart of a data transmission method according to Embodiment 1 of the present invention. As shown in FIG. 2, the method in this embodiment may include:
步骤101、在第一IPv4数据报头的尾部添加选项(Option)字段,生成第二IPv4数据报头;Option字段包括标识位、长度位和数据位,第二IPv4数据报文的IPID为第一IPv4数据报头的IPID与Option字段的数据位的比特 数之和。Step 101: Add an Option field at the end of the first IPv4 data header to generate a second IPv4 data header. The Option field includes an identifier bit, a length bit, and a data bit. The IPID of the second IPv4 data packet is the first IPv4 data. The IPID of the header and the bits of the data bits of the Option field The sum of the numbers.
在本实施例中,第一Pv4数据报头的IPID为标准的IPv4报文中的16bit的IPID,也即标准的IPv4报文的报头中的Identification字段,Option字段用于对标准的IPv4报文中的16bit的IPID进行扩展,其中,Option字段的标识位表示该Option字段用于扩展IPID,长度位表示整个Option字段的长度,数据位表示扩展的IPID的长度。标准的IPv4报文的IPID字段的长度为16bit,也即IPID的最大值为65535,本实施例中,发送端在IPv4数据报文的报头的尾部添加Option字段对IPID进行扩展,即16bit的原IPID与Option字段的数据位的比特数之和为生成的IPv4数据报文的IPID,使得IPv4数据报文的IPID的长度大于16bit,也即IPID的最大值超过65535。可以将Option字段的数据位设置为16bit,将IPID由标准中的16bit扩展到32bit的长度,也即将IPv4协议支持的Identification范围从65535扩展到4294836225,相当于将IPv4数据报文的IPID扩展到与IPv6的Identification一样的范围。In this embodiment, the IP address of the first Pv4 data header is a 16-bit IPID in a standard IPv4 packet, that is, an Identification field in a header of a standard IPv4 packet, and the Option field is used in a standard IPv4 packet. The 16-bit IPID is extended, wherein the identifier field of the Option field indicates that the Option field is used to extend the IPID, the length bit indicates the length of the entire Option field, and the data bit indicates the length of the extended IPID. The length of the IPID field of the standard IPv4 packet is 16 bits, that is, the maximum value of the IPID is 65535. In this embodiment, the sender adds an Option field to the end of the header of the IPv4 data packet to extend the IPID, that is, the 16-bit original. The sum of the number of bits of the data bits of the IPID and the Option field is the IPID of the generated IPv4 data packet, so that the length of the IPID of the IPv4 data packet is greater than 16 bits, that is, the maximum value of the IPID exceeds 65535. The data bit of the Option field can be set to 16 bits, and the IPID can be extended from 16 bits in the standard to 32 bits. The identification range supported by the IPv4 protocol is extended from 65535 to 4294836225, which is equivalent to extending the IPID of the IPv4 data packet to The same range of IPv6 Identification.
表1示出了本发明一实施例提供的IPv4数据报文的格式。Table 1 shows the format of an IPv4 data packet according to an embodiment of the present invention.
表1Table 1
Figure PCTCN2016073381-appb-000001
Figure PCTCN2016073381-appb-000001
表1中的Option字段的数据位的长度为16bit,如表1所示,第二IPv4数据报头包括IPv4协议版本(Ver)、报头长度(Internet Header Length, 简称IHL)、服务类型(Tos)、报文总长度(total length)、IP标识(Identification)、分片报文标志位(Flg)、分片报文的偏移量(Fragment offset)、生存时间(Time)、协议类型(Protocol)、头部校验和(Header Checksum)、源地址(source address)、目标地址(destination address)、Option字段的标识位(Opt.code)、Option字段的长度位(Opt.len)、Option字段的数据位(Option value),其中,Identification为标准的IPv4协议中定义的16bit的IPID。The length of the data bit of the Option field in Table 1 is 16 bits. As shown in Table 1, the second IPv4 data header includes the IPv4 protocol version (Ver) and the header length (Internet Header Length, Referred to as IHL), service type (Tos), total message length (total length), IP identification (Identification), fragmented message flag (Flg), fragmented packet offset (Fragment offset), lifetime (Time), protocol type (Protocol), Header Checksum, source address, destination address, Option field (Opt.code), length of the Option field (Opt.len), the Option field of the Option field, where the Identification is the 16-bit IPID defined in the standard IPv4 protocol.
表2示出了标准的IPv4数据报文的格式。如表2所示,第一IPv4数据报头从Ver字段开始,到destination address字段结束。Table 2 shows the format of a standard IPv4 data message. As shown in Table 2, the first IPv4 data header starts from the Ver field and ends at the destination address field.
表2Table 2
Figure PCTCN2016073381-appb-000002
Figure PCTCN2016073381-appb-000002
从表1和表2对比可以得出,标准的IPv4数据报头中的Identification字段仅有16bit,报头长度是20Byte,IPv4数据报文的总长度(Total Length)为1500Byte,Header Checksum的值为0xc7a4。而本实施例中的IPv4数据报头中不仅包括Identification字段,还包括Option字段,第二IPv4数据报头从Ver开始,到option value结束,报头长度增加了4个字节,即变成了24Byte,IPv4数据报文的总长度(Total Length)为1504Byte,Header Checksum的值为0x3c9c。It can be concluded from Table 1 and Table 2 that the Identification field in the standard IPv4 data header is only 16 bits, the header length is 20 bytes, the total length of the IPv4 data packet is 1500 bytes, and the value of the Header Checksum is 0xc7a4. The IPv4 data header in this embodiment includes not only the Identification field but also the Option field. The second IPv4 data header starts from Ver and ends with the option value. The header length is increased by 4 bytes, that is, 24 bytes, IPv4. The total length of the data packet is 1504 Byte, and the value of the Header Checksum is 0x3c9c.
步骤102、根据第二IPv4数据报头和传输数据生成IPv4数据报文。Step 102: Generate an IPv4 data packet according to the second IPv4 data header and the transmission data.
如表1所示,生成第二IPv4数据报头之后,在data字段添加传输数据即 可生成IPv4数据报文。As shown in Table 1, after the second IPv4 data header is generated, the transmission data is added in the data field. It can generate IPv4 data packets.
步骤103、发送IPv4数据报文。Step 103: Send an IPv4 data packet.
在本实施例中,发送端直接将IPv4数据报文发送给接收端,也可以通过中间设备将IPv4报文转发给接收端,例如,将IPv4数据报文转发给转发路径中的下一跳的路由器,该路由器又将IPv4数据报文转发给其它的中间设备,最终经过多次转发之后发送给接收端。In this embodiment, the sending end directly sends the IPv4 data packet to the receiving end, and the intermediate device forwards the IPv4 data packet to the receiving end, for example, forwarding the IPv4 data packet to the next hop in the forwarding path. The router forwards the IPv4 data packet to other intermediate devices, and finally sends the packet to the receiving end after being forwarded multiple times.
上述步骤101-103由发送端执行,相应地,接收端具体执行以下步骤:接收互联网协议第4版本IPv4数据报文;根据IPv4数据报头的IPID与Option字段的数据位的比特数之和对IPv4数据报文进行解析;IPv4数据报文的报头包括Option字段,Option字段包括标识位、长度位和数据位。The above steps 101-103 are performed by the transmitting end. Correspondingly, the receiving end specifically performs the following steps: receiving the Internet Protocol version 4 IPv4 data message; according to the sum of the IPID of the IPv4 data header and the number of bits of the data field of the Option field to the IPv4 The data packet is parsed; the header of the IPv4 data packet includes an Option field, and the Option field includes an identifier bit, a length bit, and a data bit.
在本实施例中,接收端接收发送端发送的IPv4数据报文之后,根据表1中所示的Identification+Option value对数据IPv4数据报文进行解析,例如,若接收端识别出多个IPv4数据报文均为分片报文、且Identification+Option value的值相同,则将该些IPv4数据报文组合为一个IPv4数据报文。In this embodiment, after receiving the IPv4 data packet sent by the sending end, the receiving end parses the data IPv4 data packet according to the Identification+Option value shown in Table 1, for example, if the receiving end identifies multiple IPv4 data. If the packets are all fragmented and the value of the Identification+Option value is the same, the IPv4 data packets are combined into one IPv4 data packet.
本实施例提供的数据传输方法,在第一IPv4数据报头的尾部添加Option字段,生成第二IPv4数据报头,根据第二IPv4数据报头和传输数据生成IPv4数据报文,并将IPv4数据报文发送给接收端,以使接收端根据IPv4数据报头的IPID与Option字段的数据位的比特数之和对IPv4数据报文进行解析,由于在标准的IPv4数据报文的报头中添加的Option字段,使得第二IPv4数据报文的IPID为第一IPv4数据报头的IPID与Option字段的数据位的比特数之和,也即最终生成的IPv4数据报文中IPID的最大值超过65535,当IPv4数据报文的IPID超过65535时可以继续增大,不会从0开始更新,避免了在一定周期内,接收端会出现两个或多个不是同一个IPv4数据报文的分片报文的IPID相同、从而将IPv4数据报文错误组合的情况,满足了未来有线或者无线数据高速传输的业务需求。The data transmission method provided in this embodiment adds an Option field to the end of the first IPv4 data header, generates a second IPv4 data header, generates an IPv4 data packet according to the second IPv4 data header and the transmission data, and sends the IPv4 data packet. The receiving end is configured to enable the receiving end to parse the IPv4 data packet according to the sum of the IPID of the IPv4 data header and the number of bits of the data bit of the Option field, because the Option field added in the header of the standard IPv4 data packet makes The IP address of the second IPv4 data packet is the sum of the IPID of the first IPv4 data header and the number of bits of the data bit of the Option field, that is, the maximum value of the IPID in the finally generated IPv4 data packet exceeds 65535, when the IPv4 data packet If the IPID exceeds 65535, the IPID of the fragmented packet that is not the same IPv4 data packet will be the same, so that the IP address of the fragmented packet that is not the same IPv4 data packet will be the same. The case of incorrectly combining IPv4 data packets satisfies the business needs of high-speed transmission of wired or wireless data in the future.
可选地,在图2所示实施例中,若Option字段的数据位的比特数小于16,则在第一IPv4数据报头的尾部添加选项Option字段之后,该方法还包括:在Option字段的数据位之后添加填充字段,以使Option字段的数据位与填充字段的比特数之和为16。Optionally, in the embodiment shown in FIG. 2, if the number of bits of the data bit of the Option field is less than 16, the method further includes: after the option Option field is added to the end of the first IPv4 data header, the method further includes: The padding field is added after the bit so that the sum of the data bits of the Option field and the number of bits of the padding field is 16.
表3示出了本发明另一实施例提供的IPv4数据报文的格式。如表3所示, 当Option字段的数据位为8bit时,Option字段未占满4Byte,因此,在Option字段的Option value之后添加了8bit的填充(Padding)字段,Padding字段是为了计算Header Checksum时用来进行16bit对齐,并没有实际的意义。Table 3 shows the format of an IPv4 data packet provided by another embodiment of the present invention. as shown in Table 3, When the data bit of the Option field is 8 bits, the Option field does not occupy 4 bytes. Therefore, an 8-bit padding field is added after the Option field of the Option field. The Padding field is used for 16-bit alignment in order to calculate the Header Checksum. There is no practical meaning.
表3table 3
Figure PCTCN2016073381-appb-000003
Figure PCTCN2016073381-appb-000003
可选地,在本发明中,还可以将Option字段的数据位的比特数设置的更长,例如,将Option字段的数据位设置为24bit,则需要在Option字段后设置Padding字段,若将Option字段的数据位设置为32bit,则不需要添加Padding字段。Optionally, in the present invention, the number of bits of the data bit of the Option field may be set longer. For example, if the data bit of the Option field is set to 24 bits, the Padding field needs to be set after the Option field, if the Option is If the data bit of the field is set to 32bit, you do not need to add the Padding field.
图3为本发明实施例二提供的数据传输方法的流程图,如图3所示,该方法包括以下步骤:FIG. 3 is a flowchart of a data transmission method according to Embodiment 2 of the present invention. As shown in FIG. 3, the method includes the following steps:
步骤201、在第一IPv4数据报头的尾部添加Option字段,生成第二IPv4数据报头;Option字段包括标识位、长度位和数据位,第二IPv4数据报文的IPID为第一IPv4数据报头的IPID与Option字段的数据位的比特数之和。Step 201: Add an Option field at the end of the first IPv4 data header to generate a second IPv4 data header. The Option field includes an identifier bit, a length bit, and a data bit. The IPID of the second IPv4 data packet is an IPID of the first IPv4 data header. The sum of the number of bits of the data bits with the Option field.
可选地,Option字段的标识位包括复制位、功能选项位和选项编号。Optionally, the identifier bits of the Option field include a copy bit, a function option bit, and an option number.
在本实施例中,Option字段的标识位Opt.code包含8bit,其中,1bit用于设置复制位(copied flag),当copied flag为0时,表示非复制(not copied);当copied flag为1时,表示复制(copied)。2bits用于设置功能选项位(option  class),当option class为0时,表示该Option字段为控制指令(control);当option class为1或者3时,表示该Option字段为保留位(reserved for future use);当option class为1时,表示该Option字段为调试和校验位(debugging and measurement)。5bits用于设置选项编号(option number),选项编号用于表示Option字段的类型,不同的选项编号表示不同用途的Option字段。In this embodiment, the identifier bit Opt.code of the Option field contains 8 bits, where 1 bit is used to set a copy flag, and when the copied flag is 0, it means non-copy (not copied); when the copied flag is 1 When it is said, it is copied. 2bits is used to set function option bits (option) Class), when the option class is 0, it indicates that the Option field is a control command (control); when the option class is 1 or 3, it indicates that the Option field is reserved for future use; when the option class is 1. , indicating that the Option field is debugging and measurement. 5bits is used to set the option number (option number). The option number is used to indicate the type of the Option field. Different option numbers indicate Option fields for different purposes.
表4示出了Option字段的格式,如表4所示,目前,协议中已经定义了8种其它用途的Option字段,并且,这8种Option字段在协议中已有明确的定义,此处不再赘述。本实施例增加第9种Option字段,用于扩展IPID。Table 4 shows the format of the Option field. As shown in Table 4, eight Option fields of other uses have been defined in the protocol, and the eight Option fields are clearly defined in the protocol. Let me repeat. This embodiment adds a ninth Option field for extending the IPID.
表4Table 4
Figure PCTCN2016073381-appb-000004
Figure PCTCN2016073381-appb-000004
Figure PCTCN2016073381-appb-000005
Figure PCTCN2016073381-appb-000005
如表4所示,本实施例提供的第9种Option字段的copied flag为1,表示复制,option class为0,表示该Option字段为control,option number为10,10代表该Option字段用于扩展IPID。优选地,本实施例中还可以使用目前RFC791协议中未使用的11~32的任一值作为option number值。As shown in Table 4, the copied flag of the ninth Option field provided in this embodiment is 1, indicating that the option is 0, indicating that the Option field is control, the option number is 10, and 10 indicates that the Option field is used for expansion. IPID. Preferably, any value of 11 to 32 that is not used in the current RFC791 protocol may be used as the option number value in this embodiment.
步骤202、更新第二IPv4数据报头的长度、对应的IPv4数据报文的总长度和头部校验和。Step 202: Update the length of the second IPv4 data header, the total length of the corresponding IPv4 data packet, and the header checksum.
如表1所示,若Option value的长度为16bit,则第二IPv4数据报头从Ver字段开始到Option value字段结束,第二IPv4数据报头的长度IHL=6,对应的IPv4数据报文的总长度为第二IPv4数据报头的长度加上数据字段(data)的长度,则对应的IPv4数据报文的总长度Total Length=0x 05dc(1504),头部校验和Header Checksum=0x3c9c。As shown in Table 1, if the length of the Option value is 16 bits, the second IPv4 data header ends from the Ver field to the Option value field, and the length of the second IPv4 data header is IHL=6, and the total length of the corresponding IPv4 data packet. For the length of the second IPv4 data header plus the length of the data field, the total length of the corresponding IPv4 data message is Total Length=0x 05dc (1504), and the header checksum Header Checksum=0x3c9c.
如表3所示,若Option value的长度为8bit,则第二IPv4数据报头从Ver字段开始到Padding字段结束,第二IPv4数据报头的长度IHL=6,对应的IPv4数据报文的总长度Total Length=0x05dc(1504),头部校验和Header Checksum=0x3c9d。As shown in Table 3, if the length of the Option value is 8 bits, the second IPv4 data header starts from the Ver field to the Padding field, and the length of the second IPv4 data header is IHL=6, and the total length of the corresponding IPv4 data packet is Total. Length=0x05dc(1504), header checksum Header Checksum=0x3c9d.
图4为本发明实施例提供的计算IPv4数据报文的头部校验和的方法流程图,该方法的执行主体为发送端。表5示出了标准的IPv4数据报文中计算Header Checksum的每个步骤的结果,表6示出了本发明实施例提供的IPv4数据报文中计算Header Checksum的每个步骤的结果。FIG. 4 is a flowchart of a method for calculating a header checksum of an IPv4 data packet according to an embodiment of the present invention. The execution body of the method is a sender. Table 5 shows the result of each step of calculating the Header Checksum in the standard IPv4 data message. Table 6 shows the result of each step of calculating the Header Checksum in the IPv4 data message provided by the embodiment of the present invention.
表5table 5
Figure PCTCN2016073381-appb-000006
Figure PCTCN2016073381-appb-000006
Figure PCTCN2016073381-appb-000007
Figure PCTCN2016073381-appb-000007
表6Table 6
Figure PCTCN2016073381-appb-000008
Figure PCTCN2016073381-appb-000008
如图4所示,该方法包括以下步骤:As shown in FIG. 4, the method includes the following steps:
步骤301、将第二IPv4数据报头的各字段的值进行16比特对齐,并将头部校验和设置为0。Step 301: Perform 16-bit alignment on the values of the fields of the second IPv4 data header, and set the header checksum to 0.
如表5和表6所示,将IPv4数据报文的报头中各字段进行16bit对齐,由于需要计算Header Checksum,先将Header Checksum设置为0。As shown in Table 5 and Table 6, the fields in the header of the IPv4 data packet are aligned 16 bits. Since the Header Checksum needs to be calculated, the Header Checksum is first set to 0.
需要说明的是,表6中示出的为opt.Value为16bit的情况,若opt.Value为8bit的情况,还包括padding字段,则opt.Value对应的值为opt.Value与padding的比特数之和。It should be noted that the case where opt.Value is 16 bits is shown in Table 6. If the opt.Value is 8 bits, and the padding field is included, the value of opt.Value is the number of bits of opt.Value and padding. Sum.
步骤302、将对齐后的各字段的值求和,获取第一头部校验和。Step 302: Summing the values of the aligned fields to obtain a first header checksum.
如表5所示,标准的IPv4数据报文,求和得到的十六进制的第一头部校 验和为“23859”,如表6所示,本实施例中的IPv4数据报文,求和得到的十六进制的第一头部校验和为“2C361”。As shown in Table 5, the standard IPv4 data message is summed and the hexadecimal first head is obtained. The sum of the checksums is "23859". As shown in Table 6, in the IPv4 data message in this embodiment, the hexadecimal first header checksum obtained by the summation is "2C361".
步骤303、重新将第一头部校验和与其它字段的值进行16比特对齐,获取第二头部校验和。Step 303: Re-align the first header checksum with the values of other fields by 16 bits to obtain a second header checksum.
如表5和表6所示,再一次将IPv4数据报文的报头中的各个字段16bit对齐,其中,若第一头部校验和字段的值超过16bit,则将超过16bit的部分与低4bit位相加,则标准的IPv4数据报文的第二头部校验和对应的数值为“385B”,本实施例中的IPv4数据报文的第二头部校验和对应的数值为“C363”。As shown in Table 5 and Table 6, the 16 bits of each field in the header of the IPv4 data packet are aligned again. If the value of the first header checksum field exceeds 16 bits, the portion exceeding 16 bits and the lower 4 bits are If the bit is added, the value corresponding to the second header checksum of the standard IPv4 data packet is "385B", and the value corresponding to the second header checksum of the IPv4 data packet in this embodiment is "C363". ".
步骤304、将第二头部校验和进行比特翻转,获取更新的头部校验和。Step 304: Perform bit flipping on the second header checksum to obtain an updated header checksum.
在表5中,先将“385B”转换为二进制数“11100001011011”,进行比特翻转后得到的二进制数为“1100011110100100”,对应的十六进制数为“c7a4”,也即,表5中最终计算得到的标准的IPv4数据报文的Header Checksum为“c7a4”。In Table 5, "385B" is first converted to a binary number "11100001011011", and the binary number obtained after bit flipping is "1100011110100100", and the corresponding hexadecimal number is "c7a4", that is, finally in Table 5. The Header Checksum of the calculated standard IPv4 data packet is "c7a4".
在表6中,先将“C363”转换为二进制数“1100001101100011”,进行比特翻转后得到放入二进制数为“0011110010011100”,对应的十六进制数为“3C9C”,也即,表6中最终计算得到的本实施例的IPv4数据报文的Header Checksum为“3C9C”。In Table 6, first convert "C363" to binary number "1100001101100011", and perform bit flip to get binary number "0011110010011100", and the corresponding hexadecimal number is "3C9C", that is, in Table 6. The Header Checksum of the IPv4 data packet of the present embodiment is “3C9C”.
步骤203、根据第二IPv4数据报头和传输数据生成IPv4数据报文。Step 203: Generate an IPv4 data packet according to the second IPv4 data header and the transmission data.
步骤204、发送IPv4数据报文。Step 204: Send an IPv4 data packet.
本实施例提供的数据传输方法,在第一IPv4数据报头的尾部添加Option字段,生成第二IPv4数据报头之后,计算并更新第二IPv4数据报头的长度、对应的IPv4数据报文的总长度和头部校验和,根据第二IPv4数据报头和传输数据生成IPv4数据报文,将IPv4数据报文发送给接收端,以使接收端根据Identification与Option value的比特数之和对IPv4数据报文进行解析,以确定多个IPv4数据报文是否为同一个IPv4数据报文的分片报文,由于在IPv4数据报文的报头中添加了Option字段,使得IPID的最大值超过65535,也即当IPv4数据报文的IPID超过65535时可以继续增大,不会从0开始更新,避免了在接收端会出现两个或多个不是同一个数据报文的分片报文的IPID相同的情况,满足了数据高速传输的业务需求。 The data transmission method provided in this embodiment adds an Option field to the end of the first IPv4 data header, generates a second IPv4 data header, and calculates and updates the length of the second IPv4 data header, the total length of the corresponding IPv4 data packet, and The header checksum generates an IPv4 data packet according to the second IPv4 data header and the transmission data, and sends the IPv4 data packet to the receiving end, so that the receiving end compares the number of bits of the identification and the Option value to the IPv4 data packet. Performing an analysis to determine whether multiple IPv4 data packets are fragmented packets of the same IPv4 data packet. Since the Option field is added to the header of the IPv4 data packet, the maximum value of the IPID exceeds 65535, that is, when When the IPID of an IPv4 data packet exceeds 65535, the IPID of the packet can continue to increase. It does not start from 0. This prevents the IPID of two or more fragmented packets that are not the same data packet from being the same at the receiving end. Meet the business needs of high-speed data transmission.
图5为本发明实施例三提供的数据传输装置的结构示意图,如图5所示,该装置包括添加模块11、生成模块12和发送模块13。其中,添加模块11在第一互联网协议第4版本IPv4数据报头的尾部添加选项Option字段,生成第二IPv4数据报头;Option字段包括标识位、长度位和数据位,第二IPv4数据报文的互联网协议标识IPID为第一IPv4数据报头的IPID与Option字段的数据位的比特数之和。生成模块12用于根据第二IPv4数据报头和传输数据生成IPv4数据报文。发送模块13用于发送IPv4数据报文。FIG. 5 is a schematic structural diagram of a data transmission apparatus according to Embodiment 3 of the present invention. As shown in FIG. 5, the apparatus includes an adding module 11, a generating module 12, and a sending module 13. The adding module 11 adds an option Option field at the end of the first Internet Protocol version 4 IPv4 data header to generate a second IPv4 data header; the Option field includes an identifier bit, a length bit, and a data bit, and the second IPv4 data packet is in the Internet. The protocol identifier IPID is the sum of the IPID of the first IPv4 data header and the number of bits of the data bits of the Option field. The generating module 12 is configured to generate an IPv4 data packet according to the second IPv4 data header and the transmission data. The sending module 13 is configured to send an IPv4 data message.
本实施例的装置,可以用于执行图2所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 2, and the implementation principle and technical effects are similar, and details are not described herein again.
可选地,若Option字段的数据位的比特数小于16,则添加模块11还用于在Option字段的数据位之后添加填充字段,以使Option字段的数据位与填充字段的比特数之和为16。Optionally, if the number of bits of the data bit of the Option field is less than 16, the adding module 11 is further configured to add a padding field after the data bit of the Option field, so that the sum of the data bit of the Option field and the number of bits of the padding field is 16.
图6为本发明实施例四提供的数据传输装置的结构示意图,如图6所示,该装置还包括更新模块14。更新模块14用于更新第二IPv4数据报头的长度、对应的IPv4数据报文的总长度和头部校验和。FIG. 6 is a schematic structural diagram of a data transmission apparatus according to Embodiment 4 of the present invention. As shown in FIG. 6, the apparatus further includes an update module 14. The update module 14 is configured to update the length of the second IPv4 data header, the total length of the corresponding IPv4 data message, and the header checksum.
可选地,Option字段的标识位包括复制位、功能选项位和选项编号。Optionally, the identifier bits of the Option field include a copy bit, a function option bit, and an option number.
本实施例的装置,可以用于执行图2所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 2, and the implementation principle and technical effects are similar, and details are not described herein again.
可选地,添加模块11更新第二IPv4数据报头的头部校验和,包括:添加模块11将第二IPv4数据报头的各字段的值进行16比特对齐,并将头部校验和设置为0;将对齐后的各字段的值求和,获取第一头部校验和;重新将第一头部校验和与其它字段的值进行16比特对齐,获取第二头部校验和;将第二头部校验和进行比特翻转,获取更新的头部校验和。Optionally, the adding module 11 updates the header checksum of the second IPv4 data header, including: the adding module 11 performs 16-bit alignment on the values of the fields of the second IPv4 data header, and sets the header checksum to 0: summing the values of the aligned fields to obtain a first header checksum; re-aligning the first header checksum with the values of other fields by 16 bits to obtain a second header checksum; The second header checksum is bit flipped to obtain an updated header checksum.
本实施例的装置,可以用于执行图3所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 3, and the implementation principle and technical effects are similar, and details are not described herein again.
图7为本发明实施例五提供的数据传输装置的结构示意图,如图7所示,该装置包括接收模块21和解析模块22。其中,接收模块21用于接收互联网协议第4版本IPv4数据报文;IPv4数据报文的报头包括Option字段,Option字段包括标识位、长度位和数据位。解析模块22用于根据IPv4数据报头的IPID与Option字段的数据位的比特数之和对IPv4数据报文进行解析。 FIG. 7 is a schematic structural diagram of a data transmission apparatus according to Embodiment 5 of the present invention. As shown in FIG. 7, the apparatus includes a receiving module 21 and a parsing module 22. The receiving module 21 is configured to receive an IPv4 data packet of the Internet Protocol version 4. The header of the IPv4 data packet includes an Option field, and the Option field includes an identifier bit, a length bit, and a data bit. The parsing module 22 is configured to parse the IPv4 data packet according to the sum of the IPID of the IPv4 data header and the number of bits of the data bit of the Option field.
可选地,Option字段的标识位包括复制位、功能选项位和选项编号。Optionally, the identifier bits of the Option field include a copy bit, a function option bit, and an option number.
本实施例的装置是与图5和图6对应的接收端的装置,其实现原理和技术效果与图2或3所示方法实施例的技术方案类似,此处不再赘述。The device in this embodiment is a device at the receiving end corresponding to FIG. 5 and FIG. 6 , and the implementation principle and technical effects thereof are similar to the technical solutions in the method embodiment shown in FIG. 2 or FIG. 3 , and details are not described herein again.
图8为本发明实施例六提供的设备的结构示意图,如图8所示,该设备包括处理器31和发送接口32,该设备还可以包括接收接口33和存储器34,发送接口32、接收接口33分别与处理器31耦合。其中,发送接口32和接收接口33可以为有线连接的插线端口,也可以为无线收发装置,例如,发送接口32为无线发射器,接收接口33为无线接收器。处理器31可包含一个或多个多核处理器和/或存储器34。处理器31可以是一个通用处理器,专用集成电路(application specific integrated circuit,ASIC),或数字信号处理器(DSP)。存储器34可为非瞬时性的存储介质,与处理器31相耦合,用于保存不同类型的数据。存储器34可包含只读存储器(read only memory,ROM),随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是磁盘存储器。存储器34可用于保存实现图2或图3所述相关方法的指令。8 is a schematic structural diagram of a device according to Embodiment 6 of the present invention. As shown in FIG. 8, the device includes a processor 31 and a sending interface 32. The device may further include a receiving interface 33 and a memory 34, a sending interface 32, and a receiving interface. 33 is coupled to processor 31, respectively. The sending interface 32 and the receiving interface 33 may be wired connection ports or wireless transceivers. For example, the sending interface 32 is a wireless transmitter, and the receiving interface 33 is a wireless receiver. Processor 31 may include one or more multi-core processors and/or memory 34. The processor 31 can be a general purpose processor, an application specific integrated circuit (ASIC), or a digital signal processor (DSP). Memory 34 can be a non-transitory storage medium coupled to processor 31 for storing different types of data. The memory 34 may comprise a read only memory (ROM), a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or may be a disk storage. Memory 34 can be used to store instructions that implement the related methods described in FIG. 2 or FIG.
处理器31在第一互联网协议第4版本IPv4数据报头的尾部添加选项Option字段,生成第二IPv4数据报头;Option字段包括标识位、长度位和数据位,第二IPv4数据报文的互联网协议标识IPID为第一IPv4数据报头的IPID与Option字段的数据位的比特数之和;根据第二IPv4数据报头和传输数据生成IPv4数据报文。发送接口32用于发送IPv4数据报文。The processor 31 adds an option Option field at the end of the first Internet Protocol version 4 IPv4 data header to generate a second IPv4 data header; the Option field includes an identifier bit, a length bit, and a data bit, and an Internet Protocol identifier of the second IPv4 data packet. The IPID is the sum of the IPID of the first IPv4 data header and the number of bits of the data bits of the Option field; and generates an IPv4 data packet according to the second IPv4 data header and the transmission data. The sending interface 32 is configured to send an IPv4 data message.
可选地,若Option字段的数据位的比特数小于16,则处理器31还用于在Option字段的数据位之后添加填充字段,以使Option字段的数据位与填充字段的比特数之和为16。Optionally, if the number of bits of the data bit of the Option field is less than 16, the processor 31 is further configured to add a padding field after the data bit of the Option field, so that the sum of the data bit of the Option field and the number of bits of the padding field is 16.
可选地,处理器31还用于更新第二IPv4数据报头的长度、对应的IPv4数据报文的总长度和头部校验和。Optionally, the processor 31 is further configured to update a length of the second IPv4 data header, a total length of the corresponding IPv4 data message, and a header checksum.
可选地,Option字段的标识位包括复制位、功能选项位和选项编号。Optionally, the identifier bits of the Option field include a copy bit, a function option bit, and an option number.
可选地,处理器31更新第二IPv4数据报头的头部校验和,包括:处理器31将第二IPv4数据报头的各字段的值进行16比特对齐,并将头部校验和设置为0;将对齐后的各字段的值求和,获取第一头部校验和;重新将第一头部校验和与其它字段的值进行16比特对齐,获取第二头部校验和;将第二 头部校验和进行比特翻转,获取更新的头部校验和。Optionally, the processor 31 updates the header checksum of the second IPv4 data header, including: the processor 31 performs 16-bit alignment on the values of the fields of the second IPv4 data header, and sets the header checksum to 0: summing the values of the aligned fields to obtain a first header checksum; re-aligning the first header checksum with the values of other fields by 16 bits to obtain a second header checksum; Will be second The header checksum performs a bit flip to obtain an updated header checksum.
本实施例的装置,可以用于执行图2或3所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 2 or 3. The implementation principle and technical effects are similar, and details are not described herein again.
本发明实施例还提供一种设备,该设备的结构与图8所示的设备的结构相同,在本实施例中,接收接口用于接收互联网协议第4版本IPv4数据报文;IPv4数据报文的报头包括Option字段,Option字段包括标识位、长度位和数据位。处理器根据IPv4数据报头的IPID与Option字段的数据位的比特数之和对IPv4数据报文进行解析。The embodiment of the present invention further provides a device. The structure of the device is the same as that of the device shown in FIG. 8. In this embodiment, the receiving interface is configured to receive the IPv4 data packet of the Internet Protocol version 4; and the IPv4 data packet. The header includes an Option field, and the Option field includes an identifier bit, a length bit, and a data bit. The processor parses the IPv4 data packet according to the sum of the IPID of the IPv4 data header and the number of bits of the data bit of the Option field.
可选地,Option字段的标识位包括复制位、功能选项位和选项编号。Optionally, the identifier bits of the Option field include a copy bit, a function option bit, and an option number.
本实施例的设备,可以用于执行图2或图3所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 2 or FIG. 3, and the implementation principle and technical effects are similar, and details are not described herein again.
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:只读存储器(Read-Only Memory,简称ROM)、随机存取存储器(random access memory,简称RAM)、磁碟或者光盘等各种可以存储程序代码的介质。One of ordinary skill in the art will appreciate that all or part of the steps to implement the various method embodiments described above may be accomplished by hardware associated with the program instructions. The aforementioned program can be stored in a computer readable storage medium. When the program is executed, the steps of the foregoing method embodiments are performed; and the foregoing storage medium includes: Read-Only Memory (ROM), Random Access Memory (RAM), and Magnetic A variety of media that can store program code, such as a disc or a disc.
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。 Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present invention, and are not intended to be limiting; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that The technical solutions described in the foregoing embodiments may be modified, or some or all of the technical features may be equivalently replaced; and the modifications or substitutions do not deviate from the technical solutions of the embodiments of the present invention. range.

Claims (14)

  1. 一种数据传输方法,其特征在于,包括:A data transmission method, comprising:
    在第一互联网协议第4版本IPv4数据报头的尾部添加选项Option字段,生成第二IPv4数据报头;所述Option字段包括标识位、长度位和数据位,所述第二IPv4数据报文的互联网协议标识IPID为所述第一IPv4数据报头的IPID与所述Option字段的数据位的比特数之和;Adding an option Option field at the end of the first Internet Protocol version 4 IPv4 data header to generate a second IPv4 data header; the Option field includes an identifier bit, a length bit, and a data bit, and the second IPv4 data message is an Internet protocol. The identifier IPID is the sum of the IPID of the first IPv4 data header and the number of bits of the data bit of the Option field;
    根据所述第二IPv4数据报头和传输数据生成IPv4数据报文;Generating an IPv4 data packet according to the second IPv4 data header and the transmission data;
    发送所述IPv4数据报文。Sending the IPv4 data packet.
  2. 根据权利要求1所述的方法,其特征在于,若所述Option字段的数据位的比特数小于16,则所述在第一IPv4数据报头的尾部添加选项Option字段之后,所述方法还包括:The method according to claim 1, wherein if the number of bits of the data bit of the Option field is less than 16, the method further includes: after adding the option Option field to the end of the first IPv4 data header, the method further includes:
    在所述Option字段的数据位之后添加填充字段,以使所述Option字段的数据位与所述填充字段的比特数之和为16。A padding field is added after the data bit of the Option field, so that the sum of the data bits of the Option field and the number of bits of the padding field is 16.
  3. 根据权利要求1或2所述的方法,其特征在于,所述方法还包括:The method according to claim 1 or 2, wherein the method further comprises:
    更新所述第二IPv4数据报头的长度、对应的IPv4数据报文的总长度和头部校验和。And updating a length of the second IPv4 data header, a total length of the corresponding IPv4 data packet, and a header checksum.
  4. 根据权利要求1-3任一项所述的方法,其特征在于,所述Option字段的标识位包括复制位、功能选项位和选项编号。The method according to any one of claims 1-3, wherein the identifier bits of the Option field include a copy bit, a function option bit, and an option number.
  5. 根据权利要求2-4任一项所述的方法,其特征在于,所述更新第二IPv4数据报头的头部校验和,包括:The method according to any one of claims 2 to 4, wherein the updating the header checksum of the second IPv4 data header comprises:
    将所述第二IPv4数据报头的各字段的值进行16比特对齐,并将所述头部校验和设置为0;And performing a 16-bit alignment on the values of the fields of the second IPv4 data header, and setting the header checksum to 0;
    将对齐后的各字段的值求和,获取第一头部校验和;Sum the values of the aligned fields to obtain a first header checksum;
    重新将所述第一头部校验和与其它字段的值进行16比特对齐,获取第二头部校验和;Re-aligning the first header checksum with the values of other fields by 16 bits to obtain a second header checksum;
    将所述第二头部校验和进行比特翻转,获取更新的头部校验和。The second header checksum is bit flipped to obtain an updated header checksum.
  6. 一种数据传输方法,其特征在于,包括:A data transmission method, comprising:
    接收互联网协议第4版本IPv4数据报文;所述IPv4数据报文的报头包括Option字段,所述Option字段包括标识位、长度位和数据位;Receiving an IPv4 data packet of the Internet Protocol version 4; the header of the IPv4 data packet includes an Option field, where the Option field includes an identifier bit, a length bit, and a data bit;
    根据所述IPv4数据报头的IPID与所述Option字段的数据位的比特数之 和对所述IPv4数据报文进行解析。According to the IPID of the IPv4 data header and the number of bits of the data bit of the Option field And parsing the IPv4 data packet.
  7. 根据权利要求6所述的方法,其特征在于,所述Option字段的标识位包括复制位、功能选项位和选项编号。The method according to claim 6, wherein the identification bits of the Option field include a copy bit, a function option bit, and an option number.
  8. 一种数据传输装置,其特征在于,包括:A data transmission device, comprising:
    添加模块,在第一互联网协议第4版本IPv4数据报头的尾部添加选项Option字段,生成第二IPv4数据报头;所述Option字段包括标识位、长度位和数据位,所述第二IPv4数据报文的互联网协议标识IPID为所述第一IPv4数据报头的IPID与所述Option字段的数据位的比特数之和;Adding a module, adding an option Option field at the end of the first Internet Protocol version 4 IPv4 data header to generate a second IPv4 data header; the Option field includes an identifier bit, a length bit, and a data bit, and the second IPv4 data packet The Internet Protocol Identity IPID is the sum of the IPID of the first IPv4 data header and the number of bits of the data bits of the Option field;
    生成模块,用于根据所述第二IPv4数据报头和传输数据生成IPv4数据报文;a generating module, configured to generate an IPv4 data packet according to the second IPv4 data header and the transmission data;
    发送模块,用于发送所述IPv4数据报文。And a sending module, configured to send the IPv4 data packet.
  9. 根据权利要求8所述的装置,其特征在于,若所述Option字段的数据位的比特数小于16,则所述添加模块还用于在所述Option字段的数据位之后添加填充字段,以使所述Option字段的数据位与所述填充字段的比特数之和为16。The apparatus according to claim 8, wherein if the number of bits of the data bit of the Option field is less than 16, the adding module is further configured to add a padding field after the data bit of the Option field, so that The sum of the data bits of the Option field and the number of bits of the padding field is 16.
  10. 根据权利要求8或9所述的装置,其特征在于,所述装置还包括:The device according to claim 8 or 9, wherein the device further comprises:
    更新模块,用于更新所述第二IPv4数据报头的长度、对应的IPv4数据报文的总长度和头部校验和。And an update module, configured to update a length of the second IPv4 data header, a total length of the corresponding IPv4 data packet, and a header checksum.
  11. 根据权利要求8-10任一项所述的装置,其特征在于,所述Option字段的标识位包括复制位、功能选项位和选项编号。The apparatus according to any one of claims 8 to 10, wherein the identification bit of the Option field comprises a copy bit, a function option bit, and an option number.
  12. 根据权利要求9-11任一项所述的装置,其特征在于,所述添加模块更新第二IPv4数据报头的头部校验和,包括:The apparatus according to any one of claims 9-11, wherein the adding module updates a header checksum of the second IPv4 data header, including:
    所述添加模块将所述第二IPv4数据报头的各字段的值进行16比特对齐,并将所述头部校验和设置为0;将对齐后的各字段的值求和,获取第一头部校验和;重新将所述第一头部校验和与其它字段的值进行16比特对齐,获取第二头部校验和;将所述第二头部校验和进行比特翻转,获取更新的头部校验和。The adding module performs 16-bit alignment on the values of the fields of the second IPv4 data header, and sets the header checksum to 0; sums the values of the aligned fields to obtain the first header. a checksum; re-aligning the first header checksum with 16 values of other fields to obtain a second header checksum; and performing bit flipping on the second header checksum to obtain Updated header checksum.
  13. 一种数据传输装置,其特征在于,包括:A data transmission device, comprising:
    接收模块,用于接收互联网协议第4版本IPv4数据报文;所述IPv4数据报文的报头包括Option字段,所述Option字段包括标识位、长度位和数据 位;a receiving module, configured to receive an IPv4 data packet of the Internet Protocol version 4; the header of the IPv4 data packet includes an Option field, where the Option field includes an identifier bit, a length bit, and a data Bit
    解析模块,用于根据所述IPv4数据报头的IPID与所述Option字段的数据位的比特数之和对所述IPv4数据报文进行解析。And a parsing module, configured to parse the IPv4 data packet according to a sum of an IPID of the IPv4 data header and a bit number of data bits of the Option field.
  14. 根据权利要求13所述的装置,其特征在于,所述Option字段的标识位包括复制位、功能选项位和选项编号。 The apparatus according to claim 13, wherein the identification bits of the Option field include a copy bit, a function option bit, and an option number.
PCT/CN2016/073381 2016-02-03 2016-02-03 Data transmission method and apparatus WO2017132911A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201680048976.3A CN107925516A (en) 2016-02-03 2016-02-03 Data transmission method and device
PCT/CN2016/073381 WO2017132911A1 (en) 2016-02-03 2016-02-03 Data transmission method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/073381 WO2017132911A1 (en) 2016-02-03 2016-02-03 Data transmission method and apparatus

Publications (1)

Publication Number Publication Date
WO2017132911A1 true WO2017132911A1 (en) 2017-08-10

Family

ID=59500331

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/073381 WO2017132911A1 (en) 2016-02-03 2016-02-03 Data transmission method and apparatus

Country Status (2)

Country Link
CN (1) CN107925516A (en)
WO (1) WO2017132911A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115150476B (en) * 2022-06-20 2024-04-12 浪潮思科网络科技有限公司 EIGRP protocol message compression method, system, equipment and medium
CN115174702B (en) * 2022-09-08 2022-11-22 深圳华锐分布式技术股份有限公司 RDMA (remote direct memory Access) protocol-based data transmission method, device, equipment and medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101567852A (en) * 2009-05-20 2009-10-28 中兴通讯股份有限公司 Method and device for switching the network address of IP message
US20100265932A1 (en) * 2009-04-20 2010-10-21 Sony Corporation Wireless transmitter, wireless transmission method, wireless receiver and wireless reception method
WO2011120470A2 (en) * 2011-05-09 2011-10-06 华为技术有限公司 Method and device for medium stream performance monitoring
CN103532672A (en) * 2013-10-22 2014-01-22 芮雄丽 Processing method of disordered fragmentation messages in SDN and application

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100265932A1 (en) * 2009-04-20 2010-10-21 Sony Corporation Wireless transmitter, wireless transmission method, wireless receiver and wireless reception method
CN101567852A (en) * 2009-05-20 2009-10-28 中兴通讯股份有限公司 Method and device for switching the network address of IP message
WO2011120470A2 (en) * 2011-05-09 2011-10-06 华为技术有限公司 Method and device for medium stream performance monitoring
CN103532672A (en) * 2013-10-22 2014-01-22 芮雄丽 Processing method of disordered fragmentation messages in SDN and application

Also Published As

Publication number Publication date
CN107925516A (en) 2018-04-17

Similar Documents

Publication Publication Date Title
US10880817B2 (en) Wi-fi configuration method, Wi-Fi mobile terminal, and Wi-Fi device
WO2021000827A1 (en) Data transmission link establishment method and apparatus, and computer-readable storage medium
US10462065B2 (en) Path maximum transmission unit discovery
US11824959B2 (en) ROHC header compression for MPTCP
WO2016000513A1 (en) Method and device for updating processing manner of service flow packet
US11153207B2 (en) Data link layer-based communication method, device, and system
US11637771B2 (en) Technologies for managing network traffic through heterogeneous networks
WO2020078324A1 (en) Delay measurement method and apparatus
WO2008040203A1 (en) Method, system, and router for calculating the maximum transmission unit of the router output interface
CN111356157A (en) Method for realizing network capability opening and related equipment
US20230379244A1 (en) Ultra reliable segment routing
Klauck et al. Enhanced DNS message compression-Optimizing mDNS/DNS-SD for the use in 6LoWPANs
WO2015192705A1 (en) Access device and method implemented by access device for allowing user equipment to access network
WO2017132911A1 (en) Data transmission method and apparatus
WO2022142390A1 (en) Packet encapsulation and de-encapsulation method and device, storage medium, and electronic device
WO2019096332A1 (en) Method, device, and system for determining packet header compression mechanism
JP2018518869A (en) Bundled forward error correction (FEC) for multiple sequencing flows
WO2015096734A1 (en) Downlink transmission method for service data, and packet data gateway
US11470502B2 (en) Congestion notification by data packet from intermediate node
WO2018045521A1 (en) Method and device for transmitting signaling in wireless network
WO2017039499A1 (en) Computer program, computer-readable storage medium transmitting device, receiving device and methods performed therein for transferring background user data
WO2009109128A1 (en) Method and apparatus of full header information message configuration
WO2017143538A1 (en) Voice data transmission method and apparatus
US8774202B2 (en) Methods, systems, and computer readable media for generating general packet radio service tunneling protocol (GTP) encapsulated real-time transport protocol (RTP) packets in a long term evolution (LTE) node simulator
US20220103451A1 (en) System and method for recording a routing path within a network packet

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16888736

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16888736

Country of ref document: EP

Kind code of ref document: A1