Packet processing method and communication device

By introducing a length identifier and field pointers into the message, the resource waste caused by the fixed length of the message bit sequence is solved, enabling flexible configuration and efficient reading, and reducing bit overhead.

CN115694723BActive Publication Date: 2026-04-24HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2021-07-30
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

In existing technologies, the fixed length of the bit sequence in a message indicates the type of the field, resulting in significant bit overhead and serious resource waste, especially when there are few field types.

Method used

The length identifier section indicates the non-fixed length of the field option section, and the field pointer determines the position of the field in the message, thereby decoupling field reading and enabling flexible configuration, and reducing bit overhead.

Benefits of technology

It effectively reduces message bit overhead, saves bit resources, improves field reading efficiency, and is suitable for various different scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115694723B_ABST
    Figure CN115694723B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a message processing method and communication equipment, which are used for reducing bit overhead of a first message and saving bit resources. The method comprises the following steps: a first communication equipment generates a first message, the first message comprises a length identifier part, a field option part and at least one field, the length identifier part is used for indicating the length of the field option part, the field option part indicates the field type of the at least one field according to a first order, and the first order is the indication order of the field type; and the first communication equipment sends the first message to a second communication equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of network technology, and in particular to a message processing method and a communication device. Background Technology

[0002] A message is a data unit exchanged and transmitted in a network. When a sending device sends a message to a receiving device, the message header contains fields. After receiving the message, the receiving device can read the fields in the message header.

[0003] Currently, the message header uses a 16-bit sequence to indicate the types of fields included in the message. A "1" bit in the sequence indicates that the first message includes the field type corresponding to that bit. However, this 16-bit sequence, with its fixed length, leads to significant bit overhead and wasted bit resources. For example, even when the first message contains fewer field types, using the same 16-bit sequence still results in high bit overhead and wasted bit resources. Summary of the Invention

[0004] This application provides a message processing method and a communication device to reduce the bit overhead of a first message and save bit resources.

[0005] The first aspect of this application provides a message processing method, including:

[0006] The first communication device generates a first message, which includes a length identifier portion, a field option portion, and at least one field. The length identifier portion is used to indicate the length of the field option portion, and the field option portion indicates the field type of at least one field in a first order, where the first order is the indication order of the field types. The first communication device sends the first message to the second communication device.

[0007] As can be seen from the above technical solution, the first communication device indicates the length of the field option section through the length identifier portion, meaning the length of the field option section is not fixed. This allows the first communication device to flexibly configure the length of the field option section according to actual needs, reducing the bit overhead of the first message and saving bit resources.

[0008] In one possible implementation, the length identifier portion is also used to indicate that each field in the first message is a fixed-length field.

[0009] In this implementation, the length identifier can also be used to indicate the structure of the first message, so that the second communication device can know the structure of the first message and read the fields in the first message in a corresponding manner. Therefore, the length identifier can indicate both the length of the field option section and the structure of the first message, achieving full and reasonable utilization of the bit resources in the first message, thereby reducing bit overhead and saving bit resources.

[0010] In another possible implementation, the length identifier portion is also used to indicate that the first message includes at least one field pointer; the at least one field includes a first field, the first field corresponding to one or more field pointers among the at least one field pointers, the one or more field pointers being used to determine the position of the first field in the first message.

[0011] In this implementation, the length identifier can also be used to indicate the structure of the first message, so that the second communication device can know the structure of the first message and read the fields in the first message in a corresponding manner. Therefore, the length identifier can indicate both the length of the field option section and the structure of the first message, achieving full and reasonable utilization of the bit resources in the first message, thereby reducing bit overhead and saving bit resources.

[0012] In another possible implementation, the first message further includes a feature identifier portion, which is used to indicate that each field in the first message is a fixed-length field, or the feature identifier portion is used for the first message to include at least one field pointer; the at least one field includes a first field, the first field corresponds to one or more field pointers in the at least one field pointer, and the one or more field pointers are used to determine the position of the first field in the first message.

[0013] In this implementation, the feature identifier portion of the first message is used to indicate the structure of the first message, so that the second communication device can know the structure of the first message and read the fields in the first message in a corresponding manner.

[0014] In another possible implementation, at least one field pointer includes a first field pointer, which corresponds to a field and is used to determine the start bit position or end bit position of the field corresponding to the first field pointer in the first message.

[0015] In this implementation, the start or end bit position of a field is determined by the corresponding field pointer. The reading of different fields is independent of each other; that is, the reading processes of different fields are decoupled. It does not depend on the reading of preceding fields and is unrelated to the field order in the message, thereby improving the efficiency of the device in reading fields.

[0016] In another possible implementation, at least one field pointer includes a second field pointer, which corresponds to the second field and the third field. The second field pointer is used to determine the start bit position of the second field in the first message and to determine the end bit position of the third field in the first message.

[0017] In this implementation, the start bit position of the second field and the end bit position of the third field are determined by corresponding field pointers. The reading of different fields is independent, meaning the reading processes between different fields are decoupled. Reading is independent of the preceding fields and the order of fields in the message, thereby improving the efficiency of field reading by the device. Furthermore, the first communication device indicates the position of a field in the first message using field pointers, and the length of the field is flexible and variable. The length of the field indicated by the field pointer by the first communication device can be non-fixed, meaning the technical solution of this application can be applied to various different scenario requirements.

[0018] In another possible implementation, the first field corresponds to at least one of the third field pointer and the fourth field pointer; the third field pointer is used to determine the start bit position of the first field in the first message, and the fourth field pointer is used to determine the end bit position of the first field in the first message.

[0019] Therefore, it can be seen that the first field corresponds to at least one of the third and fourth field pointers. At least one field pointer is used to determine the position of the first field in the first message. That is, the second communication device can determine the position of the first field in the first message through one or more field pointers corresponding to the first field. During the reading of the first field of the first message, it does not depend on the reading of the preceding fields and is independent of the field order in the message. This improves the efficiency of the device reading fields. The first communication device indicates the position of the first field in the first message through field pointers; that is, the second communication device can determine the start bit position and / or end bit position of the first field through field pointers. The length of the fields in the first message can be flexible and variable, suitable for different scenario requirements.

[0020] In another possible implementation, the first communication device generates a first message, including:

[0021] The first communication device compresses the first bit sequence to obtain a field option portion, the length of which is less than the length of the first bit sequence. The "1" bits in the first bit sequence are used to indicate the field type of at least one field in a first order.

[0022] In the above implementation, the first communication device compresses the first bit sequence to obtain the field option portion, and the length of the field option portion is less than the length of the first bit sequence. This reduces the bit overhead in the first message.

[0023] In another possible implementation, the field options section includes a first segment structure and a second segment structure. The first segment structure includes a first segment pattern identifier, and the second segment structure includes a second segment pattern identifier and a second bit sequence.

[0024] The first segmentation mode identifier is used to indicate that the third bit sequence is omitted in the field option section, and the bits in the third bit sequence are all "1" bits or all "0" bits; the second segmentation mode identifier is used to indicate that the second bit sequence contains "1" bits and that the second segmentation structure is the last segmentation structure in the field option section; the last bit of the third bit sequence is concatenated with the first bit of the second bit sequence to obtain the first bit sequence.

[0025] The above implementation illustrates one possible structure for the field options section, which is a compressed bit sequence of the first bit sequence. As can be seen from the above implementation, the field options section is significantly shorter than the length of the first bit sequence while correctly indicating the field type of the first message, thereby reducing the bit overhead of the first message.

[0026] In another possible implementation, the first segmentation structure also includes a first quantity indicator section, which is used to indicate that the field option section omits X third bit sequences, the X third bit sequences constitute a fourth bit sequence, and the fourth bit sequence includes all bits in the X third bit sequences, where X is an integer greater than or equal to 1.

[0027] The second segmentation structure includes a second quantity indicator, which indicates that the second bit sequence includes Y bit sequence units, and the length of each bit sequence unit in the Y bit sequence units is the same as the length of the third bit sequence, where Y is an integer greater than or equal to 1.

[0028] The last bit of the fourth bit sequence is concatenated with the first bit of the second bit sequence to obtain the first bit sequence.

[0029] In the above implementation, the number of bit sequences omitted in the field options section is indicated more flexibly by the quantity indicator part in the segmented structure, so as to better reduce the number of bits occupied by the field options section and save bit overhead of the first message.

[0030] In another possible implementation, at least one field is ordered in a first order; at least one field pointer includes a first type field pointer, which is a field pointer corresponding to two fields; the first type field pointers are ordered according to the field type indication order of either of the two fields corresponding to the first type field pointer.

[0031] This implementation illustrates the sorting order of at least one field and at least one field pointer of a first type, so that the second communication device can determine the field pointer corresponding to each field, thereby quickly reading the corresponding field. This improves the efficiency of the second communication device in reading fields.

[0032] In another possible implementation, at least one field pointer includes a second type field pointer, which is a field pointer corresponding to a single field;

[0033] The last field pointer in at least one field pointer is a second type field pointer, the last field pointer corresponds to the last field in the at least one field, and the last field pointer is located after the first type field pointer in the at least one field pointer.

[0034] This implementation illustrates the positional relationship between the last field pointer and the first type field pointer of the first message, so that the second communication device can determine the field pointer corresponding to the field and thus quickly read the corresponding field.

[0035] In another possible implementation, at least one field includes N fields, and at least one field pointer includes N field pointers; the i-th field corresponds to the (i-1)-th field pointer and the i-th field pointer, the (i-1)-th field pointer is used to indicate the start bit position of the i-th field in the first message, and the i-th field pointer is used to indicate the end bit position of the i-th field in the first message, where N is an integer greater than or equal to 1, and i is an integer greater than or equal to 2 and less than or equal to N.

[0036] In the above implementation, the field pointer corresponding to each field can be determined by the sorting relationship of at least one field pointer, so that the second communication device can quickly determine the field pointer corresponding to each field, thereby quickly reading the corresponding field and improving the efficiency of the second communication device in reading fields.

[0037] In another possible implementation, the bits occupied by any two adjacent field pointers in at least one field pointer are consecutive; the bits occupied by any two adjacent fields in at least one field are consecutive; the last bit occupied by the field option portion is consecutive with the first bit occupied by at least one field pointer; and the last bit occupied by at least one field pointer is consecutive with the first bit occupied by at least one field.

[0038] In the above implementation, the field options section, at least one field, and at least one field pointer are consecutive, thereby saving bit resources occupied by the first message.

[0039] In another possible implementation, the first field of the N fields is positioned at the start bit position of the first message equal to the length of the field options section plus the length of the N field pointers; the first field pointer of the N field pointers is used to indicate the end bit position of the first field in the first message.

[0040] The above implementation illustrates how to determine the position of the first field, making the solution more complete. The second communication device can determine the position of each field so that it can read any field of the first message.

[0041] In another possible implementation, the length of each of the N field pointers is equal;

[0042] The value of the j-th field pointer is offset. j =l Bitmap +w Bitmap *l offset +l (1,j) ;

[0043] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,j) It is the sum of the lengths of the first to the jth fields out of N fields, where j is an integer greater than or equal to 1 and less than or equal to N.

[0044] The above implementation illustrates how to calculate the values ​​of N field pointers so that the second communication device can determine the position of each field.

[0045] In another possible implementation, the first field pointer of at least one field pointer is a second type field pointer, the first field pointer corresponds to the first field among the at least one field, and the first field pointer is located before the first type field pointer among the at least one field pointer.

[0046] In this implementation, the positional relationship between the first field pointer and the first type field pointer of the first message is illustrated, so that the second communication device can determine the field pointer corresponding to the field and thus quickly read the corresponding field.

[0047] In another possible implementation, at least one field includes N fields, and at least one field pointer includes N+1 field pointers; the b-th field corresponds to the b-th field pointer and the b+1-th field pointer, the b-th field pointer is used to indicate the start bit position of the b-th field in the first message, and the b+1-th field pointer is used to indicate the end bit position of the b-th field in the first message, where N is an integer greater than or equal to 1, and b is an integer greater than or equal to 1 and less than or equal to N.

[0048] In the above implementation, the field pointer corresponding to each field can be determined by the sorting relationship of at least one field pointer, so that the second communication device can quickly determine the field pointer corresponding to each field, thereby quickly reading the corresponding field and improving the efficiency of the second communication device in reading fields.

[0049] In another possible implementation, the length of each of the N+1 field pointers is equal;

[0050] The value of the first field pointer is offset1 = l Bitmap +w Bitmap *l offset ;

[0051] The value of the pointer to the a-th field is offset. a =l Bitmap +w Bitmap *l offset +l (1,a-1) ;

[0052] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,a-1) It is the sum of the lengths of the first to the (a-1)th fields out of N fields, where a is an integer greater than or equal to 2 and less than or equal to N+1.

[0053] The above implementation illustrates how to calculate the values ​​of N field pointers so that the second communication device can determine the position of each field.

[0054] A second aspect of this application provides a message processing method, including:

[0055] The second communication device receives a first message from the first communication device. The first message includes a length identifier portion, a field option portion, and at least one field. The length identifier portion is used to indicate the length of the field option portion. The field option portion indicates the field type of at least one field in a first order, where the first order is the indication order of the field types. The second communication device determines the length of the field option portion based on the length identifier portion. The second communication device determines that a first field exists in the first message based on the first order and the length of the field option portion. The second communication device reads the value of the first field.

[0056] As can be seen from the above technical solution, the second communication device determines the length of the field option section through the length identifier portion, meaning the length of the field option section is not fixed. This means the first communication device can flexibly configure the length of the field option section according to the fields indicated by actual needs. This reduces the bit overhead of the first message and saves bit resources.

[0057] In one possible implementation, the length identifier portion is also used to indicate that each field in the first message is a fixed-length field.

[0058] In this implementation, the length identifier can also be used to indicate the structure of the first message, so that the second communication device can know the structure of the first message and read the fields in the first message in a corresponding manner. Therefore, the length identifier can indicate both the length of the field option section and the structure of the first message, achieving full and reasonable utilization of the bit resources in the first message, thereby reducing bit overhead and saving bit resources.

[0059] In another possible implementation, the last bit of the length identifier portion is consecutive to the first bit of the field option portion, and at least two adjacent fields of at least one field occupy consecutive bits; the last bit of the field option portion is consecutive to the first bit of at least one field; the second communication device reads the value of the first field, including:

[0060] The second communication device determines the first field as the c-th field among the at least one fields based on the field option section, where c is an integer greater than 1;

[0061] The second communication device uses the sum of the length of the field option portion and the first length as the value of the first field, where the first length is the length of each field multiplied by c-1.

[0062] The above implementation illustrates the process of a second communication device reading the first field. The length identifier indicates that each field in the first message is of fixed length. The second communication device learns the structure of the first message through the length identifier and reads the fields accordingly, which improves the efficiency of the second communication device in reading fields.

[0063] In another possible implementation, the length identifier portion is also used to indicate that the first message includes at least one field pointer; the at least one field includes the first field, the first field corresponds to one or more field pointers among the at least one field pointers, and the one or more field pointers are used to determine the position of the first field in the first message; the second communication device reads the value of the first field, including: the second communication device reads the value of the first field according to one or more field pointers.

[0064] The above implementation illustrates the process of a second communication device reading the first field. The length identifier indicates that the first message contains at least one field pointer. The second communication device learns the structure of the first message through the length identifier and reads the fields in the first message accordingly, which helps improve the efficiency of the second communication device in reading fields.

[0065] In another possible implementation, the first field corresponds to at least one of the pointers to the third and fourth fields;

[0066] The second communication device reads the value of the first field based on one or more field pointers, including:

[0067] The second communication device determines the start bit position of the first field in the first message based on the third field pointer, and / or determines the end bit position of the first field in the first message based on the fourth field pointer;

[0068] The second communication device reads the value of the first field from the first message based on the start bit position and / or end bit position.

[0069] The above implementation illustrates the process by which a second communication device reads the first field through one or more field pointers corresponding to the first field. It is evident that the reading of different fields is independent, meaning the reading processes between different fields are decoupled. Reading is independent of the preceding fields and the order of fields in the message, thereby improving the efficiency of field reading. Furthermore, the second communication device reads the position of the first field in the first message through field pointers, and the length of the first field is flexible and variable. Therefore, the technical solution of this application can be applied to various different scenario requirements.

[0070] In another possible implementation, the first message further includes a feature identifier portion, which is used to indicate that each field in the first message is a fixed-length field, or the feature identifier portion is used for the first message to include at least one field pointer; the at least one field includes a first field, the first field corresponds to one or more field pointers among the at least one field pointers, and the one or more field pointers are used to determine the position of the first field in the first message.

[0071] In this implementation, the feature identifier portion of the first message is used to indicate the structure of the first message, so that the second communication device can know the structure of the first message and read the fields in the first message in a corresponding manner. This improves the efficiency of the second communication device in reading fields.

[0072] In another possible implementation, at least one field pointer includes a first field pointer, which corresponds to a field and is used to determine the start bit position or end bit position of the field corresponding to the first field pointer in the first message.

[0073] In this implementation, the start or end bit position of a field is determined by the corresponding field pointer. Reading different fields is independent of each other; that is, the reading processes between different fields are decoupled. Reading fields does not depend on the preceding fields and is independent of the field order in the message, thereby improving the efficiency of the device in reading fields.

[0074] In another possible implementation, at least one field pointer includes a second field pointer, which corresponds to the second field and the third field. The second field pointer is used to determine the start bit position of the second field in the first message and to determine the end bit position of the third field in the first message.

[0075] In this implementation, the start bit position of the second field and the end bit position of the third field are determined by corresponding field pointers. The reading of different fields is independent of each other, meaning the reading processes between different fields are decoupled. Reading is independent of the preceding fields and the order of fields in the message, thereby improving the efficiency of field reading by the device. Furthermore, the second communication device indicates the position of a field in the first message using field pointers, and the length of the field is flexible and variable. Therefore, the technical solution of this application can be applied to various different scenario requirements.

[0076] In another possible implementation, the second communication device determines the presence of a first field in the first message based on the first order and the length of the field options portion, including:

[0077] The second communication device determines the field option section based on the length of the field option section;

[0078] The second communication device determines that the first field exists in the first message based on the first sequence and field options section.

[0079] The above implementation illustrates the process by which a second communication device can determine the fields contained in a first message so that the second communication device can read the required fields from the first message.

[0080] Another possible implementation includes:

[0081] The second communication device parses the field option portion to obtain the first bit sequence. The first bit sequence is the bit sequence before compression of the field option portion. The "1" bit in the first bit sequence is used to indicate the field type of at least one field in a first order. The length of the field option portion is less than the length of the first bit sequence.

[0082] The second communication device determines that the first field exists in the first message based on the first sequence and field options portion, including:

[0083] The second communication device determines that the first field exists in the first message based on the first bit sequence and the first order.

[0084] In the above implementation, the field option portion is compressed, thereby reducing the bit overhead in the first message. Therefore, the second communication device can parse the field option portion, restore the first bit sequence, and then determine the field types contained in the first message using the first bit sequence.

[0085] In another possible implementation, the field options section includes a first segment structure and a second segment structure. The first segment structure includes a first segment pattern identifier, and the second segment structure includes a second segment pattern identifier and a second bit sequence.

[0086] The first segmentation mode identifier is used to indicate that the third bit sequence is omitted in the field option section, and the bits in the third bit sequence are all "1" bits or all "0" bits;

[0087] The second segmentation pattern identifier is used to indicate that the second bit sequence contains a "1" bit and that the second segmentation structure is the last segmentation structure in the field options section;

[0088] The second communication device parses the field option portion according to its length to obtain the first bit sequence, including:

[0089] The second communication device determines the first segment structure and the second segment structure based on the length of the field option portion;

[0090] The second communication device determines the third bit sequence based on the first segmentation pattern identifier portion;

[0091] The second communication device determines the second bit sequence based on the second segmentation mode identifier portion;

[0092] The second communication device concatenates the last bit of the third bit sequence with the first bit of the second bit sequence according to the second segmentation mode identifier to obtain the first bit sequence.

[0093] The above implementation illustrates a possible structure for the field options section and the process by which the second communication device parses the field options section, which is a compressed bit sequence of the first bit sequence. As can be seen from the above implementation, the field options section, while correctly indicating the field type of the first message, is significantly shorter than the length of the first bit sequence, thereby reducing the bit overhead of the first message.

[0094] In another possible implementation, the field options section includes a first segment structure and a second segment structure. The first segment structure includes a first segment pattern identifier and a first quantity indicator. The second segment structure includes a second segment pattern identifier, a second quantity indicator, and a second bit sequence.

[0095] The first segmentation mode identifier indicates that the third bit sequence is omitted in the field option section, and the bits in the third bit sequence are all "1" bits or all "0" bits; the first quantity indicator indicates that X third bit sequences are omitted in the field option section, where X is an integer greater than or equal to 1; the second segmentation mode identifier indicates that the second bit sequence contains "1" bits and that the second segmentation structure is the last segmentation structure in the field option section; the second quantity indicator indicates that the second bit sequence includes Y bit sequence units, and the length of each bit sequence unit in the Y bit sequence units is the same as the length of the third bit sequence, where Y is an integer greater than or equal to 1;

[0096] The second communication device parses the field option portion to obtain a first bit sequence, including:

[0097] The second communication device determines the X third bit sequence omitted in the field option section based on the first quantity indication section and the first segmentation mode identifier section;

[0098] The second communication device constructs a fourth bit sequence using X third bit sequences, and the fourth bit sequence includes all bits in the X third bit sequences.

[0099] The second communication device determines the second bit sequence based on the second segmentation mode identifier portion and the second quantity indication portion;

[0100] The second communication device concatenates the last bit of the fourth bit sequence with the first bit of the second bit sequence according to the second segmentation mode identifier portion to obtain the first bit sequence.

[0101] In the above implementation, the number of bit sequences omitted in the field options section is indicated more flexibly by the quantity indicator part in the segmented structure, so as to better reduce the number of bits occupied by the field options section and save bit overhead of the first message.

[0102] In another possible implementation, at least one field is ordered in a first order; at least one field pointer includes a first type field pointer, which is a field pointer corresponding to two fields;

[0103] The first type field pointers are ordered according to the field type indication order of either of the two fields corresponding to the first type field pointer.

[0104] This implementation illustrates the sorting order of at least one field and at least one field pointer of a first type, so that the second communication device can determine the field pointer corresponding to each field, thereby quickly reading the corresponding field. This improves the efficiency of the second communication device in reading fields.

[0105] In another possible implementation, at least one field pointer includes a second type field pointer, which is a field pointer corresponding to a single field;

[0106] The last field pointer in at least one field pointer is a second type field pointer, the last field pointer corresponds to the last field in at least one field, and the last field pointer is located after the first type field pointer in at least one field pointer.

[0107] This implementation illustrates the positional relationship between the last field pointer and the first type field pointer of the first message, so that the second communication device can determine the field pointer corresponding to the field and thus quickly read the corresponding field.

[0108] In another possible implementation, at least one field includes N fields, and at least one field includes N field pointers; the i-th field corresponds to the (i-1)-th field pointer and the i-th field pointer, the (i-1)-th field pointer is used to indicate the start bit position of the i-th field in the first message, and the i-th field pointer is used to indicate the end bit position of the i-th field in the first message, where N is an integer greater than or equal to 1, and i is an integer greater than or equal to 2 and less than or equal to N.

[0109] In the above implementation, the field pointer corresponding to each field can be determined by the sorting relationship of at least one field pointer, so that the second communication device can quickly determine the field pointer corresponding to each field, thereby quickly reading the corresponding field and improving the efficiency of the second communication device in reading fields.

[0110] In another possible implementation, the bits occupied by any two adjacent field pointers in at least one field pointer are consecutive, and the bits occupied by any two adjacent fields in at least one field are consecutive; the last bit occupied by the field option portion is consecutive with the first bit occupied by at least one field pointer, and the last bit occupied by at least one field pointer is consecutive with the first bit occupied by at least one field.

[0111] In the above implementation, the field options section, at least one field, and at least one field pointer are consecutive, thereby saving bit resources occupied by the first message.

[0112] In another possible implementation, the first field of the N fields is positioned at the start bit position of the first message equal to the length of the field options section plus the length of the N field pointers; the first field pointer of the N field pointers is used to indicate the end bit position of the first field in the first message.

[0113] The above implementation illustrates how to determine the position of the first field, making the solution more complete. The second communication device can determine the position of each field so that it can read any field of the first message.

[0114] In another possible implementation, the length of each of the N field pointers is equal;

[0115] The value of the j-th field pointer is offset. j =l Bitmap +w Bitmap *l offset +l (1,j) ;

[0116] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,j) It is the sum of the lengths of the first to the jth fields in at least one field.

[0117] The above implementation illustrates how to calculate the values ​​of N field pointers so that the second communication device can determine the position of each field.

[0118] In another possible implementation, the first field pointer of at least one field pointer is a second type field pointer, the first field pointer corresponds to the first field among the at least one field, and the first field pointer is located before the first type field pointer among the at least one field pointer.

[0119] In this implementation, the positional relationship between the first field pointer and the first type field pointer of the first message is illustrated, so that the second communication device can determine the field pointer corresponding to the field and thus quickly read the corresponding field.

[0120] In another possible implementation, at least one field includes N fields, and at least one field pointer includes N+1 field pointers; the b-th field corresponds to the b-th field pointer and the b+1-th field pointer; N is an integer greater than or equal to 1, and b is an integer greater than or equal to 1 and less than or equal to N;

[0121] The pointer to the b-th field is used to indicate the start bit position of the b-th field in the first message; the pointer to the (b+1)-th field is used to indicate the end bit position of the b-th field in the first message.

[0122] In the above implementation, the field pointer corresponding to each field can be determined by the sorting relationship of at least one field pointer, so that the second communication device can quickly determine the field pointer corresponding to each field, thereby quickly reading the corresponding field and improving the efficiency of the second communication device in reading fields.

[0123] In another possible implementation, the length of each of the N+1 field pointers is equal;

[0124] The value of the first field pointer is offset1 = l Bitmap +w Bitmap *l offset ;

[0125] The value of the pointer to the a-th field is offset. a =l Bitmap +w Bitmap *l offset +l (1,a-1) ;

[0126] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,a-1) It is the sum of the lengths of the first to the (a-1)th fields out of N fields, where a is an integer greater than or equal to 2 and less than or equal to N+1.

[0127] The above implementation illustrates how to calculate the values ​​of N field pointers so that the second communication device can determine the position of each field.

[0128] A third aspect of this application provides a message processing method, including:

[0129] A first communication device generates a first message, which includes a field option section, at least one field pointer, and at least one field. The field option section indicates the field type of at least one field in a first order, where the first order is the order in which the field types are indicated. The at least one field includes a first field, which corresponds to one or more field pointers among the at least one field pointers. The one or more field pointers are used to determine the position of the first field in the first message. The first communication device sends the first message to a second communication device.

[0130] In the above technical solution, one or more field pointers corresponding to the first field are used to determine the position of the first field in the first message. That is, the second communication device can determine the position of the first field in the first message through one or more field pointers corresponding to the first field. During the reading of any field in the first message, it does not depend on the reading of the preceding fields and is independent of the field order in the message. This improves the efficiency of the device reading fields. Since the first communication device indicates the position of the first field in the first message through field pointers, the second communication device can determine the start bit position and / or end bit position of the first field through the field pointers. Therefore, the length of the fields in the first message is flexible and variable, suitable for different scenario requirements.

[0131] In one possible implementation, at least one field pointer includes a first field pointer, which corresponds to a field and is used to determine the start bit position or end bit position of the field corresponding to the first field pointer in the first message.

[0132] In this implementation, the start or end bit position of a field is determined by the corresponding field pointer. Reading different fields is independent of each other; that is, the reading processes between different fields are decoupled. Reading fields does not depend on the preceding fields and is independent of the field order in the message, thereby improving the efficiency of the device in reading fields.

[0133] In another possible implementation, at least one field pointer includes a second field pointer, which corresponds to the second field and the third field. The second field pointer is used to determine the start bit position of the second field in the first message and to determine the end bit position of the third field in the first message.

[0134] In this implementation, the start bit position of the second field and the end bit position of the third field are determined by corresponding field pointers. The reading of different fields is independent, meaning the reading processes between different fields are decoupled. Reading is independent of the preceding fields and the order of fields in the message, thereby improving the efficiency of field reading by the device. Furthermore, the first communication device indicates the position of a field in the first message using field pointers, and the length of the field is flexible and variable. The length of the field indicated by the field pointer by the first communication device can be non-fixed, meaning the technical solution of this application can be applied to various different scenario requirements.

[0135] In another possible implementation, the first field corresponds to at least one of the third field pointer and the fourth field pointer; the third field pointer is used to determine the start bit position of the first field in the first message, and the fourth field pointer is used to determine the end bit position of the first field in the first message.

[0136] Therefore, it can be seen that the first field corresponds to at least one of the third and fourth field pointers. At least one field pointer is used to determine the position of the first field in the first message. That is, the second communication device can determine the position of the first field in the first message through one or more field pointers corresponding to the first field. During the reading of the first field of the first message, it does not depend on the reading of the preceding fields and is independent of the field order in the message. This improves the efficiency of the device reading fields. The first communication device indicates the position of the first field in the first message through field pointers; that is, the second communication device can determine the start bit position and / or end bit position of the first field through field pointers. The length of the fields in the first message is flexible and variable, suitable for different scenario requirements.

[0137] In another possible implementation, the first message also includes a length identifier portion, which is used to indicate the length of the field options portion.

[0138] As can be seen from the above technical solution, the first communication device indicates the length of the field option section through the length identifier portion, meaning the length of the field option section is not fixed. This allows the first communication device to flexibly configure the length of the field option section according to actual needs, reducing the bit overhead of the first message and saving bit resources.

[0139] In another possible implementation, the first communication device generates a first message, including:

[0140] The first communication device compresses the first bit sequence to obtain a field option portion. The length of the field option portion is less than the length of the first bit sequence. The "1" bits in the first bit sequence are used to indicate the field type of at least one field in a first order.

[0141] In the above implementation, the first communication device compresses the first bit sequence to obtain the field option portion, and the length of the field option portion is less than the length of the first bit sequence. This reduces the bit overhead in the first message.

[0142] In another possible implementation, the field options section includes a first segment structure and a second segment structure. The first segment structure includes a first segment pattern identifier, and the second segment structure includes a second segment pattern identifier and a second bit sequence.

[0143] The first segmentation mode identifier is used to indicate that the third bit sequence is omitted in the field option section, and the bits in the third bit sequence are all "1" bits or all "0" bits;

[0144] The second segmentation pattern identifier is used to indicate that the second bit sequence contains a "1" bit and that the second segmentation structure is the last segmentation structure in the field options section;

[0145] The first bit sequence is obtained by concatenating the last bit of the third bit sequence with the first bit of the second bit sequence.

[0146] The above implementation illustrates one possible structure for the field options section, which is a compressed bit sequence of the first bit sequence. As can be seen from the above implementation, the field options section is significantly shorter than the length of the first bit sequence while correctly indicating the field type of the first message, thereby reducing the bit overhead of the first message.

[0147] In another possible implementation, the first segmentation structure also includes a first quantity indicator section, which is used to indicate that the field option section omits X third bit sequences, the X third bit sequences constitute a fourth bit sequence, and the fourth bit sequence includes all bits in the X third bit sequences, where X is an integer greater than or equal to 1.

[0148] The second segmentation structure includes a second quantity indicator, which indicates that the second bit sequence includes Y bit sequence units, and the length of each bit sequence unit in the Y bit sequence units is the same as the length of the third bit sequence, where Y is an integer greater than or equal to 1.

[0149] The last bit of the fourth bit sequence is concatenated with the first bit of the second bit sequence to obtain the first bit sequence.

[0150] In the above implementation, the number of bit sequences omitted in the field options section is indicated more flexibly by the quantity indicator part in the segmented structure, so as to better reduce the number of bits occupied by the field options section and save bit overhead of the first message.

[0151] In another possible implementation, at least one field is ordered according to the first order; at least one field pointer includes a first type field pointer, which is a field pointer corresponding to two fields;

[0152] The first type field pointers are ordered according to the field type indication order of either of the two fields corresponding to the first type field pointer.

[0153] This implementation illustrates the sorting order of at least one field and at least one field pointer of a first type, so that the second communication device can determine the field pointer corresponding to each field, thereby quickly reading the corresponding field. This improves the efficiency of the second communication device in reading fields.

[0154] In another possible implementation, at least one field pointer includes a second type field pointer, which is a field pointer corresponding to a single field;

[0155] The last field pointer in at least one field pointer is a field pointer of the second type, the last field pointer corresponds to the last field in at least one field, and the last field pointer is located after the first type field pointer in at least one field pointer.

[0156] This implementation illustrates the positional relationship between the last field pointer and the first type field pointer of the first message, so that the second communication device can determine the field pointer corresponding to the field and thus quickly read the corresponding field.

[0157] In another possible implementation, at least one field includes N fields, and at least one field pointer includes N field pointers; the i-th field corresponds to the (i-1)-th field pointer and the i-th field pointer, the (i-1)-th field pointer is used to indicate the start bit position of the i-th field in the first message, and the i-th field pointer is used to indicate the end bit position of the i-th field in the first message, where N is an integer greater than or equal to 1, and i is an integer greater than or equal to 2 and less than or equal to N.

[0158] In the above implementation, the field pointer corresponding to each field can be determined by the sorting relationship of at least one field pointer, so that the second communication device can quickly determine the field pointer corresponding to each field, thereby quickly reading the corresponding field and improving the efficiency of the second communication device in reading fields.

[0159] In another possible implementation, the bits occupied by any two adjacent field pointers in at least one field pointer are consecutive; the bits occupied by any two adjacent fields in at least one field are consecutive; the last bit occupied by the field option portion is consecutive with the first bit occupied by at least one field pointer; and the last bit occupied by at least one field pointer is consecutive with the first bit occupied by at least one field.

[0160] In the above implementation, the field options section, at least one field, and at least one field pointer are consecutive, thereby saving bit resources occupied by the first message.

[0161] In another possible implementation, the first field of the N fields is positioned at the start bit position of the first message equal to the length of the field options section plus the length of the N field pointers; the first field pointer of the N field pointers is used to indicate the end bit position of the first field in the first message.

[0162] The above implementation illustrates how to determine the position of the first field, making the solution more complete. The second communication device can determine the position of each field so that it can read any field of the first message.

[0163] In another possible implementation, the length of each of the N field pointers is equal;

[0164] The value of the j-th field pointer is offset. j =l Bitmap +w Bitmap *l offset +l (1,j) ;

[0165] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,j) It is the sum of the lengths of the first to the jth fields out of N fields, where j is an integer greater than or equal to 1 and less than or equal to N.

[0166] The above implementation illustrates how to calculate the values ​​of N field pointers so that the second communication device can determine the position of each field.

[0167] In another possible implementation, the first field pointer of at least one field pointer is a second type field pointer, the first field pointer corresponds to the first field in at least one field, and the first field pointer is located before the first type field pointer in at least one field pointer.

[0168] In this implementation, the positional relationship between the first field pointer and the first type field pointer of the first message is illustrated, so that the second communication device can determine the field pointer corresponding to the field and thus quickly read the corresponding field.

[0169] In another possible implementation, at least one field includes N fields, and at least one field pointer includes N+1 field pointers; the b-th field corresponds to the b-th field pointer and the b+1-th field pointer, the b-th field pointer is used to indicate the start bit position of the b-th field in the first message, and the b+1-th field pointer is used to indicate the end bit position of the b-th field in the first message, where N is an integer greater than or equal to 1, and b is an integer greater than or equal to 1 and less than or equal to N.

[0170] In the above implementation, the field pointer corresponding to each field can be determined by the sorting relationship of at least one field pointer, so that the second communication device can quickly determine the field pointer corresponding to each field, thereby quickly reading the corresponding field and improving the efficiency of the second communication device in reading fields.

[0171] In another possible implementation, the length of each of the N+1 field pointers is equal;

[0172] The value of the first field pointer is offset1 = l Bitmap +w Bitmap *l offset ;

[0173] The value of the pointer to the a-th field is offset. a =l Bitmap +w Bitmap *l offset +l (1,a-1) ;

[0174] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,a-1) It is the sum of the lengths of the first to the (a-1)th fields out of N fields, where a is an integer greater than or equal to 2 and less than or equal to N+1.

[0175] The above implementation illustrates how to calculate the values ​​of N field pointers so that the second communication device can determine the position of each field.

[0176] A fourth aspect of this application provides a message processing method, including:

[0177] The second communication device receives a first message from the first communication device. The first message includes a field option section, at least one field pointer, and at least one field. The field option section indicates the field type of at least one field in a first order, where the first order is the order in which the field types are indicated. The second communication device determines that the first message contains a first field based on the first order and the field option section. The second communication device determines one or more field pointers corresponding to the first field from the at least one field pointer. The second communication device determines the position of the first field in the first message based on the one or more field pointers. The second communication device reads the value of the first field from the first message based on the position of the first field in the first message.

[0178] In the above technical solution, one or more field pointers corresponding to the first field are used to determine the position of the first field in the first message. That is, the second communication device can determine the position of the first field in the first message through one or more field pointers corresponding to the first field. During the reading of any field in the first message, it does not depend on the reading of the preceding fields and is independent of the field order in the message. This improves the efficiency of the device reading fields. Since the first communication device indicates the position of the first field in the first message through field pointers, the second communication device can determine the start bit position and / or end bit position of the first field through the field pointers. Therefore, the length of the fields in the first message is flexible and variable, suitable for different scenario requirements.

[0179] In one possible implementation, at least one field pointer includes a first field pointer, which corresponds to a field and is used to determine the start bit position or end bit position of the field corresponding to the first field pointer in the first message.

[0180] In this implementation, the start or end bit position of a field is determined by the corresponding field pointer. Reading different fields is independent of each other; that is, the reading processes between different fields are decoupled. Reading fields does not depend on the preceding fields and is independent of the field order in the message, thereby improving the efficiency of the device in reading fields.

[0181] In another possible implementation, at least one field pointer includes a second field pointer, which corresponds to the second field and the third field. The first field pointer is used to determine the start bit position of the second field in the first message and to determine the end bit position of the third field in the first message.

[0182] In this implementation, the start bit position of the second field and the end bit position of the third field are determined by corresponding field pointers. The reading of different fields is independent of each other, meaning the reading processes between different fields are decoupled. Reading is independent of the preceding fields and the order of fields in the message, thereby improving the efficiency of field reading by the device. Furthermore, the second communication device determines the position of a field in the first message using field pointers, and the length of the field is flexible and variable. Therefore, the technical solution of this application can be applied to various different scenario requirements.

[0183] In another possible implementation, the first field corresponds to at least one of the pointers to the third and fourth fields;

[0184] The second communication device determines the position of the first field in the first message based on one or more field pointers, including:

[0185] The second communication device determines the start bit position of the first field in the first message based on the third field pointer, and / or determines the end bit position of the first field in the first message based on the fourth field pointer;

[0186] The second communication device reads the value of the first field from the first message according to the position of the first field in the first message, including:

[0187] The second communication device reads the value of the first field from the first message based on the start bit position and / or end bit position.

[0188] The above implementation illustrates the process by which a second communication device reads the first field through one or more field pointers corresponding to the first field. It is evident that the reading of different fields is independent, meaning the reading processes between different fields are decoupled. Reading is independent of the preceding fields and the order of fields in the message, thereby improving the efficiency of field reading. Furthermore, the second communication device reads the position of the first field in the first message through field pointers, and the length of the first field is flexible and variable. Therefore, the technical solution of this application can be applied to various different scenario requirements.

[0189] In another possible implementation, the first message also includes a length identifier portion, which is used to indicate the length of the field options portion. Other methods for this include:

[0190] The second communication device determines the length of the field option section based on the length identifier section.

[0191] As can be seen from the above implementation, the second communication device determines the length of the field option section through the length identifier portion, meaning the length of the field option section is not fixed. This means the first communication device can flexibly configure the length of the field option section according to the fields indicated by actual needs. This reduces the bit overhead of the first message and saves bit resources.

[0192] In another possible implementation, the second communication device determines that the first message contains a first field based on the field options portion and the first order, including:

[0193] The second communication device parses the field option portion to obtain the first bit sequence. The first bit sequence is the bit sequence before compression of the field option portion. The "1" bit in the first bit sequence is used to indicate the field type of at least one field in a first order. The length of the field option portion is less than the length of the first bit sequence.

[0194] The second communication device determines that the first message contains the first field based on the first bit sequence and the first order.

[0195] In the above implementation, the field option portion is compressed, thereby reducing the bit overhead in the first message. Therefore, the second communication device can parse the field option portion, restore the first bit sequence, and then determine the field types contained in the first message using the first bit sequence.

[0196] In another possible implementation, the field options section includes a first segment structure and a second segment structure. The first segment structure includes a first segment pattern identifier, and the second segment structure includes a second segment pattern identifier and a second bit sequence.

[0197] The first segmentation mode identifier is used to indicate that the third bit sequence is omitted in the field option section, and the bits in the third bit sequence are all "1" bits or all "0" bits;

[0198] The second segmentation pattern identifier is used to indicate that the second bit sequence contains a "1" bit and that the second segmentation structure is the last segmentation structure in the field options section;

[0199] The second communication device parses the field options section to obtain the first bit sequence, including:

[0200] The second communication device determines the third bit sequence based on the first segmentation pattern identifier portion;

[0201] The second communication device determines the second bit sequence based on the second segmentation mode identifier portion;

[0202] The second communication device concatenates the last bit of the third bit sequence with the first bit of the second bit sequence according to the second segmentation mode identifier to obtain the first bit sequence.

[0203] The above implementation illustrates a possible structure for the field options section and the process by which the second communication device parses the field options section, which is a compressed bit sequence of the first bit sequence. As can be seen from the above implementation, the field options section, while correctly indicating the field type of the first message, is significantly shorter than the length of the first bit sequence, thereby reducing the bit overhead of the first message.

[0204] In another possible implementation, the field options section includes a first segment structure and a second segment structure. The first segment structure includes a first segment pattern identifier and a first quantity indicator. The second segment structure includes a second segment pattern identifier, a second quantity indicator, and a second bit sequence.

[0205] The first segmentation mode identifier indicates that the third bit sequence is omitted in the field option section, and the bits in the third bit sequence are all "1" bits or all "0" bits; the first quantity indicator indicates that X third bit sequences are omitted in the field option section, where X is an integer greater than or equal to 1; the second segmentation mode identifier indicates that the second bit sequence contains "1" bits and that the second segmentation structure is the last segmentation structure in the field option section; the second quantity indicator indicates that the second bit sequence includes Y bit sequence units, and the length of each bit sequence unit in the Y bit sequence units is the same as the length of the third bit sequence, where Y is an integer greater than or equal to 1;

[0206] The second communication device parses the field options section to obtain the first bit sequence, including:

[0207] The second communication device determines the X third bit sequence omitted in the field option section based on the first quantity indication section and the first segmentation mode identifier section;

[0208] The second communication device constructs a fourth bit sequence using X second bit sequences, and the fourth bit sequence includes all bits in the X third bit sequences;

[0209] The second communication device determines the second bit sequence based on the second segmentation mode identifier portion and the second quantity indication portion;

[0210] The second communication device concatenates the last bit of the fourth bit sequence with the first bit of the second bit sequence according to the second segmentation mode identifier portion to obtain the first bit sequence.

[0211] In the above implementation, the number of bit sequences omitted in the field options section is indicated more flexibly by the quantity indicator part in the segmented structure, so as to better reduce the number of bits occupied by the field options section and save bit overhead of the first message.

[0212] In another possible implementation, at least one field is ordered in a first order; at least one field pointer includes a first type field pointer, which is a field pointer corresponding to two fields;

[0213] The first type field pointers are ordered according to the field type indication order of either of the two fields corresponding to the first type field pointer.

[0214] This implementation illustrates the sorting order of at least one field and at least one field pointer of a first type, so that the second communication device can determine the field pointer corresponding to each field, thereby quickly reading the corresponding field. This improves the efficiency of the second communication device in reading fields.

[0215] In another possible implementation, at least one field pointer includes a second type field pointer, which is a field pointer corresponding to a single field;

[0216] The last field pointer in at least one field pointer is a second type field pointer, the last field pointer corresponds to the last field in at least one field, and the last field pointer is located after the first type field pointer in at least one field pointer.

[0217] This implementation illustrates the positional relationship between the last field pointer and the first type field pointer of the first message, so that the second communication device can determine the field pointer corresponding to the field and thus quickly read the corresponding field.

[0218] In another possible implementation, at least one field includes N fields, and at least one field includes N field pointers; the i-th field corresponds to the (i-1)-th field pointer and the i-th field pointer, the (i-1)-th field pointer is used to indicate the start bit position of the i-th field in the first message, and the i-th field pointer is used to indicate the end bit position of the i-th field in the first message, where N is an integer greater than or equal to 1, and i is an integer greater than or equal to 2 and less than or equal to N.

[0219] In the above implementation, the field pointer corresponding to each field can be determined by the sorting relationship of at least one field pointer, so that the second communication device can quickly determine the field pointer corresponding to each field, thereby quickly reading the corresponding field and improving the efficiency of the second communication device in reading fields.

[0220] In another possible implementation, the bits occupied by any two adjacent field pointers in at least one field pointer are consecutive, and the bits occupied by any two adjacent fields in at least one field are consecutive; the last bit occupied by the field option portion is consecutive with the first bit occupied by at least one field pointer, and the last bit occupied by at least one field pointer is consecutive with the first bit occupied by at least one field.

[0221] In the above implementation, the field options section, at least one field, and at least one field pointer are consecutive, thereby saving bit resources occupied by the first message.

[0222] In another possible implementation, the first field of the N fields is positioned at the start bit position of the first message equal to the length of the field options section plus the length of the N field pointers; the first field pointer of the N field pointers is used to indicate the end bit position of the first field in the first message.

[0223] The above implementation illustrates how to determine the position of the first field, making the solution more complete. The second communication device can determine the position of each field so that it can read any field of the first message.

[0224] In another possible implementation, the length of each of the N field pointers is equal;

[0225] The value of the j-th field pointer is offset. j =l Bitmap +w Bitmap *l offset +l (1,j) ;

[0226] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,j) It is the sum of the lengths of the first to the jth fields in at least one field.

[0227] The above implementation illustrates how to calculate the values ​​of N field pointers so that the second communication device can determine the position of each field.

[0228] In another possible implementation, the first field pointer of at least one field pointer is a second type field pointer, the first field pointer corresponds to the first field in at least one field, and the first field pointer is located before the first type field pointer in at least one field pointer.

[0229] This implementation demonstrates the positional relationship between the first field pointer and the first type field pointer of the first message, so that the second communication device can determine the field pointer corresponding to the field and thus quickly read the corresponding field.

[0230] In another possible implementation, at least one field includes N fields, and at least one field pointer includes N+1 field pointers; the b-th field corresponds to the b-th field pointer and the b+1-th field pointer; N is an integer greater than or equal to 1, and b is an integer greater than or equal to 1 and less than or equal to N;

[0231] The pointer to the b-th field is used to indicate the start bit position of the b-th field in the first message; the pointer to the (b+1)-th field is used to indicate the end bit position of the b-th field in the first message.

[0232] In the above implementation, the field pointer corresponding to each field can be determined by the sorting relationship of at least one field pointer, so that the second communication device can quickly determine the field pointer corresponding to each field, thereby quickly reading the corresponding field and improving the efficiency of the second communication device in reading fields.

[0233] In another possible implementation, the length of each of the N+1 field pointers is equal;

[0234] The value of the first field pointer is offset1 = l Bitmap +w Bitmap *l offset ;

[0235] The value of the pointer to the a-th field is offset. a =l Bitmap +w Bitmap *l offset +l (1,a-1) ;

[0236] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,a-1) It is the sum of the lengths of the first to the (a-1)th fields out of N fields, where a is an integer greater than or equal to 2 and less than or equal to N+1.

[0237] The above implementation illustrates how to calculate the values ​​of N field pointers so that the second communication device can determine the position of each field.

[0238] The fifth aspect of this application provides a first communication device, comprising:

[0239] The processing module is used to generate a first message, which includes a length identifier part, a field option part, and at least one field. The length identifier part is used to indicate the length of the field option part, and the field option part indicates the field type of at least one field in a first order, where the first order is the indication order of the field types.

[0240] The transceiver module is used to send the first message to the second communication device.

[0241] In one possible implementation, the length identifier portion is also used to indicate that each field in the first message is a fixed-length field.

[0242] In another possible implementation, the length identifier portion is also used to indicate that the first message includes at least one field pointer; the at least one field includes a first field, the first field corresponding to one or more field pointers among the at least one field pointers, and the one or more field pointers are used to determine the position of the first field in the first message.

[0243] In another possible implementation, the first message further includes a feature identifier portion, which is used to indicate that each field in the first message is a fixed-length field, or the feature identifier portion is used for the first message to include at least one field pointer; the at least one field includes a first field, the first field corresponds to one or more field pointers in the at least one field pointer, and the one or more field pointers are used to determine the position of the first field in the first message.

[0244] In another possible implementation, at least one field pointer includes a first field pointer, which corresponds to a field and is used to determine the start bit position or end bit position of the field corresponding to the first field pointer in the first message.

[0245] In another possible implementation, at least one field pointer includes a second field pointer, which corresponds to the second field and the third field. The second field pointer is used to determine the start bit position of the second field in the first message and to determine the end bit position of the third field in the first message.

[0246] In another possible implementation, the first field corresponds to at least one of the third field pointer and the fourth field pointer; the third field pointer is used to determine the start bit position of the first field in the first message, and the fourth field pointer is used to determine the end bit position of the first field in the first message.

[0247] In another possible implementation, the processing module is specifically used for:

[0248] The first bit sequence is compressed to obtain the field option part, the length of which is less than the length of the first bit sequence. The "1" bits in the first bit sequence are used to indicate the field type of at least one field in a first order.

[0249] In another possible implementation, the field options section includes a first segment structure and a second segment structure. The first segment structure includes a first segment pattern identifier, and the second segment structure includes a second segment pattern identifier and a second bit sequence.

[0250] The first segmentation mode identifier is used to indicate that the third bit sequence is omitted in the field option section, and the bits in the third bit sequence are all "1" bits or all "0" bits; the second segmentation mode identifier is used to indicate that the second bit sequence contains "1" bits and that the second segmentation structure is the last segmentation structure in the field option section; the last bit of the third bit sequence is concatenated with the first bit of the second bit sequence to obtain the first bit sequence.

[0251] In another possible implementation, the first segmentation structure also includes a first quantity indicator section, which is used to indicate that the field option section omits X third bit sequences, the X third bit sequences constitute a fourth bit sequence, and the fourth bit sequence includes all bits in the X third bit sequences, where X is an integer greater than or equal to 1.

[0252] The second segmentation structure includes a second quantity indicator, which indicates that the second bit sequence includes Y bit sequence units, and the length of each bit sequence unit in the Y bit sequence units is the same as the length of the third bit sequence, where Y is an integer greater than or equal to 1.

[0253] The last bit of the fourth bit sequence is concatenated with the first bit of the second bit sequence to obtain the first bit sequence.

[0254] In another possible implementation, at least one field is ordered in a first order; at least one field pointer includes a first type field pointer, which is a field pointer corresponding to two fields; the first type field pointers are ordered according to the field type indication order of either of the two fields corresponding to the first type field pointer.

[0255] In another possible implementation, at least one field pointer includes a second type field pointer, which is a field pointer corresponding to a single field;

[0256] The last field pointer in at least one field pointer is a second type field pointer, the last field pointer corresponds to the last field in the at least one field, and the last field pointer is located after the first type field pointer in the at least one field pointer.

[0257] In another possible implementation, at least one field includes N fields, and at least one field pointer includes N field pointers; the i-th field corresponds to the (i-1)-th field pointer and the i-th field pointer, the (i-1)-th field pointer is used to indicate the start bit position of the i-th field in the first message, and the i-th field pointer is used to indicate the end bit position of the i-th field in the first message, where N is an integer greater than or equal to 1, and i is an integer greater than or equal to 2 and less than or equal to N.

[0258] In another possible implementation, the bits occupied by any two adjacent field pointers in at least one field pointer are consecutive; the bits occupied by any two adjacent fields in at least one field are consecutive; the last bit occupied by the field option portion is consecutive with the first bit occupied by at least one field pointer; and the last bit occupied by at least one field pointer is consecutive with the first bit occupied by at least one field.

[0259] In another possible implementation, the first field of the N fields is positioned at the start bit position of the first message equal to the length of the field options section plus the length of the N field pointers; the first field pointer of the N field pointers is used to indicate the end bit position of the first field in the first message.

[0260] In another possible implementation, the length of each of the N field pointers is equal;

[0261] The value of the j-th field pointer is offset. j =l Bitmap +w Bitmap *l offset +l (1,j) ;

[0262] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,j) It is the sum of the lengths of the first to the jth fields out of N fields, where j is an integer greater than or equal to 1 and less than or equal to N.

[0263] In another possible implementation, the first field pointer of at least one field pointer is a second type field pointer, the first field pointer corresponds to the first field among the at least one field, and the first field pointer is located before the first type field pointer among the at least one field pointer.

[0264] In another possible implementation, at least one field includes N fields, and at least one field pointer includes N+1 field pointers; the b-th field corresponds to the b-th field pointer and the b+1-th field pointer, the b-th field pointer is used to indicate the start bit position of the b-th field in the first message, and the b+1-th field pointer is used to indicate the end bit position of the b-th field in the first message, where N is an integer greater than or equal to 1, and b is an integer greater than or equal to 1 and less than or equal to N.

[0265] In another possible implementation, the length of each of the N+1 field pointers is equal;

[0266] The value of the first field pointer is offset1 = l Bitmap +w Bitmap *l offset ;

[0267] The value of the pointer to the a-th field is offset. a =l Bitmap +w Bitmap *l offset +l (1,a-1) ;

[0268] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,a-1) It is the sum of the lengths of the first to the (a-1)th fields out of N fields, where a is an integer greater than or equal to 2 and less than or equal to N+1.

[0269] A sixth aspect of this application provides a second communication device, comprising:

[0270] The transceiver module is used to receive a first message from a first communication device. The first message includes a length identifier portion, a field option portion, and at least one field. The length identifier portion is used to indicate the length of the field option portion. The field option portion indicates the field type of at least one field in a first order, where the first order is the indication order of the field types. The second communication device determines the length of the field option portion based on the length identifier portion.

[0271] The processing module is used to determine whether a first field exists in the first message based on the first order and the length of the field option part; the second communication device reads the value of the first field.

[0272] In one possible implementation, the length identifier portion is also used to indicate that each field in the first message is a fixed-length field.

[0273] In another possible implementation, the last bit of the length identifier portion is consecutive to the first bit of the field options portion, and at least two adjacent fields of at least one field occupy consecutive bits; the last bit of the field options portion is consecutive to the first bit of at least one field; the processing module is specifically used for:

[0274] The first field is determined to be the c-th field among the at least one fields, based on the field options section, where c is an integer greater than 1;

[0275] The sum of the length of the field options section and the first length is used as the value of the first field, where the first length is the length of each field multiplied by c-1.

[0276] In another possible implementation, the length identifier portion is also used to indicate that the first message includes at least one field pointer; the at least one field includes the first field, the first field corresponds to one or more field pointers in the at least one field pointer, and the one or more field pointers are used to determine the position of the first field in the first message;

[0277] The processing module is specifically used for:

[0278] Read the value of the first field based on one or more field pointers.

[0279] In another possible implementation, the first field corresponds to at least one of the pointers to the third and fourth fields; the processing module is specifically used for:

[0280] Read the value of the first field based on one or more field pointers, including:

[0281] The starting bit position of the first field in the first message is determined according to the third field pointer, and / or the ending bit position of the first field in the first message is determined according to the fourth field pointer;

[0282] The value of the first field is read from the first message based on the start bit position and / or end bit position.

[0283] In another possible implementation, the first message further includes a feature identifier portion, which is used to indicate that each field in the first message is a fixed-length field, or the feature identifier portion is used for the first message to include at least one field pointer; the at least one field includes a first field, the first field corresponds to one or more field pointers among the at least one field pointers, and the one or more field pointers are used to determine the position of the first field in the first message.

[0284] In another possible implementation, at least one field pointer includes a first field pointer, which corresponds to a field and is used to determine the start bit position or end bit position of the field corresponding to the first field pointer in the first message.

[0285] In another possible implementation, at least one field pointer includes a second field pointer, which corresponds to the second field and the third field. The second field pointer is used to determine the start bit position of the second field in the first message and to determine the end bit position of the third field in the first message.

[0286] In another possible implementation, the processing module is specifically used for:

[0287] The field options section is determined based on its length.

[0288] The presence of the first field in the first message is determined based on the first order and field options section.

[0289] In another possible implementation, the processing module is also used for:

[0290] Parse the field options section to obtain the first bit sequence. The first bit sequence is the bit sequence of the field options section before compression. The "1" bits in the first bit sequence are used to indicate the field type of at least one field in a first order. The length of the field options section is less than the length of the first bit sequence.

[0291] The processing module is specifically used for:

[0292] Based on the first bit sequence and the first order, it is determined that the first field exists in the first message.

[0293] In another possible implementation, the field options section includes a first segment structure and a second segment structure. The first segment structure includes a first segment pattern identifier, and the second segment structure includes a second segment pattern identifier and a second bit sequence.

[0294] The first segmentation mode identifier is used to indicate that the third bit sequence is omitted in the field option section, and the bits in the third bit sequence are all "1" bits or all "0" bits;

[0295] The second segmentation pattern identifier is used to indicate that the second bit sequence contains a "1" bit and that the second segmentation structure is the last segmentation structure in the field options section;

[0296] The processing module is specifically used for:

[0297] The first segment structure and the second segment structure are determined based on the length of the field option section;

[0298] The third bit sequence is determined based on the first segmentation pattern identifier.

[0299] The second bit sequence is determined based on the second segmentation pattern identifier portion;

[0300] The last bit of the third bit sequence is concatenated with the first bit of the second bit sequence according to the second segmentation pattern identifier to obtain the first bit sequence.

[0301] In another possible implementation, the field options section includes a first segment structure and a second segment structure. The first segment structure includes a first segment pattern identifier and a first quantity indicator. The second segment structure includes a second segment pattern identifier, a second quantity indicator, and a second bit sequence.

[0302] The first segmentation mode identifier indicates that the third bit sequence is omitted in the field option section, and the bits in the third bit sequence are all "1" bits or all "0" bits; the first quantity indicator indicates that X third bit sequences are omitted in the field option section, where X is an integer greater than or equal to 1; the second segmentation mode identifier indicates that the second bit sequence contains "1" bits and that the second segmentation structure is the last segmentation structure in the field option section; the second quantity indicator indicates that the second bit sequence includes Y bit sequence units, and the length of each bit sequence unit in the Y bit sequence units is the same as the length of the third bit sequence, where Y is an integer greater than or equal to 1;

[0303] The processing module is specifically used for:

[0304] The X third bit sequence omitted in the field options section is determined based on the first quantity indication section and the first segmentation mode identifier section;

[0305] A fourth bit sequence is constructed using X third bit sequences, and the fourth bit sequence includes all the bits of the X third bit sequences;

[0306] The second bit sequence is determined based on the second segmentation pattern identifier and the second quantity indicator.

[0307] The last bit of the fourth bit sequence is concatenated with the first bit of the second bit sequence according to the second segmentation pattern identifier to obtain the first bit sequence.

[0308] In another possible implementation, at least one field is ordered in a first order; at least one field pointer includes a first type field pointer, which is a field pointer corresponding to two fields;

[0309] The first type field pointers are ordered according to the field type indication order of either of the two fields corresponding to the first type field pointer.

[0310] In another possible implementation, at least one field pointer includes a second type field pointer, which is a field pointer corresponding to a single field;

[0311] The last field pointer in at least one field pointer is a second type field pointer, the last field pointer corresponds to the last field in at least one field, and the last field pointer is located after the first type field pointer in at least one field pointer.

[0312] In another possible implementation, at least one field includes N fields, and at least one field includes N field pointers; the i-th field corresponds to the (i-1)-th field pointer and the i-th field pointer, the (i-1)-th field pointer is used to indicate the start bit position of the i-th field in the first message, and the i-th field pointer is used to indicate the end bit position of the i-th field in the first message, where N is an integer greater than or equal to 1, and i is an integer greater than or equal to 2 and less than or equal to N.

[0313] In another possible implementation, the bits occupied by any two adjacent field pointers in at least one field pointer are consecutive, and the bits occupied by any two adjacent fields in at least one field are consecutive; the last bit occupied by the field option portion is consecutive with the first bit occupied by at least one field pointer, and the last bit occupied by at least one field pointer is consecutive with the first bit occupied by at least one field.

[0314] In another possible implementation, the first field of the N fields is positioned at the start bit position of the first message equal to the length of the field options section plus the length of the N field pointers; the first field pointer of the N field pointers is used to indicate the end bit position of the first field in the first message.

[0315] In another possible implementation, the length of each of the N field pointers is equal;

[0316] The value of the j-th field pointer is offset. j =l Bitmap +w Bitmap *l offset +l (1,j) ;

[0317] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,j) It is the sum of the lengths of the first to the jth fields in at least one field.

[0318] In another possible implementation, the first field pointer of at least one field pointer is a second type field pointer, the first field pointer corresponds to the first field among the at least one field, and the first field pointer is located before the first type field pointer among the at least one field pointer.

[0319] In another possible implementation, at least one field includes N fields, and at least one field pointer includes N+1 field pointers; the b-th field corresponds to the b-th field pointer and the b+1-th field pointer; N is an integer greater than or equal to 1, and b is an integer greater than or equal to 1 and less than or equal to N;

[0320] The pointer to the b-th field is used to indicate the start bit position of the b-th field in the first message; the pointer to the (b+1)-th field is used to indicate the end bit position of the b-th field in the first message.

[0321] In another possible implementation, the length of each of the N+1 field pointers is equal;

[0322] The value of the first field pointer is offset1 = l Bitmap +w Bitmap *l offset ;

[0323] The value of the pointer to the a-th field is offset. a =l Bitmap +w Bitmap *l offset +l (1,a-1) ;

[0324] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,a-1) It is the sum of the lengths of the first to the (a-1)th fields out of N fields, where a is an integer greater than or equal to 2 and less than or equal to N+1.

[0325] The seventh aspect of this application provides a first communication device, comprising:

[0326] The processing module is used to generate a first message. The first message includes a field option section, at least one field pointer, and at least one field. The field option section indicates the field type of at least one field in a first order, where the first order is the indication order of the field types. The at least one field includes a first field, which corresponds to one or more field pointers among the at least one field pointers. The one or more field pointers are used to determine the position of the first field in the first message.

[0327] The transceiver module is used to send the first message to the second communication device.

[0328] In one possible implementation, at least one field pointer includes a first field pointer, which corresponds to a field and is used to determine the start bit position or end bit position of the field corresponding to the first field pointer in the first message.

[0329] In another possible implementation, at least one field pointer includes a second field pointer, which corresponds to the second field and the third field. The second field pointer is used to determine the start bit position of the second field in the first message and to determine the end bit position of the third field in the first message.

[0330] In another possible implementation, the first field corresponds to at least one of the third field pointer and the fourth field pointer; the third field pointer is used to determine the start bit position of the first field in the first message, and the fourth field pointer is used to determine the end bit position of the first field in the first message.

[0331] In another possible implementation, the first message also includes a length identifier portion, which is used to indicate the length of the field options portion.

[0332] In another possible implementation, the processing module is specifically used for:

[0333] The first bit sequence is compressed to obtain the field option part, the length of which is less than the length of the first bit sequence. The "1" bits in the first bit sequence are used to indicate the field type of at least one field in a first order.

[0334] In another possible implementation, the field options section includes a first segment structure and a second segment structure. The first segment structure includes a first segment pattern identifier, and the second segment structure includes a second segment pattern identifier and a second bit sequence.

[0335] The first segmentation mode identifier is used to indicate that the third bit sequence is omitted in the field option section, and the bits in the third bit sequence are all "1" bits or all "0" bits;

[0336] The second segmentation pattern identifier is used to indicate that the second bit sequence contains a "1" bit and that the second segmentation structure is the last segmentation structure in the field options section;

[0337] The first bit sequence is obtained by concatenating the last bit of the third bit sequence with the first bit of the second bit sequence.

[0338] In another possible implementation, the first segmentation structure also includes a first quantity indicator section, which is used to indicate that the field option section omits X third bit sequences, the X third bit sequences constitute a fourth bit sequence, and the fourth bit sequence includes all bits in the X third bit sequences, where X is an integer greater than or equal to 1.

[0339] The second segmentation structure includes a second quantity indicator, which indicates that the second bit sequence includes Y bit sequence units, and the length of each bit sequence unit in the Y bit sequence units is the same as the length of the third bit sequence, where Y is an integer greater than or equal to 1.

[0340] The last bit of the fourth bit sequence is concatenated with the first bit of the second bit sequence to obtain the first bit sequence.

[0341] In another possible implementation, at least one field is ordered according to the first order; at least one field pointer includes a first type field pointer, which is a field pointer corresponding to two fields;

[0342] The first type field pointers are ordered according to the field type indication order of either of the two fields corresponding to the first type field pointer.

[0343] In another possible implementation, at least one field pointer includes a second type field pointer, which is a field pointer corresponding to a single field;

[0344] The last field pointer in at least one field pointer is a field pointer of the second type, the last field pointer corresponds to the last field in at least one field, and the last field pointer is located after the first type field pointer in at least one field pointer.

[0345] In another possible implementation, at least one field includes N fields, and at least one field pointer includes N field pointers; the i-th field corresponds to the (i-1)-th field pointer and the i-th field pointer, the (i-1)-th field pointer is used to indicate the start bit position of the i-th field in the first message, and the i-th field pointer is used to indicate the end bit position of the i-th field in the first message, where N is an integer greater than or equal to 1, and i is an integer greater than or equal to 2 and less than or equal to N.

[0346] In another possible implementation, the bits occupied by any two adjacent field pointers in at least one field pointer are consecutive; the bits occupied by any two adjacent fields in at least one field are consecutive; the last bit occupied by the field option portion is consecutive with the first bit occupied by at least one field pointer; and the last bit occupied by at least one field pointer is consecutive with the first bit occupied by at least one field.

[0347] In another possible implementation, the first field of the N fields is positioned at the start bit position of the first message equal to the length of the field options section plus the length of the N field pointers; the first field pointer of the N field pointers is used to indicate the end bit position of the first field in the first message.

[0348] In another possible implementation, the length of each of the N field pointers is equal;

[0349] The value of the j-th field pointer is offset. j =l Bitmap +w Bitmap *l offset +l (1,j) ;

[0350] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,j) It is the sum of the lengths of the first to the jth fields out of N fields, where j is an integer greater than or equal to 1 and less than or equal to N.

[0351] In another possible implementation, the first field pointer of at least one field pointer is a second type field pointer, the first field pointer corresponds to the first field in at least one field, and the first field pointer is located before the first type field pointer in at least one field pointer.

[0352] In another possible implementation, at least one field includes N fields, and at least one field pointer includes N+1 field pointers; the b-th field corresponds to the b-th field pointer and the b+1-th field pointer, the b-th field pointer is used to indicate the start bit position of the b-th field in the first message, and the b+1-th field pointer is used to indicate the end bit position of the b-th field in the first message, where N is an integer greater than or equal to 1, and b is an integer greater than or equal to 1 and less than or equal to N.

[0353] In another possible implementation, the length of each of the N+1 field pointers is equal;

[0354] The value of the first field pointer is offset1 = l Bitmap +w Bitmap *l offset ;

[0355] The value of the pointer to the a-th field is offset. a =l Bitmap +w Bitmap *loffset +l (1,a-1) ;

[0356] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,a-1) It is the sum of the lengths of the first to the (a-1)th fields out of N fields, where a is an integer greater than or equal to 2 and less than or equal to N+1.

[0357] The eighth aspect of this application provides a second communication device, comprising:

[0358] The transceiver module is used to receive a first message from a first communication device. The first message includes a field option section, at least one field pointer, and at least one field. The field option section indicates the field type of at least one field in a first order, where the first order is the indication order of the field types.

[0359] The processing module is configured to determine, based on the first order and field options portion, that the first message contains a first field; determine, from at least one field pointer, one or more field pointers corresponding to the first field; determine, based on the one or more field pointers, the position of the first field in the first message; and read the value of the first field from the first message based on the position of the first field in the first message.

[0360] In one possible implementation, at least one field pointer includes a first field pointer, which corresponds to a field and is used to determine the start bit position or end bit position of the field corresponding to the first field pointer in the first message.

[0361] In another possible implementation, at least one field pointer includes a second field pointer, which corresponds to the second field and the third field. The first field pointer is used to determine the start bit position of the second field in the first message and to determine the end bit position of the third field in the first message.

[0362] In another possible implementation, the first field corresponds to at least one of the pointers to the third and fourth fields; the processing module is specifically used for:

[0363] The start bit position of the first field in the first message is determined according to the third field pointer, and / or the end bit position of the first field in the first message is determined according to the fourth field pointer;

[0364] The value of the first field is read from the first message based on the start bit position and / or end bit position.

[0365] In another possible implementation, the first message also includes a length identifier portion, which is used to indicate the length of the field options portion. The processing module is also used for:

[0366] The length of the field options section is determined based on the length identifier.

[0367] In another possible implementation, the processing module is specifically used for:

[0368] Parse the field options section to obtain the first bit sequence. The first bit sequence is the bit sequence of the field options section before compression. The "1" bits in the first bit sequence are used to indicate the field type of at least one field in a first order. The length of the field options section is less than the length of the first bit sequence.

[0369] The first message contains the first field based on the first bit sequence and the first order.

[0370] In another possible implementation, the field options section includes a first segment structure and a second segment structure. The first segment structure includes a first segment pattern identifier, and the second segment structure includes a second segment pattern identifier and a second bit sequence.

[0371] The first segmentation mode identifier is used to indicate that the third bit sequence is omitted in the field option section, and the bits in the third bit sequence are all "1" bits or all "0" bits;

[0372] The second segmentation pattern identifier is used to indicate that the second bit sequence contains a "1" bit and that the second segmentation structure is the last segmentation structure in the field options section;

[0373] The processing module is specifically used for:

[0374] The third bit sequence is determined based on the first segmentation pattern identifier.

[0375] The second bit sequence is determined based on the second segmentation pattern identifier portion;

[0376] The last bit of the third bit sequence is concatenated with the first bit of the second bit sequence according to the second segmentation pattern identifier to obtain the first bit sequence.

[0377] In another possible implementation, the field options section includes a first segment structure and a second segment structure. The first segment structure includes a first segment pattern identifier and a first quantity indicator. The second segment structure includes a second segment pattern identifier, a second quantity indicator, and a second bit sequence.

[0378] The first segmentation mode identifier indicates that the third bit sequence is omitted in the field option section, and the bits in the third bit sequence are all "1" bits or all "0" bits; the first quantity indicator indicates that X third bit sequences are omitted in the field option section, where X is an integer greater than or equal to 1; the second segmentation mode identifier indicates that the second bit sequence contains "1" bits and that the second segmentation structure is the last segmentation structure in the field option section; the second quantity indicator indicates that the second bit sequence includes Y bit sequence units, and the length of each bit sequence unit in the Y bit sequence units is the same as the length of the third bit sequence, where Y is an integer greater than or equal to 1;

[0379] The processing module is specifically used for:

[0380] The X third bit sequence omitted in the field options section is determined based on the first quantity indication section and the first segmentation mode identifier section;

[0381] A fourth bit sequence is constructed using X second bit sequences, and the fourth bit sequence includes all bits of the X third bit sequences;

[0382] The second bit sequence is determined based on the second segmentation pattern identifier and the second quantity indicator.

[0383] The last bit of the fourth bit sequence is concatenated with the first bit of the second bit sequence according to the second segmentation pattern identifier to obtain the first bit sequence.

[0384] In another possible implementation, at least one field is ordered in a first order; at least one field pointer includes a first type field pointer, which is a field pointer corresponding to two fields;

[0385] The first type field pointers are ordered according to the field type indication order of either of the two fields corresponding to the first type field pointer.

[0386] In another possible implementation, at least one field pointer includes a second type field pointer, which is a field pointer corresponding to a single field;

[0387] The last field pointer in at least one field pointer is a second type field pointer, the last field pointer corresponds to the last field in at least one field, and the last field pointer is located after the first type field pointer in at least one field pointer.

[0388] In another possible implementation, at least one field includes N fields, and at least one field includes N field pointers; the i-th field corresponds to the (i-1)-th field pointer and the i-th field pointer, the (i-1)-th field pointer is used to indicate the start bit position of the i-th field in the first message, and the i-th field pointer is used to indicate the end bit position of the i-th field in the first message, where N is an integer greater than or equal to 1, and i is an integer greater than or equal to 2 and less than or equal to N.

[0389] In another possible implementation, the bits occupied by any two adjacent field pointers in at least one field pointer are consecutive, and the bits occupied by any two adjacent fields in at least one field are consecutive; the last bit occupied by the field option portion is consecutive with the first bit occupied by at least one field pointer, and the last bit occupied by at least one field pointer is consecutive with the first bit occupied by at least one field.

[0390] In another possible implementation, the first field of the N fields is positioned at the start bit position of the first message equal to the length of the field options section plus the length of the N field pointers; the first field pointer of the N field pointers is used to indicate the end bit position of the first field in the first message.

[0391] In another possible implementation, the length of each of the N field pointers is equal;

[0392] The value of the j-th field pointer is offset. j =l Bitmap +w Bitmap *l offset +l (1,j) ;

[0393] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,j) It is the sum of the lengths of the first to the jth fields in at least one field.

[0394] In another possible implementation, the first field pointer of at least one field pointer is a second type field pointer, the first field pointer corresponds to the first field in at least one field, and the first field pointer is located before the first type field pointer in at least one field pointer.

[0395] In another possible implementation, at least one field includes N fields, and at least one field pointer includes N+1 field pointers; the b-th field corresponds to the b-th field pointer and the b+1-th field pointer; N is an integer greater than or equal to 1, and b is an integer greater than or equal to 1 and less than or equal to N;

[0396] The pointer to the b-th field is used to indicate the start bit position of the b-th field in the first message; the pointer to the (b+1)-th field is used to indicate the end bit position of the b-th field in the first message.

[0397] In another possible implementation, the length of each of the N+1 field pointers is equal;

[0398] The value of the first field pointer is offset1 = l Bitmap +w Bitmap *l offset ;

[0399] The value of the pointer to the a-th field is offset. a =l Bitmap +w Bitmap *l offset +l (1,a-1) ;

[0400] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,a-1) It is the sum of the lengths of the first to the (a-1)th fields out of N fields, where a is an integer greater than or equal to 2 and less than or equal to N+1.

[0401] A ninth aspect of this application provides a first communication device, comprising a processor and a memory. The memory stores computer programs or computer instructions, and the processor is used to call and execute the computer programs or computer instructions stored in the memory, causing the processor to implement any one of the implementations of the first or third aspect.

[0402] Optionally, the first communication device further includes a transceiver, and the processor is used to control the transceiver to send and receive messages.

[0403] The tenth aspect of this application provides a second communication device, comprising a processor and a memory. The memory stores computer programs or computer instructions, and the processor is used to call and execute the computer programs or computer instructions stored in the memory, causing the processor to implement any one of the implementations of the second or fourth aspect.

[0404] Optionally, the second communication device also includes a transceiver, and the processor is used to control the transceiver to send and receive messages.

[0405] The eleventh aspect of this application provides a first communication device, including a processor for connection to a memory, for calling a program stored in the memory to execute any implementation of the first or third aspect. The memory may be located within or outside the first communication device. The processor may include one or more processors.

[0406] The twelfth aspect of this application provides a second communication device, including a processor for connection to a memory, for calling a program stored in the memory to execute any implementation of the second or fourth aspect. The memory may be located within or outside the second communication device. The processor may include one or more processors.

[0407] The thirteenth aspect of this application provides a computer program product including instructions, characterized in that, when run on a computer, it causes the computer to perform any of the implementations of any one of the first to fourth aspects.

[0408] The fourteenth aspect of this application provides a computer-readable storage medium including computer instructions that, when executed on a computer, cause the computer to perform any of the implementations of any one of the first to fourth aspects.

[0409] The fifteenth aspect of this application provides a chip device including a processor for calling a computer program or computer instructions in the memory to cause the processor to execute any one of the implementations of the first to fourth aspects described above.

[0410] Optionally, the processor is coupled to the memory via an interface.

[0411] The sixteenth aspect of this application provides a communication system comprising a first communication device as described in the fifth aspect and a second communication device as described in the sixth aspect; or, a first communication device as described in the seventh aspect and a second communication device as described in the eighth aspect.

[0412] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0413] As described in the above technical solution, the first communication device generates a first message. The first message includes a length identifier portion, a field option portion, and at least one field. The length identifier portion indicates the length of the field option portion, and the field option portion indicates the field types of at least one field in a first order, where the first order is the order in which the field types are indicated. The first communication device sends the first message to the second communication device. Therefore, the first communication device indicates the length of the field option portion through the length identifier portion, meaning the length of the field option portion is not fixed. This allows the first communication device to flexibly configure the length of the field option portion according to the actual fields indicated, thereby reducing the bit overhead of the first message and saving bit resources. Attached Figure Description

[0414] Figure 1 This is a schematic diagram of a network system according to an embodiment of this application;

[0415] Figure 2 This is a schematic diagram of one embodiment of the message processing method of this application;

[0416] Figure 3A This is a schematic diagram of the structure of the first message in an embodiment of this application;

[0417] Figure 3B This is another structural diagram of the first message in the embodiment of this application;

[0418] Figure 3C This is another structural diagram of the first message in the embodiment of this application;

[0419] Figure 3D This is another structural diagram of the first message in the embodiment of this application;

[0420] Figure 3E This is another structural diagram of the first message in the embodiment of this application;

[0421] Figure 3F This is another structural diagram of the first message in the embodiment of this application;

[0422] Figure 4A This is a schematic diagram illustrating the parsing of fields in a first message by a second communication device according to an embodiment of this application.

[0423] Figure 4B This is another parsing diagram illustrating the second communication device parsing fields in the first message according to an embodiment of this application;

[0424] Figure 4C This is another parsing diagram illustrating the second communication device parsing fields in the first message according to an embodiment of this application;

[0425] Figure 4DThis is a schematic diagram illustrating the parallel parsing of fields in a first message by a second communication device according to an embodiment of this application.

[0426] Figure 5A This is a structural diagram of the field option section in an embodiment of this application;

[0427] Figure 5B This is another structural diagram of the field option section in an embodiment of this application;

[0428] Figure 5C This is another structural diagram of the field option section in an embodiment of this application;

[0429] Figure 5D This is another structural diagram of the field option section in an embodiment of this application;

[0430] Figure 6A This is another structural diagram of the field option section in an embodiment of this application;

[0431] Figure 6B This is another structural diagram of the field option section in an embodiment of this application;

[0432] Figure 7 This is a schematic diagram of one embodiment of the message processing method of this application;

[0433] Figure 8A This is another structural diagram of the first message in the embodiment of this application;

[0434] Figure 8B This is another structural diagram of the first message in the embodiment of this application;

[0435] Figure 8C This is another structural diagram of the first message in the embodiment of this application;

[0436] Figure 8D This is another structural diagram of the first message in the embodiment of this application;

[0437] Figure 8E This is another structural diagram of the first message in the embodiment of this application;

[0438] Figure 8F This is another structural diagram of the first message in the embodiment of this application;

[0439] Figure 9A This is another structural diagram of the first message in the embodiment of this application;

[0440] Figure 9B This is another structural diagram of the first message in the embodiment of this application;

[0441] Figure 9CThis is another structural diagram of the first message in the embodiment of this application;

[0442] Figure 9D This is another structural diagram of the first message in the embodiment of this application;

[0443] Figure 10 This is a schematic diagram of the structure of a first communication device according to an embodiment of this application;

[0444] Figure 11 This is a schematic diagram of the structure of a second communication device according to an embodiment of this application;

[0445] Figure 12 This is another structural schematic diagram of the first communication device according to an embodiment of this application;

[0446] Figure 13 This is another structural schematic diagram of the second communication device according to an embodiment of this application. Detailed Implementation

[0447] This application provides a message processing method and a message processing apparatus to improve the efficiency of device reading fields.

[0448] In this application, "one embodiment" or "some embodiments," etc., means that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification, do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0449] In this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.

[0450] Figure 1This is a schematic diagram of a network system according to an embodiment of this application. Please refer to [link / reference]. Figure 1 The network system includes a first communication device and a second communication device. A communication connection is established between the first communication device and the second communication device to realize message transmission between them.

[0451] It is understood that the first and second communication devices can be chips or units or physical devices with transceiver functions. If the first communication device sends data, the second communication device receives data; if the second communication device sends data, the first communication device receives data. In this application, the first communication device is used as the transmitting end device and the second communication device is used as the receiving end device for illustration.

[0452] For example, the first communication device can be a terminal device or a network device, and the second communication device can also be a terminal device or a network device. Terminal devices can be mobile phones, tablets, in-vehicle devices, etc. Network devices can be routers, switches, servers, gateway devices, etc.

[0453] The technical solution of this application is described below with reference to specific embodiments.

[0454] Figure 2 This is a schematic diagram of one embodiment of the message processing method according to this application. Please refer to... Figure 2 The message processing methods include:

[0455] 201. A first communication device generates a first message. The first message includes a field options section, at least one field pointer, and at least one field. The field options section indicates the field types of at least one field in a first order. The at least one field includes a first field, which corresponds to one or more field pointers among the at least one field pointers. The one or more field pointers are used to determine the position of the first field in the first message.

[0456] For example, such as Figure 3A As shown, the header of the first message includes a field options section, four field pointers, and three fields.

[0457] Optionally, the field options section, at least one field pointer, and at least one field may be located in the header of the first message, or in other locations within the first message, such as the payload section of the first message. This application does not impose specific limitations; the following description uses the example of the field options section, at least one field pointer, and at least one field being located in the header of the first message.

[0458] The first order is the indication order of the field types. For example, the indication order of the field types is shown in Table 1 below using the bits of the field types and field option sections.

[0459] Table 1

[0460]

[0461] In Table 1 above, "bit" refers to the bit in the field options section. For example, the field options section includes eight bits, from bit 1 to bit 8. Bit 1 indicates the source address field shown in Table 1. Bit 2 indicates the TTL field shown in Table 1. Bit 3 indicates the next header number. Bit 4 indicates the sequence number field, and so on. Refer to Table 1 for a more detailed understanding. In other words, the bits in the field options section indicate the corresponding field; these bits can be understood as indicating the order of the field.

[0462] For example, in the first communication device, the TTL field, serial number field, and communication identifier field are the fields to be encapsulated. As shown in Table 1 above, the TTL field corresponds to bit 2 in the field option section, the serial number field corresponds to bit 4 in the field option section, and the communication identifier field corresponds to bit 8 in the field option section. Therefore, the first communication device can set bit 2, bit 4, and bit 8 in the field option section to "1" to obtain the field option section. Specifically, as follows... Figure 3A The field option section “01010001” shown, that is, the “1” bit in “01010001” indicates the TTL field, the sequence number field, and the communication identifier field in the order indicated by the field type.

[0463] It is understood that, in this application, the field pointer used to determine the position of a certain field in the first message is called the field pointer corresponding to that field. For example, one or more field pointers corresponding to the first field can be used to determine the position of the first field in the first message. Field pointers can be used to determine the position of a certain field or fields in the first message, and in this application, such a certain field or fields are referred to as the field corresponding to the field pointer.

[0464] The length of each field pointer in the at least one field pointer can be the same or different, and this application does not impose any specific limitation. Each field pointer in the at least one field pointer can be of fixed length or non-fixed length, and this application does not impose any specific limitation. If the field pointer is of non-fixed length, the first message also includes at least one field pointer length portion, with each field pointer corresponding to a field pointer length portion, which is used to indicate the length of the corresponding field pointer. The following explanation uses an example where each field pointer has a fixed length and all field pointers have the same length.

[0465] In some implementations, the at least one field pointer includes a first field pointer, which corresponds to a field. The first field pointer is used to determine the start bit position or end bit position of the field corresponding to the first field pointer in the first message.

[0466] For example, such as Figure 3A As shown, the header of the first message includes a field options section, four field pointers, and three fields. Field pointer 1 corresponds to field 1 and is used to determine the start bit position of field 1 in the first message. Similarly, field pointer 4 corresponds to field 3 and is used to determine the end bit position of field 3 in the first message.

[0467] In some implementations, the at least one field pointer includes a second field pointer, which corresponds to both the second and third fields. The second field pointer is used to determine the start bit position of the second field in the first message and to determine the end bit position of the third field in the first message.

[0468] For example, such as Figure 3A As shown, field pointer 2 corresponds to field 1 and field 2. Field pointer 2 is used to determine the end bit position of field 1 in the first message and the start bit position of field 2 in the first message.

[0469] Therefore, optionally, the at least one field pointer can include two types of field pointers: a first type field pointer and a second type field pointer. The first type field pointer corresponds to two fields. The second type field pointer corresponds to one field.

[0470] In some implementations, the first field corresponds to at least one of a third field pointer and a fourth field pointer. The third field pointer is used to determine the start bit position of the first field in the first message. The fourth field pointer is used to determine the end bit position of the first field in the first message.

[0471] Optionally, the value of the fourth field pointer can be the end bit position of the first field in the first message, or the value of the fourth field pointer can be the length of the first field. The start bit position of the first field in the first message and the length of the first field are used to determine the end bit position of the first field in the first message. The following explanation uses the example of the fourth field pointer being the end bit position of the first field in the first message.

[0472] For example, such as Figure 3A As shown, the first field is as follows Figure 3AThe field 2 shown corresponds to field pointer 1 and field pointer 2. The value of field pointer 1 is the start bit position of field 2 in the first message. The value of field pointer 2 is the end bit position of field 2 in the first message.

[0473] For example, such as Figure 3A As shown, the first field is as follows Figure 3A The field 1 shown corresponds to field pointer 1. The value of field pointer 1 is the end bit position of field 1 in the first message.

[0474] Optionally, the field options section can be of fixed length or variable length. For example, ... Figure 3A As shown, the field options section is of fixed length, with a length of 8 bits.

[0475] In some implementations, if the field option portion is not of fixed length, the length of the field option portion may be determined based on the number of bits corresponding to the field type to be indicated.

[0476] For example, the second communication device parses messages in bytes, with one byte consisting of 8 bits. Referring to Table 1 above, if the field types to be indicated correspond to bit 1, bit 4, and bit 8 respectively, the length of the field option section can be 8. If the field types to be indicated correspond to bit 4, bit 9, and bit 10 respectively, the length of the field option section can be 16.

[0477] Therefore, in this application, the field option section can be of a non-fixed length, allowing the first communication device to flexibly configure the length of the field option section according to the field type indicated in actual needs. This avoids wasting bit resources and saves unnecessary bit resources.

[0478] Optionally, the first message may also include a length identifier portion, which is used to indicate the length of the field options portion.

[0479] For example, such as Figure 3C or Figure 3D As shown, the header of the first message also includes a length identifier portion, which is used to indicate the length of the field options portion.

[0480] Optionally, the last bit occupied by the length identifier portion is consecutive to the first bit occupied by the field options portion. For example, as Figure 3C As shown, the length identifier portion is connected to the field option portion so that the second communication device can parse the length identifier portion before parsing the field option portion to determine the length of the field option portion.

[0481] Therefore, the length of the field option section is not fixed. The above implementation indicates the length of the field option section through a length identifier, allowing the first communication device to flexibly configure the length of the field option section according to the actual field types required. This improves the utilization of bit resources and can meet the needs of various scenarios. In other words, messages in various scenarios use the format provided in this application, and the receiving device parses the fields contained in messages from different scenarios in the same way. This allows the receiving device to parse the message headers of messages from various scenarios with a single set of code, reducing the amount of code required by the receiving device.

[0482] In some implementations, the length indicator portion can be of a fixed length or a variable length. The following description uses the example of a fixed-length length indicator portion.

[0483] In some implementations, the length of the length identifier portion can have one or more lengths, depending on whether the field option portion has multiple possible lengths; this application does not limit the specifics. For example, if the field option portion has two possible lengths, 8 bits and 16 bits, then the length of the length identifier portion can be 1 bit. When the length identifier portion is "1", it represents that the length of the field option portion is 8 bits; when the length identifier portion is "0", it represents that the length of the field option portion is 16 bits. For example, if the field option portion has three possible lengths, 8 bits, 16 bits, and 24 bits, then the length of the length identifier portion can be 2 bits. When the length identifier portion is "00", it represents that the length of the field option portion is 8 bits. When the length identifier portion is "01", it represents that the length of the field option portion is 16 bits; when the length identifier portion is "10", it represents that the length of the field option portion is 24 bits.

[0484] Optionally, the length identifier portion is also used to indicate a first order. For example, the length identifier portion is 3 bits long. When the length identifier portion is "001", it indicates that the field option field indicates the field type of the at least one field in the field type indication order shown in Table 1 above. When the length identifier portion is "011", it indicates that the field option portion indicates the field type of the at least one field in the field type indication order shown in Table 2 below.

[0485] Table 2

[0486]

[0487] Table 2 above indicates the order of field types by using the bits in the field type and field option sections. Similar to Table 1 above, please refer to the relevant introduction above for details.

[0488] It should be noted that the optional, commonly used field types can correspond to the earlier bits in the field options section. Therefore, the earlier bits in the field options section can indicate the commonly used field type first, thereby further improving the efficiency of the receiving device in reading the fields corresponding to that commonly used field type.

[0489] Therefore, each bit in the field options section indicates a field type. The field options section can indicate the corresponding field type according to actual needs, ensuring flexible indication of field types while also taking into account the requirement of low bit overhead.

[0490] In some implementations, at least one field is ordered in a first order, wherein the first type field pointers in the at least one field pointer are ordered in the order indicated by the field type of either of the two fields corresponding to the first type field pointer.

[0491] For example, such as Figure 3B As shown, the first communication device determines the field option section to be "01010001". That is, the "1" in the field option section "01010001" indicates the field types of field 1, field 2, and field 3, respectively. The first type of field pointer includes field pointer 2 and field pointer 3. Field pointer 2 corresponds to field 1 and field 2, and field pointer 3 corresponds to field 2 and field 3. Field pointer 2 and field pointer 3 can be ordered according to the indicated order of field 2 and field 3, that is, field pointer 2 is placed before field pointer 3.

[0492] Optionally, at least one field pointer includes a second type field pointer, which is a field pointer corresponding to a field; the last field pointer in the at least one field pointer is a second type field pointer, which corresponds to the last field in the at least one field, and the last field pointer is located after the first type field pointer in the at least one field pointer.

[0493] For example, such as Figure 3B As shown, field pointer 3 is a second-type field pointer, corresponding to field 3. Field pointer 3 follows field pointer 1 and field pointer 2. The first communication device determines the order of at least one field pointer and the order of the at least one field. Then, the first communication device encapsulates the field option portion, at least one field pointer, and at least one field in sequence, specifically resulting in a first message as shown below. Figure 3B As shown.

[0494] In this implementation, optionally, at least one field includes N fields, and at least one field pointer includes N field pointers. N is an integer greater than or equal to 1, and i is an integer greater than or equal to 2 and less than or equal to N. The i-th field corresponds to the (i-1)-th field pointer and the i-th field pointer. The (i-1)-th field pointer indicates the start bit position of the i-th field in the first message. That is, the value of the (i-1)-th field pointer is the start bit position of the i-th field in the first message. The i-th field pointer indicates the end bit position of the i-th field in the first message. That is, the value of the i-th field pointer is the end bit position of the i-th field in the first message.

[0495] For example, such as Figure 3B As shown, field 2 corresponds to field pointer 1 and field pointer 2. Field pointer 1 is used to determine the start bit position of field 2 in the first message. Field pointer 2 is used to determine the end bit position of field 2 in the first message.

[0496] For example, such as Figure 3B As shown, field 3 corresponds to field pointer 2 and field pointer 3. Field pointer 2 is used to determine the start bit position of field 3 in the first message. Field pointer 3 is used to determine the end bit position of field 3 in the first message.

[0497] Optionally, the bits occupied by any two adjacent field pointers in the at least one field pointer are consecutive. The bits occupied by any two adjacent fields in the at least one field are consecutive. The last bit occupied by the field option portion is consecutive to the first bit occupied by the at least one field pointer, and the last bit occupied by the at least one field pointer is consecutive to the first bit occupied by the at least one field.

[0498] For example, such as Figure 3B As shown, Field 1, Field 2, and Field 3 are consecutive, as are Field Pointer 1, Field Pointer 2, and Field Pointer 3. Field Pointer 1 is consecutive with the Field Options section, and Field Pointer 3 is consecutive with Field 1.

[0499] In this implementation, optionally, the first field of the N fields is positioned at the start bit position of the first field in the first message, which is equal to the length of the field options section plus the length of the N field pointers; the first field pointer of the N field pointers is used to indicate the end bit position of the first field in the first message.

[0500] For example, such as Figure 3B As shown, the starting bit position of field 1 in the first message is equal to the length of the field options section plus the total length of field pointers 1 to 3. Field 1 corresponds to field pointer 1, which is used to determine the ending bit position of field 1 in the first message.

[0501] In this implementation, optionally, the length of each of the N field pointers is equal; the value of the j-th field pointer is offset. j =l Bitmap +w Bitmap *l offset +l (1,j) .

[0502] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of each field pointer, l (1,j) It is the sum of the lengths of the first to the jth fields out of N fields, where j is an integer greater than or equal to 1 and less than or equal to N.

[0503] For example, such as Figure 3B As shown, the field options section is 8 bits long, and the number of field types indicated in the field options section is 4. Each field pointer is 8 bits long: field 1 is 8 bits long, field 2 is 16 bits long, and field 3 is 8 bits long. The value of field pointer 1, offset1, is 8 + 3 * 8 + 8 = 40. The value of field pointer 2, offset2, is 8 + 3 * 8 + 8 + 16 = 56. The value of field pointer 3, offset3, is 8 + 3 * 8 + 8 + 16 + 8 = 64.

[0504] It should be noted that the value of each of the above N field pointers is described using the first bit of the field option section as a reference bit. In practical applications, the value of a field pointer can be calculated using other bits as reference bits, and this application does not impose any restrictions on this.

[0505] Optionally, the first field pointer of the at least one field pointer is a second type field pointer, the first field pointer corresponds to the first field among the at least one fields, and the first field pointer is located before the first type field pointer among the at least one field pointer.

[0506] For example, such as Figure 3A As shown, field pointer 1 corresponds to field 1, and field pointer 1 is located before field pointer 2 and field pointer 3. The first communication device determines the order of at least one field pointer and the order of the at least one field. Then, the first communication device encapsulates the field option portion, at least one field pointer, and at least one field in sequence, and the resulting first message is as follows. Figure 3A As shown.

[0507] In this implementation, optionally, the at least one field includes N fields, and the at least one field pointer includes N+1 field pointers. N is an integer greater than or equal to 1, and b is an integer greater than or equal to 1 and less than or equal to N.

[0508] The b-th field corresponds to a pointer to the b-th field and a pointer to the (b+1)-th field. The pointer to the b-th field indicates the start bit position of the b-th field in the first message. The pointer to the (b+1)-th field indicates the end bit position of the b-th field in the first message.

[0509] For example, such as Figure 3A As shown, field 1 corresponds to field pointer 1 and field pointer 2. Field pointer 1 takes the value of the start bit position of field 1 in the first message. Field pointer 2 takes the value of the end bit position of field 1 in the first message. For example, as... Figure 3A As shown, field 2 corresponds to field pointer 2 and field pointer 3. The value of field pointer 2 is the start bit position of field 2 in the first message. The value of field pointer 3 is the end bit position of field 2 in the first message. The same applies to field 3, so it will not be described in detail here.

[0510] In some implementations, the length of each of the N+1 field pointers is equal.

[0511] The value of the pointer to the first field out of N+1 fields is offset1 = l Bitmap +w Bitmap *l offset .

[0512] The value of the pointer to the a-th field out of N+1 fields is offset. a =l Bitmap +w Bitmap *l offset +l (1,a-1) .

[0513] Among them, l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of the pointer to each field. (1,a-1) It is the sum of the lengths of the first to the (a-1)th fields out of N fields, where a is an integer greater than or equal to 2 and less than or equal to N+1.

[0514] For example, such as Figure 3AAs shown, the field options section is 8 bits long, and the number of field types indicated in the field options section is 4. Each field pointer is 8 bits long. Field 1 is 8 bits long, field 2 is 16 bits long, and field 3 is 8 bits long. The value of field pointer 1 is offset1 = 8 + 4 * 8 = 40. The value of field pointer 2 is offset2 = 8 + 4 * 8 + 8 = 48. The value of field pointer 3 is offset3 = 8 + 4 * 8 + 8 + 16 = 64. The value of field pointer 4 is offset4 = 8 + 4 * 8 + 8 + 16 + 8 = 72.

[0515] It should be noted that the value of each of the above N field pointers is described using the first bit of the field option section as a reference bit. In practical applications, the value of a field pointer can be calculated using other bits as reference bits, and this application does not impose any restrictions on this.

[0516] 202. The first communication device sends a first message to the second communication device. Correspondingly, the second communication device receives the first message from the first communication device.

[0517] For details regarding the first message, please refer to the relevant information in step 201 above; it will not be repeated here.

[0518] 203. The second communication device determines that the first message contains the first field based on the field option section and the first order.

[0519] For example, based on Figure 3A The diagram shows the structure of the first message. The field options section is "01010001". The second communication device determines that bit 2 of the field options section is "1". Based on Table 1 above, the second communication device can determine that the first message contains field 1 (i.e., the TTL field). For example, the second communication device determines that bit 4 of the field options section is "1". Based on Table 1 above, the second communication device can determine that the first message contains field 2 (i.e., the sequence number field). For example, the second communication device determines that bit 8 of the field options section is "1". Based on Table 1 above, the second communication device can determine that the first message contains field 3 (i.e., the communication identifier field).

[0520] In some implementations, the first message also includes a length identifier portion. The length identifier portion is used to indicate the length of the field options portion.

[0521] Optionally, the last bit of the length identifier portion is consecutive to the first bit of the field options portion. For example, as shown below. Figure 3C As shown, the length identifier portion is connected to the field option portion so that the second communication device can parse the length identifier portion before parsing the field option portion to determine the length of the field option portion.

[0522] Optionally, the length identifier portion is also used to indicate the first order. For example, if the length identifier portion is 3 bits long and is "001", it indicates that the first order is the field type indication order shown in Table 1 above. If the length identifier portion is "010", it indicates that the first order is the field type indication order shown in Table 2 above.

[0523] Optional, Figure 2 The illustrated embodiment also includes steps 203a and 203b, which can be performed before step 203.

[0524] 203a. The second communication device determines the length of the field option portion based on the length identifier portion;

[0525] For example, if the length identifier part is 3 bits long, that is, the length identifier part is "001", it means that the length of the field option part is 8 bits long.

[0526] Optionally, the length identifier portion is also used to indicate the first order. (The above...) Figure 2 The illustrated embodiment also includes step 203c, which can be performed before step 203.

[0527] 203c. The second communication device determines the first order based on the length identifier portion.

[0528] For example, when the length identifier portion is "001", the second communication device determines to use the field type indication order in Table 1 above as the first order. When the length identifier portion is "010", the second communication device determines to use the field type indication order shown in Table 2 above as the first order.

[0529] Therefore, the length indicator is also used to indicate the first order, that is, the field type indication order used in the field option section can be flexibly configured as needed, which improves the practicality of the solution.

[0530] It should be noted that there is no fixed execution order between step 203c and steps 203a and 203b. Steps 203a and 203b can be executed first, followed by step 203c; or step 203c can be executed first, followed by steps 203a and 203b; or, depending on the circumstances, steps 203c can be executed simultaneously with steps 203a and 203b. This application does not impose any specific restrictions on this.

[0531] 203b. The second communication device determines the field option section based on the length of the field option section.

[0532] Specifically, after the second communication device determines the length of the field option portion, the second communication device can read the field option portion according to the length of the field option portion.

[0533] In some implementations, the at least one field is a first type field, and the first message also includes a second type field.

[0534] The second type of field can be understood as a commonly used field type, or a field type that is read frequently. The first type of field, on the other hand, is read less frequently than the second type. For example, a second type of field could be a destination address field.

[0535] In one possible implementation, the last bit occupied by the second type field is consecutive to the first bit occupied by the field option portion. For example, as... Figure 3E As shown, the second type field and the field option section are consecutive. The second communication device can read the second type field first, and then read the field option section.

[0536] In another possible implementation, the last bit occupied by the second type field is consecutive to the first bit occupied by the length identifier portion. For example, as... Figure 3F As shown, the second type field is continuous with the length identifier portion. The second communication device can first read the second type field, and then read the length identifier portion to determine the length of the field option portion. Then, the second communication device reads the field option portion according to the length of the field option portion and the first order.

[0537] 204. The second communication device determines one or more fields corresponding to the first field from at least one field pointer.

[0538] In step 204 above, the second communication device can determine the indication order of the first fields in the field option section. The second communication device then determines one or more fields corresponding to the first field from at least one field pointer based on this indication order.

[0539] For example, based on the above Figure 3B or Figure 3D The structure of the first message shown is as follows: Figure 4B As shown, the second communication device determines that the field type indicated in the second field option section is field type 2. The second communication device can determine that field 2 corresponds to field pointer 1 and field pointer 2.

[0540] For example, based on the above Figure 3B or Figure 3D The structure of the first message shown is as follows: Figure 4CAs shown, the second communication device determines that the third field type indicated in the field options section is field type 3. The second communication device can determine that field 3 corresponds to field pointer 2 and field pointer 3.

[0541] Optionally, the first field of the N fields is positioned at the start bit position of the first field in the first message, which is equal to the length of the field options section plus the length of the N field pointers; the first field pointer of the N field pointers is used to indicate the end bit position of the first field in the first message.

[0542] For example, based on the above Figure 3B or Figure 3D The structure of the first message shown is as follows: Figure 4A As shown, the second communication device determines that the first indicated field type in the field options section is field type 1. The second communication device can determine that field 1 corresponds to field pointer 1.

[0543] 205. The second communication device determines the position of the first field in the first message based on the one or more field pointers.

[0544] In some implementations, the at least one field includes a third field pointer and a fourth field pointer. The first field corresponds to at least one of the third and fourth field pointers.

[0545] Optionally, step 205 above specifically includes step 205a. Step 205a: The second communication device determines the start bit position of the first field in the first message according to the third field pointer, and / or determines the end bit position of the first field in the first message according to the fourth field pointer.

[0546] The value of the fourth field pointer is either the position of the end bit of the first field in the first message, or the length of the first field. The following explanation will use the example of the fourth field pointer being the position of the end bit of the first field in the first message.

[0547] For example, based on Figure 3B or Figure 3D The second communication device determines field pointer 1 corresponding to field 1. Specifically, as follows... Figure 4A As shown, the second communication device uses the value of field pointer 1 as the end bit position of field 1 in the first message.

[0548] If the first message is Figure 3B In the structure shown, the value of field pointer 1 is offset1 = l Bitmap +w Bitmap *l offset , l Bitmap w represents the length of the field options section. BitmapThe number of field types indicated in the field options section, l offset The length of each field pointer. If the first message is... Figure 3D In the structure shown, the value of field pointer 1 is offset1 = l Bitmaplength +l Bitmap +w Bitmap *l offset l Bitmaplength The length of the length identifier portion.

[0549] For example, based on Figure 3B or Figure 3D The second communication device determines that field 2 corresponds to field pointer 1 and field pointer 2. Specifically, as follows... Figure 4B As shown, the second communication device uses the value of field pointer 1 as the start bit position of field 2 in the first message. The second communication device uses the value of field pointer 2 as the end bit position of field 2 in the first message.

[0550] If the first message is Figure 3B In the structure shown, the value of field pointer 2 is offset2 = l Bitmap +w Bitmap *l offset +l (1,2-1) , l Bitmap w represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of the pointer to each field. (1,2-1) This is the length of the first field. If the first message is... Figure 3D In the structure shown, the value of field pointer 2 is offset2 = l Bitmaplength +l Bitmap +w Bitmap *l offset +l (1,2-1) .

[0551] For example, based on Figure 3B or Figure 3D The second communication device determines that field 3 corresponds to field pointer 2 and field pointer 3. For example... Figure 4C As shown, the second communication device uses the value of field pointer 2 as the start bit position of field 3 in the first message. The second communication device uses the value of field pointer 3 as the end bit position of field 3 in the first message.

[0552] If the first message is Figure 3B In the structure shown, the value of field pointer 3 is offset3 = l Bitmap +w Bitmap *l offset +l (1,3-1) , l Bitmapw represents the length of the field options section. Bitmap The number of field types indicated in the field options section, l offset The length of the pointer to each field. (1,3-1) It equals the length of the first field plus the length of the second field. If the first message is... Figure 3D In the structure shown, the value of field pointer 2 is offset3 = l Bitmaplength +l Bitmap +w Bitmap *l offset +l (1,3-1) .

[0553] 206. The second communication device determines the value of the first field based on its position in the first message.

[0554] Optionally, based on step 205a above, step 206 specifically includes: the second communication device reading the value of the first field from the first message according to the start bit position and / or end bit position.

[0555] For example, combining Figure 3B and Figure 4A The second communication device reads the first field from its position in the first message to obtain its value. The second communication device can then send field 1 to process A to facilitate its execution. Figure 4B and Figure 4C The examples are similar, and will not be described one by one here.

[0556] The above Figure 4A , Figure 4B and Figure 4C The process of a second communication device reading a single field is illustrated. Because the reading processes for different fields are decoupled (the position of a field is determined by its corresponding field pointer, and the reading of different fields is independent), the second communication device can read multiple fields in parallel and send the values ​​of the corresponding fields to the appropriate processes, thereby achieving parallel process execution and improving message processing efficiency. For example, as shown... Figure 4D As shown, the second communication device combines the above Table 1 and Figure 3B The diagram shows the structure of the first message. The second communication device determines the field types of the three fields in the first message based on the field options section, and identifies the corresponding field pointers for each of the three fields. Then, the second communication device determines the position of each of the three fields within the first message based on its corresponding field pointers. Next, the second communication device determines the value of each field based on its position in the first message, and then sends the value of each field to the corresponding process, thereby achieving parallel field parsing.

[0557] In this embodiment, a first communication device generates a first message, which includes a field option section, at least one field pointer, and at least one field. The field option section indicates the field type of at least one field in a first order, where the first order is the indication order of the field types. The at least one field includes a first field and one or more field pointers among at least one pointers corresponding to the first field. These one or more field pointers are used to determine the position of the first field in the first message. The first communication device sends the first message to a second communication device. Therefore, the one or more field pointers among at least one pointers corresponding to the first field are used to determine the position of the first field in the first message. That is, the second communication device can determine the position of the first field in the first message through the one or more field pointers corresponding to the first field. During the reading of any field in the first message, it does not depend on the reading of the preceding fields, i.e., it is independent of the field order in the message. This improves the efficiency of the device reading fields. Furthermore, since the first communication device indicates the position of the first field in the first message through field pointers, the second communication device can determine the start bit position and / or end bit position of the first field through the field pointers. Therefore, the length of the fields in the first message is flexible and variable, suitable for different scenario requirements.

[0558] In this application, the above Figure 2 In step 201 of the illustrated embodiment, during the generation of the first message, the first communication device determines the field option portion. The following describes a possible implementation of the first communication device determining the field option portion. Optionally, step 201 includes step 201a.

[0559] 201a. The first communication device compresses the first bit sequence to obtain the field option part.

[0560] The first bit sequence is the bit sequence before compression, and the "1" bits in the first bit sequence are used to indicate the field type of at least one field in a first order. The field option portion is the bit sequence obtained after compression. The length of the field option portion is less than the length of the first bit sequence. For example, if the first bit sequence is "1111111101010000", the "1" bits in "1111111101010000" indicate the field type of at least one field in a first order.

[0561] Therefore, in step 201a above, the length of the field options portion is less than the length of the first bit sequence. The first communication device obtains the field options portion by compressing the first bit sequence, thereby reducing the bit overhead in the first message.

[0562] Correspondingly, optionally, the above Figure 2The illustrated embodiment also includes step 203d, which can be performed before step 203.

[0563] 203d. The second communication device parses the field options section to obtain the first bit sequence.

[0564] Based on step 203d above, step 203 specifically includes: the second communication device determining that the first message contains a first field based on the first bit sequence and the first order.

[0565] For example, the first bit sequence is "1111111101010000". The second communication device, combining the field type indication order shown in Table 1 above, can determine the field types contained in the first message. Referring to the examples in Table 1, the first message includes a source address field, a TTL field, a next message header number, a sequence number, etc.

[0566] In step 201a above, the first communication device can compress the first bit sequence in various ways, and this application does not limit the compression method. The following describes two possible structures for the field option portion obtained after the first communication device compresses the first bit sequence.

[0567] Structure 1: The field options section includes a first segment structure and a second segment structure. The first segment structure includes a first segment pattern identifier, and the second segment structure includes a second segment pattern identifier and a second bit sequence.

[0568] The first segmentation mode identifier indicates that the third bit sequence is omitted in the field options section, and that all bits in the third bit sequence are either "1" bits or all bits are "0" bits. The second segmentation mode identifier indicates that the second bit sequence contains "1" bits and that the second segmentation structure is the last segmentation structure in the field options section. The last bit of the third bit sequence is concatenated with the first bit of the second bit sequence to form the first bit sequence.

[0569] It should be noted that, optionally, the segmentation pattern identifier portion in each segmentation structure in the field options section can be of a fixed length, and the length of the segmentation pattern identifier portion in different segmentation structures can be the same.

[0570] For example, when the mode digits identifier is 00, it means that a sequence of all "0" bits has been omitted from the field options. When MD is "01", it means that a sequence of all "1" bits has been omitted from the field options. MD is "10", indicating that the segment structure corresponding to this MD includes a bit sequence containing "1" bits, but not all "1" bits. MD is "11", indicating that the segment structure corresponding to this MD includes a bit sequence containing "1" bits, and this segment structure is the last segment structure in the field options. It should be noted that the bit sequences indicated by MD are of the same length.

[0571] For example, such as Figure 5A As shown, the field options section includes a first segment structure and a second segment structure. The MD value in the first segment structure is 00, indicating that the third bit sequence, consisting entirely of "0" bits, is omitted. The length of the third bit sequence is 8, meaning the third bit sequence is "00000000". The MD value in the second segment structure is 11, indicating that the second bit sequence included in the second segment structure is a bit sequence containing "1" bits, and that the second segment structure is the last segment structure in the field options section. Figure 5A As shown, the second bit sequence is "01010001". Therefore, the first bit sequence is "0000000001010001".

[0572] For example, such as Figure 5B As shown, the field options section includes a first segment structure and a second segment structure. The MD value in the first segment structure is 01, indicating that the third bit sequence, consisting entirely of "1" bits, is omitted. This third bit sequence is 8 bits long, meaning it is "11111111". The MD value in the second segment structure is 11, indicating that the second segment structure includes a bit sequence containing "1" bits, and that this second segment structure is the last segment structure in the field options section. Figure 5B As shown, the second bit sequence is "01010001". Therefore, the first bit sequence is "1111111101010001".

[0573] It should be noted that the above example only shows the case where the field option section includes two segmented structures. In actual applications, the field option section includes at least two segmented structures.

[0574] For example, such as Figure 5CAs shown, the field options section includes a first segment structure, a second segment structure, and a third segment structure. In the first segment structure, MD is 00, indicating that the bit sequence "00000000" is omitted from the field options section. In the second segment structure, MD is 11, indicating that the second segment structure includes a bit sequence containing "1" bits, and that the second segment structure is the last segment of the field options section. The second segment structure includes the bit sequence "01010001". In the third segment structure, MD is 01, indicating that the bit sequence "11111111" is omitted from the field options section. Therefore, the first bit sequence is "111111110000000001010001".

[0575] For example, such as Figure 5D As shown, the field options section includes a first segment structure, a second segment structure, and a third segment structure. In the first segment structure, MD is 00, indicating that the bit sequence "00000000" is omitted from the field options section. In the second segment structure, MD is 11, indicating that the second segment structure includes a bit sequence containing "1" bits, and that the second segment structure is the last segment structure in the field options section. The second segment structure includes the bit sequence "01010001". In the third segment structure, MD is 10, indicating that the third segment structure includes a bit sequence containing "1" bits, but not all of them being "1", as detailed below. Figure 5D As shown, the third segment structure includes the bit sequence "00010000". Therefore, the first bit sequence is "000100000000000001010001".

[0576] Based on the above structure 1, step 203d specifically includes steps 2001 to 2003.

[0577] 2001. The second communication device determines the third bit sequence based on the first segmentation mode identifier portion.

[0578] For example, such as Figure 5A As shown, the second communication device omits the third bit sequence "00000000" in the field option section based on the first segmentation mode representation section.

[0579] 2002. The second communication device determines the second bit sequence based on the second segmentation mode identifier portion.

[0580] For example, such as Figure 5A As shown, the second segment structure includes the second bit sequence "01010001".

[0581] 2003. The second communication device concatenates the last bit of the third bit sequence with the first bit of the second bit sequence according to the second segmentation mode identifier portion to obtain the first bit sequence.

[0582] For example, such as Figure 5A As shown, the second segmentation mode identifier is used to indicate that the second segmentation structure is the last segmentation structure of the field option section. Therefore, the second communication device concatenates the last bit of the third bit sequence "00000000" with the first bit of the second bit sequence "01010001" to obtain the first bit sequence "0000000001010001".

[0583] Structure 2: The field options section includes a first segment structure and a second segment structure. The first segment structure includes a first segment pattern identifier and a first quantity indicator. The second segment structure includes a second segment pattern identifier, a second quantity indicator, and a second bit sequence.

[0584] The first segmentation mode identifier indicates that the third bit sequence is omitted in the field option section, and the bits in the third bit sequence are all "1" bits or all "0" bits. The first quantity indicator indicates that X third bit sequences are omitted in the field option section, where X is an integer greater than or equal to 1. The X third bit sequences constitute the fourth bit sequence, which includes all bits in the X third bit sequences.

[0585] The second segmentation pattern identifier indicates that the second bit sequence contains a "1" bit and that the second segmentation structure is the last segmentation structure in the field options section. The second quantity indicator indicates that the second bit sequence comprises Y bit sequence units, where the length of each of the Y bit sequence units is the same as the length of the third bit sequence, and Y is an integer greater than or equal to 1. The last bit of the fourth bit sequence is concatenated with the first bit of the second bit sequence to obtain the first bit sequence. It should be noted that the first and second quantity indicator sections can be of fixed length.

[0586] Optionally, the segmentation pattern identifier portion in each segmentation structure can be of fixed length, and the length of the segmentation pattern identifier portion in different segmentation structures can be the same. The quantity indicator portion in each segmentation structure can also be of fixed length, and the length of the quantity indicator portion in different segmentation structures can be the same.

[0587] For example, such as Figure 6AAs shown, in the first segment structure, MD is 00, indicating that the third bit sequence "00000000" is omitted in the field option section. The first quantity indicator (expressed length, EL) is 3, indicating that three third bit sequences are omitted in the field option section. These three third bit sequences constitute the fourth bit sequence "00000000000000000". In the second segment structure, MD is 11, indicating that the second segment structure includes a second bit sequence containing a "1" bit. The second quantity indicator EL is 1, indicating that the length of the second bit sequence is 8. Therefore, the first bit sequence is "000000000000000001010001".

[0588] It should be noted that the above example only shows the case where the field option section includes two segmented structures. In actual applications, the field option section includes at least two segmented structures.

[0589] For example, such as Figure 6B As shown, in the first segment structure, MD is 00, indicating that the field option section omits the bit sequence "00000000". The first quantity indicator EL = 5, indicating that 5 bit sequences are omitted from the field option section. The three bit sequences "00000000" constitute the bit sequence "000000000000000000000000000000000". In the second segment structure, MD is 11, indicating that the second segment structure includes a bit sequence containing a "1" bit. The second quantity indicator EL = 1, indicating that the length of this bit sequence containing a "1" bit is 8 bits. In the third segment structure, MD is 10, indicating that the third segment structure includes a bit sequence containing a "1" bit, but not all of them are "1" bits. The third quantity indicator EL = 1, indicating that the length of this bit sequence containing a "1" bit, but not all of them are "1" bits, is 8 bits. Therefore, the first bit sequence is "00001000000000000000000000000000000000001010001".

[0590] Based on the above structure 2, step 203d specifically includes steps 2004 to 2007.

[0591] 2004. The second communication device determines the X third bit sequence omitted in the field option section based on the first quantity indication section and the first segmentation mode identifier section.

[0592] For example, such as Figure 6A As shown, the second communication device can determine the three third bit sequences "00000000" by using the first quantity indication part EL=3 and the first segmentation mode identifier part MD=00.

[0593] 2005. The second communication device constructs a fourth bit sequence using X second bit sequences, the fourth bit sequence including all bits in the X third bit sequences.

[0594] like Figure 6A As shown, the fourth bit sequence formed by the three third bit sequences is "0000000000000000".

[0595] 2006. The second communication device determines the second bit sequence based on the second segmentation mode identifier portion and the second quantity indication portion.

[0596] For example, such as Figure 6A As shown, the second bit sequence is "01010001".

[0597] 2007. The second communication device concatenates the last bit of the fourth bit sequence with the first bit of the second bit sequence according to the second segmentation mode identifier to obtain the first bit sequence.

[0598] For example, such as Figure 6A As shown, the fourth bit sequence is "00000000000000000", and the second bit sequence is "01010001". The second segmentation mode identifier indicates that the second segmentation structure is the last segmentation structure in the field option section. Therefore, the second communication device can concatenate the fourth bit sequence with the second bit sequence to obtain the first bit sequence "000000000000000001010001".

[0599] Figure 7 This is a schematic diagram of another embodiment of the message processing method described in this application. Please refer to... Figure 7 The message processing methods include:

[0600] 701. A first communication device generates a first message. The first message includes a length identifier portion, a field options portion, and at least one field. The length identifier portion indicates the length of the field options portion. The field options portion indicates the field types of at least one field in a first order. The first order is the order in which the field types are indicated.

[0601] For example, such as Figure 8A As shown, the first message includes a length identifier portion, a field options portion, and at least one field. The length identifier portion indicates that the length of the field options portion is 7 bits.

[0602] For example, such as Figure 3D As shown, the first message includes a length identifier portion, a field options portion, and at least one field. The length identifier portion indicates that the length of the field options portion is 8 bits.

[0603] For information regarding field options, length identifiers, and first order, please refer to the aforementioned sections. Figure 2 The relevant description of step 201 in the illustrated embodiment will not be repeated here.

[0604] In one possible implementation, the last bit occupied by the length identifier portion is consecutive to the first bit occupied by the field options portion.

[0605] For example, such as Figure 8A In this context, the length identifier portion is 1 bit long, and the bits occupied by the length identifier portion are consecutive to the first bit occupied by the field options portion. From... Figure 8A As can be seen, the length identifier and the field options are located in the same byte. The length identifier occupies the first bit of the byte, and the field options occupy the last 7 bits of the byte. The length identifier being "1" indicates that the length of the field options is 7.

[0606] For example, such as Figure 8B In this context, the length identifier portion is 2 bits long, and the last bit of the length identifier portion is consecutive to the first bit of the field options portion. From... Figure 8B As can be seen, the length identifier and the field options are located in the same byte. The length identifier occupies the first two bits of the byte, and the field options occupy the last six bits of the byte.

[0607] For example, such as Figure 8C In this context, the length identifier portion is 2 bits long, and the last bit of the length identifier portion is consecutive to the first bit of the field options portion. From... Figure 8C It can be seen that the length identifier part and the field option part are located in two consecutive bytes. The length identifier part occupies the first two bits of the first byte of the two consecutive bytes, and the field option part occupies the last 14 bits of the two consecutive bytes.

[0608] In some implementations, the structure type of the first message can be indicated in any of the following ways. In this application, the structure type of the first message may include: each field in the first message may be a fixed-length field, or the first message may include at least one field pointer (the length of the field may be flexible).

[0609] Method 1: The length identifier portion is also used to indicate that each field in the first message is a fixed-length field; or, the length identifier portion is also used to indicate that the first message also includes at least one field pointer. The at least one field includes a first field, which corresponds to one or more field pointers among the at least one field pointers, which are used to determine the position of the first field in the first message.

[0610] Optional, fixed-length fields include: predefined fixed-length fields and third-type fields. Third-type fields are fields in which a portion of the field's bits can be used to identify its length. For example, third-type fields can be destination address fields, source address fields, etc.

[0611] For example, the first communication device can encode and encapsulate the length identifier portion and the field option portion in accordance with the correspondence shown in Table 3 below.

[0612] Table 3

[0613]

[0614] As shown in Table 1 above, the value of the length identifier can indicate the length of the field options section and that each field in the first message is a fixed-length field.

[0615] As shown in Table 1, when the length identifier is "1", it means the field option section is 7 bits long and each field in the first message is a fixed-length field. When the length identifier is "01", it means the field option section is 14 bits long and each field in the first message is a fixed-length field. When the length identifier is "001", it means the field option section is 21 bits long and each field in the first message is a fixed-length field. When the length identifier is "0001", it means the field option section is 28 bits long and each field in the first message is a fixed-length field. When the length identifier is "00001", it means the field option section is 35 bits long and each field in the first message is a fixed-length field. When the length identifier is "000001", it means the field option section is 42 bits long and each field in the first message is a fixed-length field. When the length identifier is "0000001", it means the length of the field options section is 49 bits and each field in the first message is a fixed-length field. When the length identifier is "00000001", it means the length of the field options section is 56 bits and the first message contains at least one field pointer.

[0616] For example, such as Figure 8D As shown, when the length identifier is "1", it means that the length of the field options section is 7 bits, and it also means that Field 1, Field 2, and Field 3 included in the first message are all fixed-length fields. In other words, a length identifier of "1" indicates that the first message is a message for a very simple scenario, and each field in the first message is a fixed-length field.

[0617] For example, such as Figure 8EAs shown, when the length identifier is "01", it indicates that the length of the field options section is 14 bits, and also that fields 1, 2, and 3 included in the first message are all fixed-length fields. In other words, a length identifier of "01" indicates that the first message is a message in a very simplified scenario, and each field in the first message is a fixed-length field.

[0618] For example, such as Figure 8F As shown, when the length identifier is "001", it means that the length of the field options section is 21 bits, and it also means that Field 1, Field 2, and Field 3 included in the first message are all fixed-length fields. In other words, the length identifier "001" is used to indicate that the first message is a message in a very simplified scenario, and each field in the first message is a fixed-length field.

[0619] For example, such as Figure 3D As shown, when the length identifier is "0", it means that the length of the field option section is 8 bits, and it also means that the first message includes at least one field pointer. That is, when the length identifier is "0", it indicates that the first message includes at least one field pointer, thereby indirectly indicating that the second communication device can read the value of the field in the first message by means of the field pointer.

[0620] In Method 1, please refer to the foregoing for details regarding the at least one field pointer, the one or more field pointers corresponding to the first field, the order of the at least one field, and the order of the at least one field pointer. Figure 2 The relevant descriptions of the embodiments shown will not be repeated here.

[0621] In one possible implementation, the last bit of the length identifier portion is consecutive to the first bit of the field options portion. At least one field has consecutive bits between any two adjacent fields, and the last bit of the field options portion is consecutive to the first bit of at least one field.

[0622] Method 2: The first message also includes a feature identifier portion, which indicates that each field in the first message is a fixed-length field, or the feature identifier portion indicates that the first message includes at least one field pointer. The at least one field includes a first field, which corresponds to one or more field pointers among the at least one field pointers, and the one or more field pointers are used to determine the position of the first field in the first message.

[0623] For example, when the feature identifier is "1", it indicates that each field in the first message is a fixed-length field; when the feature identifier is "0", it indicates that the first message includes at least one field pointer.

[0624] It should be noted that the length of the feature identifier portion is not limited in this application. For example, the length of the feature identifier portion may be 1 bit, 2 bits, or 3 bits. The length of the feature identifier portion can be determined in conjunction with the structure type of the first message. For example, as described above, in this application, each field in the first message may be a fixed-length field, or the first message may include at least one field pointer (the field may be of flexible length). Therefore, the feature identifier portion can indicate either of these two possible message structures with just 1 bit.

[0625] For information on fixed-length fields and at least one field pointer, please refer to the aforementioned introductions. Further details will not be provided here.

[0626] Optionally, the last bit occupied by the feature identifier portion is consecutive to the first bit occupied by the length identifier portion.

[0627] For example, such as Figure 9A As shown, the first message also includes a feature identifier section, which is continuous with the length identifier section. For example, when the feature identifier section is "1", it indicates that each field in the first message is a fixed-length field. Figure 9A In the structure of the first message shown, fields 1 to 3 are all fixed-length fields.

[0628] For example, such as Figure 9B As shown, the first message includes a feature identifier portion, which is continuous with the length identifier portion. The feature identifier portion is used to indicate that the structure of the first message includes at least one field pointer.

[0629] For example, such as Figure 9C As shown, the feature identifier portion of the first message is “00000001”, which indicates that the structure of the first message includes at least one field pointer.

[0630] In some implementations, the at least one field is a first type field, and the first message also includes a second type field.

[0631] The second type of field can be understood as a commonly used field type, or a field type that is read frequently. The first type of field, on the other hand, is read less frequently than the second type. For example, a second type of field could be a destination address field.

[0632] Optionally, the last bit occupied by the second type field is consecutive to the first bit occupied by the field options section. For example, as Figure 9D As shown, the first message includes a second type field, which is the destination address field, and the destination address field is continuous with the length identifier portion. Field 1 is the source address field, field 2 is the TTL field, and field 3 is the next message header field.

[0633] 702. The first communication device sends a first message to the second communication device. Correspondingly, the second communication device receives the first message from the first communication device.

[0634] 703. The second communication device determines the length of the field option section based on the length identifier section.

[0635] For example, such as Figure 8A As shown, when the length identifier part is "1", the second communication device can determine that the length of the field option part is 7 bits.

[0636] It should be noted that, optionally, if the first message also includes a second type field, and the second type field precedes the length identifier portion, the second communication device may first parse the second type field, and then parse the length identifier portion to determine the length of the field options portion.

[0637] 704. The second communication device determines that the first message contains the first field based on the first sequence and the length of the field option portion.

[0638] In some implementations, step 704 specifically includes steps 704a and 704b.

[0639] 704a. The second communication device determines the field option section based on the length of the field option section.

[0640] 704b. The second communication device determines that the first message contains the first field based on the first sequence and field options section.

[0641] Step 704b and the aforementioned Figure 2 Step 203 in the illustrated embodiment is similar; please refer to the foregoing for details. Figure 2 The relevant description of step 203 in the illustrated embodiment will not be repeated here.

[0642] 705. The second communication device reads the value of the first field.

[0643] In some implementations, step 705 specifically includes steps 705a to 705c.

[0644] 705a. The second communication device determines that each field in the first message is a fixed-length field.

[0645] Implementation Method 1: The length identifier portion is used to indicate that each field in the first message is a fixed-length field. The second communication device determines that each field in the first message is a fixed-length field based on the length identifier portion.

[0646] For example, such as Figure 8AAs shown, the length identifier is "1", which means that the length of the field options section is 7 bits, and also means that the first message includes fields 1, 2 and 3, which are all fixed-length fields.

[0647] Implementation Method 2: The first message also includes a feature identifier portion, which indicates that each field in the first message is a fixed-length field. The second communication device determines that each field in the first message is a fixed-length field based on the feature identifier portion.

[0648] For example, such as Figure 9A As shown, the feature identifier is "1", which means that fields 1, 2 and 3 included in the first message are all fixed-length fields.

[0649] 705b. The second communication device determines, based on the field option section, that the first field is the c-th field among at least one field, where c is an integer greater than 1.

[0650] As described above, at least one field is ordered according to a first order. The second communication device can determine that the first field is the c-th field among at least one fields based on the indicated order of the first field.

[0651] For example, such as Figure 8A As shown, the field options section is "1010001". Referring to Table 1 above, if the first field is the source address field, then the first field is the first field among the at least one fields, i.e., field 1. If the first field is the next message header number, then the first field is the second field among the at least one fields, i.e., field 2.

[0652] 705c, The second communication device uses the sum of the length of the length identifier portion, the length of the field option portion, and the first length as the value of the first field, where the first length is the length of each field multiplied by c-1; or, the second communication device uses the sum of the length of the feature identifier portion, the length identifier portion, the length of the field option portion, and the first length as the value of the first field.

[0653] Based on implementation method 1 in step 705a above, the last bit occupied by the length identifier portion is consecutive to the first bit occupied by the field option portion. The at least one field is ordered in a first order, and any two adjacent fields occupy consecutive bits. The last bit occupied by the field option portion is consecutive to the first bit occupied by the at least one field. The second communication device uses the sum of the length of the length identifier portion, the length of the field option portion, and the first length as the value of the first field.

[0654] Based on implementation method 2 in step 705a above, the last bit occupied by the feature identifier portion is consecutive to the first bit occupied by the length identifier portion. The last bit occupied by the length identifier portion is consecutive to the first bit occupied by the field option portion. The at least one field is ordered in a first order, and any two adjacent fields occupy consecutive bits. The last bit occupied by the field option portion is consecutive to the first bit occupied by at least one field. The second communication device uses the sum of the length of the feature identifier portion, the length of the length identifier portion, the length of the field option portion, and the first length as the value of the first field.

[0655] For example, such as Figure 8A As shown, if the first field is field 1, then the value of the first field is the length of the field option section. For example, if the first field is field 2, then the value of the first field is the length of the field option section plus the length of field 1. For another example, if the first field is field 3, then the value of the first field is the length of the field option section plus the length of field 1 plus the length of field 2.

[0656] It should be noted that, optionally, at least one field is a first-type field, and the first message also includes a second-type field. The last bit occupied by the second-type field is consecutive to the first bit occupied by the field options section.

[0657] The above step 705c specifically includes: the second communication device taking the sum of the length of the second type field, the length of the length identifier portion, the length of the field option portion, and the first length as the value of the first field, where the first length is the length of each field multiplied by c-1; or, the second communication device taking the sum of the length of the feature identifier portion, the length of the field option portion, and the first length as the value of the first field.

[0658] For example, such as Figure 8B As shown, the value of field 1 is equal to the length of the second type field plus the length of the length identifier part plus the length of the field option part. The value of field 2 is equal to the sum of the length of the second type field, the length of the length identifier part, the length of the field option part, and the length of field 1. The value of field 3 is equal to the sum of the length of the second type field, the length of the length identifier part, the length of the field option part, the length of field 1, and the length of field 2.

[0659] Therefore, it can be seen that the second communication device, in the process of reading any field of the first message, does not need to rely on the preceding fields of that field, that is, it is independent of the order of the fields in the message. This improves the efficiency of the device in reading fields and enables efficient parsing of message fields.

[0660] In some implementations, step 705 specifically includes steps 705d and 705e.

[0661] 705d: The second communication device determines that the first message includes at least one field pointer, or the second communication device determines that the first message includes at least one field pointer based on the feature identifier portion.

[0662] Implementation Method 1: The length identifier portion is used to indicate that the first message includes at least one field pointer. The second communication device determines that the first message includes at least one field pointer based on the length identifier portion.

[0663] For example, such as Figure 3A As shown, the length identifier is "0", which means that the length of the field options section is 8, and also means that the first message includes at least one field pointer.

[0664] Implementation Method 2: The first message also includes a feature identifier portion, which indicates that the first message includes at least one field pointer. The second communication device determines that the first message includes at least one field pointer based on the feature identifier portion.

[0665] For example, such as Figure 9B As shown, the feature identifier is "0", which means that the first message includes at least one field pointer.

[0666] 705e: The second communication device reads the value of the first field based on one or more field pointers corresponding to the first field.

[0667] Please refer to the preceding section for the process by which the second communication device reads the value of the first field based on one or more field pointers. Figure 2 The relevant descriptions of steps 205 and 206 in the illustrated embodiments will not be repeated here.

[0668] In this embodiment, a first communication device generates a first message. The first message includes a length identifier portion, a field option portion, and at least one field. The length identifier portion indicates the length of the field option portion, and the field option portion indicates the field types of at least one field in a first order, where the first order is the indication order of the field types. The first communication device sends the first message to a second communication device. Therefore, the first communication device indicates the length of the field option portion through the length identifier portion, meaning the length of the field option portion is not fixed. This allows the first communication device to flexibly configure the length of the field option portion according to the actual fields indicated. This improves the utilization rate of bit resources and can meet the needs of various scenarios. For example, as... Figure 8A The structure of the first message shown is suitable for extremely simple scenarios. It uses fewer bits to indicate the field type of at least one field in the first message, resulting in low bit overhead. This significantly reduces power consumption in low-power scenarios.

[0669] In this application, optionally, the above... Figure 7In the illustrated embodiment, during the process of the first communication device generating the first message, the first communication device determines the field option portion. The following describes a possible implementation of the first communication device determining the field option portion. Optionally, step 701 above includes step 701a.

[0670] 701a. The first communication device compresses the first bit sequence to obtain the field option part.

[0671] Step 701a is similar to the aforementioned step 201a. Please refer to the relevant description of the aforementioned step 201a for details, which will not be repeated here.

[0672] Correspondingly, optionally, the above Figure 7 The illustrated embodiment also includes step 704c, which can be performed before step 704b.

[0673] 704c. The second communication device parses the field options section to obtain the first bit sequence.

[0674] The first bit sequence is the bit sequence of the field options section before compression. The "1" bits in the first bit sequence are used to indicate the field type of the at least one field in a first order. The length of the field options section is less than the length of the first bit sequence.

[0675] Step 704c is similar to step 203d above. Please refer to the relevant introduction of step 203d above for details. It will not be repeated here.

[0676] Based on step 704c above, step 704b specifically includes: the second communication device determining, based on the first bit sequence and the first order, that the first field exists in the first message. For a more detailed description of step 704b, please refer to the foregoing. Figure 2 The relevant description of step 203 in the illustrated embodiment will not be repeated here.

[0677] This application also provides a first communication device; please refer to [link to relevant documentation]. Figure 10 , Figure 10 This is a schematic diagram of the structure of a first communication device according to an embodiment of this application. The first communication device 1000 can be used to perform... Figure 2 and Figure 7 For details regarding the steps performed by the first communication device in the illustrated embodiment, please refer to the relevant description of the above method embodiment.

[0678] The first communication device 1000 includes a processing module 1001 and a transceiver module 1002.

[0679] Processing module 1001 is used to generate a first message. The first message includes a length identifier part, a field option part, and at least one field. The length identifier part is used to indicate the length of the field option part. The field option part indicates the field type of at least one field in a first order. The first order is the indication order of the field types.

[0680] The transceiver module 1002 is used to send the first message to the second communication device.

[0681] Figure 10 The processing module 1001 shown can be used to perform the above. Figure 2 and Figure 7 The relevant processing operations performed by the first communication device in the illustrated embodiment. Figure 10 The transceiver module 1002 shown can be used to perform the above. Figure 2 and Figure 7 The embodiments shown depict the relevant send and receive operations performed by the first communication device. Please refer to the description of the above method embodiments for details.

[0682] This application also provides a second communication device; please refer to [link to relevant documentation]. Figure 11 , Figure 11 This is a schematic diagram of the structure of a second communication device according to an embodiment of this application. The second communication device 1100 can be used to perform... Figure 2 and Figure 7 For details regarding the steps performed by the second communication device in the illustrated embodiment, please refer to the relevant description of the above method embodiment.

[0683] The second communication device 1100 includes a transceiver module 1101 and a processing module 1102.

[0684] Transceiver module 1101 is used to receive a first message from a first communication device. The first message includes a length identifier portion, a field option portion, and at least one field. The length identifier portion is used to indicate the length of the field option portion. The field option portion indicates the field type of at least one field in a first order, where the first order is the indication order of the field types. The second communication device determines the length of the field option portion based on the length identifier portion.

[0685] The processing module 1102 is used to determine that a first field exists in the first message based on the first order and the length of the field option part; the second communication device reads the value of the first field.

[0686] Figure 11 The processing module 1102 shown can be used to perform the above. Figure 2 and Figure 7 The related processing operations performed by the second communication device in the illustrated embodiment. Figure 11 The transceiver module 1101 shown can be used to perform the above. Figure 2 and Figure 7 The embodiments shown depict the relevant send and receive operations performed by the second communication device. Please refer to the description of the above method embodiments for details.

[0687] This application embodiment also provides a first communication device 1200. The first communication device 1200 includes a processor 1210, which is coupled to a memory 1220. The memory 1220 is used to store computer programs or instructions, and the processor 1210 is used to execute the computer programs or instructions stored in the memory 1220, so that the methods in the above method embodiments are executed.

[0688] Optionally, the first communication device 1200 may include one or more processors 1210.

[0689] Optionally, such as Figure 12 As shown, the first communication device 1200 may further include a memory 1220.

[0690] Optionally, the first communication device 1200 may include one or more memory 1220s.

[0691] Alternatively, the memory 1220 may be integrated with the processor 1210 or set separately.

[0692] Optionally, such as Figure 12 As shown, the first communication device 1200 may further include a transceiver 1230, which is used for receiving and / or transmitting signals. For example, the processor 1210 is used to control the transceiver 1230 to receive and / or transmit signals.

[0693] The first communication device 1200 is used to implement the operations performed by the first communication device in the above method embodiment. The processor 1210 is used to implement the processing-related operations performed by the first communication device in the above method embodiment, and the transceiver 1230 is used to implement the transmission-reception-related operations performed by the first communication device in the above method embodiment.

[0694] When the first communication device 1200 is a chip, the chip includes a processor, a memory, and a transceiver. The transceiver can be an input / output circuit or a communication interface; the processor can be a processing unit integrated on the chip, a microprocessor, or an integrated circuit. In the above method embodiments, the transmitting operation of the first communication device can be understood as the chip's output, and the receiving operation of the first communication device in the above method embodiments can be understood as the chip's input.

[0695] This application embodiment also provides a second communication device 1300. The second communication device 1300 includes a processor 1310, which is coupled to a memory 1320. The memory 1320 is used to store computer programs or instructions, and the processor 1310 is used to execute the computer programs or instructions stored in the memory 1320, so that the methods in the above method embodiments are executed.

[0696] Optionally, the second communication device 1300 may include one or more processors 1310.

[0697] Optionally, such as Figure 13 As shown, the second communication device 1300 may also include a memory 1320.

[0698] Optionally, the second communication device 1300 may include one or more memory 1320s.

[0699] Alternatively, the memory 1320 may be integrated with the processor 1310 or set separately.

[0700] Optionally, such as Figure 13 As shown, the second communication device 1300 may further include a transceiver 1330, which is used for receiving and / or transmitting signals. For example, a processor 1310 is used to control the transceiver 1330 to receive and / or transmit signals.

[0701] The second communication device 1300 is used to implement the operations performed by the second communication device in the above method embodiment. The processor 1310 is used to implement the processing-related operations performed by the second communication device in the above method embodiment, and the transceiver 1330 is used to implement the transmission-reception-related operations performed by the second communication device in the above method embodiment.

[0702] When the second communication device 1300 is a chip, the chip includes a processor, a memory, and a transceiver. The transceiver can be an input / output circuit or a communication interface; the processor can be a processing unit integrated on the chip, a microprocessor, or an integrated circuit. In the above method embodiments, the transmitting operation of the second communication device can be understood as the chip's output, and the receiving operation of the second communication device in the above method embodiments can be understood as the chip's input.

[0703] This application also provides a computer-readable storage medium storing computer instructions for implementing the method executed by the first communication device or the method executed by the second communication device in the above method embodiments.

[0704] For example, when the computer program is executed by a computer, it enables the computer to implement the method executed by the first communication device or the method executed by the second communication device in the above method embodiments.

[0705] This application also provides a computer program product containing instructions that, when executed by a computer, cause the computer to implement the method executed by the first communication device or the method executed by the second communication device in the above method embodiments.

[0706] This application embodiment also provides a communication system, the communication system including... Figure 10 The first communication device shown and Figure 11 The second communication device shown. Figure 10 The first communication device shown is used to perform the above. Figure 2 and Figure 7 The steps performed by the first communication device in the illustrated embodiment. Figure 11 The second communication device shown is used to perform the above. Figure 2 and Figure 7 The steps performed by the second communication device in the illustrated embodiment.

[0707] This application also provides a chip device, including a processor, configured to call computer programs or computer instructions stored in the memory, so that the processor executes the above-described... Figure 2 and Figure 7 The message processing method of the embodiment shown.

[0708] In one possible implementation, the input of the chip device corresponds to the above. Figure 2 and Figure 7 The receiving operation in the illustrated embodiment corresponds to the output of the chip device described above. Figure 2 and Figure 7 The sending operation in the illustrated embodiment.

[0709] Optionally, the processor is coupled to the memory via an interface.

[0710] Optionally, the chip device may also include a memory that stores computer programs or computer instructions.

[0711] The processor mentioned above can be a general-purpose central processing unit, a microprocessor, an application-specific integrated circuit (ASIC), or one or more devices used to control the above. Figure 2 and Figure 7 The illustrated embodiment's message processing method uses an integrated circuit for program execution. The memory mentioned above can be read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions, such as random access memory (RAM).

[0712] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the explanations and beneficial effects of the relevant content in any of the communication devices provided above can be referred to the corresponding method embodiments provided above, and will not be repeated here.

[0713] In this embodiment, the first or second communication device may include a hardware layer, an operating system layer running on top of the hardware layer, and an application layer running on the operating system layer. The hardware layer may include hardware such as a central processing unit (CPU), a memory management unit (MMU), and memory (also called main memory). The operating system layer may be any one or more computer operating systems that implement business processing through processes, such as Linux, Unix, Android, iOS, or Windows. The application layer may include applications such as browsers, address books, word processing software, and instant messaging software.

[0714] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0715] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0716] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0717] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0718] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks.

[0719] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A message processing method, characterized in that, The method includes: A first communication device generates a first message, the first message including a length identifier portion, a field option portion and at least one field, the length identifier portion being used to indicate the length of the field option portion, the length of the field option portion being a non-fixed length, the field option portion indicating the field type of the at least one field in a first order, the first order being the indication order of the field types; The first communication device sends the first message to the second communication device.

2. The method according to claim 1, characterized in that, The length identifier portion is also used to indicate that each field in the first message is a fixed-length field.

3. The method according to claim 1, characterized in that, The length identifier portion is also used to indicate that the first message includes at least one field pointer; the at least one field includes a first field, the first field corresponds to one or more field pointers among the at least one field pointers, and the one or more field pointers are used to determine the position of the first field in the first message.

4. The method according to claim 3, characterized in that, The at least one field pointer includes a first field pointer, which corresponds to a field. The first field pointer is used to determine the start bit position or end bit position of the field corresponding to the first field pointer in the first message.

5. The method according to claim 3, characterized in that, The at least one field pointer includes a second field pointer, which corresponds to a second field and a third field. The second field pointer is used to determine the start bit position of the second field in the first message and to determine the end bit position of the third field in the first message.

6. The method according to any one of claims 3 to 5, characterized in that, The first field corresponds to at least one of the third field pointer and the fourth field pointer; the third field pointer is used to determine the start bit position of the first field in the first message, and the fourth field pointer is used to determine the end bit position of the first field in the first message.

7. The method according to any one of claims 3 to 5, characterized in that, The at least one field is sorted according to the first order; the at least one field pointer includes a first type field pointer, which is a field pointer corresponding to two fields; the first type field pointer is sorted according to the field type indication order of any one of the two fields corresponding to the first type field pointer.

8. The method according to claim 7, characterized in that, The at least one field pointer includes a second type field pointer, which is a field pointer corresponding to a single field; The last field pointer in the at least one field pointer is a second type field pointer, the last field pointer corresponds to the last field in the at least one field, and the last field pointer is located after the first type field pointer in the at least one field pointer.

9. The method according to claim 8, characterized in that, The first field pointer of the at least one field pointer is a second type field pointer, the first field pointer corresponds to the first field in the at least one field, and the first field pointer is located before the first type field pointer in the at least one field pointer.

10. A message processing method, characterized in that, The method includes: The second communication device receives a first message from the first communication device. The first message includes a length identifier portion, a field option portion, and at least one field. The length identifier portion is used to indicate the length of the field option portion. The length of the field option portion is not fixed. The field option portion indicates the field type of the at least one field in a first order. The first order is the indication order of the field types. The second communication device determines the length of the field option portion based on the length identifier portion; The second communication device determines that the first field exists in the first message based on the first sequence and the length of the field option portion; The second communication device reads the value of the first field.

11. The method according to claim 10, characterized in that, The length identifier portion is also used to indicate that each of the at least one field is a field of fixed length.

12. The method according to claim 11, characterized in that, The last bit occupied by the length identifier portion is consecutive to the first bit occupied by the field option portion, and the bits occupied by any two adjacent fields of the at least one field are consecutive. The last bit occupied by the field option portion is consecutive to the first bit occupied by the at least one field; The second communication device reads the value of the first field, including: The second communication device determines, based on the field option portion, that the first field is the c-th field among the at least one fields, where c is an integer greater than 1; The second communication device takes the sum of the length of the field option portion and the first length as the value of the first field, where the first length is the length of each field multiplied by c-1.

13. The method according to claim 10, characterized in that, The length identifier portion is also used to indicate that the first message includes at least one field pointer; the at least one field includes the first field, the first field corresponds to one or more field pointers among the at least one field pointers, and the one or more field pointers are used to determine the position of the first field in the first message; The second communication device reads the value of the first field, including: The second communication device reads the value of the first field based on the one or more field pointers.

14. The method according to claim 13, characterized in that, The first field corresponds to at least one of the field pointers, the third field pointer and the fourth field pointer; The second communication device reads the value of the first field based on the one or more field pointers, including: The second communication device determines the start bit position of the first field in the first message based on the third field pointer, and / or determines the end bit position of the first field in the first message based on the fourth field pointer; The second communication device reads the value of the first field from the first message according to the start bit position and / or the end bit position.

15. The method according to claim 13, characterized in that, The at least one field pointer includes a first field pointer, which corresponds to a field. The first field pointer is used to determine the start bit position or end bit position of the field corresponding to the first field pointer in the first message.

16. The method according to any one of claims 13 to 15, characterized in that, The at least one field pointer includes a second field pointer, which corresponds to a second field and a third field. The second field pointer is used to determine the start bit position of the second field in the first message and to determine the end bit position of the third field in the first message.

17. The method according to any one of claims 13 to 15, characterized in that, The at least one field is sorted according to the first order; the at least one field pointer includes a first type field pointer, which is a field pointer corresponding to two fields; the first type field pointer is sorted according to the field type indication order of any one of the two fields corresponding to the first type field pointer.

18. The method according to claim 17, characterized in that, The at least one field pointer includes a second type field pointer, which is a field pointer corresponding to a field; the last field pointer in the at least one field pointer is a second type field pointer, which corresponds to the last field in the at least one field, and the last field pointer is located after the first type field pointer in the at least one field pointer.

19. The method according to claim 18, characterized in that, The first field pointer of the at least one field pointer is a second type field pointer, the first field pointer corresponds to the first field in the at least one field, and the first field pointer is located before the first type field pointer in the at least one field pointer.

20. A first communication device, characterized in that, The first communication device includes: A processing module is configured to generate a first message, the first message including a length identifier portion, a field option portion and at least one field, the length identifier portion being used to indicate the length of the field option portion, the length of the field option portion being a non-fixed length, the field option portion indicating the field type of the at least one field in a first order, the first order being the indication order of the field types; The transceiver module is used to send the first message to the second communication device.

21. The first communication device according to claim 20, characterized in that, The length identifier portion is also used to indicate that each field in the first message is a fixed-length field.

22. The first communication device according to claim 20, characterized in that, The length identifier portion is also used to indicate that the first message includes at least one field pointer; the at least one field includes a first field, the first field corresponds to one or more field pointers among the at least one field pointers, and the one or more field pointers are used to determine the position of the first field in the first message.

23. The first communication device according to claim 22, characterized in that, The at least one field pointer includes a first field pointer, which corresponds to a field. The first field pointer is used to determine the start bit position or end bit position of the field corresponding to the first field pointer in the first message.

24. The first communication device according to claim 22, characterized in that, The at least one field pointer includes a second field pointer, which corresponds to a second field and a third field. The second field pointer is used to determine the start bit position of the second field in the first message and to determine the end bit position of the third field in the first message.

25. The first communication device according to any one of claims 22 to 24, characterized in that, The first field corresponds to at least one of the third field pointer and the fourth field pointer; the third field pointer is used to determine the start bit position of the first field in the first message, and the fourth field pointer is used to determine the end bit position of the first field in the first message.

26. The first communication device according to any one of claims 22 to 24, characterized in that, The at least one field is sorted according to the first order; the at least one field pointer includes a first type field pointer, which is a field pointer corresponding to two fields; the first type field pointer is sorted according to the field type indication order of any one of the two fields corresponding to the first type field pointer.

27. The first communication device according to claim 26, characterized in that, The at least one field pointer includes a second type field pointer, which is a field pointer corresponding to a single field; The last field pointer in the at least one field pointer is a second type field pointer, the last field pointer corresponds to the last field in the at least one field, and the last field pointer is located after the first type field pointer in the at least one field pointer.

28. The first communication device according to claim 27, characterized in that, The first field pointer of the at least one field pointer is a second type field pointer, the first field pointer corresponds to the first field in the at least one field, and the first field pointer is located before the first type field pointer in the at least one field pointer.

29. A second communication device, characterized in that, The second communication device includes: A transceiver module is configured to receive a first message from a first communication device. The first message includes a length identifier portion, a field option portion, and at least one field. The length identifier portion is used to indicate the length of the field option portion. The length of the field option portion is not fixed. The field option portion indicates the field type of the at least one field in a first order, where the first order is the indication order of the field types. The processing module is configured to determine the length of the field option portion based on the length identifier portion; determine that a first field exists in the first message based on the first order and the length of the field option portion; and read the value of the first field.

30. The second communication device according to claim 29, characterized in that, The length identifier portion is also used to indicate that each of the at least one field is a field of fixed length.

31. The second communication device according to claim 29 or 30, characterized in that, The last bit occupied by the length identifier portion is consecutive to the first bit occupied by the field option portion, and the bits occupied by any two adjacent fields of the at least one field are consecutive; the last bit occupied by the field option portion is consecutive to the first bit occupied by the at least one field; the processing module is specifically used for: Based on the field option section, the first field is determined to be the c-th field among the at least one fields, where c is an integer greater than 1; The sum of the length of the field option portion and the first length is used as the value of the first field, where the first length is the length of each field multiplied by c-1.

32. The second communication device according to claim 29, characterized in that, The length identifier portion is also used to indicate that the first message includes at least one field pointer; the at least one field includes the first field, the first field corresponds to one or more field pointers among the at least one field pointers, and the one or more field pointers are used to determine the position of the first field in the first message; The processing module is specifically used for: The value of the first field is read based on one or more field pointers.

33. The second communication device according to claim 32, characterized in that, The first field corresponds to at least one of the field pointers, the third field pointer and the fourth field pointer; The processing module is specifically used for: The start bit position of the first field in the first message is determined according to the third field pointer, and / or the end bit position of the first field in the first message is determined according to the fourth field pointer; The value of the first field is read from the first message according to the start bit position and / or the end bit position.

34. The second communication device according to claim 32, characterized in that, The at least one field pointer includes a first field pointer, which corresponds to a field. The first field pointer is used to determine the start bit position or end bit position of the field corresponding to the first field pointer in the first message.

35. The second communication device according to any one of claims 32 to 34, characterized in that, The at least one field pointer includes a second field pointer, which corresponds to a second field and a third field. The second field pointer is used to determine the start bit position of the second field in the first message and to determine the end bit position of the third field in the first message.

36. The second communication device according to any one of claims 32 to 34, characterized in that, The at least one field is sorted according to the first order; the at least one field pointer includes a first type field pointer, which is a field pointer corresponding to two fields; the first type field pointer is sorted according to the field type indication order of any one of the two fields corresponding to the first type field pointer.

37. The second communication device according to claim 36, characterized in that, The at least one field pointer includes a second type field pointer, which is a field pointer corresponding to a field; the last field pointer in the at least one field pointer is a second type field pointer, which corresponds to the last field in the at least one field, and the last field pointer is located after the first type field pointer in the at least one field pointer.

38. The second communication device according to claim 37, characterized in that, The first field pointer of the at least one field pointer is a second type field pointer, the first field pointer corresponds to the first field in the at least one field, and the first field pointer is located before the first type field pointer in the at least one field pointer.

39. A first communication device, characterized in that, The first communication device includes a processor: the processor is configured to execute a computer program or computer instructions in a memory to perform the method as described in any one of claims 1 to 9.

40. A second communication device, characterized in that, The second communication device includes a processor: the processor is configured to execute a computer program or computer instructions in a memory to perform the method as described in any one of claims 10 to 19.

41. A computer-readable storage medium, characterized in that, It stores a computer program thereon, which, when executed by a communication device, causes the communication device to perform the method as described in any one of claims 1 to 19.

Citation Information

Patent Citations

  • Message packaging method and message analysis method and device

    CN102932285A

  • Serial port communication protocol automatic adaptation middleware

    CN109936553A