WO2017156684A1 - 一种用于传输数据的方法、装置和系统 - Google Patents
一种用于传输数据的方法、装置和系统 Download PDFInfo
- Publication number
- WO2017156684A1 WO2017156684A1 PCT/CN2016/076297 CN2016076297W WO2017156684A1 WO 2017156684 A1 WO2017156684 A1 WO 2017156684A1 CN 2016076297 W CN2016076297 W CN 2016076297W WO 2017156684 A1 WO2017156684 A1 WO 2017156684A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- check
- mode
- data
- receiving device
- algorithm
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/04—Protocols for data compression, e.g. ROHC
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M13/00—Coding, decoding or code conversion, for error detection or error correction; Coding theory basic assumptions; Coding bounds; Error probability evaluation methods; Channel models; Simulation or testing of codes
- H03M13/03—Error detection or forward error correction by redundancy in data representation, i.e. code words containing more digits than the source words
- H03M13/05—Error detection or forward error correction by redundancy in data representation, i.e. code words containing more digits than the source words using block codes, i.e. a predetermined number of check bits joined to a predetermined number of information bits
- H03M13/09—Error detection only, e.g. using cyclic redundancy check [CRC] codes or single parity bit
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L1/00—Arrangements for detecting or preventing errors in the information received
- H04L1/004—Arrangements for detecting or preventing errors in the information received by using forward error control
- H04L1/0056—Systems characterized by the type of code used
- H04L1/0061—Error detection codes
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/32—Flow control; Congestion control by discarding or delaying data units, e.g. packets or frames
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/40—Network security protocols
Definitions
- the present invention relates to the field of communications and, more particularly, to a method, apparatus and system for transmitting data.
- a transmitting device transmits a message to a receiving device.
- the message contains compressed data.
- the sending device may support at least two compression modes.
- the compression mode supported by the sending device may be Ethernet frame header compression, Internet Protocol (IP) header compression or payload compression.
- IP Internet Protocol
- the transmitting device compresses the data to be transmitted using compressed mode to obtain compressed data, and the transmitting device transmits a message including the compressed data to the receiving device.
- the receiving device needs to know the compression mode used by the transmitting device to decompress the received compressed data using a decompression mode corresponding to the compressed mode.
- the packet header of the packet generated by the sending device carries an overhead byte for indicating a compressed mode used by the sending device.
- the receiving device determines the compression mode used by the sending device according to the overhead byte carried by the packet header of the received packet.
- the overhead of the above scheme is relatively large.
- the present application provides a method, apparatus and system for transmitting data to reduce overhead.
- the present application provides a method for transmitting data, where the method includes: receiving, by a receiving device, a first packet sent by a sending device, where the first packet includes first compressed data and a first check value.
- the first compressed data is obtained by the transmitting device for compressing the first data based on the first compressed mode, and the first check value is used by the sending device to determine the second check value based on the first check algorithm.
- Obtaining, the second check value is obtained by the sending device to process the first compressed data based on a second check algorithm; and the receiving device performs the first packet by using a third check algorithm.
- the receiving device Processing, obtaining a first check code, where the second check algorithm and the third check algorithm comprise the same generator polynomial; the receiving device according to the obtained first check code, and the first Corresponding relationship between the check code and the first compression mode, determining that the first compression mode is a compression mode used by the sending device to compress the first data; and the receiving device is based on the first decompression mold
- the said first message comprising the first compressed data is decompressed to obtain
- the first data, the first decompression mode is a decompression mode corresponding to the first compression mode.
- the transmitting device generates a check value by using a check algorithm corresponding to the compressed mode, and transmits the check value and the message composed of the compressed data to the receiving device.
- the receiving device processes the check value to obtain a check code for determining the compressed mode.
- the receiving device determines a compression mode used by the transmitting device to compress the data according to the correspondence between the check code and the compression mode.
- the compressed mode is indicated by the extra overhead bytes of the packet header, and the present invention carries the indication information by using the check value, thereby reducing the overhead.
- the extra overhead bytes of the packet header need to reserve enough overhead bytes in advance when the system is planned.
- the sending device by compressing the first data based on the first compression mode, obtains the first compressed data, including: The target field in the packet carrying the first data is compressed to obtain first compressed data, where the target field includes S bits, and the compressed target field is M bits, and S is greater than M.
- the transmitting device can replace the content in the target field with a short compressed field, which reduces the bandwidth usage during the transmission and improves the bandwidth usage.
- the receiving device determines that the first compression mode is a compression mode used by the sending device to compress the first data, comprising: the receiving device acquiring a one-to-one correspondence between multiple check codes and multiple compression modes, The plurality of check codes include the first check code; the receiving device determines, according to the one-to-one correspondence between the plurality of check codes and the plurality of compression modes, the first check code corresponding to the first check code
- the first compression mode is a compression mode used by the transmitting device to compress the first data.
- the transmitting device generates different check values by based on a check algorithm corresponding to different compression modes.
- the receiving device obtains different check codes by processing different check values.
- the receiving device can determine the compression mode used by the sending data currently sent by the sending device according to the correspondence between the different check codes and the compressed mode. This reduces overhead and facilitates system compatibility and scalability.
- the receiving device according to the obtained first check code, and the first check code Corresponding to the first compression mode, determining that the first compression mode is after the compression mode used by the sending device to compress the first data, and at the receiving device by using the first decompression mode Before decompressing the first compressed data included in the first packet to obtain the first data, the method further includes: the receiving device determining a second solution currently used by the receiving device The compressed mode is different from the first decompression mode corresponding to the first compressed mode used by the transmitting device when the transmitting device compresses the first data; and the receiving device is based on the receiving device The second decompression mode currently used is different from the first decompression mode, and the decompression mode currently used by the receiving device is set to the first decompression mode.
- the receiving device determines that the second decompression mode currently used is different from the first decompression mode
- the currently used decompression mode is set to the first decompression mode, so that the next transmission sent by the transmitting device can be received.
- the data is obtained from the next message based on the second decompression mode.
- the method further includes: when the receiving device determines that the first check code is one of the plurality of check codes, determining the first compressed data and the received by the receiving device The first compressed data sent by the sending device is the same.
- the receiving device can also check whether the first compressed data is transmitted without error while determining the compression mode used when the transmitting device compresses the first data according to the first check code.
- the receiving device determines, by the receiving device, that the second decompression mode currently used by the receiving device is determined by the receiving device After the first decompression mode corresponding to the first compression mode used by the transmitting device to compress the first data is different, and the receiving device is based on the first used by the receiving device The second decompression mode is different from the first decompression mode, and before the decompression mode currently used by the receiving device is set to the first decompression mode, the method further includes: the receiving device discarding the A message.
- the receiving device determines that the first packet is discarded when the decompression mode currently used by the receiving device is different from the first decompression mode. Therefore, the receiving device is prevented from decompressing the first compressed data by using an erroneous decompression mode, and the packet leakage to avoid error is normal, causing network abnormality.
- the receiving device is based on the second decompression mode currently used by the receiving device Different from the first decompression mode, before the decompression mode currently used by the receiving device is set to the first decompression mode, the method further includes: the receiving device receiving the second sent by the sending device a packet, where the second packet includes second compressed data and a third check value, where the second compressed data is obtained by the sending device for compressing the second data based on the first compressed mode, The third check value is obtained by the sending device according to the first check algorithm for the fourth check value, and the fourth check value is determined by the sending device according to the second check algorithm
- the second compressed data processing is obtained; the receiving device obtains the first check code by processing the second packet based on the third check algorithm; and the receiving device is configured according to the obtained a first check code, and a correspondence between the first check code and the first compressed mode, determining that the first compressed mode is a compressed mode used by a transmitting
- the receiving device determines, according to the packet sent twice consecutively by the sending device, that the compression mode used by the transmitting device is the first compression mode.
- the receiving device switches the currently used decompression mode to a first decompression mode corresponding to the first compression mode. It can avoid the situation that the verification value caused by the network transmission error cannot correctly determine the compression mode used by the transmitting device, thereby reducing the probability of the receiving device erroneously and erroneously switching.
- the present application provides a method for transmitting data, where the method includes: receiving, by a receiving device, a first packet sent by a sending device, where the first packet includes first compressed data and a first check value.
- the first compressed data is obtained by the sending device for compressing the first data based on the first compressed mode
- the first check value is obtained by the sending device by processing the second check value based on the first check algorithm.
- the second check value is obtained by the sending device to process the first compressed data based on a second check algorithm; and the receiving device is used in the first packet by using the second check algorithm.
- the first compressed data included is processed to obtain the second check value; and the receiving device processes the obtained second check value based on the first check algorithm to obtain the first One a check value; the receiving device determines that the first check algorithm is the sending device, based on the obtained first check value being the same as the first check value included in the first packet.
- the first verification algorithm used by the receiving device to generate the first packet by the sending device determined by the receiving device, and the Corresponding relationship between the first verification algorithm and the first compression mode, determining that the first compression mode is a compression mode used by the sending device to compress the first data; and the receiving device is based on the first
- the decompressing mode decompresses the first compressed data included in the first packet to obtain the first data, where the first decompressing mode is a decompressing mode corresponding to the first compressed mode.
- the transmitting device generates a check value by using a check algorithm corresponding to the compressed mode, and transmits the check value and the message composed of the compressed data to the receiving device.
- the receiving device processes the compressed data in the message to determine the same verification algorithm as the transmitting device.
- the receiving device determines a compression mode used by the transmitting device to compress the data according to the correspondence between the verification algorithm and the compression mode.
- the compressed mode is indicated by the extra overhead bytes of the packet header.
- the present invention carries the indication information by using the check value, thereby reducing the overhead.
- the extra overhead bytes of the packet header need to reserve enough overhead bytes in advance when the system is planned. If the system does not reserve sufficient overhead bytes during planning, the compression mode cannot be indicated by the method.
- the present invention does not need to reserve overhead bytes during system planning, thereby facilitating system compatibility and scalability.
- the receiving device by processing the obtained second check value based on the first check algorithm, obtains the first
- the check value includes: the receiving device obtains a plurality of check values by processing the second check value respectively according to multiple check algorithms, where the plurality of check values includes the first check value
- the plurality of check values are in one-to-one correspondence with the plurality of check algorithms.
- the method further includes: the receiving device determining, by the receiving device The second decompression mode currently used by the receiving device is different from the first decompression mode corresponding to the first compression mode used by the receiving device when the transmitting device compresses the first data; The receiving device is based on the receiving device The second decompression mode currently in use is different from the first decompression mode, and the decompression mode currently used by the receiving device is set to the first decompression mode.
- the receiving device determines that the second decompression mode currently used is different from the first decompression mode
- the currently used decompression mode is set to the first decompression mode, so that the next transmission sent by the transmitting device can be received.
- the data is obtained from the next message based on the second decompression mode.
- the method further includes: when the receiving device determines that the first check code is one of the plurality of check codes, determining the first compressed data and the received by the receiving device The first compressed data sent by the sending device is the same.
- the receiving device can also check whether the first compressed data is transmitted without error while determining the compression mode used when the transmitting device compresses the first data according to the first check code.
- the receiving device determines, by the receiving device, that the second decompression mode currently used by the receiving device is determined by the receiving device After the first decompression mode corresponding to the first compression mode used by the transmitting device to compress the first data is different, and the receiving device is based on the first used by the receiving device The second decompression mode is different from the first decompression mode, and before the decompression mode currently used by the receiving device is set to the first decompression mode, the method further includes: the receiving device discarding the A message.
- the receiving device determines that the first packet is discarded when the decompression mode currently used by the receiving device is different from the first decompression mode. Therefore, the receiving device is prevented from decompressing the first compressed data by using an erroneous decompression mode, and the packet leakage to avoid error is normal, causing network abnormality.
- the receiving device is based on the second decompression mode currently used by the receiving device and the first The decompressing mode is different, and before the decompressing mode currently used by the receiving device is set to the first decompressing mode, the method further includes: the receiving device receiving the second packet sent by the sending device, where The second message includes second compressed data and a third check value, and the second compressed data is obtained by the transmitting device for compressing the second data based on the first compressed mode, and the third check value is obtained by The sending device is obtained by processing the fourth check value based on the first check algorithm, and the fourth check value is obtained by the sending device by processing the second compressed data based on the second check algorithm.
- the second compressed data included is processed to obtain the fourth check value; and the receiving device processes the obtained second check value based on the first check algorithm to obtain the first a check value; the receiving device determines that the first check algorithm is the sending, based on the obtained first check value being the same as the first check value included in the second packet.
- the first compression mode is a compression mode used by the sending device to compress the second data; the receiving device is based on the The second decompression mode currently used by the receiving device is different from the first decompression mode, and setting the decompression mode currently used by the receiving device to the first decompression mode comprises: the receiving device is based on Said The second decompression mode currently used by the receiving device is different from the first decompression mode corresponding to the first compression mode used by the receiving device when the transmitting device compresses the first data, and The second decompression mode currently used by the receiving device is different from the first decompression mode corresponding to the first compression mode used by the receiving device when the transmitting device compresses the second data, The decompression mode currently used by the receiving device is set to the first decompression mode.
- the receiving device determines, according to the packet sent twice consecutively by the sending device, that the compression mode used by the transmitting device is the first compression mode.
- the receiving device switches the currently used decompression mode to a first decompression mode corresponding to the first compression mode.
- the check value caused by the network transmission error can be prevented from correctly determining the compression mode used by the transmitting device, thereby reducing the probability of the receiving device erroneously and erroneously switching.
- the present application provides a method for transmitting data.
- the method includes: the transmitting device obtains first compressed data by compressing the first data according to the first compression mode; and the sending device obtains the second by processing the first compressed data by using a second verification algorithm a check value; the sending device processes the first check value by using a first check algorithm to obtain a first check value, where the first check algorithm corresponds to the first compression mode; The sending device sends a first packet to the receiving device, where the first packet includes the first compressed data and the first check value.
- the transmitting device generates a check value by using a check algorithm corresponding to the compressed mode, and transmits the check value and the message composed of the compressed data to the receiving device.
- the receiving device processes the check value to obtain a check code for determining the compressed mode.
- Receiving device according to the check code and compression mode Correspondence relationship determines the compression mode used by the transmitting device to compress the compressed data. Thereby, the compression mode is indicated by the check code, the overhead is reduced, and the compatibility and scalability of the system are facilitated.
- the method further includes: the sending device acquiring a one-to-one correspondence between the plurality of verification algorithms and the plurality of compression modes, wherein the second verification algorithm is different from any one of the plurality of verification algorithms; The sending device determines a first verification algorithm corresponding to the first compression mode according to a one-to-one correspondence between the plurality of verification algorithms and the plurality of compression modes.
- the transmitting device generates different check values by based on a check algorithm corresponding to different compression modes.
- the receiving device obtains different check codes by processing different check values.
- the receiving device can determine the compression mode used by the sending data currently sent by the sending device according to the correspondence between the different check codes and the compressed mode. This reduces overhead and facilitates system compatibility and scalability.
- the present application provides an apparatus for transmitting data for performing the method of the first aspect or any possible implementation of the first aspect.
- the apparatus comprises means for performing the method of the first aspect or any of the possible implementations of the first aspect.
- the present application provides an apparatus for transmitting data for performing the method of any of the second aspect or the second aspect.
- the apparatus comprises means for performing the method of any of the second aspect or any of the possible implementations of the second aspect.
- the present application provides an apparatus for transmitting data for performing the method of any of the third aspect or any of the possible implementations of the third aspect.
- the apparatus comprises means for performing the method of any of the third or third aspects of the possible implementation.
- the present application provides a system for transmitting data, the system comprising the apparatus of the above fourth aspect, and the apparatus of the sixth aspect, or the system comprising the fifth aspect described above Apparatus and apparatus of the sixth aspect.
- the present application provides an apparatus for transmitting data, the apparatus comprising: a receiver, a transmitter, a memory, a processor, and a bus system.
- the receiver, the transmitter, the memory and the processor are connected by the bus system, the memory is for storing instructions for executing the instructions stored by the memory to control the receiver to receive signals and control the sending
- the transmitter transmits a signal, and when the processor executes the memory stored instructions, the execution causes the processor to perform the method of the first aspect or any of the possible implementations of the first aspect.
- the present application provides an apparatus for transmitting data, the apparatus comprising: a receiver, a transmitter, a memory, a processor, and a bus system.
- the receiver, the transmitter, the memory and the processor are connected by the bus system, the memory is for storing instructions for executing the instructions stored by the memory to control the receiver to receive signals and control the sending
- the transmitter transmits a signal, and when the processor executes the memory stored instructions, the execution causes the processor to perform the method of any of the second aspect or any of the possible implementations of the second aspect.
- the application provides an apparatus for transmitting data, the apparatus comprising: a receiver, a transmitter, a memory, a processor, and a bus system.
- the receiver, the transmitter, the memory and the processor are connected by the bus system, the memory is for storing instructions for executing the instructions stored by the memory to control the receiver to receive signals and control the sending
- the processor transmits a signal, and when the processor executes the memory stored instructions, the execution causes the processor to perform the method of any of the possible implementations of the third aspect or the third aspect.
- the present application provides a system for transmitting data, the system comprising the device of the above eighth aspect, and the device of the tenth aspect, or the system And the device of the tenth aspect.
- the present application provides a computer readable medium for storing a computer program, the computer program comprising instructions for performing the method of the first aspect or any of the possible implementations of the first aspect.
- the present application provides a computer readable medium for storing a computer program, the computer program comprising instructions for performing the method of any of the second aspect or the second aspect of the second aspect.
- the present application provides a computer readable medium for storing a computer program, the computer program comprising instructions for performing the method of any of the third aspect or any of the possible implementations of the third aspect.
- the first compressed mode includes: an Ethernet frame header compression mode, an Internet Protocol IP header compression mode, or an Ethernet frame header and an IP frame header compression mode.
- the second check value includes a cyclic redundancy check CRC value
- the second check algorithm is a CRC algorithm
- the method, device and system for transmitting data provided by the present application can reduce overhead and facilitate system compatibility and scalability.
- FIG. 1 is a schematic flow chart of a method for transmitting data according to an embodiment of the present invention.
- FIG. 2 is another schematic flowchart of a method for transmitting data according to an embodiment of the present invention.
- FIG. 3 is another schematic diagram of a method for transmitting data in accordance with an embodiment of the present invention.
- FIG. 4 is a schematic block diagram of an apparatus for transmitting data in accordance with an embodiment of the present invention.
- FIG. 5 is a schematic block diagram of an apparatus for transmitting data according to another embodiment of the present invention.
- FIG. 6 is a schematic block diagram of an apparatus for transmitting data in accordance with still another embodiment of the present invention.
- FIG. 7a and 7b are schematic block diagrams of systems for transmitting data in accordance with an embodiment of the present invention.
- FIG. 8 is a schematic block diagram of an apparatus for transmitting data according to an embodiment of the present invention.
- FIG. 9 is a schematic block diagram of an apparatus for transmitting data in accordance with another embodiment of the present invention.
- FIG. 10 is a schematic block diagram of an apparatus for transmitting data according to still another embodiment of the present invention.
- 11a and 11b are another schematic block diagram of a system for transmitting data in accordance with an embodiment of the present invention.
- a component can be, but is not limited to being, a process running on a processor, a processor, an object, an executable, a thread of execution, a program, and/or a computer.
- an application running on a computing device and a computing device can be a component.
- One or more components can reside within a process and/or execution thread, and the components can be located on one computer and/or distributed between two or more computers.
- these components are available from Execution is performed on various computer readable media having various data structures stored thereon.
- a component may, for example, be based on signals having one or more data packets (eg, data from two components interacting with another component between the local system, the distributed system, and/or the network, such as the Internet interacting with other systems) Communicate through local and/or remote processes.
- data packets eg, data from two components interacting with another component between the local system, the distributed system, and/or the network, such as the Internet interacting with other systems
- the term "article of manufacture” as used in this application encompasses a computer program accessible from any computer-readable device, carrier, or media.
- the computer readable medium may include, but is not limited to, a magnetic storage device (eg, a hard disk, a floppy disk, or a magnetic tape), an optical disk (eg, a CD (Compact Disk), a DVD (Digital Versatile Disk), or the like. ), smart cards and flash memory devices (eg, EPROM (Erasable Programmable Read-Only Memory), cards, sticks or key drivers, etc.).
- various storage media described herein can represent one or more devices and/or other machine-readable media for storing information.
- the term "machine-readable medium” may include, without limitation, a wireless channel and various other mediums capable of storing, containing, and/or carrying instructions and/or data.
- the compressed mode can be negotiated between the transmitting device and the receiving device to decompress the compressed data.
- the sending device and the receiving device may be a base station and a base station, respectively, or a base station controller and a base station controller, or a switch and a switch, respectively.
- the sending device is a base station
- the receiving device is a radio network controller (Radio Network Controller, abbreviated as "RNC").
- RNC Radio Network Controller
- the transmitting device and the receiving device transmit radio signals through air interfaces.
- the carrier can manage the sending device and the receiving device through the network management device. When the network management device monitors the current network bandwidth usage rate through the traffic monitoring module, it can notify the sending device to start the compressed mode for transmission. In other words, bandwidth can be saved by compressing the transmitted data.
- FIG. 1 is a schematic flow diagram of a method 100 for transmitting data, in accordance with an embodiment of the present invention, from the perspective of device interaction.
- the method 100 can be applied to systems that support point-to-point transmission of one or more compressed modes. As shown in FIG. 1, the method 100 includes:
- the sending device obtains the first compressed data by compressing the first data according to the first compression mode.
- the transmitting device may first determine a compressed mode (eg, the first compressed mode) for compressing the first data before transmitting the data. Then, the transmitting device obtains the first compressed data by compressing the first data based on the first compression mode.
- a compressed mode eg, the first compressed mode
- the sending device obtains the first compressed data by compressing the first data according to the first compression mode, including:
- the packet received by the sending device through the receiving port may be the first data.
- the packet may be an Ethernet (Ethernet) frame, a Multi-Protocol Label Switching ("MPLS") packet, an IP packet, or a User Datagram Protocol (“UDP"). ) message.
- Ethernet Ethernet
- MPLS Multi-Protocol Label Switching
- IP IP
- UDP User Datagram Protocol
- the transmitting device compresses a target field used in the first data based on the first compression mode to obtain first compressed data.
- the target field includes S bits, and the compressed target field is M bits. S is greater than M.
- the target field may be an Ethernet frame header, a field in the IP frame header, or one or more fields in the payload of the message.
- the target field may be an Ethernet type field.
- the target field may be an Ethernet type field and a source media access control ("MAC") protocol address field.
- MAC media access control
- the target field may be a field in the payload for the first data.
- the target field may be a protocol field.
- the target field may be a source port field and a destination port field.
- the sending device compresses the target field to obtain a compressed field. That is, the first data includes the target field and data that does not need to be compressed.
- the first compressed data includes the compressed field and uncompressed data.
- the transmitting device transmits the first compressed data to the receiving device.
- the receiving device decompresses the first compressed data according to a decompression mode corresponding to the compressed mode to generate first data.
- the first data contains a target field.
- the sending device and the receiving device may establish a one-to-one correspondence between the target field and the compressed field by using a predetermined compression mapping relationship table.
- the sending device determines the compressed field corresponding to the target field according to the compression mapping relationship table.
- the sending device generates a first packet that includes the compressed field (refer to S104 for a detailed description of the first packet), thereby implementing compression of the data.
- the receiving device decompresses the compressed field according to the compressed mapping relationship table to generate a value in the original target field, thereby implementing decompression of the compressed data.
- the target field may be an Ethernet type field.
- the sending device and The compression mapping relationship table may be pre-stored in the receiving device.
- the value of the target field is different, and the corresponding compressed field is also different.
- the transmitting device and the receiving device perform data compression and decompression according to the compression mapping relationship table.
- the sending device updates the compressed mapping relationship table periodically or on demand based on the value in the currently compressed target field, and sends the updated compressed mapping relationship table to the receiving device.
- the receiving device decompresses the compressed field in the received compressed data based on the updated compressed mapping relationship table.
- the target field may be an Ethernet frame header, an IP frame header, or even a Physical Layer (PHY) layer header
- the transmitting device may compress one or more of the frame headers.
- the receiving device does not know which frame headers are compressed by the transmitting device, and cannot be correctly parsed when receiving compressed data.
- the transmitting device may send indication information to instruct the receiving device to decompress the compressed data based on which decompression mode.
- the transmitting device can compress the data based on different compression modes.
- the first compression mode may be to compress only the Ethernet frame header, or to compress only the IP frame header, and also compress both the Ethernet frame header and the IP frame header.
- the sending device when the sending device compresses the first data based on the first compression mode, the sending device generates the first check value by using a first check algorithm corresponding to the first compression mode.
- the receiving device determines, based on the first check value, which data to decompress based on which decompression mode. That is to say, a compression mode corresponds to a compression mapping relationship table.
- the compression mapping relationship table may be a one-to-one correspondence between an IP frame header and a compressed field, or may be an Ethernet frame header and a compressed field. Correspondence relationship.
- the receiving device determines the compression mode used by the transmitting device, and determines which compression mapping relationship table the received data of the transmitting device is compressed based on, so that it can determine which compression mapping relationship table is used for decompression.
- the sending device obtains a second check value by processing the first compressed data according to a second check algorithm.
- the first compressed data is processed according to the second check algorithm to obtain a second check value.
- the second check value is a Cyclic Redundancy Check ("CRC") value
- the second check algorithm is a CRC algorithm
- the transmitting device processes the first compressed data by using a cyclic redundancy check CRC algorithm to obtain a CRC value.
- the number of compressions to be sent by the sending device by using the second check algorithm is obtained.
- the second verification algorithm can be understood as: the transmitting device shifts the compressed data to the left by m bits based on the highest power of the generator polynomial, and adds "0" to the vacated m bits.
- the transmitting device performs a CRC operation on the first compressed data based on the generator polynomial to obtain a CRC value, and the number of bits of the CRC value is m.
- the CRC value and the first compressed data are not encapsulated into a message and sent to the receiving device, but the transmitting device waits for the CRC value to be processed according to S103.
- the first compressed data is a binary number "1010”.
- the first compressed data is shifted to the left by 3 bits to obtain "1010 000”
- the actually transmitted compressed data may be more bits, and the CRC value corresponding to the compressed data may be 16 bits, or 32 bits, or more.
- the sending device processes the second check value by using a first check algorithm to obtain a first check value.
- the sending device determines a corresponding check algorithm according to the compression mode used when compressing the first data, and processes the second check value to obtain a first check value, thereby generating a corresponding message.
- the verification algorithm corresponding to the first compression mode is the first verification algorithm.
- the sending device processes the second check value generated in S102 according to the first check algorithm, and obtains the first check value.
- the first check value generation algorithm includes: performing an inverse operation on one or more bits of the second check value. For example, the transmitting device inverts one or more bits of the CRC value based on the CRC value generated in S102 such that the generated first check value is different from the CRC value.
- the CRC value generated in S102 (that is, an example of the second check value) is "011". It is assumed that the first check algorithm is to invert the Least Significant Bit (LSB) of the second check value, that is, the first check value is “010”; or, the first check is assumed. The algorithm is to invert the second bit of the second check value, that is, the first check value is “001”.
- Least Significant Bit Least Significant Bit
- the method before the sending, by the sending device, processing the second check value by using the first check algorithm to obtain the first check value, the method further includes:
- the sending device acquires a one-to-one correspondence between multiple verification algorithms and multiple compression modes
- the sending device determines the first verification algorithm corresponding to the first compression mode according to a one-to-one correspondence between the multiple verification algorithms and multiple compression modes.
- the sending device may obtain a one-to-one correspondence between the multiple verification algorithms and the multiple compression modes from the memory of the sending device.
- the transmitting device can pre-save a plurality of computer programs according to various compression modes supported by the transmitting device.
- the plurality of computer programs are respectively configured to implement a plurality of verification algorithms corresponding to the plurality of compression modes.
- the multiple verification algorithms include a first verification algorithm, and the multiple verification algorithms do not include a second verification algorithm.
- the various compression modes described above may include: an Ethernet frame header compression mode, an IP frame header compression mode, and an Ethernet frame header and an IP frame header compression mode.
- the first compression mode may be: an Ethernet frame header compression mode, an IP frame header compression mode, or an Ethernet frame header and an IP frame header payload compression mode.
- the corresponding second check value is a hexadecimal number "7FFF”.
- the transmitting device obtains the first check value by processing the second check value based on the first check algorithm corresponding to the first compressed mode.
- the first check value is a hexadecimal number "1000”.
- the corresponding second check value is a hexadecimal number "1FFF”.
- the transmitting device obtains the first check value by processing the second check value based on the first check algorithm.
- the first check value is a hexadecimal number "3800”.
- the corresponding second check value is a hexadecimal number "3FFF".
- the transmitting device obtains the first check value by processing the second check value based on the first check algorithm.
- the first check value is a hexadecimal number "E001”.
- the first compression mode and the first verification value enumerated above are merely illustrative and should not be construed as limiting the invention.
- the first check value may be 16 bits, or may be 32 bits, or more bits.
- the first check value may be a hexadecimal number or a binary number, which is not specifically limited in the present invention.
- the sending device Before the data is compressed, the sending device can determine various compression modes supported by itself. And obtaining, according to the multiple compression modes, a one-to-one correspondence between the plurality of verification algorithms and the plurality of compression modes.
- the following is a first-to-one correspondence between various verification algorithms and multiple compression modes. Mapping relations. Table 1 shows an example of the first mapping relationship.
- the sending device acquires the first verification algorithm corresponding to the first compression mode according to the first mapping relationship, and further processes the second verification value according to the first verification algorithm to obtain the first verification value.
- the sending device can save the correspondence between a check algorithm and a compressed mode, and can also save the correspondence between multiple check algorithms and multiple compression modes, which is not specifically limited in the present invention.
- the second verification algorithm and the first verification algorithm listed above are two different algorithms.
- the second verification algorithm is different from any of the plurality of verification algorithms described above.
- the first verification algorithm corresponds to the compression mode used by the transmitting device.
- the sending device uses different check algorithms to generate the first check value, which in turn generates a message.
- the sending device sends the first packet to the receiving device, where the first packet includes the first compressed data and the first check value.
- the sending device performs the obtained first check value and the first compressed data.
- Processing generating a first packet, where the first packet includes the first compressed data and the first check value.
- the first message listed above may include a binary number "1010 010", where "1010” is obtained by the transmitting device based on the first compression mode, and "010” is determined by the transmitting device based on the second verification algorithm and The first compression mode corresponding to the first compression mode is processed.
- the first packet may include a binary number "1010 001", where "1010” is generated by the transmitting device based on the first compression mode compression, and "001" is determined by the transmitting device based on the second verification algorithm and the first The compressed mode corresponds to the first check algorithm processed.
- the receiving device determines, according to the first packet, that the first compression mode is the The compression mode used by the transmitting device to compress the first data.
- the receiving device after receiving the first packet sent by the sending device, the receiving device needs to first determine a compression mode used by the sending device to compress the first data.
- the receiving device may process the first packet according to the third check algorithm, obtain the first check code, and determine, according to the correspondence between the check code and the compressed mode, the first check code.
- the first compression mode in another specific implementation manner, the receiving device may also process the first compressed data based on the second verification algorithm, obtain the second verification value, and then perform the second The check value is processed to obtain the same check value as the first check value. And determining a first compression mode corresponding to the first verification algorithm according to the correspondence between the verification algorithm and the compression mode.
- the receiving device obtains the first data by decompressing the first compressed data included in the first packet according to a first decompression mode.
- the receiving device may set the decompression mode to correspond to the first compression mode.
- the first decompression mode The receiving device decompresses the first compressed data included in the first packet based on the first decompression mode to obtain the first data.
- S106 may be: the receiving device decompresses the compressed data included in the other packets by using the first decompression mode.
- the other message is a message received by the receiving device from the sending device.
- the sending device sends the other packet at a later time than the sending device sends the first packet.
- the transmitting device generates the check value by using a check algorithm corresponding to the compressed mode.
- the receiving device obtains a compressed mode check code or a check algorithm by processing a message composed of compressed data and a check value.
- the receiving device may determine the compression mode used by the compressed data sent by the sending device according to the correspondence between the check code and the compressed mode, or the correspondence between the verification algorithm and the compressed mode.
- the compressed mode is indicated by the extra overhead bytes of the packet header.
- the present invention carries the indication information by using the check value, thereby reducing the overhead.
- the extra overhead bytes of the packet header need to reserve enough overhead bytes in advance when the system is planned. If the system does not reserve sufficient overhead bytes during planning, the compression mode cannot be indicated by the method.
- the present invention does not need to reserve overhead bytes during system planning, thereby facilitating system compatibility and scalability.
- the receiving device determines the first compression mode according to the first check value.
- Method may be method one or method two).
- the receiving device processes the first packet by using a third verification algorithm to obtain a first check code.
- the receiving device determines, according to the obtained first check code, a correspondence between the first check code and the first compression mode, that the first compressed mode is the sending device compression device.
- the compression mode used when describing the first data.
- a computer program for executing the third verification algorithm is stored in the receiving device.
- a computer program for executing the second verification algorithm is stored in the transmitting device.
- the third verification algorithm and the second verification algorithm contain the same generator polynomial.
- the sending device processes the first compressed data according to the second check algorithm, obtains the second check value, and processes the second check value based on the first check algorithm to obtain the first check value, thereby generating the first Message.
- the first message includes first compressed data and a first check value.
- the receiving device processes the received first packet based on the third verification algorithm, and obtains the first check code.
- the third check algorithm can be understood as: the receiving device performs a CRC operation on the received first packet based on the generator polynomial, and the obtained remainder is the first check code.
- the first message may be obtained.
- the first message contains the binary number "1010 010".
- "1010” is obtained by the transmitting device based on the first compression mode compression.
- "010” is obtained by the transmitting device based on the second verification algorithm and the first verification algorithm corresponding to the first compression mode.
- the receiving device performs a CRC operation on the first message based on the generator polynomial, and the remainder is “001”.
- the first message contains the binary number "1010 001".
- “1010” is obtained by the transmitting device based on the first compression mode compression.
- “010” is obtained by the transmitting device based on the second verification algorithm and the first verification algorithm corresponding to the first compression mode.
- the receiving device performs a CRC operation on the first message based on the generator polynomial, and the remainder is “010”. It can be seen that the transmitting device processes the second check value by using different check algorithms, and the CRC operation is performed on the receiving device based on the same generator polynomial, and the obtained result is also different.
- the receiving device may determine the first pressure corresponding to the first check code according to the correspondence between the check code pre-stored by the receiving device and the compressed mode.
- the reduced mode is the compressed mode used by the transmitting device to compress the first data.
- the receiving device determines, according to the obtained first check code, and the correspondence between the first check code and the first compression mode, that the first compressed mode is the sending device.
- the compression mode used when compressing the first data includes:
- the receiving device acquires a one-to-one correspondence between multiple check codes and multiple compression modes, where the multiple check codes include the first check code;
- the receiving device determines, according to the one-to-one correspondence between the plurality of check codes and the plurality of compression modes, that the first compression mode corresponding to the first check code is that the sending device compresses the first The compression mode used when the data is used.
- the receiving device may acquire, in advance, a one-to-one correspondence between the plurality of check codes and the plurality of compression modes from the memory.
- a one-to-one correspondence between a plurality of check codes and a plurality of compression modes is referred to as a second mapping relationship.
- the receiving device may determine, according to the multiple compression modes and decompression modes supported by the sending device and the receiving device, and the first mapping relationship acquired by the sending device in S103, determine that the multiple matching algorithms correspond to multiple A check code, thereby determining a second mapping relationship of the compressed mode.
- each compression mode corresponds to one check code, and each check code is different from each other.
- the receiving device processes the received first message based on the pre-stored computer program for implementing the third verification algorithm to obtain the first check code.
- the receiving device determines, according to the one-to-one correspondence between the plurality of check codes and the plurality of compression modes, the first compression mode corresponding to the first check code, to determine that the sending device sends the first datagram based on the first compressed mode. Text.
- the first packet listed in S201 may include a binary number “1010 010”, and the corresponding check code is “001”; or the first packet may include a binary number “1010 001”, and the corresponding checksum The code is "010", that is, two different check codes correspond to two different compression modes.
- the multiple check codes pre-stored in the receiving device are processed by the receiving device according to the third check algorithm, after the second check algorithm in the sending device and multiple check algorithms corresponding to multiple compression modes are processed.
- the obtained check value is obtained by processing.
- the receiving device may pre-determine: when the first check code obtained by the receiving device based on the third check algorithm is any one of the plurality of check codes, the compressed data included in the corresponding message may be determined. No errors occurred during the transfer. That is, when the receiving device determines that the first check code is one of the multiple check codes, the first compressed data in the first packet received by the receiving device and the first sent by the sending device may be determined. The first compressed data in the message is the same.
- the transmitting device and the receiving device can pre-agreed the check for indicating the compressed mode. code.
- the check code obtained by the receiving device based on the third check algorithm is the pre-agreed check code, it is considered that the data does not generate an error during the transmission; when the receiving device reports the report based on the third check algorithm
- the check code obtained by the text processing is not the above-mentioned pre-agreed check code, it is considered that the data has an error during transmission.
- the receiving device obtains the first check code by processing the received first packet according to the third check algorithm. That is to say, the first check algorithm used by the sending device has a corresponding relationship with the first check code pre-stored in the receiving device.
- each compressed data may generate a corresponding message based on the first verification algorithm.
- the compressed data included in each packet is different, but the algorithm used to generate the packet is the same. Therefore, the result obtained by the third verification algorithm in the receiving device is the same check code, that is, the first school. Code verification.
- the receiving device may save a correspondence between a check code and a compressed mode, and may also maintain a matching relationship between multiple check codes and multiple compression modes, which is not specifically limited in the present invention.
- the specific execution method of the second check algorithm and the third check algorithm may refer to the CRC algorithm in the prior art.
- the difference between the present invention and the prior art is that the CRC value obtained based on the second verification algorithm is further processed, and after the verification value is obtained based on the verification algorithm corresponding to the compression mode, the compressed data and the verification are performed.
- a message consisting of values is sent to the receiving device.
- the receiving device processes the packet based on the third verification algorithm to obtain a check code. Further, the compression mode used by the transmitting device is determined according to the correspondence between the check code and the compression mode.
- the transmitting device generates the check value by using a check algorithm corresponding to the compressed mode.
- the receiving device obtains a check code for determining the compressed mode by processing the check value.
- the receiving device can determine the compression mode used when the transmitting device compresses the data according to the correspondence between the check code and the compression mode. This reduces overhead and facilitates system compatibility and scalability.
- the check code can be used to determine whether the data transmission is correct, and the accuracy of the transmission is ensured.
- the receiving device obtains the second check value by processing the first compressed data included in the first packet according to the second check algorithm.
- the receiving device obtains the first check value by processing the obtained second check value according to the first check algorithm.
- the receiving device is configured to be included in the first packet based on the obtained first check value.
- the first check value is the same, and the first check algorithm is determined to be a check algorithm used by the sending device to generate the first message;
- the receiving device after receiving the first packet, the receiving device first acquires the first compressed data included therein.
- the specific method for the receiving device to obtain the compressed data from the packet is similar to the specific method in the prior art for the receiving device to obtain the field in the packet header from the packet. For the sake of brevity, it will not be repeated here.
- the receiving device may process the acquired first compressed data to obtain a second check value based on the pre-stored computer program for implementing the second verification algorithm.
- the receiving device obtains a second check value by processing the first compressed data according to the second check algorithm, and the second compressed check is performed by the sending device by processing the first compressed data by using the second check algorithm.
- the specific method of the value is the same.
- the specific method for the sending device to process the first compressed data by using the second check algorithm to obtain the second check value has been described in detail above, and is not described herein again for brevity.
- the receiving device After obtaining the second check value, the receiving device processes the second check value based on the first check algorithm to obtain the first check value. It should be noted here that when the receiving device performs processing based on the first verification algorithm, it does not know that the verification algorithm used by it is the same verification algorithm as the first verification algorithm used by the transmitting device.
- a computer program for executing the first check algorithm may be pre-stored in the receiving device, and the check value obtained by the receiving device processing the second check value based on the first check algorithm is exactly the first report sent by the sending device.
- the receiving device may determine that the first check algorithm is the first check algorithm used by the sending device.
- the receiving device may determine, according to the correspondence between the pre-stored check algorithm and the compressed mode in the receiving device, that the first compression mode corresponding to the first check algorithm is The compression mode used by the sending device to compress the first data.
- the first packet includes the first compressed data and the first check value. Therefore, the receiving device may determine whether the first check algorithm is a check algorithm used by the sending device to send the first packet, according to whether the packet obtained by processing the first compressed data is the same as the received first packet. .
- the present invention is not particularly limited thereto.
- the receiving device by processing the obtained second check value according to the first check algorithm, obtaining the first check value, including:
- the receiving device obtains a plurality of check values by processing the second check value by using a plurality of check algorithms, where the plurality of check values includes the first check value, and the plurality of schools
- the verification value is in one-to-one correspondence with the plurality of verification algorithms.
- the receiving device may acquire, in advance, a one-to-one correspondence between the plurality of check codes and the plurality of compression modes from the memory.
- a one-to-one correspondence relationship between a plurality of check codes and a plurality of compression modes is referred to as a third mapping relationship.
- the receiving device may determine the third mapping relationship according to the multiple compression modes and decompression modes supported by the sending device and the receiving device.
- the third mapping relationship is the same as the first mapping relationship pre-stored in the transmitting device.
- the third mapping relationship may include a correspondence between a verification algorithm and a compression mode, and may also include a correspondence between multiple verification algorithms and multiple compression modes, which is not specifically limited in the present invention.
- the receiving device may traverse the plurality of check algorithms in the third mapping relationship, and process the second check value to obtain a plurality of check values.
- the receiving device searches for the same check value as the first check value included in the first data packet from the plurality of obtained check values, and determines a check algorithm used to generate the check value. Is the first verification algorithm.
- the receiving device may be preset: when the receiving device respectively executes the pre-stored plurality of computer programs for implementing the plurality of verification algorithms, and may determine the verification algorithm for generating the first check value, The compressed data contained in the corresponding message did not have an error during transmission.
- the receiving device separately executes the pre-stored plurality of computer programs for implementing the plurality of verification algorithms, and cannot determine the verification algorithm for generating the first check value, the compressed data included in the corresponding message may be determined. An error occurred during the transfer. That is, when a plurality of computer programs pre-stored in the receiving device that implement the plurality of verification algorithms include a computer program for implementing the first verification algorithm, the first message received by the receiving device may be determined.
- the first compressed data is the same as the first compressed data in the first packet sent by the sending device.
- the sending device generates a check value by using a check algorithm corresponding to the compressed mode, and sends the check value and the message composed of the compressed data to the receiving device.
- the receiving device processes the compressed data in the message to determine the same verification algorithm as the transmitting device.
- the receiving device determines a compression mode used by the transmitting device to compress the compressed data according to the correspondence between the verification algorithm and the compression mode. Thereby, the compression mode is indicated by the verification algorithm, the overhead is reduced, and the compatibility and scalability of the system are facilitated.
- the actual transmitted data may be more bits, and the CRC value used may be 16 bits, or 32 bits, or more.
- the method for determining the compression mode by the check value in the above-exemplified embodiments of the present invention is merely illustrative, and the present invention should not be limited in any way, and the present invention should not be limited thereto.
- the invention is also applicable to transmission systems having multiple modes of operation (e.g., non-compressed mode) and requiring both ends of the device to negotiate to switch modes of operation.
- the method 100 for transmitting data in accordance with an embodiment of the present invention has been described in detail above with reference to FIG.
- a specific process of the receiving device switching the compression mode will be described in detail with reference to FIGS. 2 and 3.
- the compression mode of the receiving device needs to adopt the same compression mode as the transmitting device.
- the receiving device can only determine the first data packet sent after the transmitting device switches the compressed mode, according to the data packet.
- FIG. 2 is another schematic flow diagram of a method 100 for transmitting data in accordance with an embodiment of the present invention.
- the receiving device determines that the first compression mode is a compression mode used by the sending device to compress the first data, and at S106, the receiving device is based on The first decompression mode decompresses the first compressed data included in the first packet, and before the obtaining the first data, the method 100 further includes:
- the receiving device determines, according to the second decompression mode currently used by the receiving device, the first compression mode that is used by the receiving device to compress the first data when the sending device compresses the first data.
- the first decompression mode is different;
- the receiving device sets, according to the second decompression mode currently used by the receiving device, the decompression mode currently used by the receiving device to the first solution, different from the first decompression mode. Compression mode.
- the first decompression mode is used to replace the second decompression mode.
- the receiving device may determine, according to the foregoing method 1 or method 2, a compression mode used by the transmitting device to compress the first data. After determining the compression mode of the sending device, the receiving device determines whether the received first message can be correctly parsed according to the currently used decompression mode.
- the identifier of the check code or the check algorithm for indicating the current decompression mode may be pre-stored.
- the receiving device may determine the decompression mode currently used according to the pre-stored check code (referred to as a second decompression mode for convenience of distinction and description).
- the receiving device determines, according to the check code corresponding to the received first packet (that is, the first check code obtained by the method 1), the first compression mode used by the sending device to compress the first data.
- the receiving device can directly compare the first check code obtained based on the first message with the check code in the pre-existing register or other storage space. When the two are the same, the receiving device determines that the currently used decompression mode corresponds to the compression mode used by the transmitting device, that is, the second decompression mode corresponds to the first compression mode.
- the receiving device is based on the second decompression mode, which is a decompression mode corresponding to the first compression mode, and may decompress the first compressed data and acquire the first data directly based on the second decompression mode currently used.
- the receiving device determines that the currently used decompression mode does not correspond to the compression mode used by the transmitting device, and thus the first data in the first compressed data cannot be properly decompressed.
- the receiving device may also determine the currently used decompression mode (ie, the second decompression mode) according to the identifier of the pre-stored verification algorithm.
- the receiving device determines, according to the verification algorithm corresponding to the received first packet (that is, the first verification algorithm determined by the method 2), the first compression mode used by the sending device to compress the first data.
- the receiving device may directly compare the identifier of the first verification algorithm determined based on the first message with the identifier of the pre-existing register or other verification algorithm in the storage space. When the two are the same, the receiving device determines that the currently used decompression mode corresponds to the compression mode used by the transmitting device, that is, the second decompression mode corresponds to the first compression mode.
- the receiving device is based on the second decompression mode, which is a decompression mode corresponding to the first compression mode, and may decompress the first compressed data and acquire the first data directly based on the second decompression mode currently used.
- the receiving device determines that the currently used decompression mode does not correspond to the compression mode used by the transmitting device, and thus the first data in the first compressed data cannot be properly decompressed.
- the compression mode corresponds to the decompression mode, or compression and decompression are reversible.
- the correspondence between the compression mode and the check code or the correspondence between the compression mode and the check algorithm can be understood as the correspondence between the decompression mode and the check code or the correspondence or the compression mode and the check algorithm. That is, when the correspondence between the compression mode and the check code is known, the correspondence between the decompression mode and the check code can be known; or when the correspondence between the compression mode and the check algorithm is known, the decompression mode The correspondence with the verification algorithm is known.
- the sending device may compress the first packet by using the third compressed mode, and the decompressing mode currently used by the receiving device may be the first decompressing mode, and the sending This is not specifically limited.
- the method 100 further includes:
- the receiving device discards the first packet.
- the receiving device is different in determining that the currently used decompression mode is different from the first decompression mode used by the transmitting device to compress the first data, or the receiving device determines that the currently used decompression mode is When the compression mode used by the transmitting device to compress the first data does not correspond, the receiving device determines that the first data in the first compressed data cannot be correctly decompressed. In order to prevent the erroneous packet leakage from being normal to the network, causing the network to be abnormal, the receiving device discards the first packet currently received.
- the receiving device according to the second decompression mode currently used by the receiving device, is different from the first decompression mode, and the decompression mode currently used by the receiving device is set to be Before the first decompression mode
- the method 100 further includes:
- the receiving device receives a second packet sent by the sending device, where the second packet includes second compressed data and a third check value, where the second compressed data is used by the sending device according to the The first compressed mode is obtained by compressing the second data, and the third check value is obtained by the sending device by processing the fourth check value based on the first check algorithm, where the fourth check value is Transmitting, by the sending device, the second compressed data processing according to the second verification algorithm;
- the receiving device determines, according to the second packet, that the first compression mode is a compression mode used by the sending device to compress the second data.
- the receiving device determines a first decompression corresponding to a compression mode used when the second decompression mode currently used is compressed by the transmitting device to compress the first data.
- the current decompression mode may not be immediately set to the first decompression mode. That is to say, when receiving the message sent by the sending device and determining the first decompression mode, the receiving device does not immediately switch from the second decompression mode to the first decompression mode.
- the receiving device may set the currently used decompression mode to the first one after determining whether the compression mode used by the sending device is the first compression mode by using two or more consecutive messages sent by the sending device. Unzip mode.
- the second packet can be understood as the sending device is switched by other compression modes.
- the first compression mode the second data is compressed, and after the second verification algorithm and the first verification algorithm are processed, the first message is sent to the receiving device.
- the first packet can be understood as a packet sent by the sending device after the second packet, or the first packet can be understood as a packet received by the receiving device after the second packet.
- the receiving device may determine, according to the second packet, a first compression mode used by the sending device, and determine, according to the first query, a first compression mode used by the transmitting device. That is to say, the receiving device can record each determination by the counter. When the number of recordings is two or more times, it may be determined that the compression mode currently used by the first transmitting device is the first compression mode.
- the receiving device can set the currently used decompression mode to the first decompression mode.
- the receiving device determines the first compression mode used by the transmitting device based on the same check code or check algorithm multiple times, the number can be continuously counted.
- the receiving device determines that the compression mode used by the transmitting device is not always in the first compression mode, based on different check codes or check algorithms, when the check code or the check algorithm changes, it needs to recount. It should not be continuously recorded to avoid misjudgment and cause false switching.
- first and second message listed above are merely exemplary descriptions, and “first” and “second” are used to distinguish two sending actions of the sending device, or two receiving devices of the receiving device. The action should not be construed as limiting the invention.
- first message and the second message are merely exemplary descriptions, and the receiving device may further switch the currently used decompression mode by determining more times based on the received more messages.
- the specific method for determining, by the S325 receiving device, the compression mode used by the sending device to compress the second data according to the second packet may be similar to the foregoing method 1 and method 2.
- the receiving device determines that the first compression mode is a compression mode that is used when the sending device compresses the second data, and includes:
- the receiving device obtains the first check code by processing the second packet according to the third check algorithm
- Determining, by the receiving device, that the first compression mode is that the sending device compresses the second data according to the obtained third check code and the correspondence between the first check code and the first compression mode.
- the receiving device determines that the first compression mode is a compression mode that is used when the sending device compresses the second data, and includes:
- the compressed mode is obtained by compressing the second data
- the third check value is obtained by the sending device by processing the fourth check value based on the first check algorithm, and the fourth check value is used by the sending device Obtaining the second compressed data processing based on the second verification algorithm
- the receiving device obtains the fourth check value by processing the second compressed data included in the second packet according to the second check algorithm
- the receiving device obtains the third check value by processing the obtained fourth check value based on the first check algorithm
- the first check algorithm used by the receiving device to generate the second packet, and the correspondence between the first check algorithm and the first compression mode, according to the receiving device The relationship determines that the first compressed mode is a compressed mode used by the transmitting device to compress the second data.
- the receiving device sets, according to the second decompression mode currently used by the receiving device, the decompression mode currently used by the receiving device to be different from the first decompression mode.
- a decompression mode includes:
- the receiving device is based on the second decompression mode currently used by the receiving device, and the first corresponding to the first compression mode used by the sending device when the sending device compresses the first data Decompressing mode is different, and the second decompression mode currently used by the receiving device is different from the first compression mode used by the receiving device when the transmitting device compresses the second data A decompression mode is different, and the decompression mode currently used by the receiving device is set to the first decompression mode.
- the receiving device determines, according to the received second packet, a specific process of the compression mode used by the sending device to compress the second data, and the receiving device determines, according to the received first packet,
- the specific process of the compression mode used by the transmitting device to compress the second data is similar. For the sake of brevity, it will not be repeated here.
- the size of the sequence numbers of the foregoing processes does not mean the order of execution sequence, and the execution order of each process should be determined by its function and internal logic, and should not be implemented in the embodiment of the present invention.
- the process constitutes any limitation.
- S315 may be executed before S320, or may be performed after S320, or may be performed simultaneously with S320. Do not limit.
- the receiving device determines, according to the packet sent by the sending device twice, the compression mode used by the sending device to the first compression mode.
- the receiving device switches the currently used decompression mode to a first decompression mode corresponding to the first compression mode. It can avoid the situation that the verification value caused by the network transmission error cannot correctly determine the compression mode used by the transmitting device, thereby reducing the probability of the receiving device erroneously and erroneously switching.
- FIG. 3 is another schematic diagram of a method 100 for transmitting data in accordance with an embodiment of the present invention.
- the method shown in FIG. 3 may obtain the foregoing by the receiving device in S106 of FIG. 1 by decompressing the first compressed data included in the first packet according to a first decompression mode.
- the first data is executed before.
- the receiving device may receive N packets, and determine that the N packets include the compressed data generated by the sending device based on the first compression mode compression. Where N is a natural number greater than or equal to 1.
- N is a natural number greater than or equal to 1.
- FIG. 3 shows a schematic diagram of a case where N>1 in the method 100, in accordance with an embodiment of the present invention.
- the data is compressed based on the second compression mode to obtain compressed data (for ease of understanding and differentiation, data L, L is a natural number greater than or equal to 1) .
- the transmitting device processes the data L based on a verification algorithm corresponding to the second compression mode (referred to as a verification algorithm 1 for ease of understanding and differentiation) to obtain a check value (for ease of understanding and differentiation, it is recorded as a check value 1 ).
- the transmitting device transmits a message consisting of the data L and the check value 1 (for easy understanding and differentiation, recorded as the message L) to the receiving device.
- the transmitting device compresses the data based on the first compression mode to obtain compressed data (referred to as data L+1 for ease of understanding and differentiation).
- the transmitting device processes the data L+1 based on a verification algorithm corresponding to the first compression mode (referred to as the verification algorithm 2 for ease of understanding and differentiation) to obtain a check value (for ease of understanding and differentiation, for verification Value 3).
- the sending device sends a message consisting of data L+1 and check value 2 (for ease of understanding and differentiation, recorded as message L+1) to the receiving device.
- the receiving device may determine the number of consecutively received messages by multiple times.
- the receiving device sets the currently used decompression mode to the decompression mode corresponding to the compression mode used by the transmitting device, when it is determined that the compression mode used by the transmitting device is the same compression mode a plurality of times.
- the transmitting device After the packet L+1, the transmitting device processes the consecutive N data to be transmitted based on the first compression mode to obtain N compressed data.
- the transmitting device processes the N compressed data based on the check algorithm corresponding to the first compressed mode (ie, the check algorithm 2), and obtains N check values respectively, thereby obtaining N consecutive messages.
- the N messages correspond to the N compressed data one by one, and the i-th message includes the i-th compressed data, where i ⁇ [1, N], N is a natural number greater than or equal to 1.
- the sending device continuously sends the N packets to the receiving device, where the N digits are the packets sent by the sending device after the packet L+1.
- the receiving device performs N discarding processing on the N packets.
- the receiving device determines, according to the i th packet, the currently used second decompressed compression mode and the receiving device. After determining that the first decompression mode corresponding to the first compression mode used by the sending device is different, the i th message is discarded.
- the receiving device can record each discarding process by the counter, and after receiving the N+1 discarding process, that is, receiving the L+N+1th message (recorded as L+N+1, including data L+) After N+1 and the check value 2), the currently used decompression mode is set to the first decompression mode corresponding to the first compression mode.
- the receiving device compresses the data in the message based on the first decompression mode (recorded as data L+N+) 2) Decompress to get the data.
- the value of N is 10.
- the transmitting device compresses the data based on the first compression mode and generates the message L+1
- the receiving device sets the decompression mode to the first decompression mode, and the receiving continues consecutively. The next message after the 10 outgoing messages, thus ensuring that the probability of no handover is extremely low.
- the method for transmitting data in the embodiment of the present invention determines, by the receiving device, the compression mode used by the transmitting device to be the first compression mode, according to the packet that is continuously sent by the sending device.
- the receiving device switches the currently used decompression mode to a first decompression mode corresponding to the first compression mode. It can avoid the situation that the verification value caused by the network transmission error cannot correctly determine the compression mode used by the transmitting device, thereby reducing the probability of the receiving device erroneously and erroneously switching.
- the data included in the N+1 messages may be the same data or different.
- the data of the present invention is not particularly limited thereto. Moreover, when the N+1 data is the same data, the loss of data can be reduced, and the transmission interruption time can be reduced.
- the first compression mode enumerated above and the corresponding verification algorithm 2, check value 2, data L+1, message L+1, data L+N+1, message L+N+1, The data L+N+2, the message L+N+2, and the second compression mode and the corresponding verification algorithm 1, the check value 1, and the message L are exemplary descriptions, and the present invention should not be limited in any way. .
- L, L+1, L+N+1, and L+N+2 distinguish different messages and data, and should not be construed as limiting the present invention.
- the first compression mode and the second compression mode are merely illustrative, and the transmitting device may also be switched from the third compression mode to the first compression mode.
- the present invention is not particularly limited thereto.
- FIGS. 1 through 3 a method for transmitting data according to an embodiment of the present invention has been described in detail with reference to FIGS. 1 through 3.
- an apparatus for transmitting data according to an embodiment of the present invention will be described in detail with reference to FIGS. 4, 5, and 6.
- FIG. 4 is a schematic block diagram of an apparatus 400 for transmitting data in accordance with an embodiment of the present invention.
- Apparatus 400 can be used to implement a receiving device in the method illustrated in Figures 1-3.
- the apparatus 400 includes a receiving unit 410, a processing unit 420, and a determining unit 430.
- the receiving unit 410 is configured to receive a first packet sent by the sending device, where the first packet includes first compressed data and a first check value, where the first compressed data is used by the sending device Obtaining the first data compression based on the first compression mode, the first verification value is obtained by the sending device by processing the second verification value based on the first verification algorithm, and the second verification value is sent by the sending The device obtains the first compressed data processing based on a second verification algorithm;
- the processing unit 420 is configured to process, by using the third verification algorithm, the first packet received by the receiving unit 410 to obtain a first check code, the second check algorithm and the third
- the verification algorithm contains the same generator polynomial;
- the determining unit 430 is configured to determine, according to the first check code obtained by the processing unit 420, and the correspondence between the first check code and the first compression mode, that the first compression mode is a compression mode used by the sending device to compress the first data;
- the processing unit 420 is further configured to obtain the first data by decompressing the first compressed data included in the first packet received by the receiving unit 410 according to a first decompression mode.
- the first decompression mode is a decompression mode corresponding to the first compression mode determined by the determining unit 430.
- the determining unit 430 is further configured to: according to the processing by the determining unit 430 The first check code obtained by the unit 420 and the corresponding relationship between the first check code and the first compressed mode, determining that the first compressed mode is when the sending device compresses the first data After the compressed mode is used, and the processing unit 420 decompresses the first compressed data included in the first packet received by the receiving unit 410 based on the first decompression mode, Before the first data, determining that the second decompression mode currently used by the device 400 corresponds to the first compression mode used by the determining device 430 when the transmitting device compresses the first data The first decompression mode is different;
- the processing unit 420 is further configured to: according to the second decompression mode currently used by the device 400 determined by the determining unit 430, different from the first decompression mode, the decompression mode currently used by the device 400 Set to the first decompression mode.
- the receiving unit 410 is further configured to: at the processing unit 420, the second decompression mode currently used by the device 400 determined by the determining unit 430 is different from the first decompression mode, Before the decompressing mode currently used by the device 400 is set to the first decompression mode, receiving a second packet sent by the sending device, where the second packet includes second compressed data and a third check value, The second compressed data is obtained by the sending device for compressing the second data based on the first compressed mode, and the third check value is fourth by the sending device based on the first check algorithm. The check value processing is obtained, and the fourth check value is obtained by the sending device to process the second compressed data based on the second check algorithm;
- the processing unit 420 is further configured to: obtain the first check code by processing the second packet received by the receiving unit 410 according to the third check algorithm;
- the determining unit 430 is further configured to determine the first compression according to the first check code obtained by the processing unit 420 and the correspondence between the first check code and the first compression mode.
- the mode is a compression mode used by the transmitting device to compress the second data;
- the processing unit 420 is specifically configured to use, according to the second decompression mode currently used by the device 400 determined by the determining unit 430, and the transmitting device that is determined by the determining unit 430 to compress the first data.
- the first decompression mode corresponding to the first compression mode is different, and based on the second decompression mode currently used by the device 400 determined by the determining unit 430 and the determined by the determining unit 430
- the first decompression mode corresponding to the first compression mode used by the transmitting device to compress the second data is different, and the decompression mode currently used by the device 400 is set to the first decompression mode.
- Apparatus 400 for transmitting data in accordance with an embodiment of the present invention may correspond to implementation in accordance with the present invention a receiving device for performing the method 1 in the method for transmitting data, and the respective units in the device 400 and the other operations and/or functions described above are respectively configured to implement the respective processes of the methods in FIGS. 1 to 3. For the sake of brevity, we will not repeat them here.
- the apparatus for transmitting data in the embodiment of the present invention processes the check value included in the packet by receiving the packet sent by the sending device, and obtains a check code for determining the compressed mode.
- the device determines a compression mode used by the transmitting device to compress the compressed data according to the correspondence between the check code and the compressed mode. Thereby, the compression mode is indicated by the check code, the overhead is reduced, and the compatibility and scalability of the system are facilitated.
- FIG. 5 is a schematic block diagram of an apparatus 500 for transmitting data in accordance with another embodiment of the present invention.
- Apparatus 500 can be used to implement a receiving device in the method illustrated in Figures 1-3.
- the apparatus 500 includes a receiving unit 510, a processing unit 520, and a determining unit 530.
- the receiving unit 510 is configured to receive a first packet sent by the sending device, where the first packet includes first compressed data and a first check value, where the first compressed data is used by the sending device Obtaining the first data compression based on the first compression mode, the first verification value is obtained by the sending device by processing the second verification value based on the first verification algorithm, and the second verification value is sent by the sending The device obtains the first compressed data processing based on a second verification algorithm;
- the processing unit 520 is configured to process the first compressed data included in the first packet received by the receiving unit 510 by using the second verification algorithm to obtain the second checksum. a value, and processing the second check value obtained by the processing unit 520 based on the first check algorithm to obtain the first check value;
- the determining unit 530 is configured to determine that the first check value obtained by the processing unit 520 is the same as the first check value included in the first packet received by the receiving unit 510.
- the first verification algorithm is a verification algorithm used by the sending device to generate the first packet, and the determining unit 530 determines, according to the determining unit 530, the used by the sending device to generate the first packet. a first verification algorithm, and a correspondence between the first verification algorithm and the first compression mode, determining that the first compression mode is a compression mode used by the sending device to compress the first data;
- the processing unit 520 is further configured to: obtain the first data by decompressing the first compressed data included in the first packet received by the receiving unit 510 according to a first decompression mode.
- the first decompression mode is a decompression mode corresponding to the first compression mode determined by the determining unit 530.
- the processing unit 520 is specifically configured to separately perform the solution by using multiple verification algorithms.
- the second check value obtained by the processing unit 520 is processed to obtain a plurality of check values, the plurality of check values including the first check value, the plurality of check values and the plurality of check values
- the algorithm is one-to-one correspondence.
- the determining unit 530 is further configured to: according to the determining, the determining, by the determining unit 530, the first check algorithm used by the sending device to generate the first packet, and the first checksum Corresponding relationship between the algorithm and the first compression mode, determining that the first compression mode is after a compression mode used by the sending device to compress the first data, and, at the processing unit 520, based on the first solution
- the compressed mode decompresses the first compressed data included in the first packet received by the receiving unit 510, and before determining the first data, determines a second solution currently used by the device 500.
- the compressed mode is different from the first decompression mode corresponding to the first compression mode used by the transmitting device to compress the first data determined by the determining unit 530;
- the processing unit 520 is further configured to use, according to the second decompression mode currently used by the device 500 determined by the determining unit 530, and the transmitting device that is determined by the determining unit 530 to compress the first data.
- the first decompression mode corresponding to the first compression mode is different, and the decompression mode currently used by the device 500 is set to the first decompression mode.
- the receiving unit 510 is further configured to compress, at the processing unit 520, the first device determined by the determining unit 530, based on a second decompression mode currently used by the device 500, to compress the first device.
- the first decompression mode corresponding to the first compression mode used in the data is different, and before the decompression mode currently used by the device 500 is set to the first decompression mode, receiving the sending by the sending device a second packet, where the second packet includes second compressed data and a third check value, where the second compressed data is obtained by the sending device to compress the second data based on the first compressed mode,
- the third check value is obtained by the sending device according to the first check algorithm for the fourth check value, and the fourth check value is determined by the sending device according to the second check algorithm
- the second compressed data processing is obtained;
- the processing unit 520 is further configured to: obtain the fourth by processing the second compressed data included in the second packet received by the receiving unit 510 by using the second verification algorithm. a check value; and processing the fourth check value obtained by the processing unit 520 based on the first check algorithm to obtain the third check value;
- the determining unit 530 is further configured to: the third check value obtained by the processing unit 520 is the same as the third check value included in the second message received by the receiving unit 510 Determining that the first verification algorithm is a verification algorithm used by the sending device to generate the second packet; and when the sending device generates the second packet according to the determining unit 530, a verification algorithm used, and a correspondence between the first verification algorithm and the first compression mode, determining that the first compression mode is a compression mode used by the sending device to compress the second data;
- the processing unit 520 is specifically configured to use, according to the second decompression mode currently used by the device 500 determined by the determining unit 530, and the transmitting device that is determined by the determining unit 530 to compress the first data.
- the first decompression mode corresponding to the first compression mode is different, and based on the second decompression mode currently used by the device 500 determined by the determining unit 530 and the determined by the determining unit 530
- the first decompression mode corresponding to the first compression mode used by the transmitting device to compress the second data is different, and the decompression mode currently used by the device 500 is set to the first decompression mode.
- the apparatus 500 for transmitting data according to an embodiment of the present invention may correspond to a receiving apparatus for performing the method 2 in the method for transmitting data according to an embodiment of the present invention, and each unit in the apparatus 500 and the above Other operations and/or functions are respectively implemented in order to implement the corresponding processes of the respective methods in FIG. 1 to FIG. 3, and are not described herein again for brevity.
- the apparatus for transmitting data in the embodiment of the present invention processes the packet by receiving the packet sent by the sending device to determine the same verification algorithm as the sending device.
- the receiving device determines a compression mode used by the transmitting device to compress the compressed data according to the correspondence between the verification algorithm and the compression mode.
- the compression mode is indicated by the verification algorithm, the overhead is reduced, and the compatibility and scalability of the system are facilitated.
- FIG. 6 is a schematic block diagram of an apparatus 600 for transmitting data in accordance with yet another embodiment of the present invention.
- Apparatus 600 can be used to implement a transmitting device in the method illustrated in Figures 1-3.
- the apparatus 600 includes a processing unit 610 and a transmitting unit 620.
- the processing unit 610 is configured to obtain first compressed data by compressing the first data according to the first compression mode, and obtain a second school by processing the first compressed data by using a second verification algorithm.
- the first check value is obtained by processing the first check value based on the first check algorithm, where the first check algorithm corresponds to the first compression mode;
- the sending unit 620 is configured to send a first packet to the receiving device, where the first packet includes the first compressed data and the first check value obtained by the processing unit 610.
- the apparatus 600 further includes: an acquiring unit, configured to acquire a one-to-one correspondence between the plurality of verification algorithms and the plurality of compression modes, where the second verification algorithm is different from the plurality of verification algorithms anyone;
- the processing unit 610 is further configured to: according to the multiple verification algorithms and one of multiple compression modes a correspondence relationship determining a first verification algorithm corresponding to the first compression mode.
- the apparatus 600 for transmitting data according to an embodiment of the present invention may correspond to a transmitting apparatus in a method for transmitting data according to an embodiment of the present invention, and each unit in the apparatus 600 and the other operations and/or functions described above For the sake of brevity, the corresponding processes of the methods in FIG. 1 to FIG. 3 are respectively omitted.
- the apparatus generates a check value by using a check algorithm corresponding to the compressed mode, and transmits the check value and the message composed of the compressed data to the receiving device.
- the receiving device processes the check value to obtain a check code for determining the compressed mode.
- the receiving device determines a compression mode used by the device to compress the compressed data according to the correspondence between the check code and the compression mode. Thereby, the compression mode is indicated by the check code, the overhead is reduced, and the compatibility and scalability of the system are facilitated.
- FIG. 7a and 7b are schematic block diagrams of a system 700 for transmitting data in accordance with an embodiment of the present invention.
- the system 700 includes an apparatus 400 for transmitting data and an apparatus 600 for transmitting data in accordance with an embodiment of the present invention.
- the apparatus 400 for transmitting data according to an embodiment of the present invention may correspond to a receiving apparatus for performing the method 1 in the method for transmitting data according to an embodiment of the present invention, and each unit in the apparatus 400
- the device 600 for transmitting data according to an embodiment of the present invention may correspond to a transmitting device in a method for transmitting data according to an embodiment of the present invention
- each unit in the device 600 and the other operations and/or functions described above are respectively configured to implement respective processes of the methods in FIGS. 1 to 3, for the sake of brevity. I will not repeat them here.
- the system 700 includes an apparatus 500 for transmitting data and an apparatus 600 for transmitting data in accordance with an embodiment of the present invention.
- the apparatus 500 for transmitting data according to an embodiment of the present invention may correspond to a receiving apparatus for performing the method 2 in the method for transmitting data according to an embodiment of the present invention, and each unit in the apparatus 500
- the device 600 for transmitting data according to an embodiment of the present invention may correspond to a transmitting device in a method for transmitting data according to an embodiment of the present invention
- each unit in the device 600 and the other operations and/or functions described above are respectively configured to implement respective processes of the methods in FIGS. 1 to 3, for the sake of brevity. I will not repeat them here.
- the system generates a check value by the sending device based on the check algorithm corresponding to the compressed mode, and sends the check value and the message composed of the compressed data to the receiving device.
- the receiving device processes the check value to obtain a check code for determining the compressed mode.
- the receiving device determines a compression mode used by the device to compress the compressed data according to the correspondence between the check code and the compression mode. Thereby, the compression mode is indicated by the check code, the overhead is reduced, and the compatibility and scalability of the system are facilitated.
- FIGS. 4 to 7 including FIGS. 7a and 7b.
- FIGS. 8 to 11 including FIGS. 11a and 11b.
- FIG. 8 is a schematic block diagram of an apparatus 800 for transmitting data in accordance with an embodiment of the present invention.
- Apparatus 800 can be used to implement a receiving device in the method illustrated in Figures 1-3.
- Apparatus 800 can be used to implement apparatus 400 shown in FIG.
- the device 800 includes a receiver 810, a transmitter 820, a processor 830, a memory 840, and a bus system 850.
- the receiver 810, the transmitter 820, the processor 830, and the memory 840 are connected by the bus system 850, the memory 840 is configured to store instructions, and the processor 830 is configured to execute
- the memory 840 stores instructions to control the receiver 810 to receive signals and to control the transmitter 820 to transmit signals.
- the receiver 810 is configured to receive a first packet sent by the sending device, where the first packet includes first compressed data and a first check value, where the first compressed data is used by the sending device Obtaining the first data compression based on the first compression mode, the first verification value is obtained by the sending device by processing the second verification value based on the first verification algorithm, and the second verification value is sent by the sending The device obtains the first compressed data processing based on a second verification algorithm;
- the processor 830 is configured to process, by using the third verification algorithm, the first packet received by the receiver 810 to obtain a first check code, the second check algorithm and the third
- the verification algorithm includes the same generator polynomial; and determines the first according to the first check code obtained by the processor 830 and the correspondence between the first check code and the first compression mode.
- the compressed mode is a compressed mode used by the transmitting device to compress the first data; and the first compression included in the first packet received by the receiver 810 based on the first decompressed mode
- the data is decompressed to obtain the first data, and the first decompression mode is a decompression mode corresponding to the first compression mode determined by the processor 830.
- the processor 830 is further configured to: in the first check code obtained according to the processor 830, and the first check code Corresponding relationship of the first compression mode, determining that the first compression mode is after a compression mode used by the transmitting device to compress the first data, and at the processor 830 by using a first decompression mode Decompressing the first compressed data included in the first packet received by the receiver 810, and determining a second decompression mode currently used by the device 800 before obtaining the first data.
- the first decompression mode corresponding to the first compression mode used by the transmitting device to compress the first data determined by the processor 830 is different;
- the processor 830 is further configured to: according to the second decompression mode currently used by the device 800 determined by the processor 830, different from the first decompression mode, the decompression mode currently used by the device 800 Set to the first decompression mode.
- the receiver 810 is further configured to: at the processor 830, based on the processor 830, determine that the second decompression mode currently used by the device 800 is different from the first decompression mode, Before the decompressing mode currently used by the device 800 is set to the first decompression mode, receiving a second packet sent by the sending device, where the second packet includes second compressed data and a third check value, The second compressed data is obtained by the sending device for compressing the second data based on the first compressed mode, and the third check value is fourth by the sending device based on the first check algorithm. The check value processing is obtained, and the fourth check value is obtained by the sending device to process the second compressed data based on the second check algorithm;
- the processor 830 is further configured to: obtain the first check code by processing the second packet received by the receiver 810 according to the third check algorithm;
- the processor 830 is further configured to determine the first compression according to the first check code obtained by the processor 830 and the correspondence between the first check code and the first compression mode.
- the mode is a compression mode used by the transmitting device to compress the second data;
- the processor 830 is specifically configured to use, according to the second decompression mode currently used by the device 800 determined by the processor 830, and the first device that is determined by the processor 830 to compress the first data.
- the first decompression mode corresponding to the first compression mode is different, and based on the second decompression mode currently used by the device 800 determined by the processor 830 and the processor 830 determines
- the first decompression mode corresponding to the first compression mode used by the transmitting device to compress the second data is different, and the decompression mode currently used by the device 800 is set to the first decompression mode.
- the processor 830 may be a central processing unit (“CPU"), and the processor 830 may also be another general-purpose processor.
- DSP digital signal processor
- ASIC application specific integrated circuit
- FPGA off-the-shelf programmable gate array
- the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
- the memory 840 can include read only memory and random access memory and provides instructions and data to the processor 830. A portion of the memory 840 may also include a non-volatile random access memory. For example, the memory 840 can also store information of the device type.
- the bus system 850 may include a power bus, a control bus, a status signal bus, and the like in addition to the data bus. However, for clarity of description, various buses are labeled as bus system 850 in the figure.
- each step of the above method may be completed by an integrated logic circuit of hardware in the processor 830 or an instruction in the form of software.
- the steps of the positioning method disclosed in the embodiments of the present invention may be directly implemented as hardware processor execution completion, or performed by a combination of hardware and software modules in the processor.
- the software module can be located in a conventional storage medium such as random access memory, flash memory, read only memory, programmable read only memory or electrically erasable programmable memory, registers, and the like.
- the storage medium is located in memory 840, and processor 830 reads the information in memory 840 and, in conjunction with its hardware, performs the steps of the above method. To avoid repetition, it will not be described in detail here.
- the apparatus 800 for transmitting data according to an embodiment of the present invention may correspond to a receiving apparatus for performing the method 1 in the method for transmitting data according to an embodiment of the present invention, and for transmitting data according to an embodiment of the present invention.
- the device 400, and the modules in the device 800 and the other operations and/or functions described above are respectively used to implement the corresponding processes of the methods in FIG. 1 to FIG. 3, and are not described herein again for brevity.
- the device for transmitting data in the embodiment of the present invention processes the check value included in the packet by receiving the packet sent by the sending device, and obtains a check code for determining the compressed mode.
- the device determines a compression mode used by the transmitting device to compress the compressed data according to the correspondence between the check code and the compressed mode. Thereby, the compression mode is indicated by the check code, the overhead is reduced, and the compatibility and scalability of the system are facilitated.
- FIG. 9 is a schematic block diagram of an apparatus 900 for transmitting data in accordance with another embodiment of the present invention.
- Apparatus 900 can be used to implement a receiving device in the method illustrated in Figures 1-3.
- Apparatus 900 can be used to implement apparatus 500 shown in FIG.
- the device 900 includes a receiver 910, a transmitter 920, a processor 930, a memory 940, and a bus system 950.
- the receiver 910, the transmitter 920, the processor 930, and the memory 940 pass the total Line system 950 is coupled to memory 940 for storing instructions
- processor 930 is operative to execute instructions stored by said memory 940 to control said receiver 910 to receive signals and to control said transmitter 920 to transmit signals.
- the receiver 910 is configured to receive a first packet sent by the sending device, where the first packet includes first compressed data and a first check value, where the first compressed data is used by the sending device Obtaining the first data compression based on the first compression mode, the first verification value is obtained by the sending device by processing the second verification value based on the first verification algorithm, and the second verification value is sent by the sending The device obtains the first compressed data processing based on a second verification algorithm;
- the processor 930 is configured to process the first compressed data included in the first packet received by the receiver 910 by using the second verification algorithm to obtain the second checksum. And obtaining the first check value by processing the second check value obtained by the processor 930 based on the first check algorithm; and based on the obtained by the processor 930
- the first check value is the same as the first check value included in the first packet received by the receiver 910, and determining that the first check algorithm is that the sending device generates the first a check algorithm used in the message; and determining, according to the processor 930, the first check algorithm used by the sending device to generate the first message, and the first check algorithm and the Corresponding relationship of the first compression mode, determining that the first compression mode is a compression mode used by the transmitting device to compress the first data; and receiving the receiver 910 by using the first decompression mode Performing the first compressed data included in the first message Compression to obtain the first data, the first decompression mode is the processor 930 determines the first compression decompression mode corresponding to the mode.
- the processor 930 is specifically configured to process the second check value obtained by the processor 930 by using multiple check algorithms to obtain multiple check values, and the multiple checksums
- the value includes the first check value, and the plurality of check values are in one-to-one correspondence with the plurality of check algorithms.
- the processor 930 is further configured to: according to the first check algorithm used by the sending device to generate the first packet, and the first check according to the determining by the processor 930 Corresponding relationship between the algorithm and the first compression mode, determining that the first compression mode is after the compression mode used by the sending device to compress the first data, and before the processor 930 passes the first solution
- the compressed mode decompresses the first compressed data included in the first packet received by the receiver 910, and before determining the first data, determines a second solution currently used by the device 900.
- the compressed mode is different from the first decompression mode corresponding to the first compression mode used by the transmitting device to compress the first data determined by the processor 930;
- the processor 930 is further configured to use, according to the second decompression mode currently used by the device 900 determined by the processor 930, and the first device that is determined by the processor 930 to compress the first data.
- the first decompression mode corresponding to the first compression mode is different, and the decompression mode currently used by the device 900 is set to the first decompression mode.
- the receiver 910 is further configured to compress, at the processor 930, the first device that is determined by the processor 930 based on a second decompression mode currently used by the device 900 to compress the first device.
- the first decompression mode corresponding to the first compression mode used in the data is different, and before the decompression mode currently used by the device 900 is set to the first decompression mode, receiving the sending by the sending device a second packet, where the second packet includes second compressed data and a third check value, where the second compressed data is obtained by the sending device to compress the second data based on the first compressed mode,
- the third check value is obtained by the sending device according to the first check algorithm for the fourth check value, and the fourth check value is determined by the sending device according to the second check algorithm
- the second compressed data processing is obtained;
- the processor 930 is further configured to: obtain the fourth by processing the second compressed data included in the second packet that is received by the receiver 910 by using the second verification algorithm. a check value; and processing the fourth check value obtained by the processor 930 based on the first check algorithm to obtain the third check value;
- the processor 930 is further configured to: the third check value obtained by the processor 930 is the same as the third check value included in the second message received by the receiver 910 Determining that the first verification algorithm is a verification algorithm used by the sending device to generate the second packet, and is used when the sending device generates the second packet according to the determining by the processor 930. a verification algorithm, and a correspondence between the first verification algorithm and the first compression mode, determining that the first compression mode is a compression mode used by the transmitting device to compress the second data;
- the processor 930 is specifically configured to use, according to the second decompression mode currently used by the device 900 determined by the processor 930, and the first device determined by the processor 930 to compress the first data.
- the first decompression mode corresponding to the first compression mode is different, and based on the second decompression mode currently used by the device 900 determined by the processor 930 and the processor 930 determines
- the first decompression mode corresponding to the first compression mode used by the transmitting device to compress the second data is different, and the decompression mode currently used by the device 900 is set to the first decompression mode.
- Apparatus 900 for transmitting data in accordance with an embodiment of the present invention may correspond to implementation in accordance with the present invention a receiving device for performing method two in the method for transmitting data, and an apparatus 500 for transmitting data according to an embodiment of the present invention, and each module in the device 900 and the above other operations and/or The functions are respectively implemented in order to implement the corresponding processes of the respective methods in FIG. 1 to FIG. 3, and are not described herein for brevity.
- the device for transmitting data in the embodiment of the present invention processes the packet by receiving the packet sent by the sending device to determine the same verification algorithm as the sending device.
- the receiving device determines a compression mode used by the transmitting device to compress the compressed data according to the correspondence between the verification algorithm and the compression mode.
- the compression mode is indicated by the verification algorithm, the overhead is reduced, and the compatibility and scalability of the system are facilitated.
- FIG. 10 is a schematic block diagram of an apparatus 1000 for transmitting data in accordance with still another embodiment of the present invention.
- Apparatus 1000 can be used to implement a transmitting device in the method illustrated in Figures 1-3.
- Apparatus 1000 can be used to implement apparatus 600 shown in FIG.
- the device 1000 includes the device 1000 including a receiver 1100, a transmitter 1200, a processor 1300, a memory 1400, and a bus system 1500.
- the receiver 1100, the transmitter 1200, the processor 1300, and the memory 1400 are connected by the bus system 1500, the memory 1400 is used to store instructions, and the processor 1300 is configured to execute
- the memory 1400 stores instructions to control the receiver 1100 to receive signals and control the transmitter 1200 to transmit signals.
- the processor 1300 is configured to obtain first compressed data by compressing the first data according to the first compression mode, and obtain a second school by processing the first compressed data by using a second verification algorithm.
- the first check value is obtained by processing the first check value based on the first check algorithm, where the first check algorithm corresponds to the first compression mode;
- the transmitter 1200 is configured to send a first packet to the receiving device, where the first packet includes the first compressed data and the first check value obtained by the processor 1300.
- the processor 1300 is further configured to obtain a one-to-one correspondence between multiple verification algorithms and multiple compression modes, where the second verification algorithm is different from any one of the multiple verification algorithms;
- the processor 1300 is further configured to determine, according to a one-to-one correspondence between the multiple verification algorithms and the multiple compression modes, a first verification algorithm corresponding to the first compression mode.
- the device 1000 for transmitting data according to an embodiment of the present invention may correspond to a transmitting device in a method for transmitting data according to an embodiment of the present invention, and each module in the device 1000 and other operations and/or functions described above For the sake of brevity, the corresponding processes of the methods in FIG. 1 to FIG. 3 are respectively omitted.
- the device generates a check value by using a check algorithm corresponding to the compressed mode, and sends the check value and the message composed of the compressed data to the receiving device.
- the receiving device processes the check value to obtain a check code for determining the compressed mode.
- the receiving device determines a compression mode used by the device to compress the compressed data according to the correspondence between the check code and the compression mode. Thereby, the compression mode is indicated by the check code, the overhead is reduced, and the compatibility and scalability of the system are facilitated.
- 11a and 11b are another schematic block diagram of a system 2000 for transmitting data in accordance with an embodiment of the present invention.
- the system 2000 includes an apparatus 800 for transmitting data and an apparatus 1000 for transmitting data in accordance with an embodiment of the present invention.
- the apparatus 800 for transmitting data according to an embodiment of the present invention may correspond to a receiving apparatus for performing the method 1 in the method for transmitting data according to an embodiment of the present invention, and for using according to an embodiment of the present invention
- the device 400 for transmitting data, and the modules in the device 800 and the other operations and/or functions described above are respectively used to implement the corresponding processes of the respective methods in FIG. 1 to FIG.
- the apparatus 1000 for transmitting data of an embodiment may correspond to a transmitting apparatus in a method for transmitting data according to an embodiment of the present invention, and an apparatus 600 for transmitting data according to an embodiment of the present invention, and the apparatus 1000
- the respective modules in the above and the other operations and/or functions described above are respectively implemented in order to implement the corresponding processes of the respective methods in FIG. 1 to FIG. 3, and are not described herein again for brevity.
- the system 2000 includes an apparatus 900 for transmitting data and an apparatus 1000 for transmitting data according to an embodiment of the present invention.
- the apparatus 900 for transmitting data according to an embodiment of the present invention may correspond to a receiving apparatus for performing method 2 in a method for transmitting data according to an embodiment of the present invention, and for using according to an embodiment of the present invention
- the apparatus 500 for transmitting data, and the modules in the device 900 and the other operations and/or functions described above are respectively implemented in order to implement the respective processes of the methods in FIG. 1 to FIG.
- the apparatus 1000 for transmitting data of an embodiment may correspond to a transmitting apparatus in a method for transmitting data according to an embodiment of the present invention, and an apparatus 600 for transmitting data according to an embodiment of the present invention, and the apparatus 1000
- the respective modules in the above and the other operations and/or functions described above are respectively implemented in order to implement the corresponding processes of the respective methods in FIG. 1 to FIG. 3, and are not described herein again for brevity.
- a system is based on a transmission device based on a compression mode
- the verification algorithm generates a check value, and sends the check value and the packet composed of the compressed data to the receiving device.
- the receiving device processes the check value to obtain a check code for determining the compressed mode.
- the receiving device determines a compression mode used by the device to compress the compressed data according to the correspondence between the check code and the compression mode. Thereby, the compression mode is indicated by the check code, the overhead is reduced, and the compatibility and scalability of the system are facilitated.
- the size of the sequence numbers of the above processes does not mean the order of execution, and the order of execution of each process should be determined by its function and internal logic, and should not be directed to the embodiments of the present invention.
- the implementation process constitutes any limitation.
- the disclosed systems, devices, and methods may be implemented in other manners.
- the device embodiments described above are merely illustrative.
- the division of the unit is only a logical function division.
- there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
- the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
- the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
- each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
- the function is implemented in the form of a software functional unit and sold or made as a standalone product When used, it can be stored in a computer readable storage medium.
- the technical solution of the present invention which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including
- the instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
- the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Physics & Mathematics (AREA)
- Probability & Statistics with Applications (AREA)
- Theoretical Computer Science (AREA)
- Communication Control (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本发明公开了一种用于传输数据的方法,能够降低开销。该方法包括:接收设备接收发送设备发送的第一报文,第一报文包括第一压缩数据和第一校验值,其中,第一压缩数据由发送设备基于第一压缩模式对第一数据压缩获得,第一校验值由发送设备基于第一校验算法对第二校验值处理获得,第二校验值由发送设备基于第二校验算法对第一压缩数据处理获得;接收设备通过基于第三校验算法对第一报文进行处理,获得第一校验码;并根据获得的第一校验码与第一压缩模式的对应关系,确定第一压缩模式是发送设备压缩第一数据时使用的压缩模式;接收设备通过基于与第一压缩模式对应的第一解压缩模式对第一报文中包括的第一压缩数据进行解压缩,获得第一数据。
Description
本发明涉及通信领域,并且更具体地,涉及一种用于传输数据的方法、装置和系统。
在使用以太网协议的点到点传输系统中,发送设备向接收设备发送报文。报文中包含经压缩的数据。发送设备可能支持至少两种压缩模式。发送设备支持的压缩模式可以是以太网帧头压缩,网际协议(Internet Protocol,简称“IP”)头压缩或者净荷压缩。具体来说,发送设备使用压缩模式对待传输数据进行压缩获得经压缩的数据,发送设备向接收设备发送包含经压缩的数据的报文。接收设备需要知道发送设备所使用的压缩模式,从而采用与压缩模式对应的解压缩模式对接收到的经压缩的数据进行解压缩。
一种实现方式中,发送设备生成的报文的报文头携带用于指示发送设备使用的压缩模式的开销字节。接收设备根据接收到的报文的报文头携带的开销字节确定发送设备使用的压缩模式。上述方案的开销比较大。
发明内容
本申请提供一种用于传输数据的方法、装置和系统,以降低开销。
第一方面,本申请提供一种用于传输数据的方法,所述方法包括:接收设备接收发送设备发送的第一报文,所述第一报文包括第一压缩数据和第一校验值,其中,所述第一压缩数据由所述发送设备基于第一压缩模式对第一数据压缩获得,所述第一校验值由所述发送设备基于第一校验算法对第二校验值处理获得,所述第二校验值由所述发送设备基于第二校验算法对所述第一压缩数据处理获得;所述接收设备通过基于第三校验算法对所述第一报文进行处理,获得第一校验码,所述第二校验算法与所述第三校验算法包含相同的生成多项式;所述接收设备根据获得的所述第一校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式;以及,所述接收设备通过基于第一解压缩模式对所述第一报文中包括的所述第一压缩数据进行解压缩,获得
所述第一数据,所述第一解压缩模式是所述第一压缩模式对应的解压缩模式。
因此,发送设备通过基于与压缩模式对应的校验算法生成校验值,并将该校验值与压缩数据组成的报文发送给接收设备。接收设备对该校验值进行处理,获得用于确定压缩模式的校验码。接收设备根据该校验码与压缩模式的对应关系,确定发送设备压缩该数据时使用的压缩模式。相比于现有技术中通过报文头额外的开销字节来指示压缩模式,本发明通过校验值来携带该指示信息,从而降低了开销。并且,现有技术中通过报文头额外的开销字节需要系统规划时提前预留足够的开销字节。若系统在规划时未预留足够的开销字节,则无法通过该方法来指示压缩模式,本发明无需在系统规划时预留开销字节,便于实现系统的兼容性和可扩展性。结合第一方面,在第一方面的第一种可能的实现方式中,所述发送设备通过基于第一压缩模式对第一数据进行压缩,获得第一压缩数据,包括:所述发送设备对用于承载所述第一数据的报文中的目标字段进行压缩,获得第一压缩数据,其中,所述目标字段包含S比特,压缩后的所述目标字段为M比特,S大于M。
因此,发送设备可以将目标字段中的内容通过短的压缩字段来替代,减少了传输过程中的带宽使用,提高了带宽使用率。
结合第一方面,在第一方面的第二种可能的实现方式中,所述接收设备根据获得的所述第一校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式,包括:所述接收设备获取多个校验码与多种压缩模式的一一对应关系,所述多个校验码包括所述第一校验码;所述接收设备根据所述多个校验码与多种压缩模式的一一对应关系,确定与所述第一校验码对应的所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式。
因此,发送设备通过基于与不同的压缩模式对应的校验算法生成不同的校验值。接收设备通过对不同的校验值进行处理,获得不同的校验码。接收设备根据不同的校验码与压缩模式的对应关系,可以确定发送设备当前发送的压缩数据所使用的压缩模式。从而降低了开销,并且便于实现系统的兼容性和可扩展性。
结合第一方面的上述可能的实现方式,在第一方面的第三种可能的实现方式中,在所述接收设备根据获得的所述第一校验码,以及所述第一校验码
与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备用于压缩所述第一数据的压缩模式以后,以及,在所述接收设备通过基于第一解压缩模式对所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据之前,所述方法还包括:所述接收设备确定所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同;以及,所述接收设备基于所述接收设备当前所使用的所述第二解压缩模式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式。
因此,接收设备在确定当前使用的第二解压缩模式与第一解压缩模式不同时,将当前所使用的解压缩模式设置为第一解压缩模式,从而可以在接收到发送设备发送的下一个报文时,基于第二解压缩模式,从该下一个报文中获取数据。
进一步地,所述方法还包括:所述接收设备确定所述第一校验码为所述多个校验码中的一个时,确定所述接收设备接收到的所述第一压缩数据与所述发送设备发送的所述第一压缩数据相同。
因此,接收设备在根据第一校验码确定发送设备压缩第一数据时使用的压缩模式的同时,还可以校验第一压缩数据是否传输无误。
结合第一方面的上述可能的实现方式,在第一方面的第四种可能的实现方式中,在所述接收设备确定所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同之后,以及,所述接收设备基于所述接收设备当前所使用的所述第二解压缩模式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式之前,所述方法还包括:所述接收设备丢弃所述第一报文。
因此,接收设备在接收到第一报文后,确定接收设备当前使用的解压缩模式与第一解压缩模式不同时,丢弃该第一报文。从而避免接收设备使用错误的解压缩模式解压缩第一压缩数据,进入避免错误的数据包泄漏都正常网络,引起网络异常。
结合第一方面的上述可能的实现方式,在第一方面的第五种可能的实现方式中,在所述接收设备基于所述接收设备当前所使用的所述第二解压缩模
式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式之前,所述方法还包括:所述接收设备接收发送设备发送的第二报文,所述第二报文包括第二压缩数据和第三校验值,其中,所述第二压缩数据由所述发送设备基于所述第一压缩模式对第二数据压缩获得,所述第三校验值由所述发送设备基于所述第一校验算法对第四校验值处理获得,所述第四校验值由所述发送设备基于所述第二校验算法对所述第二压缩数据处理获得;所述接收设备通过基于所述第三校验算法对所述第二报文进行处理,获得所述第一校验码;以及,所述接收设备根据获得的所述第一校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是发送设备压缩所述第二数据时使用的压缩模式;所述接收设备基于所述接收设备当前所使用的所述第二解压缩模式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式包括:所述接收设备基于所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,以及所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第二数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式。
因此,通过接收设备根据发送设备连续两次发送的报文,连续两次确定发送设备使用的压缩模式为第一压缩模式。接收设备将当前所使用的解压缩模式切换到与第一压缩模式相对应的第一解压缩模式。能够避免网络传输错误造成的校验值无法正确确定发送设备所使用的压缩模式的情况,从而减少接收设备误判、误切换的概率。
第二方面,本申请提供一种用于传输数据的方法,所述方法包括:接收设备接收发送设备发送的第一报文,所述第一报文包括第一压缩数据和第一校验值,所述第一压缩数据由所述发送设备基于第一压缩模式对第一数据压缩获得,所述第一校验值由所述发送设备基于第一校验算法对第二校验值处理获得,所述第二校验值由所述发送设备基于第二校验算法对所述第一压缩数据处理获得;所述接收设备通过基于所述第二校验算法对所述第一报文中包括的所述第一压缩数据进行处理,获得所述第二校验值;所述接收设备通过基于所述第一校验算法对获得的所述第二校验值进行处理,获得所述第一
校验值;所述接收设备基于获得的所述第一校验值与所述第一报文中包含的所述第一校验值相同,确定所述第一校验算法是所述发送设备生成所述第一报文时使用的校验算法;所述接收设备根据所述接收设备确定的所述发送设备生成所述第一报文时使用的所述第一校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式;以及,所述接收设备通过基于第一解压缩模式对所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据,所述第一解压缩模式是所述第一压缩模式对应的解压缩模式。
因此,发送设备通过基于与压缩模式对应的校验算法生成校验值,并将该校验值与压缩数据组成的报文发送给接收设备。接收设备对该报文中的压缩数据进行处理,以确定与发送设备相同的校验算法。接收设备根据该校验算法与压缩模式的对应关系,确定发送设备压缩该数据时使用的压缩模式。相比于现有技术中通过报文头额外的开销字节来指示压缩模式,本发明通过校验值来携带该指示信息,降低了开销。并且,现有技术中通过报文头额外的开销字节需要系统规划时提前预留足够的开销字节。若系统在规划时未预留足够的开销字节,则无法通过该方法来指示压缩模式,本发明无需在系统规划时预留开销字节,便于实现系统的兼容性和可扩展性。
结合第二方面,在第二方面的第一种可能的实现方式中,所述接收设备通过基于所述第一校验算法对获得的所述第二校验值进行处理,获得所述第一校验值,包括:所述接收设备通过基于多个校验算法,分别对所述第二校验值处理获得多个校验值,所述多个校验值包括所述第一校验值,所述多个校验值与所述多个校验算法一一对应。
结合第二方面的上述可能的实现方式,在第二方面的第二种可能的实现方式中,在所述接收设备根据所述接收设备确定的所述发送设备使用的所述第一校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式之后,以及,在所述接收设备通过基于第一解压缩模式,对所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据之前,所述方法还包括:所述接收设备确定所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同;以及,所述接收设备基于所述接收设备
当前使用的所述第二解压缩模式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式。
因此,接收设备在确定当前使用的第二解压缩模式与第一解压缩模式不同时,将当前所使用的解压缩模式设置为第一解压缩模式,从而可以在接收到发送设备发送的下一个报文时,基于第二解压缩模式,从该下一个报文中获取数据。
进一步地,所述方法还包括:所述接收设备确定所述第一校验码为所述多个校验码中的一个时,确定所述接收设备接收到的所述第一压缩数据与所述发送设备发送的所述第一压缩数据相同。
因此,接收设备在根据第一校验码确定发送设备压缩第一数据时使用的压缩模式的同时,还可以校验第一压缩数据是否传输无误。
结合第二方面的上述可能的实现方式,在第二方面的第三种可能的实现方式中,在所述接收设备确定所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同之后,以及,所述接收设备基于所述接收设备当前所使用的所述第二解压缩模式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式之前,所述方法还包括:所述接收设备丢弃所述第一报文。
因此,接收设备在接收到第一报文后,确定接收设备当前使用的解压缩模式与第一解压缩模式不同时,丢弃该第一报文。从而避免接收设备使用错误的解压缩模式解压缩第一压缩数据,进入避免错误的数据包泄漏都正常网络,引起网络异常。
结合第二方面的上述可能的实现方式,在第二方面的第四种可能的实现方式中,在所述接收设备基于所述接收设备当前使用的所述第二解压缩模式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式之前,所述方法还包括:所述接收设备接收所述发送设备发送的第二报文,所述第二报文包括第二压缩数据和第三校验值,所述第二压缩数据由所述发送设备基于所述第一压缩模式对第二数据压缩获得,所述第三校验值由所述发送设备基于所述第一校验算法对第四校验值处理获得,所述第四校验值由所述发送设备基于所述第二校验算法对所述第二压缩数据处理获得;所述接收设备通过基于所述第二校验算法对所述第二报文中
包括的所述第二压缩数据进行处理,获得所述第四校验值;所述接收设备通过基于所述第一校验算法对获得的所述第二校验值进行处理,获得所述第一校验值;所述接收设备基于获得的所述第一校验值与所述第二报文中包含的所述第一校验值相同,确定所述第一校验算法是所述发送设备生成所述第二报文时使用的校验算法;以及,所述接收设备根据所述接收设备确定的所述发送设备生成所述第二报文时使用的所述第一校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第二数据时使用的压缩模式;所述接收设备基于所述接收设备当前所使用的所述第二解压缩模式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式包括:所述接收设备基于所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,并且所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第二数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式。
因此,通过接收设备根据发送设备连续两次发送的报文,连续两次确定发送设备使用的压缩模式为第一压缩模式。接收设备将当前所使用的解压缩模式切换到与第一压缩模式相对应的第一解压缩模式。能够避免网络传输错误造成的校验值无法正确确定发送设备所使用的压缩模式,从而减少接收设备误判、误切换的概率。
第三方面,本申请提供一种用于传输数据的方法。所述方法包括:发送设备通过基于第一压缩模式对第一数据进行压缩,获得第一压缩数据;所述发送设备通过基于第二校验算法对所述第一压缩数据进行处理,获得第二校验值;所述发送设备通过基于第一校验算法对所述第一校验值进行处理,获得第一校验值,所述第一校验算法对应所述第一压缩模式;所述发送设备向接收设备发送第一报文,所述第一报文包括所述第一压缩数据和所述第一校验值。
因此,发送设备通过基于与压缩模式对应的校验算法生成校验值,并将该校验值与压缩数据组成的报文发送给接收设备。接收设备对该校验值进行处理,获得用于确定压缩模式的校验码。接收设备根据该校验码与压缩模式
的对应关系,确定发送设备压缩该压缩数据时使用的压缩模式。从而通过校验码来指示压缩模式,降低了开销,并且便于实现系统的兼容性和可扩展性。
结合第三方面,在第三方面的第一种可能的实现方式中,在所述发送设备通过基于第一校验算法对所述第二校验值进行处理,获得第一校验值之前,所述方法还包括:所述发送设备获取多个校验算法与多个压缩模式的一一对应关系,所述第二校验算法不同于所述多个校验算法中的任意一个;所述发送设备根据所述多个校验算法与多个压缩模式的一一对应关系,确定与所述第一压缩模式对应的第一校验算法。
因此,发送设备通过基于与不同的压缩模式对应的校验算法生成不同的校验值。接收设备通过对不同的校验值进行处理,获得不同的校验码。接收设备根据不同的校验码与压缩模式的对应关系,可以确定发送设备当前发送的压缩数据所使用的压缩模式。从而降低了开销,并且便于实现系统的兼容性和可扩展性。
第四方面,本申请提供一种用于传输数据的装置,用于执行第一方面或第一方面的任意可能的实现方式中的方法。具体地,该装置包括用于执行第一方面或第一方面的任意可能的实现方式中的方法的单元。
第五方面,本申请提供一种用于传输数据的装置,用于执行第二方面或第二方面的任意可能的实现方式中的方法。具体地,该装置包括用于执行第二方面或第二方面的任意可能的实现方式中的方法的单元。
第六方面,本申请提供一种用于传输数据的装置,用于执行第三方面或第三方面的任意可能的实现方式中的方法。具体地,该装置包括用于执行第三方面或第三方面的任意可能的实现方式中的方法的单元。
第七方面,本申请提供一种用于传输数据的系统,所述系统包括上述第四方面所述的装置和第六方面所述的装置,或者,所述系统包括上述第五方面所述的装置和第六方面所述的装置。
第八方面,本申请提供一种用于传输数据的设备,该设备包括:接收器、发送器、存储器、处理器和总线系统。其中,该接收器、该发送器、该存储器和该处理器通过该总线系统相连,该存储器用于存储指令,该处理器用于执行该存储器存储的指令,以控制接收器接收信号,并控制发送器发送信号,并且当该处理器执行该存储器存储的指令时,该执行使得该处理器执行第一方面或第一方面的任意可能的实现方式中的方法。
第九方面,本申请提供一种用于传输数据的设备,该设备包括:接收器、发送器、存储器、处理器和总线系统。其中,该接收器、该发送器、该存储器和该处理器通过该总线系统相连,该存储器用于存储指令,该处理器用于执行该存储器存储的指令,以控制接收器接收信号,并控制发送器发送信号,并且当该处理器执行该存储器存储的指令时,该执行使得该处理器执行第二方面或第二方面的任意可能的实现方式中的方法。
第十方面,本申请提供一种用于传输数据的设备,该设备包括:接收器、发送器、存储器、处理器和总线系统。其中,该接收器、该发送器、该存储器和该处理器通过该总线系统相连,该存储器用于存储指令,该处理器用于执行该存储器存储的指令,以控制接收器接收信号,并控制发送器发送信号,并且当该处理器执行该存储器存储的指令时,该执行使得该处理器执行第三方面或第三方面的任意可能的实现方式中的方法。
第十一方面,本申请提供一种用于传输数据的系统,所述系统包括上述第八方面所述的设备和第十方面所述的设备,或者,所述系统包括上述第九方面所述的设备和第十方面所述的设备。
第十二方面,本申请提供一种计算机可读介质,用于存储计算机程序,该计算机程序包括用于执行第一方面或第一方面的任意可能的实现方式中的方法的指令。
第十三方面,本申请提供一种计算机可读介质,用于存储计算机程序,该计算机程序包括用于执行第二方面或第二方面的任意可能的实现方式中的方法的指令。
第十四方面,本申请提供一种计算机可读介质,用于存储计算机程序,该计算机程序包括用于执行第三方面或第三方面的任意可能的实现方式中的方法的指令。
在某些实现方式中,所述第一压缩模式包括:以太网帧头压缩模式、网际协议IP头压缩模式,或者,以太网帧头和IP帧头压缩模式。
在某些实现方式中,第二校验值包括循环冗余校验CRC值,所述第二校验算法是CRC算法。
本申请提供的用于传输数据的方法、装置和系统,能够降低开销,便于实现系统的兼容性和可扩展性。
为了更清楚地说明本发明实施例的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是根据本发明一实施例的用于传输数据的方法的示意性流程图。
图2是根据本发明一实施例的用于传输数据的方法的另一示意性流程图。
图3是根据本发明一实施例的用于传输数据的方法的另一示意图。
图4是根据本发明一实施例的用于传输数据的装置的示意性框图。
图5是根据本发明另一实施例的用于传输数据的装置的示意性框图。
图6是根据本发明又一实施例的用于传输数据的装置的示意性框图。
图7a和图7b是根据本发明一实施例的用于传输数据的系统的示意性框图。
图8是根据本发明一实施例的用于传输数据的设备的示意性框图。
图9是根据本发明另一实施例的用于传输数据的设备的示意性框图。
图10是根据本发明又一实施例的用于传输数据的设备的示意性框图。
图11a和图11b是根据本发明一实施例的用于传输数据的系统的另一示意性框图。
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚地描述。显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下可以获得其他实施例。
在本说明书中使用的术语“部件”、“单元”、“系统”等用于表示计算机相关的实体、硬件、固件、硬件和软件的组合、软件、或执行中的软件。例如,部件可以是但不限于,在处理器上运行的进程、处理器、对象、可执行文件、执行线程、程序和/或计算机。通过图示,在计算设备上运行的应用和计算设备都可以是部件。一个或多个部件可驻留在进程和/或执行线程中,部件可位于一个计算机上和/或分布在两个或更多个计算机之间。此外,这些部件可从
在上面存储有各种数据结构的各种计算机可读介质执行。部件可例如根据具有一个或多个数据分组(例如来自与本地系统、分布式系统和/或网络间的另一部件交互的二个部件的数据,例如通过信号与其它系统交互的互联网)的信号通过本地和/或远程进程来通信。
另外,本发明的各个方面或特征可以实现成方法、装置或使用标准编程和/或工程技术的制品。本申请中使用的术语“制品”涵盖可从任何计算机可读器件、载体或介质访问的计算机程序。例如,计算机可读介质可以包括,但不限于:磁存储器件(例如,硬盘、软盘或磁带),光盘(例如,CD(Compact Disk,压缩盘)、DVD(Digital Versatile Disk,数字通用盘)等),智能卡和闪存器件(例如,EPROM(Erasable Programmable Read-Only Memory,可擦写可编程只读存储器)、卡、棒或钥匙驱动器等)。另外,本文描述的各种存储介质可代表用于存储信息的一个或多个设备和/或其它机器可读介质。术语“机器可读介质”可包括但不限于,无线信道和能够存储、包含和/或承载指令和/或数据的各种其它介质。
应理解,本发明实施例可以适用于支持多种压缩模式的设备的点到点传输系统中。发送设备与接收设备之间可以协商压缩模式,从而实现对经压缩的数据进行解压缩。例如,该发送设备和接收设备可以分别为基站与基站,或者分别为基站控制器与基站控制器,或者分别为交换机与交换机。或者,发送设备为基站,接收设备为无线网络控制器(Radio Network Controller,简称“RNC”)。发送设备与接收设备通过空口传输无线电信号。运营商可以通过网管设备对发送设备与接收设备进行管理。当网管设备通过流量监控模块监控到当前的网络带宽使用率较高时,可以通知发送设备启动压缩模式进行传输。换句话说,通过对传输的数据进行压缩,可以节省带宽。
图1是从设备交互的角度描述的根据本发明一实施例的用于传输数据的方法100的示意性流程图。该方法100可以应用于支持一种或者多种压缩模式的点到点传输的系统中。如图1所示,该方法100包括:
S101,发送设备通过基于第一压缩模式对第一数据进行压缩,获得第一压缩数据。
具体而言,发送设备在发送数据之前,可以先确定用于压缩第一数据的压缩模式(例如,第一压缩模式)。然后,该发送设备通过基于第一压缩模式对第一数据进行压缩,获得第一压缩数据。
可选地,所述发送设备通过基于第一压缩模式对第一数据进行压缩,获得第一压缩数据,包括:
所述发送设备通过接收端口接收到的报文可以为第一数据。例如,该报文可以是以太网(Ethernet)帧,多协议标签交换(Multi-Protocol Label Switching,简称“MPLS”)报文,IP报文或者用户数据包协议(User Datagram Protocol,简称“UDP”)报文。
所述发送设备基于第一压缩模式,对用于所述第一数据中的目标字段进行压缩,获得第一压缩数据。其中,所述目标字段包含S比特,压缩后的所述目标字段为M比特。S大于M。具体而言,目标字段可以是以太网帧头、IP帧头中的字段,也可以是报文的净荷中的一个或多个字段。例如,所述第一数据是以太网帧的情况下,目标字段可以为以太网类型(Ethernet type)字段。再例如,所述第一数据是以太网帧的情况下,目标字段可以为Ethernet type字段以及源介质访问控制(Media Access Control,简称“MAC”)协议地址字段。此外,目标字段可以是用于所述第一数据的净荷中的字段。例如,所述第一数据是以太网帧,并且所述以太网帧中包含IP头的情况下,目标字段可以为协议(protocol)字段。再例如,携带所述第一数据的报文是IP报文,并且所述IP报文中包含UDP头的情况下,目标字段可以为源端口字段以及目的端口字段。
在本发明实施例中,发送设备对目标字段进行压缩,得到压缩字段。也就是说,第一数据包括目标字段与不需要压缩的数据。第一压缩数据包括该压缩字段与未被压缩的数据。发送设备将第一压缩数据发送给接收设备。接收设备根据与压缩模式相对应的解压缩模式,对第一压缩数据进行解压缩,生成第一数据。该第一数据中包含有目标字段。
在本发明实施例中,发送设备和接收设备可以通过预先约定好的压缩映射关系表,建立目标字段与压缩字段的一一对应关系。发送设备根据压缩映射关系表,确定目标字段所对应的压缩字段。发送设备生成包含所述压缩字段的第一报文(关于第一报文的详细说明请参考S104),从而实现了对数据的压缩。接收设备根据该压缩映射关系表,把压缩字段解压缩,生成原目标字段中的值,从而实现了对压缩数据的解压缩。例如,目标字段可以是Ethernet type字段,当目标字段的值为“0800”,对应压缩字段为“0”;或者,当目标字段的值为“8847”,对应压缩字段为“1”。换句话说,发送设备和
接收设备中可以预存有该压缩映射关系表。在该压缩映射关系表中,目标字段的值不同,所对应的压缩字段也不同。发送设备和接收设备根据该压缩映射关系表进行数据的压缩和解压缩。
或者,发送设备基于当前压缩的目标字段中的值,周期性地或者按需更新压缩映射关系表,并将更新后的压缩映射关系表发送给接收设备。接收设备基于更新后的压缩映射关系表,对接收到的压缩数据中的压缩字段进行解压缩。进一步地,由于目标字段可以为以太网帧头、IP帧头,甚至还可以是物理层(Physical Layer,简称“PHY”)帧头,发送设备可以对其中的一个或多个帧头作压缩。但接收设备不知道发送设备是对哪些帧头作了压缩,在接收到压缩数据时无法正确解析。发送设备可以发送指示信息来指示接收设备基于哪种解压缩模式来对压缩数据进行解压缩。
也就是说,发送设备可以基于不同的压缩模式,对数据进行压缩。例如,第一压缩模式可以为仅对以太网帧头进行压缩,也可以为仅对IP帧头进行压缩,还可以对以太网帧头和IP帧头都进行压缩。在本发明实施例中,发送设备基于第一压缩模式对第一数据进行压缩时,发送设备通过基于与第一压缩模式相对应的第一校验算法来生成第一校验值。接收设备根据该第一校验值,确定基于哪种解压缩模式来对数据进行解压缩。也就是说,一种压缩模式对应了一个压缩映射关系表,例如,该压缩映射关系表可以为IP帧头与压缩字段的一一对应关系,也可以为以太网帧头与压缩字段的一一对应关系。接收设备确定了发送设备使用的压缩模式,就确定了接收到的发送设备所发出的数据是基于哪个压缩映射关系表来进行压缩的,从而可以确定基于哪个压缩映射关系表来进行解压缩。
S102,所述发送设备通过基于第二校验算法对所述第一压缩数据进行处理,获得第二校验值。
具体而言,该发送设备在对第一数据进行压缩,获得第一压缩数据之后,基于第二校验算法对该第一压缩数据进行处理,获得第二校验值。
作为示例而非限定,所述第二校验值为循环冗余校验(Cyclic Redundancy Check,简称“CRC”)值,所述第二校验算法为CRC算法。
也就是说,该发送设备通过基于循环冗余校验CRC算法对第一压缩数据进行处理,获得CRC值。
在本发明实施例中,发送设备通过基于第二校验算法对待发送的压缩数
据进行处理得到CRC值。具体地,该第二校验算法可以理解为:发送设备基于该生成多项式的最高次幂为m,将压缩数据左移m位,并对空出的m位补“0”。发送设备在基于生成多项式对第一压缩数据进行CRC运算得到CRC值,该CRC值的位数即为m。发送设备基于第二校验算法处理得到CRC值后,并未将该CRC值与第一压缩数据封装成报文并发送给接收设备,而是等待发送设备根据S103对该CRC值进行处理。
举例来说,第一压缩数据为二进制数“1010”。发送设备中保存有用于执行第二校验算法的计算机程序,该第二校验算法包含有生成多项式G(x)=x3+x+1,该生成多项式G(x)可以表示为二进制数:“1011”。该生成多项式G(x)的最高次幂m=3。则将第一压缩数据左移3位,得到“1010 000”,再利用生成多项式G(x)=x3+x+1对“1010 000”作CRC运算,可以得到余数“011”即为CRC值。
应理解,以上所列举的第一压缩数据以及CRC值仅为示例性说明,不应对本发明构成任何限定,本发明也不应限于此。实际传输的压缩数据可以为更多比特,与压缩数据所对应的CRC值可以为16比特、或者32比特、或者更多比特。
S103,所述发送设备通过基于第一校验算法对所述第二校验值进行处理,获得第一校验值。
具体而言,发送设备根据压缩第一数据时使用的压缩模式,确定相对应的校验算法,以对第二校验值进行处理获得第一校验值,进而生成对应的报文。第一压缩模式对应的校验算法是第一校验算法。在本发明实施例中,发送设备基于第一校验算法对S102中生成的第二校验值进行处理,可以获得第一校验值。作为示例而非限定,该第一校验值生成算法包括:对第二校验值的一位或多位作取反操作。例如,发送设备基于S102中所生成的CRC值,对该CRC值中的一位或多位取反,使得生成的第一校验值与CRC值不同。例如,S102中所生成的CRC值(即,第二校验值的一个例子)为“011”。假设第一校验算法是对第二校验值的最低有效位(Least Significant Bit,简称“LSB”)取反,即可以得到第一校验值为“010”;或者,假设第一校验算法是对第二校验值的第二位取反,即可以得到第一校验值为“001”。
应理解,以上所列举的第一校验算法的具体内容仅为示例性说明,不应对本发明构成任何限定。例如,可以通过对第二校验值中的一位或多位作处
理,使得生成的第一校验值与第二校验值不同。
可选地,在所述发送设备通过基于第一校验算法对所述第二校验值进行处理,获得第一校验值之前,所述方法还包括:
所述发送设备获取多种校验算法与多种压缩模式的一一对应关系;
所述发送设备根据所述多个校验算法与多种压缩模式的一一对应关系,确定与所述第一压缩模式对应的所述第一校验算法。
具体而言,发送设备在执行S101之前,可以从该发送设备的存储器中获取多种校验算法与多种压缩模式的一一对应关系。发送设备可以根据该发送设备所支持的多种压缩模式,预先保存多个计算机程序。该多个计算机程序分别用于实现与多种压缩模式对应的多种校验算法。其中,该多种校验算法包括第一校验算法,且该多种校验算法不包括第二校验算法。
作为示例而非限定,上述多种压缩模式可以包括:以太网帧头压缩模式、IP帧头压缩模式以及以太网帧头和IP帧头压缩模式。或者说,该第一压缩模式可以为:以太网帧头压缩模式、IP帧头压缩模式,或者,以太网帧头和IP帧头净荷压缩模式。
举例来说,当第一压缩模式为以太网帧头压缩模式时,对应的第二校验值为十六进制数“7FFF”。发送设备通过基于与第一压缩模式对应的第一校验算法对第二校验值进行处理,得到第一校验值。所述第一校验值为十六进制数“1000”。当第一压缩模式为IP帧头压缩模式时,对应的第二校验值为十六进制数“1FFF”。发送设备通过基于第一校验算法对第二校验值进行处理,得到第一校验值。所述第一校验值为十六进制数“3800”。当第一压缩模式为以太网帧头和IP帧头压缩模式时,对应的第二校验值为十六进制数“3FFF”。发送设备通过基于第一校验算法对第二校验值进行处理,得到第一校验值。所述第一校验值为十六进制数“E001”。
应理解,以上列举的第一压缩模式与第一校验值仅为示例性说明,不应对本发明构成任何限定。例如,该第一校验值可以为16比特,也可以为32比特,或者更多比特。又例如,该第一校验值可以为十六进制数,也可以为二进制数,本发明对此并未特别限定。
发送设备在对数据进行压缩处理前,可以先确定自身所支持的多种压缩模式。并根据该多种压缩模式,获取多种校验算法与所述多种压缩模式的一一对应关系。下文将多种校验算法与多种压缩模式的一一对应关系称为第一
映射关系。表1示出了第一映射关系的一个例子。
校验算法 | 压缩模式 |
校验算法1 | 压缩模式1 |
校验算法2 | 压缩模式2 |
校验算法3 | 压缩模式3 |
发送设备根据该第一映射关系,获取与第一压缩模式对应的第一校验算法,进而基于第一校验算法对第二校验值进行处理,获得第一校验值。
应理解,发送设备可以保存一种校验算法与一种压缩模式的对应关系,也可以保存多种校验算法与多种压缩模式的对应关系,本发明对此并未特别限定。
还应理解,这里所列举的发送设备确定压缩模式的具体方法仅为示例性说明,不应对本发明构成任何限定。发送设备确定当前使用的压缩模式的方法与现有技术相似,为了简洁,这里不再赘述。
需要说明的是,上述列举的第二校验算法与第一校验算法是两种不同的算法。或者说,第二校验算法与上述多个校验算法中的任意一种都不相同。关于第二校验算法,可以参考现有技术中的CRC算法。
与之不同的是,第一校验算法是与发送设备所使用的压缩模式相对应的。不同的压缩模式,发送设备会采用不同的校验算法来生成第一校验值,进而生成报文。
S104,所述发送设备向接收设备发送所述第一报文,所述第一报文包括所述第一压缩数据和所述第一校验值。
具体而言,该发送设备在通过该基于第一校验算法对第二校验值进行处理,获得第一校验值之后,该发送设备将获得的第一校验值与第一压缩数据进行处理,生成第一报文,该第一报文中包含第一压缩数据和第一校验值。例如,上述列举的第一报文可以包含二进制数“1010 010”,其中“1010”是由发送设备基于第一压缩模式压缩得到,“010”是由该发送设备基于第二校验算法和与第一压缩模式对应的第一校验算法处理得到。或者,第一报文可以包含二进制数“1010 001”,其中“1010”是由发送设备基于第一压缩模式压缩生成的,“001”是由该发送设备基于第二校验算法和与第一压缩模式对应的第一校验算法处理获得的。
S105,所述接收设备根据所述第一报文,确定所述第一压缩模式是所述
发送设备压缩所述第一数据时使用的压缩模式。
具体而言,接收设备接收到发送设备发送的第一报文后,需要首先确定发送设备压缩该第一数据时使用的压缩模式。一种具体实现方式中,接收设备可以基于第三校验算法对第一报文进行处理,获得第一校验码,根据校验码与压缩模式的对应关系,确定第一校验码对应的第一压缩模式;另一种具体实现方式中,接收设备也可以基于第二校验算法对第一压缩数据进行处理,获得第二校验值后,再通过基于第一校验算法对第二校验值进行处理,获得与第一校验值相同的校验值。进而根据校验算法与压缩模式的对应关系,确定与第一校验算法对应的第一压缩模式。后文将分别对所述一种实现方式(即方法一)和所述另一种实现方式(即方法二)的具体过程详细说明。
S106,所述接收设备通过基于第一解压缩模式对所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据。
具体来说,接收设备在根据接收到的第一报文中的第一校验值,确定发送设备使用的压缩模式之后,可以将接收设备的解压缩模式设置为与第一压缩模式相对应的第一解压缩模式。接收设备基于第一解压缩模式对第一报文中包括的第一压缩数据进行解压缩,获得第一数据。
可选地,S106也可以是:所述接收设备通过基于第一解压缩模式对其他报文中包括压缩数据进行解压缩。
其他报文是所述接收设备接收到的来自所述发送设备的报文。所述发送设备发送所述其他报文的时间晚于所述发送设备发送所述第一报文的时间。
因此,本发明实施例的用于传输数据的方法,发送设备通过基于与压缩模式对应的校验算法生成校验值。接收设备通过对由压缩数据和校验值组成的报文进行处理,获得用于确定压缩模式校验码或者校验算法。接收设备根据校验码与压缩模式的对应关系,或者校验算法与压缩模式的对应关系,可以确定发送设备发送的压缩数据所使用的压缩模式。相比于现有技术中通过报文头额外的开销字节来指示压缩模式,本发明通过校验值来携带该指示信息,降低了开销。并且,现有技术中通过报文头额外的开销字节需要系统规划时提前预留足够的开销字节。若系统在规划时未预留足够的开销字节,则无法通过该方法来指示压缩模式,本发明无需在系统规划时预留开销字节,便于实现系统的兼容性和可扩展性。
以下,结合图1,详细说明接收设备根据第一校验值,确定第一压缩模
式的方法(可以是方法一或者方法二)。
方法一:
S201,接收设备通过基于第三校验算法对所述第一报文进行处理,获得第一校验码;
S202,所述接收设备根据获得的所述第一校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式。
具体而言,接收设备中保存有用于执行第三校验算法的计算机程序。发送设备中保存有用于执行第二校验算法的计算机程序。该第三校验算法与第二校验算法包含有相同的生成多项式。发送设备基于第二校验算法对第一压缩数据进行处理,获得第二校验值,再基于第一校验算法对第二校验值进行处理,得到第一校验值,进而生成第一报文。该第一报文包含第一压缩数据和第一校验值。接收设备基于第三校验算法对接收到的第一报文进行处理,可以获得第一校验码。具体地,该第三校验算法可以理解为:接收设备基于该生成多项式对接收到的第一报文进行CRC运算,得到的余数即为第一校验码。
举例来说,在S104中,发送设备基于第一压缩模式、第二校验算法和第一校验算法的处理后,可以得到第一报文。例如,第一报文包含二进制数“1010 010”。其中,“1010”是由发送设备基于第一压缩模式压缩得到。“010”是由该发送设备基于第二校验算法和与第一压缩模式对应的第一校验算法处理得到。第三校验算法与第二校验算法包含相同的生成多项式G(x)=x3+x+1,该生成多项式G(x)可以表示为二进制数:“1011”。接收设备基于该生成多项式对第一报文作CRC运算,可以得到余数为“001”。或者,假设第一报文包含二进制数“1010 001”。其中,“1010”是由发送设备基于第一压缩模式压缩得到。“010”是由该发送设备基于第二校验算法和与第一压缩模式对应的第一校验算法处理得到。接收设备基于生成多项式对第一报文作CRC运算,可以得到余数为“010”。由此可以看到,发送设备采用不同的校验算法对第二校验值作处理,在接收设备基于相同的生成多项式作CRC运算,所得到的结果也不相同。
接收设备可以在基于第三校验算法获得第一校验码之后,根据接收设备预存的校验码与压缩模式的对应关系,可以确定与第一校验码对应的第一压
缩模式是发送设备压缩第一数据时使用的压缩模式。
可选地,所述接收设备根据获得的所述第一校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式,包括:
所述接收设备获取多个校验码与多种压缩模式的一一对应关系,所述多个校验码包括所述第一校验码;
所述接收设备根据所述多个校验码与多种压缩模式的一一对应关系,确定与所述第一校验码对应的所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式。
具体而言,接收设备可以预先从存储器中获取多个校验码与多种压缩模式的一一对应关系。下文将多个校验码与多种压缩模式的一一对应关系称为第二映射关系。在本发明实施例中,接收设备可以根据发送设备和接收设备所支持的多种压缩模式和解压缩模式,以及S103中发送设备获取的第一映射关系,确定与多个校验算法相对应的多个校验码,进而确定压缩模式第二映射关系。或者说,每种压缩模式对应一个校验码,各校验码彼此相异。接收设备基于预存的用于实现第三校验算法的计算机程序,对接收到的第一报文进行处理,可以得到第一校验码。接收设备根据多个校验码与多种压缩模式的一一对应关系,确定该第一校验码所对应的第一压缩模式,便可以确定发送设备是基于第一压缩模式发送第一数据报文的。
例如,在S201中所列举的第一报文可以包含二进制数“1010 010”,对应的校验码为“001”;或者,第一报文可以包含二进制数“1010 001”,对应的校验码为“010”,即两个不同的校验码对应两种不同的压缩模式。
需要说明的是,接收设备中预存的多个校验码是接收设备基于第三校验算法,对发送设备中经过第二校验算法和与多种压缩模式对应的多种校验算法处理后得到的校验值处理获得的。
进一步地,接收设备可以预先规定:当接收设备基于第三校验算法获得的第一校验码为上述多个校验码中的任一个时,可以确定对应的报文中所包含的压缩数据在传输过程中没有发生错误。也就是说,接收设备确定该第一校验码为上述多个校验码中的一个时,可以确定该接收设备接收到的第一报文中的第一压缩数据与发送设备发送的第一报文中的第一压缩数据相同。
换句话说,发送设备和接收设备可以预先约定用于指示压缩模式的校验
码。当接收设备基于第三校验算法对报文处理得到的校验码为该预先约定的校验码时,则认为数据在传输过程中没有发生错误;当接收设备基于第三校验算法对报文处理得到的校验码不是上述预先约定的校验码时,则认为该数据在传输过程中发生错误。
需要说明的是,接收设备通过基于第三校验算法对接收到的第一报文进行处理,获得第一校验码。也就是说,该发送设备所使用的第一校验算法与该接收设备中预存的第一校验码具有对应关系。换句话说,当发送设备基于第一压缩模式生成多个压缩数据,并向接收设备发送该多个压缩数据时,每个压缩数据都可以基于第一校验算法生成对应的报文。每个报文所包括的压缩数据虽不同,但用于生成报文的算法相同,因此,在接收设备中基于第三校验算法得到的结果都为同一个校验码,即,第一校验码。应理解,接收设备可以保存一个校验码与一种压缩模式的对应关系,也可以保存多个校验码与多种压缩模式的对用关系,本发明对此并未特别限定。
还应理解,第二校验算法和第三校验算法的具体执行方法可以参考现有技术中的CRC算法。本发明与现有技术所不同的是,对基于第二校验算法获得的CRC值进行进一步处理,基于与压缩模式相对应的校验算法,获得校验值后,将压缩数据与该校验值组成的报文发送给接收设备。接收设备基于第三校验算法对该报文进行处理可以得到校验码。进而根据校验码与压缩模式的对应关系确定发送设备使用的压缩模式。
因此,本发明实施例的方法,发送设备通过基于与压缩模式对应的校验算法生成校验值。接收设备通过对校验值进行处理,获得用于确定压缩模式的校验码。接收设备根据该校验码与压缩模式的对应关系,可以确定发送设备压缩数据时所使用的压缩模式。从而降低了开销,并且便于实现系统的兼容性和可扩展性。并且可以通过该校验码来确定数据传输是否无误,保证传输的准确性。
方法二:
S203,所述接收设备通过基于所述第二校验算法对所述第一报文中包括的所述第一压缩数据进行处理,获得所述第二校验值;
S204,所述接收设备通过基于所述第一校验算法对获得的所述第二校验值进行处理,获得所述第一校验值;
S205,所述接收设备基于获得的所述第一校验值与所述第一报文中包含
的所述第一校验值相同,确定所述第一校验算法是所述发送设备生成所述第一报文时使用的校验算法;
S206,所述接收设备根据所述接收设备确定的所述发送设备生成所述第一报文时使用的所述第一校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式。
具体而言,接收设备在接收到第一报文后,首先获取其中所包含的第一压缩数据。接收设备从报文中获取压缩数据的具体方法与现有技术中接收设备从报文中获取报文头中的字段的具体方法相似。为了简洁,这里不再赘述。
接收设备可以基于预存的用于实现第二校验算法的计算机程序,对获取到的第一压缩数据进行处理,得到第二校验值。接收设备通过基于第二校验算法对第一压缩数据进行处理,获得第二校验值的具体方法,与发送设备通过基于第二校验算法对第一压缩数据进行处理,获得第二校验值的具体方法相同。发送设备通过基于第二校验算法对第一压缩数据进行处理,获得第二校验值的具体方法在上文中已经详细描述,为了简洁,这里不再赘述。
接收设备在获得第二校验值后,基于第一校验算法对第二校验值进行处理,获得第一校验值。这里需要说明的是,接收设备基于第一校验算法进行处理时,并不知道它所使用的校验算法是与发送设备所使用的第一校验算法相同的校验算法。接收设备中可以预存用于执行第一校验算法的计算机程序,当接收设备基于该第一校验算法对第二校验值进行处理获得的校验值,正好与发送设备发送的第一报文中的第一校验值相同时,接收设备可以确定该第一校验算法即为发送设备所使用的第一校验算法。
接收设备在确定发送设备所使用的第一校验算法后,根据该接收设备中预存的校验算法与压缩模式的对应关系,便可以确定与第一校验算法相对应的第一压缩模式是发送设备压缩第一数据时使用的压缩模式。
需要说明的是,在本发明实施例中,由于第一报文包含第一压缩数据和第一校验值。因此,接收设备也可以根据对第一压缩数据处理后获得的报文与接收到的第一报文是否相同,确定第一校验算法是否为发送设备发送第一报文时使用的校验算法。本发明对此并未特别限定。
可选地,所述接收设备通过基于所述第一校验算法对获得的所述第二校验值进行处理,获得所述第一校验值,包括:
所述接收设备通过基于多个校验算法,分别对所述第二校验值处理获得多个校验值,所述多个校验值包括所述第一校验值,所述多个校验值与所述多个校验算法一一对应。
具体而言,接收设备可以预先从存储器中获取多个校验码与多种压缩模式的一一对应关系。下文将多个校验码与多种压缩模式的一一对应关系称为第三映射关系。在本发明实施例中,接收设备可以根据该发送设备和接收设备所支持的多种压缩模式和解压缩模式,确定第三映射关系。该第三映射关系与发送设备中所预存的第一映射关系相同。
应理解,该第三映射关系可以包含一种校验算法与一种压缩模式的对应关系,也可以包含多种校验算法与多种压缩模式的对应关系,本发明对此并未特别限定。
在本发明实施例中,接收设备可以遍历第三映射关系中的多种校验算法,对第二校验值进行处理,获得多个校验值。接收设备从该多个获得的多个校验值中寻找与第一数据报文中所包含的第一校验值相同的校验值,并将用于生成该校验值的校验算法确定为第一校验算法。
进一步地,接收设备可以预先设定:当接收设备分别执行预存的用于实现多种校验算法的多个计算机程序,可以确定出用于生成第一校验值的校验算法时,可以确定对应的报文中所包含的压缩数据在传输过程中没有发生错误。当接收设备分别执行预存的用于实现多种校验算法的多个计算机程序,无法确定出用于生成第一校验值的校验算法时,可以确定对应的报文中所包含的压缩数据在传输过程中发生错误。也就是说,当接收设备中预存的用实现多种校验算法的多个计算机程序中包含用于实现第一校验算法的计算机程序时,可以确定该接收设备接收到的第一报文中的第一压缩数据与发送设备发送的第一报文中的第一压缩数据相同。
因此,本发明实施例的用于传输数据的方法,发送设备通过基于与压缩模式对应的校验算法生成校验值,并将该校验值与压缩数据组成的报文发送给接收设备。接收设备对该报文中的压缩数据进行处理,以确定与发送设备相同的校验算法。接收设备根据该校验算法与压缩模式的对应关系,确定发送设备压缩该压缩数据时使用的压缩模式。从而通过校验算法来指示压缩模式,降低了开销,并且便于实现系统的兼容性和可扩展性。
应理解,上述列举的第一压缩数据和第一报文的具体内容仅为示例性说
明,不应对本发明构成任何限定,本发明也不应限于此。实际传输的数据可以为更多比特,所使用的CRC值可以为16比特、或者32比特、或者更多比特。
还应理解,以上所列举的本发明实施例通过校验值确定压缩模式的方法仅为示例性说明,不应对本发明构成任何限定,本发明也不应限于此。本发明也适用于具有多种工作模式(例如,非压缩模式),并且需要两端设备协商来切换工作模式的传输系统中。
以上,结合图1详细说明了本发明实施例的用于传输数据的方法100。以下,结合图2和图3详细说明接收设备切换压缩模式的具体过程。
在本发明实施例中,为了保证数据被正确解析,接收设备的压缩模式需要采用与发送设备相同的压缩模式。但是,当发送设备的压缩模式发生改变时,接收设备只能在接收到发送设备切换压缩模式后发送的第一个数据报文时,根据该数据报文而确定。
图2是根据本发明一实施例的用于传输数据的方法100的另一示意性流程图。
可选地,如图2所示,在所述接收设备确定所述第一压缩模式是所述发送设备用于压缩所述第一数据的压缩模式之后,以及,在S106所述接收设备通过基于第一解压缩模式对所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据之前,所述方法100还包括:
S310,所述接收设备确定所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同;
S330,所述接收设备基于所述接收设备当前所使用的所述第二解压缩模式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式。
所述第一解压缩模式用于替换所述第二解压缩模式。具体而言,接收设备可以基于上述方法一或方法二来确定发送设备用于压缩第一数据的压缩模式。接收设备在确定发送设备的压缩模式后,根据当前所使用的解压缩模式,来确定是否可以正确解析接收到的第一报文。
在本发明实施例中,在接收设备的寄存器或其他存储空间中,可以预存用于指示当前解压缩模式的校验码或校验算法的标识。
具体地,接收设备可以根据该预存的校验码,确定当前所使用的解压缩模式,(为便于区分和说明,记作第二解压缩模式)。接收设备根据接收到的第一报文所对应的校验码(即,通过方法一获得的第一校验码),确定发送设备压缩第一数据使用的第一压缩模式。接收设备可以直接对基于第一报文获得的第一校验码和预存在的寄存器或其他存储空间中的校验码作比较。当两者相同时,接收设备确定当前所使用的解压缩模式与发送设备所使用的压缩模式对应,即第二解压缩模式与第一压缩模式对应。接收设备基于第二解压缩模式是与第一压缩模式对应的解压缩模式,并可以直接基于当前所使用的第二解压缩模式,解压缩第一压缩数据,获取第一数据。相反,当两者不同时,接收设备确定当前所使用的解压缩模式与发送设备所使用的压缩模式并不对应,也就无法正确解压缩第一压缩数据中的第一数据。
或者,接收设备也可以根据预存的校验算法的标识,确定当前所使用的解压缩模式(即,第二解压缩模式)。接收设备根据接收到的第一报文所对应的校验算法(即,通过方法二确定的第一校验算法),确定发送设备压缩第一数据使用的第一压缩模式。接收设备可以直接对基于第一报文确定的第一校验算法的标识和预存在的寄存器或其他存储空间中的校验算法的标识作比较。当两者相同时,接收设备确定当前所使用的解压缩模式与发送设备所使用的压缩模式对应,即第二解压缩模式与第一压缩模式对应。接收设备基于第二解压缩模式是与第一压缩模式对应的解压缩模式,并可以直接基于当前所使用的第二解压缩模式,解压缩第一压缩数据,获取第一数据。相反,当两者不同时,接收设备确定当前所使用的解压缩模式与发送设备所使用的压缩模式并不对应,也就无法正确解压缩第一压缩数据中的第一数据。
应理解,在本发明实施例中,压缩模式与解压缩模式是相对应的,或者说,压缩与解压缩是可逆的。压缩模式与校验码的对应关系或者压缩模式与校验算法的对应关系,就可以理解为解压缩模式与校验码或者对应关系或者压缩模式与校验算法的对应关系。也就是说,当压缩模式与校验码的对应关系已知时,解压缩模式与校验码的对应关系就可获知;或者当压缩模式与校验算法的对应关系已知时,解压缩模式与校验算法的对应关系就可获知。
还应理解,这里所列举的第一压缩模式和第二解压缩模式仅为示例性说明,不应对本发明构成任何限定。例如,发送设备可以使用第三压缩模式压缩第一报文,接收设备当前使用的解压缩模式可以为第一解压缩模式,本发
明对此并未特别限定。
进一步地,在S310在所述接收设备确定所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同之后,所述方法100还包括:
S315,所述接收设备丢弃所述第一报文。
具体而言,接收设备在确定当前所使用的解压缩模式与发送设备压缩第一数据时使用的压缩模式对应的第一解压缩模式不同,或者说,接收设备确定当前所使用的解压缩模式与发送设备压缩第一数据时使用的压缩模式不对应时,接收设备确定无法正确解压缩出第一压缩数据中的第一数据。为了避免错误的数据包泄漏都正常网络,引起网络异常,接收设备将当前接收到的第一报文作丢弃处理。
可选地,在S330所述接收设备基于所述接收设备当前所使用的所述第二解压缩模式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式之前,所述方法100还包括:
S320,所述接收设备接收发送设备发送的第二报文,所述第二报文包括第二压缩数据和第三校验值,其中,所述第二压缩数据由所述发送设备基于所述第一压缩模式对第二数据压缩获得,所述第三校验值由所述发送设备基于所述第一校验算法对第四校验值处理获得,所述第四校验值由所述发送设备基于所述第二校验算法对所述第二压缩数据处理获得;
S325,所述接收设备根据所述第二报文,确定所述第一压缩模式是所述发送设备压缩所述第二数据时使用的压缩模式。
具体而言,由于在传输过程中有可能出现错误,为了避免误切换,接收设备在确定当前所使用的第二解压缩模式与发送设备压缩第一数据时使用的压缩模式对应的第一解压缩模式不同之后,可以不立即将当前的解压缩模式设置为第一解压缩模式。也就是说,接收设备在收到发送设备发送的一个报文,确定第一解压缩模式时,不立即从第二解压缩模式切换为第一解压缩模式。接收设备可以根据发送设备连续发送的两个或者更多个报文,通过两次或者多次确定发送设备使用的压缩模式都为第一压缩模式之后,将当前使用的解压缩模式设置为第一解压缩模式。
在本发明实施例中,第二报文可以理解为发送设备由其他压缩模式切换
为第一压缩模式后,对第二数据进行压缩,并基于第二校验算法和第一校验算法处理后,向接收设备发出的第一个报文。第一报文可以理解为发送设备继第二报文之后发出的报文,或者说,第一报文可以理解为接收设备继第二报文之后接收到的报文。接收设备基于第二报文可以确定一次发送设备使用的第一压缩模式,基于第一报问又可以确定一次发送设备使用的第一压缩模式。也就是说,接收设备可以通过计数器记录每一次确定。当记录次数为两次或者更多次,则可以确定第一发送设备当前使用的压缩模式为第一压缩模式。接收设备可以将当前使用的解压缩模式设置为第一解压缩模式。
需要说明的是,当接收设备连续多次基于相同的校验码或者校验算法,确定发送设备所使用的第一压缩模式时,可以连续记数。当接收设备基于不同的校验码或校验算法,确定发送设备所使用的压缩模式并不是一直保持在第一压缩模式时,在校验码或校验算法变化时,需要重新记数,而不应连续记录,以避免误判,造成误切换。
应理解,以上列举的第一报文、第二报文仅为示例性说明,“第一”和“第二”用于区分发送设备的两次发送动作,或者说,接收设备的两次接收动作,而不应对本发明构成任何限定。
还应理解,第一报文、第二报文仅为示例性说明,接收设备还可以基于接收到的更多的报文,通过更多次确定,来切换当前使用的解压缩模式。
在本发明实施例中,S325接收设备根据第二报文,确定发送设备压缩第二数据时使用的压缩模式的具体方法可以与上述方法一和方法二类似。
可选地,S325所述接收设备根据所述第二报文,确定所述第一压缩模式是所述发送设备压缩所述第二数据时使用的压缩模式,包括:
所述接收设备通过基于所述第三校验算法对所述第二报文进行处理,获得所述第一校验码;
所述接收设备根据获得的所述第三校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是发送设备压缩所述第二数据时使用的压缩模式。
可选地,S325所述接收设备根据所述第二报文,确定所述第一压缩模式是所述发送设备压缩所述第二数据时使用的压缩模式,包括:
所述接收设备接收所述发送设备发送的第二报文,所述第二报文包括第二压缩数据和第三校验值,所述第二压缩数据由所述发送设备基于所述第一
压缩模式对第二数据压缩获得,所述第三校验值由所述发送设备基于所述第一校验算法对第四校验值处理获得,所述第四校验值由所述发送设备基于所述第二校验算法对所述第二压缩数据处理获得;
所述接收设备通过基于所述第二校验算法对所述第二报文中包括的所述第二压缩数据进行处理,获得所述第四校验值;
所述接收设备通过基于所述第一校验算法对获得的所述第四校验值进行处理,获得所述第三校验值;
所述接收设备基于获得的所述第三校验值与所述第二报文中包含的所述第三校验值相同,确定所述第一校验算法是所述发送设备生成所述第二报文时使用的校验算法;
所述接收设备根据所述接收设备确定的所述发送设备生成所述第二报文时使用的所述第一校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第二数据时使用的压缩模式。
可选地,所述接收设备基于所述接收设备当前所使用的所述第二解压缩模式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式包括:
所述接收设备基于所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,并且所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第二数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式。
应理解,接收设备通过方法一或方法二,根据接收到的第二报文,确定发送设备压缩第二数据时使用的压缩模式的具体过程,与接收设备根据接收到的第一报文,确定发送设备压缩第二数据时使用的压缩模式的具体过程相似。为了简洁,这里不再赘述。
还应理解,在本发明实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本发明实施例的实施过程构成任何限定。例如,S315可以与S320之前执行,也可以在S320之后执行,或者还可以与S320同时执行,本发明对此并未特
别限定。
因此,本发明实施例的方法,通过接收设备根据发送设备连续两次发送的报文,连续两次确定发送设备使用的压缩模式为第一压缩模式。接收设备将当前所使用的解压缩模式切换到与第一压缩模式相对应的第一解压缩模式。能够避免网络传输错误造成的校验值无法正确确定发送设备所使用的压缩模式的情况,从而减少接收设备误判、误切换的概率。
以上,结合图1和图2详细说明了根据本发明一实施例的用于传输数据的方法。以下,结合图3详细说明根据本发明另一实施例的用于传输数据的方法。
图3是根据本发明一实施例的用于传输数据的方法100的另一示意图。
应理解,图3所示的方法可以在图1中的S106所述接收设备通过基于第一解压缩模式对所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据之前执行。接收设备在接收到第一报文之前,可以接收到N个报文,并确定该N个报文都包含有发送设备基于第一压缩模式压缩生成的压缩数据。其中,N为大于等于1的自然数。图2所示的根据本发明一实施例的方法100的另一示意性流程图中,示出了N=1的情况。图3示出了根据本发明一实施例的方法100中N>1的情况的示意图。
如图3所示,发送设备在切换为第一压缩模式之前,基于第二压缩模式对数据进行压缩,获得压缩数据(为便于理解和区分,记作数据L,L为大于等于1的自然数)。发送设备基于与第二压缩模式相对应的校验算法(为便于理解和区分,记作校验算法1)对数据L进行处理得到校验值(为便于理解和区分,记作校验值1)。发送设备将由数据L和校验值1组成的报文(为便于理解和区分,记作报文L)发送给接收设备。
需要说明的是,发送设备基于校验算法对数据进行处理的具体过程在上文中已经详细描述。为了简洁,这里不再赘述。
发送设备在切换为第一压缩模式之后,基于第一压缩模式对数据进行压缩,获得压缩数据(为便于理解和区分,记作数据L+1)。发送设备基于与第一压缩模式相对应的校验算法(为便于理解和区分,记作校验算法2)对数据L+1进行处理得到校验值(为便于理解和区分,记作校验值3)。发送设备将有数据L+1和校验值2组成的报文(为便于理解和区分,记作报文L+1)发送给接收设备。
为了避免系统在传输过程中出现错误可能会造成的压缩模式的误判,接收设备可以通过对连续多次接收到的报文进行多次确定。接收设备在连续多次确定发送设备使用的压缩模式为同一压缩模式时,才将当前使用的解压缩模式设置为与发送设备所使用的压缩模式对应的解压缩模式。
发送设备在继报文L+1之后,基于第一压缩模式,对连续N个待传输的数据进行处理,得到N个压缩数据。发送设备基于与第一压缩模式对应的校验算法(即,校验算法2)对N个压缩数据进行处理,分别可以获得N个校验值,进而得到N个连续的报文。N个报文与N个压缩数据一一对应,第i个报文包括第i个压缩数据,其中,i∈[1,N],N为大于等于1的自然数。发送设备向接收设备连续发送该N个报文,该N个数文为发送设备继报文L+1之后发送的报文。
接收设备对该N个报文执行N次丢弃处理,在N次丢弃处理中的第i次丢弃处理中,接收设备基于第i个报文,确定当前所使用的第二解压压缩模式与接收设备确定的发送设备所使用的第一压缩模式对应的第一解压缩模式不同后,丢弃第i个报文。接收设备可以通过计数器记录每次丢弃处理,在计数到达N+1丢弃处理后,也就是在接收到第L+N+1个报文(记作报文L+N+1,包括数据L+N+1和校验值2)后,将当前所用的解压缩模式设置为与第一压缩模式对应的第一解压缩模式。接收设备在接收到第L+N+2个报文(记作报文L+N+2)时,基于第一解压缩模式,对该报文中的压缩数据(记作数据L+N+2)进行解压缩,以获取数据。
可选地,该N的取值为10。
也就是说,发送设备在基于第一压缩模式压缩数据并生成报文L+1后,连续10次发出报文后,接收设备才会将解压缩模式设置为第一解压缩模式,接收继连续10次发出的报文之后的下一个报文,从而保证无切换的概率极低。
因此,本发明实施例的用于传输数据的方法,通过接收设备根据发送设备连续多次发送的报文,连续多次确定发送设备使用的压缩模式为第一压缩模式。接收设备将当前所使用的解压缩模式切换到与第一压缩模式相对应的第一解压缩模式。能够避免网络传输错误造成的校验值无法正确确定发送设备所使用的压缩模式的情况,从而减少接收设备误判、误切换的概率。需要说明的是,该N+1个报文中所包括的数据可以为相同的数据,也可以为不同
的数据,本发明对此并未特别限定。并且,当该N+1个数据为相同的数据时,可以减少数据的丢失,减少传输中断时间。
应理解,上述列举的第一压缩模式以及相对应的校验算法2、校验值2、数据L+1、报文L+1、数据L+N+1、报文L+N+1、数据L+N+2、报文L+N+2,以及第二压缩模式以及相对应的校验算法1、校验值1、报文L均为示例性说明,不应对本发明构成任何限定。L、L+1、L+N+1、L+N+2区分不同的报文和数据,不应对本发明构成任何限定。第一压缩模式和第二压缩模式仅为示例性说明,发送设备也可以由第三压缩模式切换为第一压缩模式。本发明对此并未特别限定。
以上,结合图1至图3详细说明了根据本发明实施例的用于传输数据的方法。以下,结合图4、图5和图6详细说明根据本发明实施例的用于传输数据的装置。
图4是根据本发明一实施例的用于传输数据的装置400的示意性框图。装置400可以用于实现图1至图3所示的方法中的接收设备。如图4所示,该装置400包括接收单元410、处理单元420、和确定单元430。
其中,所述接收单元410用于接收发送设备发送的第一报文,所述第一报文包括第一压缩数据和第一校验值,其中,所述第一压缩数据由所述发送设备基于第一压缩模式对第一数据压缩获得,所述第一校验值由所述发送设备基于第一校验算法对第二校验值处理获得,所述第二校验值由所述发送设备基于第二校验算法对所述第一压缩数据处理获得;
所述处理单元420用于通过基于第三校验算法对所述接收单元410接收的所述第一报文进行处理,获得第一校验码,所述第二校验算法与所述第三校验算法包含相同的生成多项式;
所述确定单元430用于根据所述处理单元420获得的所述第一校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式;
所述处理单元420还用于,通过基于第一解压缩模式对所述接收单元410接收到的所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据,所述第一解压缩模式是所述确定单元430确定的所述第一压缩模式对应的解压缩模式。
可选地,所述确定单元430还用于,在所述确定单元430根据所述处理
单元420获得的所述第一校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式之后,以及,在所述处理单元420通过基于第一解压缩模式对所述接收单元410接收到的所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据之前,确定所述装置400当前所使用的第二解压缩模式与所述确定单元430确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同;
所述处理单元420还用于,基于所述确定单元430确定的所述装置400当前所使用的第二解压缩模式与所第一解压缩模式不同,将所述装置400当前使用的解压缩模式设置为所述第一解压缩模式。
可选地,所述接收单元410还用于,在所述处理单元420基于所述确定单元430确定的所述装置400当前所使用的第二解压缩模式与所述第一解压缩模式不同,将所述装置400当前使用的解压缩模式设置为所述第一解压缩模式之前,接收发送设备发送的第二报文,所述第二报文包括第二压缩数据和第三校验值,其中,所述第二压缩数据由所述发送设备基于所述第一压缩模式对第二数据压缩获得,所述第三校验值由所述发送设备基于所述第一校验算法对第四校验值处理获得,所述第四校验值由所述发送设备基于所述第二校验算法对所述第二压缩数据处理获得;
所述处理单元420还用于,通过基于所述第三校验算法对所述接收单元410接收到的所述第二报文进行处理,获得所述第一校验码;
所述确定单元430还用于,根据所述处理单元420获得的所述第一校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是发送设备压缩所述第二数据时使用的压缩模式;
所述处理单元420具体用于,基于所述确定单元430确定的所述装置400当前所使用的第二解压缩模式与所述确定单元430确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,并基于所述确定单元430确定的所述装置400当前所使用的第二解压缩模式与所述确定单元430确定的所述发送设备压缩所述第二数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述装置400当前使用的解压缩模式设置为所述第一解压缩模式。
根据本发明实施例的用于传输数据的装置400可对应于根据本发明实施
例的用于传输数据的方法中的用于执行方法一的接收设备,并且,该装置400中的各单元和上述其他操作和/或功能分别为了实现图1至图3中各个方法的相应流程,为了简洁,在此不再赘述。
因此,本发明实施例的用于传输数据的装置,通过接收发送设备发送的报文,对报文中包含的校验值进行处理,获得用于确定压缩模式的校验码。该装置根据该校验码与压缩模式的对应关系,确定发送设备压缩该压缩数据时使用的压缩模式。从而通过校验码来指示压缩模式,降低了开销,并且便于实现系统的兼容性和可扩展性。
图5是根据本发明另一实施例的用于传输数据的装置500的示意性框图。装置500可以用于实现图1至图3所示的方法中的接收设备。如图5所示,该装置500包括接收单元510、处理单元520和确定单元530。
其中,所述接收单元510用于接收发送设备发送的第一报文,所述第一报文包括第一压缩数据和第一校验值,其中,所述第一压缩数据由所述发送设备基于第一压缩模式对第一数据压缩获得,所述第一校验值由所述发送设备基于第一校验算法对第二校验值处理获得,所述第二校验值由所述发送设备基于第二校验算法对所述第一压缩数据处理获得;
所述处理单元520用于通过基于所述第二校验算法对所述接收单元510接收到的所述第一报文中包括的所述第一压缩数据进行处理,获得所述第二校验值,并通过基于所述第一校验算法对所述处理单元520获得的所述第二校验值进行处理,获得所述第一校验值;
所述确定单元530用于基于所述处理单元520获得的所述第一校验值与所述接收单元510接收到的所述第一报文中包含的所述第一校验值相同,确定所述第一校验算法是所述发送设备生成所述第一报文时使用的校验算法;并根据所述确定单元530确定所述发送设备生成所述第一报文时使用的所述第一校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式;
所述处理单元520还用于,通过基于第一解压缩模式对所述接收单元510接收到的所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据,所述第一解压缩模式是所述确定单元530确定的所述第一压缩模式对应的解压缩模式。
可选地,所述处理单元520具体用于通过基于多个校验算法,分别对所
述处理单元520获得的第二校验值进行处理,获得多个校验值,所述多个校验值包括所述第一校验值,所述多个校验值与所述多个校验算法一一对应。
可选地,所述确定单元530还用于,根据所述确定单元530确定的所述发送设备生成所述第一报文时使用的所述第一校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式之后,以及,在所述处理单元520通过基于第一解压缩模式对所述接收单元510接收到的所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据之前,确定所述装置500当前所使用的第二解压缩模式与所述确定单元530确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同;
所述处理单元520还用于,基于所述确定单元530确定的所述装置500当前所使用的第二解压缩模式与所述确定单元530确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述装置500当前使用的解压缩模式设置为所述第一解压缩模式。
可选地,所述接收单元510还用于,在所述处理单元520基于所述装置500当前所使用的第二解压缩模式与所述确定单元530确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述装置500当前使用的解压缩模式设置为所述第一解压缩模式之前,接收所述发送设备发送的第二报文,所述第二报文包括第二压缩数据和第三校验值,所述第二压缩数据由所述发送设备基于所述第一压缩模式对第二数据压缩获得,所述第三校验值由所述发送设备基于所述第一校验算法对第四校验值处理获得,所述第四校验值由所述发送设备基于所述第二校验算法对所述第二压缩数据处理获得;
所述处理单元520还用于,通过基于所述第二校验算法对所述接收单元510接收到的所述第二报文中包括的所述第二压缩数据进行处理,获得所述第四校验值;并通过基于所述第一校验算法对所述处理单元520获得的所述第四校验值进行处理,获得所述第三校验值;
所述确定单元530还用于,基于所述处理单元520获得的所述第三校验值与所述接收单元510接收到的所述第二报文中包含的所述第三校验值相同,确定所述第一校验算法是所述发送设备生成所述第二报文时使用的校验算法;并根据所述确定单元530确定的所述发送设备生成所述第二报文时使
用的校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第二数据时使用的压缩模式;
所述处理单元520具体用于,基于所述确定单元530确定的所述装置500当前所使用的第二解压缩模式与所述确定单元530确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,并基于所述确定单元530确定的所述装置500当前所使用的第二解压缩模式与所述确定单元530确定的所述发送设备压缩所述第二数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述装置500当前使用的解压缩模式设置为所述第一解压缩模式。
根据本发明实施例的用于传输数据的装置500可对应于根据本发明实施例的用于传输数据的方法中的用于执行方法二的接收设备,并且,该装置500中的各单元和上述其他操作和/或功能分别为了实现图1至图3中各个方法的相应流程,为了简洁,在此不再赘述。
因此,本发明实施例的用于传输数据的装置,通过接收发送设备发送的报文,对报文进行处理,以确定与发送设备相同的校验算法。接收设备根据该校验算法与压缩模式的对应关系,确定发送设备压缩该压缩数据时使用的压缩模式。从而通过校验算法来指示压缩模式,降低了开销,并且便于实现系统的兼容性和可扩展性。
图6是根据本发明又一实施例的用于传输数据的装置600的示意性框图。装置600可以用于实现图1至图3所示的方法中的发送设备。如图6所示,该装置600包括:处理单元610和发送单元620。
其中,所述处理单元610用于通过基于第一压缩模式对第一数据进行压缩,获得第一压缩数据;并通过基于第二校验算法对所述第一压缩数据进行处理,获得第二校验值;并通过基于第一校验算法对所述第一校验值进行处理,获得第一校验值,所述第一校验算法对应所述第一压缩模式;
所述发送单元620用于向接收设备发送第一报文,所述第一报文包括所述第一压缩数据和所述处理单元610获得的所述第一校验值。
可选地,所述装置600还包括获取单元,用于获取多个校验算法与多个压缩模式的一一对应关系,所述第二校验算法不同于所述多个校验算法中的任意一个;
所述处理单元610还用于,根据所述多个校验算法与多个压缩模式的一
一对应关系,确定与所述第一压缩模式对应的第一校验算法。
根据本发明实施例的用于传输数据的装置600可对应于根据本发明实施例的用于传输数据的方法中的发送设备,并且,该装置600中的各单元和上述其他操作和/或功能分别为了实现图1至图3中各个方法的相应流程,为了简洁,在此不再赘述。
因此,根据本发明实施例的装置,通过基于与压缩模式对应的校验算法生成校验值,并将该校验值与压缩数据组成的报文发送给接收设备。接收设备对该校验值进行处理,获得用于确定压缩模式的校验码。接收设备根据该校验码与压缩模式的对应关系,确定该设备压缩该压缩数据时使用的压缩模式。从而通过校验码来指示压缩模式,降低了开销,并且便于实现系统的兼容性和可扩展性。
图7a和图7b是根据本发明一实施例的用于传输数据的系统700的示意性框图。
如图7a所示,该系统700包括根据本发明实施例的用于传输数据的装置400和根据本发明实施例的用于传输数据的装置600。其中,根据本发明实施例的用于传输数据的装置400可以对应于根据本发明实施例的用于传输数据的方法中的用于执行方法一的接收设备,并且,该装置400中的各单元和上述其他操作和/或功能分别为了实现图1至图3中各个方法的相应流程,为了简洁,在此不再赘述;根据本发明实施例的用于传输数据的装置600可对应于根据本发明实施例的用于传输数据的方法中的发送设备,并且,该装置600中的各单元和上述其他操作和/或功能分别为了实现图1至图3中各个方法的相应流程,为了简洁,在此不再赘述。
如图7b所示,该系统700包括根据本发明实施例的用于传输数据的装置500和根据本发明实施例的用于传输数据的装置600。其中,根据本发明实施例的用于传输数据的装置500可以对应于根据本发明实施例的用于传输数据的方法中的用于执行方法二的接收设备,并且,该装置500中的各单元和上述其他操作和/或功能分别为了实现图1至图3中各个方法的相应流程,为了简洁,在此不再赘述;根据本发明实施例的用于传输数据的装置600可对应于根据本发明实施例的用于传输数据的方法中的发送设备,并且,该装置600中的各单元和上述其他操作和/或功能分别为了实现图1至图3中各个方法的相应流程,为了简洁,在此不再赘述。
因此,根据本发明实施例的系统,通过发送设备基于与压缩模式对应的校验算法生成校验值,并将该校验值与压缩数据组成的报文发送给接收设备。接收设备对该校验值进行处理,获得用于确定压缩模式的校验码。接收设备根据该校验码与压缩模式的对应关系,确定该设备压缩该压缩数据时使用的压缩模式。从而通过校验码来指示压缩模式,降低了开销,并且便于实现系统的兼容性和可扩展性。
以上,结合图4至图7(包括图7a和图7b)详细说明了根据本发明实施例的用于传输数据的装置和系统。以下,结合图8至图11(包括图11a和图11b)详细说明根据本发明实施例的用于传输数据的设备和系统。
图8是根据本发明一实施例的用于传输数据的设备800的示意性框图。设备800可以用于实现图1至图3所示的方法中的接收设备。设备800可以用于实现图4所示的装置400。如图8所示,所述设备800包括接收器810、发送器820、处理器830、存储器840和总线系统850。其中,所述接收器810、所述发送器820、所述处理器830和所述存储器840通过所述总线系统850相连,所述存储器840用于存储指令,所述处理器830用于执行所述存储器840存储的指令,以控制所述接收器810接收信号,并控制所述发送器820发送信号。
其中,所述接收器810用于接收发送设备发送的第一报文,所述第一报文包括第一压缩数据和第一校验值,其中,所述第一压缩数据由所述发送设备基于第一压缩模式对第一数据压缩获得,所述第一校验值由所述发送设备基于第一校验算法对第二校验值处理获得,所述第二校验值由所述发送设备基于第二校验算法对所述第一压缩数据处理获得;
所述处理器830用于通过基于第三校验算法对所述接收器810接收的所述第一报文进行处理,获得第一校验码,所述第二校验算法与所述第三校验算法包含相同的生成多项式;并根据所述处理器830获得的所述第一校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式;并通过基于第一解压缩模式对所述接收器810接收到的所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据,所述第一解压缩模式是所述处理器830确定的所述第一压缩模式对应的解压缩模式。可选地,所述处理器830还用于,在根据所述处理器830获得的所述第一校验码,以及所述第一校验码与
所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式之后,以及,在所述处理器830通过基于第一解压缩模式对所述接收器810接收到的所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据之前,确定所述设备800当前所使用的第二解压缩模式与所述处理器830确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同;
所述处理器830还用于,基于所述处理器830确定的所述设备800当前所使用的第二解压缩模式与所第一解压缩模式不同,将所述设备800当前使用的解压缩模式设置为所述第一解压缩模式。
可选地,所述接收器810还用于,在所述处理器830基于所述处理器830确定的所述设备800当前所使用的第二解压缩模式与所述第一解压缩模式不同,将所述设备800当前使用的解压缩模式设置为所述第一解压缩模式之前,接收发送设备发送的第二报文,所述第二报文包括第二压缩数据和第三校验值,其中,所述第二压缩数据由所述发送设备基于所述第一压缩模式对第二数据压缩获得,所述第三校验值由所述发送设备基于所述第一校验算法对第四校验值处理获得,所述第四校验值由所述发送设备基于所述第二校验算法对所述第二压缩数据处理获得;
所述处理器830还用于,通过基于所述第三校验算法对所述接收器810接收到的所述第二报文进行处理,获得所述第一校验码;
所述处理器830还用于,根据所述处理器830获得的所述第一校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是发送设备压缩所述第二数据时使用的压缩模式;
所述处理器830具体用于,基于所述处理器830确定的所述设备800当前所使用的第二解压缩模式与所述处理器830确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,并基于所述处理器830确定的所述设备800当前所使用的第二解压缩模式与所述处理器830确定的所述发送设备压缩所述第二数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述设备800当前使用的解压缩模式设置为所述第一解压缩模式。
应理解,在本发明实施例中,该处理器830可以是中央处理单元(central processing unit,简称为“CPU”),该处理器830还可以是其他通用处理器、
数字信号处理器(DSP)、专用集成电路(ASIC)、现成可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
该存储器840可以包括只读存储器和随机存取存储器,并向处理器830提供指令和数据。存储器840的一部分还可以包括非易失性随机存取存储器。例如,存储器840还可以存储设备类型的信息。
该总线系统850除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都标为总线系统850。
在实现过程中,上述方法的各步骤可以通过处理器830中的硬件的集成逻辑电路或者软件形式的指令完成。结合本发明实施例所公开的定位方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器840,处理器830读取存储器840中的信息,结合其硬件完成上述方法的步骤。为避免重复,这里不再详细描述。
根据本发明实施例的用于传输数据的设备800可对应于根据本发明实施例的用于传输数据的方法中的用于执行方法一的接收设备,以及根据本发明实施例的用于传输数据的装置400,并且,该设备800中的各模块和上述其他操作和/或功能分别为了实现图1至图3中各个方法的相应流程,为了简洁,在此不再赘述。
因此,本发明实施例的用于传输数据的设备,通过接收发送设备发送的报文,对报文中包含的校验值进行处理,获得用于确定压缩模式的校验码。该装置根据该校验码与压缩模式的对应关系,确定发送设备压缩该压缩数据时使用的压缩模式。从而通过校验码来指示压缩模式,降低了开销,并且便于实现系统的兼容性和可扩展性。
图9是根据本发明另一实施例的用于传输数据的设备900的示意性框图。设备900可以用于实现图1至图3所示的方法中的接收设备。设备900可以用于实现图5所示的装置500。如图9所示,所述设备900包括接收器910、发送器920、处理器930、存储器940和总线系统950。其中,所述接收器910、所述发送器920、所述处理器930和所述存储器940通过所述总
线系统950相连,所述存储器940用于存储指令,所述处理器930用于执行所述存储器940存储的指令,以控制所述接收器910接收信号,并控制所述发送器920发送信号。
其中,所述接收器910用于接收发送设备发送的第一报文,所述第一报文包括第一压缩数据和第一校验值,其中,所述第一压缩数据由所述发送设备基于第一压缩模式对第一数据压缩获得,所述第一校验值由所述发送设备基于第一校验算法对第二校验值处理获得,所述第二校验值由所述发送设备基于第二校验算法对所述第一压缩数据处理获得;
所述处理器930用于通过基于所述第二校验算法对所述接收器910接收到的所述第一报文中包括的所述第一压缩数据进行处理,获得所述第二校验值,并通过基于所述第一校验算法对所述处理器930获得的所述第二校验值进行处理,获得所述第一校验值;并基于所述处理器930获得的所述第一校验值与所述接收器910接收到的所述第一报文中包含的所述第一校验值相同,确定所述第一校验算法是所述发送设备生成所述第一报文时使用的校验算法;并根据所述处理器930确定所述发送设备生成所述第一报文时使用的所述第一校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式;并通过基于第一解压缩模式对所述接收器910接收到的所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据,所述第一解压缩模式是所述处理器930确定的所述第一压缩模式对应的解压缩模式。可选地,所述处理器930具体用于通过基于多个校验算法,分别对所述处理器930获得的第二校验值进行处理,获得多个校验值,所述多个校验值包括所述第一校验值,所述多个校验值与所述多个校验算法一一对应。
可选地,所述处理器930还用于,根据所述处理器930确定的所述发送设备生成所述第一报文时使用的所述第一校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式之后,以及,在所述处理器930通过基于第一解压缩模式对所述接收器910接收到的所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据之前,确定所述设备900当前所使用的第二解压缩模式与所述处理器930确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同;
所述处理器930还用于,基于所述处理器930确定的所述设备900当前所使用的第二解压缩模式与所述处理器930确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述设备900当前使用的解压缩模式设置为所述第一解压缩模式。
可选地,所述接收器910还用于,在所述处理器930基于所述设备900当前所使用的第二解压缩模式与所述处理器930确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述设备900当前使用的解压缩模式设置为所述第一解压缩模式之前,接收所述发送设备发送的第二报文,所述第二报文包括第二压缩数据和第三校验值,所述第二压缩数据由所述发送设备基于所述第一压缩模式对第二数据压缩获得,所述第三校验值由所述发送设备基于所述第一校验算法对第四校验值处理获得,所述第四校验值由所述发送设备基于所述第二校验算法对所述第二压缩数据处理获得;
所述处理器930还用于,通过基于所述第二校验算法对所述接收器910接收到的所述第二报文中包括的所述第二压缩数据进行处理,获得所述第四校验值;并通过基于所述第一校验算法对所述处理器930获得的所述第四校验值进行处理,获得所述第三校验值;
所述处理器930还用于,基于所述处理器930获得的所述第三校验值与所述接收器910接收到的所述第二报文中包含的所述第三校验值相同,确定所述第一校验算法是所述发送设备生成所述第二报文时使用的校验算法;并根据所述处理器930确定的所述发送设备生成所述第二报文时使用的校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第二数据时使用的压缩模式;
所述处理器930具体用于,基于所述处理器930确定的所述设备900当前所使用的第二解压缩模式与所述处理器930确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,并基于所述处理器930确定的所述设备900当前所使用的第二解压缩模式与所述处理器930确定的所述发送设备压缩所述第二数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述设备900当前使用的解压缩模式设置为所述第一解压缩模式。
根据本发明实施例的用于传输数据的设备900可对应于根据本发明实施
例的用于传输数据的方法中的用于执行方法二的接收设备,以及根据本发明实施例的用于传输数据的装置500,并且,该设备900中的各模块和上述其他操作和/或功能分别为了实现图1至图3中各个方法的相应流程,为了简洁,在此不再赘述。
因此,本发明实施例的用于传输数据的设备,通过接收发送设备发送的报文,对报文进行处理,以确定与发送设备相同的校验算法。接收设备根据该校验算法与压缩模式的对应关系,确定发送设备压缩该压缩数据时使用的压缩模式。从而通过校验算法来指示压缩模式,降低了开销,并且便于实现系统的兼容性和可扩展性。
图10是根据本发明又一实施例的用于传输数据的设备1000的示意性框图。设备1000可以用于实现图1至图3所示的方法中的发送设备。设备1000可以用于实现图6所示的装置600。如图10所示,所述设备1000包括:所述设备1000包括接收器1100、发送器1200、处理器1300、存储器1400和总线系统1500。其中,所述接收器1100、所述发送器1200、所述处理器1300和所述存储器1400通过所述总线系统1500相连,所述存储器1400用于存储指令,所述处理器1300用于执行所述存储器1400存储的指令,以控制所述接收器1100接收信号,并控制所述发送器1200发送信号。
其中,所述处理器1300用于通过基于第一压缩模式对第一数据进行压缩,获得第一压缩数据;并通过基于第二校验算法对所述第一压缩数据进行处理,获得第二校验值;并通过基于第一校验算法对所述第一校验值进行处理,获得第一校验值,所述第一校验算法对应所述第一压缩模式;
所述发送器1200用于向接收设备发送第一报文,所述第一报文包括所述第一压缩数据和所述处理器1300获得的所述第一校验值。
可选地,所述处理器1300还用于获取多个校验算法与多个压缩模式的一一对应关系,所述第二校验算法不同于所述多个校验算法中的任意一个;
所述处理器1300还用于,根据所述多个校验算法与多个压缩模式的一一对应关系,确定与所述第一压缩模式对应的第一校验算法。
根据本发明实施例的用于传输数据的设备1000可对应于根据本发明实施例的用于传输数据的方法中的发送设备,并且,该设备1000中的各模块和上述其他操作和/或功能分别为了实现图1至图3中各个方法的相应流程,为了简洁,在此不再赘述。
因此,根据本发明实施例的设备,通过基于与压缩模式对应的校验算法生成校验值,并将该校验值与压缩数据组成的报文发送给接收设备。接收设备对该校验值进行处理,获得用于确定压缩模式的校验码。接收设备根据该校验码与压缩模式的对应关系,确定该设备压缩该压缩数据时使用的压缩模式。从而通过校验码来指示压缩模式,降低了开销,并且便于实现系统的兼容性和可扩展性。
图11a和图11b是根据本发明一实施例的用于传输数据的系统2000的另一示意性框图。
如图11a所示,该系统2000包括根据本发明实施例的用于传输数据的设备800和根据本发明实施例的用于传输数据的设备1000。其中,根据本发明实施例的用于传输数据的设备800可以对应于根据本发明实施例的用于传输数据的方法中的用于执行方法一的接收设备,以及根据本发明实施例的用于传输数据的装置400,并且,该设备800中的各模块和上述其他操作和/或功能分别为了实现图1至图3中各个方法的相应流程,为了简洁,在此不再赘述;根据本发明实施例的用于传输数据的设备1000可对应于根据本发明实施例的用于传输数据的方法中的发送设备,以及根据本发明实施例的用于传输数据的装置600,并且,该设备1000中的各模块和上述其他操作和/或功能分别为了实现图1至图3中各个方法的相应流程,为了简洁,在此不再赘述。
如图11b所示,该系统2000包括根据本发明实施例的用于传输数据的设备900和根据本发明实施例的用于传输数据的设备1000。其中,根据本发明实施例的用于传输数据的设备900可以对应于根据本发明实施例的用于传输数据的方法中的用于执行方法二的接收设备,以及根据本发明实施例的用于传输数据的装置500,并且,该设备900中的各模块和上述其他操作和/或功能分别为了实现图1至图3中各个方法的相应流程,为了简洁,在此不再赘述;根据本发明实施例的用于传输数据的设备1000可对应于根据本发明实施例的用于传输数据的方法中的发送设备,以及根据本发明实施例的用于传输数据的装置600,并且,该设备1000中的各模块和上述其他操作和/或功能分别为了实现图1至图3中各个方法的相应流程,为了简洁,在此不再赘述。
因此,根据本发明实施例的系统,通过发送设备基于与压缩模式对应的
校验算法生成校验值,并将该校验值与压缩数据组成的报文发送给接收设备。接收设备对该校验值进行处理,获得用于确定压缩模式的校验码。接收设备根据该校验码与压缩模式的对应关系,确定该设备压缩该压缩数据时使用的压缩模式。从而通过校验码来指示压缩模式,降低了开销,并且便于实现系统的兼容性和可扩展性。
应理解,在本发明的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本发明实施例的实施过程构成任何限定。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使
用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。
Claims (18)
- 一种用于传输数据的方法,其特征在于,包括:接收设备接收发送设备发送的第一报文,所述第一报文包括第一压缩数据和第一校验值,其中,所述第一压缩数据由所述发送设备基于第一压缩模式对第一数据压缩获得,所述第一校验值由所述发送设备基于第一校验算法对第二校验值处理获得,所述第二校验值由所述发送设备基于第二校验算法对所述第一压缩数据处理获得;所述接收设备通过基于第三校验算法对所述第一报文进行处理,获得第一校验码,所述第二校验算法与所述第三校验算法包含相同的生成多项式;所述接收设备根据获得的所述第一校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式;以及所述接收设备通过基于第一解压缩模式对所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据,所述第一解压缩模式是所述第一压缩模式对应的解压缩模式。
- 根据权利要求1所述的方法,其特征在于,在所述接收设备根据获得的所述第一校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备用于压缩所述第一数据的压缩模式之后,以及,在所述接收设备通过基于第一解压缩模式对所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据之前,所述方法还包括:所述接收设备确定所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同;以及所述接收设备基于所述接收设备当前所使用的所述第二解压缩模式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式。
- 根据权利要求2所述的方法,其特征在于,在所述接收设备基于所述接收设备当前所使用的所述第二解压缩模式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式之前,所述方法还包括:所述接收设备接收发送设备发送的第二报文,所述第二报文包括第二压缩数据和第三校验值,其中,所述第二压缩数据由所述发送设备基于所述第一压缩模式对第二数据压缩获得,所述第三校验值由所述发送设备基于所述第一校验算法对第四校验值处理获得,所述第四校验值由所述发送设备基于所述第二校验算法对所述第二压缩数据处理获得;所述接收设备通过基于所述第三校验算法对所述第二报文进行处理,获得所述第一校验码;以及所述接收设备根据获得的所述第一校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是发送设备压缩所述第二数据时使用的压缩模式;所述接收设备基于所述接收设备当前所使用的所述第二解压缩模式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式包括:所述接收设备基于所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,以及所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第二数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式。
- 根据权利要求1至3中任一项所述的方法,其特征在于,所述第一压缩模式包括:以太网帧头压缩模式、网际协议IP帧头压缩模式,或者,以太网帧头和IP帧头压缩模式。
- 根据权利要求1至4中任一项所述的方法,其特征在于,所述第二校验值包括循环冗余校验CRC值,所述第二校验算法是CRC算法。
- 一种用于传输数据的方法,其特征在于,包括:接收设备接收发送设备发送的第一报文,所述第一报文包括第一压缩数据和第一校验值,所述第一压缩数据由所述发送设备基于第一压缩模式对第一数据压缩获得,所述第一校验值由所述发送设备基于第一校验算法对第二校验值处理获得,所述第二校验值由所述发送设备基于第二校验算法对所述第一压缩数据处理获得;所述接收设备通过基于所述第二校验算法对所述第一报文中包括的所 述第一压缩数据进行处理,获得所述第二校验值;所述接收设备通过基于所述第一校验算法对获得的所述第二校验值进行处理,获得所述第一校验值;所述接收设备基于获得的所述第一校验值与所述第一报文中包含的所述第一校验值相同,确定所述第一校验算法是所述发送设备生成所述第一报文时使用的校验算法;所述接收设备根据所述接收设备确定的所述发送设备生成所述第一报文时使用的所述第一校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式;以及所述接收设备通过基于第一解压缩模式对所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据,所述第一解压缩模式是所述第一压缩模式对应的解压缩模式。
- 根据权利要求6所述的方法,其特征在于,所述接收设备通过基于所述第一校验算法对获得的所述第二校验值进行处理,获得所述第一校验值,包括:所述接收设备通过基于多个校验算法,分别对所述第二校验值处理获得多个校验值,所述多个校验值包括所述第一校验值,所述多个校验值与所述多个校验算法一一对应。
- 根据权利要求6或7所述的方法,其特征在于,在所述接收设备根据所述接收设备确定的所述发送设备生成所述第一报文时使用的所述第一校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式之后,以及,在所述接收设备通过基于第一解压缩模式,对所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据之前,所述方法还包括:所述接收设备确定所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同;以及所述接收设备基于所述接收设备当前使用的所述第二解压缩模式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式。
- 根据权利要求8所述的方法,其特征在于,在所述接收设备基于所述接收设备当前使用的所述第二解压缩模式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式之前,所述方法还包括:所述接收设备接收所述发送设备发送的第二报文,所述第二报文包括第二压缩数据和第三校验值,所述第二压缩数据由所述发送设备基于所述第一压缩模式对第二数据压缩获得,所述第三校验值由所述发送设备基于所述第一校验算法对第四校验值处理获得,所述第四校验值由所述发送设备基于所述第二校验算法对所述第二压缩数据处理获得;所述接收设备通过基于所述第二校验算法对所述第二报文中包括的所述第二压缩数据进行处理,获得所述第四校验值;所述接收设备通过基于所述第一校验算法对获得的所述第四校验值进行处理,获得所述第三校验值;所述接收设备基于获得的所述第三校验值与所述第二报文中包含的所述第三校验值相同,确定所述第一校验算法是所述发送设备生成所述第二报文时使用的校验算法;以及所述接收设备根据所述接收设备确定的所述发送设备生成所述第二报文时使用的所述第一校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第二数据时使用的压缩模式;所述接收设备基于所述接收设备当前所使用的所述第二解压缩模式与所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式包括:所述接收设备基于所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,并且所述接收设备当前所使用的第二解压缩模式与所述接收设备确定的所述发送设备压缩所述第二数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述接收设备当前使用的解压缩模式设置为所述第一解压缩模式。
- 根据权利要求6至9中任一项所述的方法,其特征在于,所述第一压缩模式包括:以太网帧头压缩模式、网际协议IP帧头压缩模式,或者, 以太网帧头和IP帧头压缩模式。
- 根据权利要求6至10中任一项所述的方法,其特征在于,所述第二校验值为第二循环冗余校验CRC值,所述第二校验算法为CRC算法。
- 一种用于传输数据的装置,其特征在于,包括:接收单元,用于接收发送设备发送的第一报文,所述第一报文包括第一压缩数据和第一校验值,其中,所述第一压缩数据由所述发送设备基于第一压缩模式对第一数据压缩获得,所述第一校验值由所述发送设备基于第一校验算法对第二校验值处理获得,所述第二校验值由所述发送设备基于第二校验算法对所述第一压缩数据处理获得;处理单元,用于通过基于第三校验算法对所述接收单元接收的所述第一报文进行处理,获得第一校验码,所述第二校验算法与所述第三校验算法包含相同的生成多项式;确定单元,用于根据所述处理单元获得的所述第一校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式;所述处理单元还用于,通过基于第一解压缩模式对所述接收单元接收到的所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据,所述第一解压缩模式是所述确定单元确定的所述第一压缩模式对应的解压缩模式。
- 根据权利要求12所述的装置,其特征在于,所述确定单元还用于,在所述确定单元根据所述处理单元获得的所述第一校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式之后,以及,在所述处理单元通过基于第一解压缩模式对所述接收单元接收到的所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据之前,确定所述装置当前所使用的第二解压缩模式与所述确定单元确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同;所述处理单元还用于,基于所述确定单元确定的所述装置当前所使用的第二解压缩模式与所第一解压缩模式不同,将所述装置当前使用的解压缩模式设置为所述第一解压缩模式。
- 根据权利要求13所述的装置,其特征在于,所述接收单元还用于, 在所述处理单元基于所述确定单元确定的所述装置当前所使用的第二解压缩模式与所述第一解压缩模式不同,将所述装置当前使用的解压缩模式设置为所述第一解压缩模式之前,接收发送设备发送的第二报文,所述第二报文包括第二压缩数据和第三校验值,其中,所述第二压缩数据由所述发送设备基于所述第一压缩模式对第二数据压缩获得,所述第三校验值由所述发送设备基于所述第一校验算法对第四校验值处理获得,所述第四校验值由所述发送设备基于所述第二校验算法对所述第二压缩数据处理获得;所述处理单元还用于,通过基于所述第三校验算法对所述接收单元接收到的所述第二报文进行处理,获得所述第一校验码;所述确定单元还用于,根据所述处理单元获得的所述第一校验码,以及所述第一校验码与所述第一压缩模式的对应关系,确定所述第一压缩模式是发送设备压缩所述第二数据时使用的压缩模式;所述处理单元具体用于,基于所述确定单元确定的所述装置当前所使用的第二解压缩模式与所述确定单元确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,并基于所述确定单元确定的所述装置当前所使用的第二解压缩模式与所述确定单元确定的所述发送设备压缩所述第二数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述装置当前使用的解压缩模式设置为所述第一解压缩模式。
- 一种用于传输数据的装置,其特征在于,包括:接收单元,用于接收发送设备发送的第一报文,所述第一报文包括第一压缩数据和第一校验值,其中,所述第一压缩数据由所述发送设备基于第一压缩模式对第一数据压缩获得,所述第一校验值由所述发送设备基于第一校验算法对第二校验值处理获得,所述第二校验值由所述发送设备基于第二校验算法对所述第一压缩数据处理获得;处理单元,用于通过基于所述第二校验算法对所述接收单元接收到的所述第一报文中包括的所述第一压缩数据进行处理,获得所述第二校验值,并通过基于所述第一校验算法对所述处理单元获得的所述第二校验值进行处理,获得所述第一校验值;确定单元,用于基于所述处理单元获得的所述第一校验值与所述接收单元接收到的所述第一报文中包含的所述第一校验值相同,确定所述第一校验 算法是所述发送设备生成所述第一报文时使用的校验算法,并根据所述确定单元确定所述发送设备生成所述第一报文时使用的所述第一校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式;所述处理单元还用于,通过基于第一解压缩模式对所述接收单元接收到的所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据,所述第一解压缩模式是所述确定单元确定的所述第一压缩模式对应的解压缩模式。
- 根据权利要求15所述的装置,其特征在于,所述处理单元具体用于通过基于多个校验算法,分别对所述处理单元获得的第二校验值进行处理,获得多个校验值,所述多个校验值包括所述第一校验值,所述多个校验值与所述多个校验算法一一对应。
- 根据权利要求15或16所述的装置,其特征在于,所述确定单元还用于,根据所述确定单元确定的所述发送设备生成所述第一报文时使用的所述第一校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第一数据时使用的压缩模式之后,以及,在所述处理单元通过基于第一解压缩模式对所述接收单元接收到的所述第一报文中包括的所述第一压缩数据进行解压缩,获得所述第一数据之前,确定所述装置当前所使用的第二解压缩模式与所述确定单元确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同;所述处理单元还用于,基于所述确定单元确定的所述装置当前所使用的第二解压缩模式与所述确定单元确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述装置当前使用的解压缩模式设置为所述第一解压缩模式。
- 根据权利要求17所述的装置,其特征在于,所述接收单元还用于在所述处理单元基于所述装置当前所使用的第二解压缩模式与所述确定单元确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述装置当前使用的解压缩模式设置为所述第一解压缩模式之前,接收所述发送设备发送的第二报文,所述第二报文包括第二压缩数据和第三校验值,所述第二压缩数据由所述发送设备基于所述 第一压缩模式对第二数据压缩获得,所述第三校验值由所述发送设备基于所述第一校验算法对第四校验值处理获得,所述第四校验值由所述发送设备基于所述第二校验算法对所述第二压缩数据处理获得;所述处理单元还用于,通过基于所述第二校验算法对所述接收单元接收到的所述第二报文中包括的所述第二压缩数据进行处理,获得所述第四校验值;并通过基于所述第一校验算法对所述处理单元获得的所述第四校验值进行处理,获得所述第三校验值;所述确定单元还用于,基于所述处理单元获得的所述第三校验值与所述接收单元接收到的所述第二报文中包含的所述第三校验值相同,确定所述第一校验算法是所述发送设备生成所述第二报文时使用的校验算法;并根据所述确定单元确定的所述发送设备生成所述第二报文时使用的校验算法,以及所述第一校验算法与所述第一压缩模式的对应关系,确定所述第一压缩模式是所述发送设备压缩所述第二数据时使用的压缩模式;所述处理单元具体用于,基于所述确定单元确定的所述装置当前所使用的第二解压缩模式与所述确定单元确定的所述发送设备压缩所述第一数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,并基于所述确定单元确定的所述装置当前所使用的第二解压缩模式与所述确定单元确定的所述发送设备压缩所述第二数据时使用的所述第一压缩模式对应的所述第一解压缩模式不同,将所述装置当前使用的解压缩模式设置为所述第一解压缩模式。
Priority Applications (4)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
EP16893849.6A EP3419238B1 (en) | 2016-03-14 | 2016-03-14 | Method, apparatus, and system for transmitting data |
CN201680083196.2A CN108781213B (zh) | 2016-03-14 | 2016-03-14 | 一种用于传输数据的方法、装置和系统 |
PCT/CN2016/076297 WO2017156684A1 (zh) | 2016-03-14 | 2016-03-14 | 一种用于传输数据的方法、装置和系统 |
US16/130,692 US11375047B2 (en) | 2016-03-14 | 2018-09-13 | Data transmission method, apparatus, and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2016/076297 WO2017156684A1 (zh) | 2016-03-14 | 2016-03-14 | 一种用于传输数据的方法、装置和系统 |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US16/130,692 Continuation US11375047B2 (en) | 2016-03-14 | 2018-09-13 | Data transmission method, apparatus, and system |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2017156684A1 true WO2017156684A1 (zh) | 2017-09-21 |
Family
ID=59850552
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2016/076297 WO2017156684A1 (zh) | 2016-03-14 | 2016-03-14 | 一种用于传输数据的方法、装置和系统 |
Country Status (4)
Country | Link |
---|---|
US (1) | US11375047B2 (zh) |
EP (1) | EP3419238B1 (zh) |
CN (1) | CN108781213B (zh) |
WO (1) | WO2017156684A1 (zh) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112534789B (zh) * | 2018-11-14 | 2022-12-27 | Oppo广东移动通信有限公司 | 压缩、解压缩以太帧的方法和通信设备 |
JP2022532020A (ja) | 2019-03-29 | 2022-07-13 | オッポ広東移動通信有限公司 | 圧縮処理方法、解圧縮処理方法及び関連機器 |
CN114077569B (zh) * | 2020-08-18 | 2023-07-18 | 富泰华工业(深圳)有限公司 | 压缩数据的方法及设备、解压缩数据的方法及设备 |
CN112686019A (zh) * | 2020-12-25 | 2021-04-20 | 深圳市元征科技股份有限公司 | 车辆传感器数据解析方法、设备及存储介质 |
CN116527777B (zh) * | 2023-04-23 | 2024-04-23 | 国网湖南省电力有限公司 | 量测数据压缩采集方法及系统、电子设备、存储介质 |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102025737A (zh) * | 2010-12-09 | 2011-04-20 | 中兴通讯股份有限公司 | 微波通信中以太网数据包压缩、传输方法和压缩机、系统 |
CN102377651A (zh) * | 2010-08-13 | 2012-03-14 | 中国移动通信集团公司 | 一种tcp报文的发送方法、接收方法及装置 |
US20120177064A1 (en) * | 2009-11-27 | 2012-07-12 | Zte Corporation | Method and device for user datagram protocol packet compression and decompression |
CN102938683A (zh) * | 2012-09-24 | 2013-02-20 | 华为技术有限公司 | 一种数据处理的方法和装置 |
US20130077601A1 (en) * | 2009-09-18 | 2013-03-28 | Qualcomm Incorporated | Method and apparatus for facilitating compressed mode communications |
CN103384884A (zh) * | 2012-12-11 | 2013-11-06 | 华为技术有限公司 | 一种文件压缩方法、文件解压缩方法、装置及服务器 |
CN104038307A (zh) * | 2013-03-05 | 2014-09-10 | 鸿富锦精密工业(深圳)有限公司 | 数据流传输系统及方法 |
Family Cites Families (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2624299B2 (ja) * | 1988-06-09 | 1997-06-25 | 株式会社日立製作所 | 加速演算回路 |
EP1349285A1 (en) | 2002-03-28 | 2003-10-01 | Matsushita Electric Industrial Co., Ltd. | Method for making efficient use of the bits allocated to the sequence number when transmitting compressed header data |
WO2007136166A1 (en) * | 2006-05-23 | 2007-11-29 | Lg Electronics Inc. | Digital broadcasting system and method of processing data |
JP4974652B2 (ja) * | 2006-11-20 | 2012-07-11 | シャープ株式会社 | ストリーミング通信システム |
US8418037B2 (en) * | 2007-09-03 | 2013-04-09 | Zte Corporation | Method and device for decoding by using window-based least significant bits in robust header compression |
US8176368B2 (en) * | 2009-01-12 | 2012-05-08 | Texas Instruments Incorporated | Error correcting DPCM transcoding |
CN101860904B (zh) * | 2009-04-07 | 2012-11-07 | 上海摩波彼克半导体有限公司 | 基于数据包ip头压缩技术实现校验和计算的方法 |
CN102131234B (zh) * | 2010-01-18 | 2013-12-04 | 华为技术有限公司 | Ip数据包的压缩及解压缩方法和装置 |
CN102143527B (zh) * | 2010-02-03 | 2013-09-11 | 华为技术有限公司 | 嵌套协议包头的压缩方法及装置 |
CN102036307B (zh) * | 2010-12-17 | 2016-04-13 | 中兴通讯股份有限公司 | 鲁棒性头压缩中提高上下文更新报文健壮性的方法和装置 |
US8959130B2 (en) * | 2011-06-30 | 2015-02-17 | Altera Corporation | Compression of floating-point data in encoding groups |
US20150195326A1 (en) * | 2014-01-03 | 2015-07-09 | Qualcomm Incorporated | Detecting whether header compression is being used for a first stream based upon a delay disparity between the first stream and a second stream |
-
2016
- 2016-03-14 WO PCT/CN2016/076297 patent/WO2017156684A1/zh active Application Filing
- 2016-03-14 EP EP16893849.6A patent/EP3419238B1/en active Active
- 2016-03-14 CN CN201680083196.2A patent/CN108781213B/zh active Active
-
2018
- 2018-09-13 US US16/130,692 patent/US11375047B2/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130077601A1 (en) * | 2009-09-18 | 2013-03-28 | Qualcomm Incorporated | Method and apparatus for facilitating compressed mode communications |
US20120177064A1 (en) * | 2009-11-27 | 2012-07-12 | Zte Corporation | Method and device for user datagram protocol packet compression and decompression |
CN102377651A (zh) * | 2010-08-13 | 2012-03-14 | 中国移动通信集团公司 | 一种tcp报文的发送方法、接收方法及装置 |
CN102025737A (zh) * | 2010-12-09 | 2011-04-20 | 中兴通讯股份有限公司 | 微波通信中以太网数据包压缩、传输方法和压缩机、系统 |
CN102938683A (zh) * | 2012-09-24 | 2013-02-20 | 华为技术有限公司 | 一种数据处理的方法和装置 |
CN103384884A (zh) * | 2012-12-11 | 2013-11-06 | 华为技术有限公司 | 一种文件压缩方法、文件解压缩方法、装置及服务器 |
CN104038307A (zh) * | 2013-03-05 | 2014-09-10 | 鸿富锦精密工业(深圳)有限公司 | 数据流传输系统及方法 |
Also Published As
Publication number | Publication date |
---|---|
CN108781213A (zh) | 2018-11-09 |
CN108781213B (zh) | 2020-08-14 |
EP3419238A1 (en) | 2018-12-26 |
US11375047B2 (en) | 2022-06-28 |
EP3419238B1 (en) | 2020-05-06 |
US20190014194A1 (en) | 2019-01-10 |
EP3419238A4 (en) | 2019-03-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2017156684A1 (zh) | 一种用于传输数据的方法、装置和系统 | |
WO2022078509A1 (zh) | IPv6报文的扩展头封装方法及装置 | |
US9166931B2 (en) | Method and device for improving robustness of context update message in robust header compression | |
EP3445094A1 (en) | Wifi configuration method, wifi mobile terminal, and wifi device | |
US8718098B2 (en) | Method for compressing and decompressing time stamp and equipment thereof | |
JP5904347B2 (ja) | データ通信方法、装置、およびシステム | |
EP2472813B1 (en) | Method and device for user datagram protocol packet compression and decompression | |
US8418037B2 (en) | Method and device for decoding by using window-based least significant bits in robust header compression | |
US7733865B2 (en) | Communication apparatus and method | |
WO2017041534A1 (zh) | 一种电力线网络通信的方法及装置、计算机存储介质 | |
CN111277580B (zh) | 节点数据发送方法、接收方法以及传输方法 | |
CN111225077B (zh) | 物联网设备配网方法、装置和系统 | |
EP2190163A1 (en) | A method for repairing the window-based least significant bits decoding in the robust header compression | |
CN111148153B (zh) | 数据包发送方法、接收方法和设备 | |
WO2010087421A1 (ja) | 送受信装置及びデータ処理方法 | |
EP2852082A1 (en) | Information sending method and device | |
CN112422525B (zh) | 一种故障数据传输方法、装置、设备及存储介质 | |
US10051436B2 (en) | Compression with multicast dictionary | |
TWI692947B (zh) | 在傳輸裝置和其對應的傳輸裝置中進行壓縮操作之模式轉換的方法、及傳輸裝置 | |
WO2021036189A1 (zh) | Rdma数据发送及接收方法、电子设备及可读存储介质 | |
CN110138505B (zh) | 一种异构协议转换的crc计算方法及系统 | |
AU2011365883B2 (en) | Method and system for updating reorder depth in robust header compression | |
WO2022257533A1 (zh) | 一种数据传输方法、装置、存储介质及电子装置 | |
BR112017006571B1 (pt) | Aparelho e método para comunicação sem fio |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
WWE | Wipo information: entry into national phase |
Ref document number: 2016893849 Country of ref document: EP |
|
ENP | Entry into the national phase |
Ref document number: 2016893849 Country of ref document: EP Effective date: 20180921 |
|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 16893849 Country of ref document: EP Kind code of ref document: A1 |