WO2010000139A1 - 用于通信数据的tlv格式处理方法 - Google Patents

用于通信数据的tlv格式处理方法 Download PDF

Info

Publication number
WO2010000139A1
WO2010000139A1 PCT/CN2009/070391 CN2009070391W WO2010000139A1 WO 2010000139 A1 WO2010000139 A1 WO 2010000139A1 CN 2009070391 W CN2009070391 W CN 2009070391W WO 2010000139 A1 WO2010000139 A1 WO 2010000139A1
Authority
WO
WIPO (PCT)
Prior art keywords
function
type
code stream
decoding
value
Prior art date
Application number
PCT/CN2009/070391
Other languages
English (en)
French (fr)
Inventor
张新平
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Priority to US13/001,978 priority Critical patent/US20110134939A1/en
Priority to RU2011103630/08A priority patent/RU2473180C2/ru
Priority to ES09771909.0T priority patent/ES2659396T3/es
Priority to EP09771909.0A priority patent/EP2302864B1/en
Priority to BRPI0915217-2A priority patent/BRPI0915217B1/pt
Publication of WO2010000139A1 publication Critical patent/WO2010000139A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/06Notations for structuring of protocol data, e.g. abstract syntax notation one [ASN.1]

Definitions

  • ASN.1 BACKGROUND OF THE INVENTION Abstract Syntax Notation 1
  • ITU International Telecommunications Union
  • Each node only needs to know the data format translated or translated from ASN.1 into ASN.1, without having to know the format in which the data exists anywhere else on the network.
  • ASN.1 has two parts: The first part (ISO 8824/ITU X.208) describes the data, data type and sequence format within the information, ie the syntax of the data; the second part (ISO 8825/ITU X.209) describes how The rules for composing each part of the data into a message, that is, the basic encoding rules of the data.
  • ASN.1 was originally developed as part of X.409 and later became a standard independently.
  • the first public key infrastructure (PKI) standard is mainly based on ASN.1.
  • SNMP Simple Network Management Protocol
  • ASN.1 is used to define The format of SNMP data units and objects.
  • ASN.1 is widely used in other fields such as communication and computer.
  • ASN.1 has the following special characteristics: 1.
  • the message is in a tree structure, and more levels of message nesting can be defined as needed.
  • the data type of the node in the message it may be a simple data type, such as INTEGER, GRAPHICSTRING, ENUM, etc.; or it may be a composite data type SET, SEQUENCE, SET OF, SEQUENCE OF containing the subordinate node.
  • a node may not exist, because the corresponding node is allowed to be set to OPTIONAL, indicating that it is optional.
  • ASN.1 file first define the ASN.1 type in the ASN.1 file, then compile the ASN.1 type through the compiler, making it a type of intermediate programming language such as Java or C++, and then by using The type of programming language should be used to achieve the purpose of communication.
  • ASN.1 supports BER, DER, VAL and other encodings.
  • the intermediate language type instance can be encoded as a code stream, which can be decoded from the code stream to an instance of the corresponding intermediate language type.
  • UserNameList-T is an array of UserName-T elements.
  • C/S Client/Server Server
  • the sender of the message fills in the ASN.1 header and the body of the message.
  • the header includes the command code.
  • the body of the message is of the AsnAny type. The actual data type varies according to the command code.
  • 4 ⁇ sender code 4 The text is the code stream and is sent to the 4 text recipients;
  • the receiver of the message receives the message stream, decodes the header, and then decodes the file with a specific data type according to the command code therein;
  • TLV format data type, data length, data body
  • Type (Type), Length (Length), Value (Value) referred to as TLV format.
  • Organizing data in TLV format is very convenient and efficient, especially for variable-length data.
  • the organization of the content in the application layer data body generally adopts this format, and the BER encoding in ASN.1 is actually a TLV encoding.
  • the data type T in the TLV encoding is not customizable by the user, and if the same name type is not completely defined in different versions, the Client and the Server may not be able to communicate.
  • a TLV format processing method for communication data including the following steps:: defining an integer type T in an ASN.1 format; and sending a message in an ASN.1 format,
  • the packet includes an instance of the data structure.
  • the sender encodes the packet into a code stream.
  • the code stream of the data structure instance in the packet includes the value V, or includes the integer type of V and the length L of V.
  • the TLV format processing method further comprises: processing an integer type function for a compiler of the ASN.1 format.
  • the TLV format processing method further comprises: obtaining an integer type by a function in a C++ type of the ASN.1 format.
  • the sender encodes the message into the code stream, including: calling the value encoding function, the length encoding function, and the integer type encoding function through the overall encoding function, or calling only the value encoding function by the overall encoding function to encode the message into a code
  • An integer type encoding function is used to obtain an integer type in a code stream according to data encoding in a data structure instance; for a data structure instance of a simple data type, a value encoding function is used to encode a simple data in a data structure instance into a code stream.
  • V in the case of a data structure of the SEQUEENSE or SET type, the value encoding function is used to sequentially call the overall encoding function of each member in the data structure instance; for the data structure instance of the SEQUEENSE OF or SET OF type, the value encoding function is used for Invoke the entire element of the array in the data structure instance in turn a body coding function; for a CHOICE type data structure instance, a value encoding function is used to encode selected members of the data structure instance into V in the code stream, where V includes the serial number and selected member of the selected member in CHOICE .
  • the TLV format processing method further includes: the receiver decoding the code stream.
  • decoding the code stream specifically comprises: calling a value decoding function, a length decoding function, and an integer type decoding function by an overall decoding function, or only calling a value decoding function by an overall decoding function to decode the code stream; and using an integer type decoding function Decoding the code stream according to the integer type in the code stream; for the data structure instance of the simple data type, the value decoding function is used to decompose the V in the code stream into simple data in the data structure instance; for the data structure of the SEQUEENSE or SET type For example, the value decoding function is used to sequentially decode V in the code stream into each member data in the data structure instance; for the data structure instance of the SEQUEENSE OF or SET OF type, the value decoding function is used for the V in the ⁇ 1 code 3 ⁇ 4 ⁇ Decompose into each element of the array in the data structure instance; determine whether the length of the decoded stream in the structure is less than L in the process of decoding V, and continue decoding if less than
  • the value decoding function, the length decoding function, and the integer type decoding function are called by the global decoding function, or only the value decoding function is called by the global decoding function to decode the code stream.
  • the integer decoding function determines whether the integer type is 0. Or whether it exists; if it is not 0 or exists, the value decoding function, the length decoding function, and the integer type decoding function are called, wherein the value decoding function is called to decode the integer type in the code stream, and whether the obtained integer type and its own are verified The integer types are consistent. If they are inconsistent, the decoding is considered abnormal.
  • the method for processing the TLV format in the foregoing embodiment of the present invention is capable of interworking between different versions of ASN.1 because the method of extending the T is added to the ASN.1 format, so that the different versions of the monthly protocol can not communicate with each other. And can implement the object-oriented approach of TLV.
  • FIG. 1 is a flowchart of a TLV format processing method for communication data according to an embodiment of the present invention
  • FIG. 2 is a diagram of a client and a server sharing the same development locale according to a preferred embodiment of the present invention.
  • FIG. 3 is a development process when different development language environments are used according to a preferred embodiment of the present invention;
  • FIG. 4 is a diagram showing different development language environments and protocol versions used by a client and a server according to a preferred embodiment of the present invention.
  • FIG. 5 is a schematic diagram of an ESNACC C++ basic class type inheritance system according to a preferred embodiment of the present invention;
  • FIG. 6 is a flow chart of a TLV overall decoding function according to a preferred embodiment of the present invention.
  • the embodiment of the present invention provides a TLV format processing method for communication data, in which the function of the client and the server is inconsistent when the versions of the client and the server are inconsistent.
  • the method of extending the T is added to the ASN.1 format, and the packet is filled in the extended ASN.1 format, which can overcome the defect that different versions of the protocol cannot be interworked, and can implement different versions of ASN.1. Interoperability, and an object-oriented approach to implementing TLV.
  • the invention will be described in detail below with reference to the drawings in conjunction with the embodiments. The features of the embodiments of the present invention and the embodiments may be combined with each other if they do not conflict.
  • Step S10 defining an integer type T in an ASN.1 format
  • Step S20 the sender fills in In the ASN.1 format message, the message includes an instance of the data structure.
  • step S30 the sender encodes the 4 ⁇ file into a code stream, and the code stream of the data structure instance in the message includes the value V, or includes an integer type of V.
  • the TLV format processing method adopts the method of extending the T in the ASN.1 format, so it can overcome the defect that different versions of the protocol cannot be intercommunicated, can realize the interworking of different versions of ASN.1, and can implement an object-oriented method of TLV.
  • the above processing will be described in detail below.
  • the structure of an integer type is of the SEQUENCE, SET or CHOICE type of the same type name. It is stipulated that if the member is to be modified, only the net boost port or the net decrease member is allowed, and only the last member can be changed. .
  • the old and new compatibility of protocol messages can be achieved.
  • the extended member can only be at the end of the parent type, but not reduced.
  • the function of the integer type can be set for the compiler of the ASN.1 format.
  • the integer type is obtained by a function in the C+ ten type of the ASN.1 format.
  • Step S20 The operation of the sender to encode the message into the code stream specifically includes: calling the value encoding function, the length encoding function, and the integer type encoding function through the overall encoding function, or calling only the value encoding function through the overall encoding function to
  • the message is encoded as a code stream; the integer type encoding function is used to obtain an integer type in the code stream according to the data in the data structure instance; specifically, for a data structure instance of a simple data type, the value encoding function is used to implement the data structure instance
  • the simple data in the code is encoded into V in the code stream; for the data structure instance of the SEQUEENSE or SET type, the value encoding function is used to sequentially call the overall encoding function of each member in the data structure instance; for the data of the SEQUEENSE OF or SET OF type
  • the value encoding function is used to sequentially call the overall encoding function of each element of the array in the data structure instance; for the CHOICE type data structure
  • the value encoding function, the length encoding function, and the integer type encoding function are called by the overall encoding function, that is, the code stream includes V, V length L, and integer type.
  • the TLV format processing method further includes: the receiver decodes the code stream.
  • the operation of decoding the code stream specifically includes: calling a value decoding function, a length decoding function, and an integer type decoding function by an overall decoding function, or performing only a value decoding function by using an overall decoding function to perform code stream decoding; integer type decoding
  • the function is used to decode the code stream according to the integer type in the code stream; for the data structure instance of the simple data type, the value decoding function is used to resolve the V in the code stream into simple data in the data structure instance; for the SEQUEENSE or SET type
  • the value decoding function is used to sequentially decode the V in the code stream into each member data in the data structure instance; for the data structure instance of the SEQUEENSE OF or SET OF type, the value decoding function is used in the code stream V is sequentially solved into each element of the array in the data structure instance; in the process of decoding V, it is judged whether the length of the decoding stream in the structure is less than L, if it is less than L, the decoding is
  • the foregoing operation of calling the value decoding function, the length decoding function, and the integer type decoding function by the overall decoding function, or only calling the value decoding function by the global decoding function to decode the code stream specifically includes: determining the integer type by the overall decoding function Whether it is 0 or exists; if it is not 0 or exists, the value decoding function, the length decoding function, and the integer type decoding function are called, wherein the value decoding function is called to decode the integer type in the code stream, and whether the obtained integer type is verified It is consistent with its own integer type.
  • the length decoding function is called to decode L in the code stream, and then the value encoding function is called to decode the V in the code stream. If the length VL obtained by decoding V is less than L, Then skip the L-vL byte; if it is 0 or does not exist, only the value decoding function is called.
  • the overall decoding function first determines if its own T is zero. If not 0, decode T, verify
  • T is consistent with its own T. If it is inconsistent, it is considered that the decoding is abnormal, and then L is decoded, and then V is decoded. If the length vL of the decoded V is less than L, the L-vL byte is skipped, and the length in the type is balanced; if it is 0, Directly press V to decode.
  • the virtual functions required by the above encoding function and decoding function may be added to the ASN.1 base class in the ASN.1 C ten-base module; and the classes required by the above encoding function and decoding function in the ASN.1 C++ compiler and Its member function.
  • the above preferred embodiment includes two functional modules: a base module, a compiler.
  • the base module implements the base class and some support functions that support the TLV.
  • the compiler implements the analysis of the ASN.1 file and generates the classes corresponding to each ASN.1 type and their member functions.
  • the four-text defined by the TLV protocol can not only interact with the version protocol, but also allow the client and server of the new and old protocols to interact with each other.
  • the encoding rules provided by the /S interaction are guaranteed.
  • Embodiments of the present invention may be implemented independently or extended on any existing ASN.1 compiler platform.
  • FIG. 2 shows a development process when the client and the server share the same development language environment according to a preferred embodiment of the present invention. Both Client and Server are developed in C++. Including: A.
  • Interface developers define ASN.1 interface files, and use Asn.1 C++ compiler to generate interface files. h and interface files. cpp; B. Server developers write Server 4 weights, and interface files.h, interfaces File. cpp - compiled into an executable server program; C. Client developers write Client code, and interface file .h, interface file. cpp - compiled into an executable client program; D. executable Client program and The executable Server program uses the Asn. l C++ base module to communicate interactively during execution.
  • Figure 3 illustrates the use of different development locales in accordance with a preferred embodiment of the present invention.
  • the development process, the client uses java development
  • Server uses C++ development. Including: A.
  • the interface developer defines the ASN.1 interface file, and generates the interface file for the C++ developer using the Asn.l C++ compiler. h, the interface file. cpp, for the java developer to generate the interface file with the Asn. l java compiler .java; B. Server developers write Server «code, and interface file.h, interface file. cpp - compiled into an executable server program; C. Client developers write Client code, and interface file .j ava compile The executable client program; D. The executable Client program and the executable Server program communicate with each other using the Asn.l base module of the respective language during execution. FIG.
  • the server is an old version
  • the client is developed by java
  • the server is developed by C++.
  • both Client and Server are developed in C++ in the implementation steps.
  • the process includes:
  • A. Interface creator The version of the interface file defined in the old version, l.asn, defines the interface file version 2.asn when developing the new version. Compile the C++ and Java interface implementation files for the two versions respectively;
  • B. Server developers write the Server code in the old version, and compile the executable file execution with the interface file version 1.h and the interface file version l.cpp. Document
  • the C. Client developer writes the Client code in the new version, and compiles the executable client executable file into the interface file 2.java.
  • FIG. 5 illustrates an ESNACC C++ base class type inheritance system in accordance with a preferred embodiment of the present invention.
  • ESNACC basic class inheritance relationship hierarchy diagram, ESNACC basic base class is AsnType, AsnType is abstract base class.
  • Asnlnt is also derived from PERGgeneral
  • AsnEnum is derived from Asnlnt
  • AsnOid is derived from AsnRelativeOid.
  • AsnList is an intermediate type that implements other Asn.
  • l classes, AsnSetOf, and AsnSeqOf are derived from AsnList; std::string, std::list using the standard template library to further support SEQUENCE OF, SET OF, and so on.
  • Some application string types such as VisibleString, GraphicString, Ia5 String, PrintableString, NumericString are derived from the base string type AsnString. Its MediumizedTime, UTCTime is derived from VisibleString. 6 shows a flow chart of the overall TLV decoding function in accordance with a preferred embodiment of the present invention.
  • the present invention can be applied to any object-oriented programming language implementation, this article mainly in conjunction with C + + discussion, can also use other object-oriented The programming language, such as the JAVA language implementation.
  • the source of the demand is in the network management system.
  • a network management system often needs to manage various device network elements. Different devices have different versions.
  • the network management system also has different versions.
  • the network management and device software need to exchange packets.
  • the version between the device and the device software is relatively small. You need a management NE that is compatible with the NMS. This requires a protocol rule to support this requirement.
  • ESNACC is an open source ASN.1 compiler that supports BER, PER encoding, and ASN.1 base modules provided by the compiler:
  • the ASN.1 compiler usually provides a compiler and base support module, and the compiler compiles the ASN.1 file.
  • Specific programming language code such as C++, Java, compiles the types of ASN.1 into classes of programming languages.
  • the base support module provides support for generated code execution.
  • the TLV codec rules are implemented by tampering with the compiler and the underlying support module.
  • T uses 2 bytes
  • L uses 4 bytes.
  • the format is in network order. Other formats may be used in the implementation to store T and L, such as the representation format of the length in the BER.
  • T can be expressed in various formats, such as decimal, hexadecimal. The syntax is optional, and the absence of the representation ⁇ is 0.
  • the old version of the 4 ⁇ code stream to the new version 4 ⁇ d3, d4 uses the default value, and the c3 code stream is ignored.
  • the new version of the 4 ⁇ code stream to the old version • t ⁇ text d3, d4 code stream is ignored, and the value of c3 uses the default value.
  • Other data is old and new The version is consistent.
  • V-encoding function virtual AsnLen TlvEncContent ( AsnBuf &_b ); Overall decoding code function: virtual AsnLen TlvDec ( AsnBuf &-b, AsnLen &bytesDecoded ); Value decoding function: virtual AsnLen TlvDecContent ( AsnBuf &-b, short iT,
  • AsnLen iL, AsnLen & bytesDecoded where - b is the stream parameter, byteDecoded is the cumulative number of bytes decoded by a message stream, iT is the T in the stream, iL is the L in the stream, TlvEnc, TlvEncContent The return value is the length of the encoded stream.
  • the TlvDec and TlvDecContext return values are the number of bytes decoded in the function. According to the implementation mode function prototype can be changed according to needs.
  • step S10 develop a new/old version interface file. asn, generate interface 4 ⁇ .h, interface 4 ⁇ . cpp, client and server are written in C+10, which is similar to Figure 3. In this way, it is possible to implement interactive communication between different versions of client and server.
  • various possible changes or substitutions may be made in accordance with the description and specific embodiments of the technical solutions of the present invention, such as the location and format of T, the format of L, and possibly Compressed and encrypted formats, the implementation of the function methods may be different, even without the use of member functions and the use of coding operators. From the above description, it can be seen that the present invention achieves the following technical effects:
  • the type can be converted to a code stream by an encoding method. 2. It can be decoded into a class instance by the decoding method 4 bar code stream.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)
  • Communication Control (AREA)
  • Devices For Executing Special Programs (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Description

用于通信数据的 TLV格式处理方法 技术领域 本发明涉及通信领域, 具体而言, 涉及一种用于通信数据的 TLV格式 处理方法。 背景技术 抽象语法标己 1 ( Abstract Syntax Notation 1 , 简称为 ASN.1 )是国际电 信联盟 ( International Telecommunications Union, 简称为 ITU )定义的 4 述在 网络上传输信息格式的标准方法, 用于为节点间的数据转换提供标准格式。 每个节点只需要知道从 ASN.1进行翻译或翻译成 ASN.1 的数据格式, 而不 必知道数据存在于网络任何其他处的格式。
ASN.1有两部分: 第一部分( ISO 8824/ITU X.208 )描述信息内的数据、 数据类型及序列格式, 也就是数据的语法; 第二部分(ISO 8825/ITU X.209 ) 描述如何将各部分数据组成消息的规则,也就是数据的基本编码规则。 ASN.1 最早是作为 X.409的一部分而开发的, 后来才独立地成为一个标准。 第一代 公开密钥体系( Public Key Infrastructure,简称为 PKI )标准主要是基于 ASN.1 的, 在简单网络管理十办议 ( Simple Network Management Protocol, 简称为 SNMP ) 中, ASN.1用于定义 SNMP数据单元和对象的格式。
ASN.1被广泛应用于诸如通信和计算机的其他领域, ASN.1 4艮文具有如 下特殊性质: 1. 报文呈树状结构, 可以根据需要定义较多层次的报文嵌套。
2. 对于报文中节点的数据类型, 可能是一个简单数据类型, 比如 INTEGER, GRAPHICSTRING, ENUM 等等; 也有可能是包含再下级节点 的复合数据类型 SET, SEQUENCE, SET OF , SEQUENCE OF。
3. 在 SET、 SEQUENCE类型中, 某个节点有可能不存在, 因为对应 4艮 文节点允许设置为可选(OPTIONAL ), 表示可有可无。 在使用 ASN.1文件 时, 首先在 ASN.1文件中定义 ASN.1类型, 然后通过编译器编译 ASN.1类 型, 使之成为中间程序语言比如 Java或 C++语言的类型, 然后再通过使用对 应的程序语言类型, 达到通信的目的。
4. ASN.1支持 BER、 DER、 VAL等编码, 可以将中间语言类型实例编 码为码流, 可以从码流解码为对应中间语言类型的实例。
5. ASN.1 的采用定义格式: " NewStructName ::= 定义信息", 如 UserNameList-T::= SEQUENCE OF UserName-T 表 示 定 义 类 型
UserNameList-T是以 UserName-T为元素的数组。 在软件的客户机 Client/服务器 Server ( C/S ) 架构中, Client和 Server 之间需要进行通信, 通信 4艮文一般有两种格式: 私有格式、 标准格式, 如 ASN. SNMP等协议。 关于 ASN.1 4艮文在 C/S类型软件中一 常用的方法:
1、 建立客户端与服务器端的连接;
2、 客户端与服务器端进行协议交互:
1 )报文发送方填写 ASN.1报文头和报文体, 报文头包括命令码, 报文体采用 AsnAny类型, 其真实数据类型因命令码不同而不同; 2 ) 4艮文发送方编码 4艮文为码流, 发送给 4艮文接收方;
3 )报文接收方接收到报文码流, 解码报文头, 然后根据其中的命令 码, 用特定数据类型解码 4艮文体;
4 ) 4艮文接收方才艮据 4艮文的内容, 作相应的响应;
3、 交互结束, 关闭连接。 在通信中, 按照 "数据类型、 数据长度、 数据体" 的格式组织数据的, 表示为 "Type (类型), Length (长度), Value (值)", 简称 TLV格式。 利用 TLV格式组织数据非常方便和高效, 尤其适用于可变长的数据。 对于应用层 数据体中内容的组织一般都是采用这种格式, 在 ASN.1的 BER编码实际上 就是一种 TLV编码。 在相关技术中, TLV编码中的数据类型 T是用户不能定制的, 同一名 称类型如果在不同版本中定义不完全一样,则 Client和 Server可能不能通信, 也就是说, Client和 Server端的 4艮文协议版本要一致, 如果不一致, 二者之 间就无法交互。 发明内容 针对相关技术中存在的 Client和 Server端的 4艮文协议版本不一致时二者 之间无法互通的问题而提出本发明, 为此, 本发明旨在提供一种改进的用于 通信数据的 TLV格式处理方法, 以解决相关技术中的上述问题。 在本发明的实施例中,提供了一种用于通信数据的 TLV格式处理方法, 包括以下步骤: 在 ASN.1格式中定义整数类型的类型 T; 发送方填写 ASN.1 格式的报文, 报文中包括数据结构实例; 发送方将报文编码为码流, 报文中 的数据结构实例的码流包括值 V, 或者包括 、 V的整数类型、 V的长度 L。 优选地, 在 ASN.1格式中定义整数类型具体包括: 设置 ASN.1格式允 许定义整数类型; 以 "字符串类型名 [X] ::=定义结构" 的格式定义整数类型 的结构, 其中 X指整数类型。 优选地, 以 "字符串类型名 [X]: :=定义结构" 的格式定义整数类型的结 构具体包括: 设置整数类型的结构为同类型名的 SEQUENCE , SET 或 CHOICE类型, 规定要爹改其成员, 则仅允许净增加或净减少成员, 并且只 能变动末尾的成员, 不允许修改类型。 优选地, 该 TLV格式处理方法还包括: 对 ASN.1格式的编译器设置处 理整数类型的功能。 优选地, 该 TLV格式处理方法还包括: 在 ASN.1格式的 C++类型中通 过函数获取整数类型。 优选地, 发送方将报文编码为码流包括: 通过整体编码函数调用值编码 函数、 长度编码函数、 以及整数类型编码函数, 或者通过整体编码函数仅调 用值编码函数以将报文编码为码流; 整数类型编码函数用于根据数据结构实 例中的数据编码得到码流中的整数类型;对于简单数据类型的数据结构实例, 值编码函数用于将数据结构实例中的简单数据编成码流中的 V; 对于 SEQUENSE或 SET类型的数据结构实例, 值编码函数用于依次调用数据结 构实例中的各成员的整体编码函数; 对于 SEQUENSE OF或 SET OF类型的 数据结构实例, 值编码函数用于依次调用数据结构实例中的数组各元素的整 体编码函数; 对于 CHOICE类型的数据结构实例, 值编码函数用于将数据结 构实例中选定的成员编成码流中的 V, 其中, V包括选定成员在 CHOICE中 的序号和选定成员。 优选地,当整数类型为 0或不存在,则整体编码函数仅调用值编码函数; 当整数类型不为 0, 则码流包括 V、 V的长度 L、 和整数类型。 优选地, 该 TLV格式处理方法还包括: 接收方将码流解码。 优选地, 将码流解码具体包括: 通过整体解码函数调用值解码函数、 长 度解码函数、 以及整数类型解码函数, 或者通过整体解码函数仅调用值解码 函数以将码流解码;整数类型解码函数用于根据码流中的整数类型解码码流; 对于简单数据类型的数据结构实例,值解码函数用于将码流中的 V解成数据 结构实例中的简单数据; 对于 SEQUENSE或 SET类型的数据结构实例, 值 解码函数用于将码流中的 V 依次解成数据结构实例中的各成员数据; 对于 SEQUENSE OF或 SET OF类型的数据结构实例, 值解码函数用于^1码 ¾ϊ中 的 V依次解成数据结构实例中的数组各元素;解码 V的过程中判断本结构内 解码流长度是否小于 L , 如果小于 L则继续解码, 否则停止本结构内解码; 对于 CHOICE类型的数据结构实例,值解码函数用于解码码流中的序号和序 号对应的成员, 如果序号对应的成员在本结构中不存在则结束值解码函数。 优选地, 通过整体解码函数调用值解码函数、 长度解码函数、 以及整数 类型解码函数, 或者通过整体解码函数仅调用值解码函数以将码流解码具体 包括: 通过整体解码函数判断整数类型是否为 0或者是否存在; 如果不为 0 或者存在, 则调用值解码函数、 长度解码函数、 以及整数类型解码函数, 其 中, 调用值解码函数解码码流中的整数类型, 验证得到的整数类型是否和自 身的整数类型一致, 如果不一致, 则认为解码异常, 再调用长度解码函数解 码码流中的 L , 再调用值编码函数解码码流中的 V , 如果解码 V得到的长度 vL小于 L, 则跳过 L-vL字节; 如果为 0或者不存在, 则仅调用值解码函数。 本发明上述实施例的 TLV格式处理方法因为在 ASN.1格式中增加了扩 展 T的方法, 所以能够克月 协议不同版本之间不能互通的缺陷, 从而可以实 现 ASN.1不同版本之间的互通, 并且能够实现 TLV的面向对象的方法。 本发明的其它特征和优点将在随后的说明书中阐述, 并且, 部分地从说 明书中变得显而易见, 或者通过实施本发明而了解。 本发明的目的和其他优 点可通过在所写的说明书、 权利要求书、 以及附图中所特别指出的结构来实 现和获得。 附图说明 此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部 分, 本发明的示意性实施例及其说明用于解释本发明, 并不构成对本发明的 不当限定。 在附图中: 图 1是根据本发明实施例的用于通信数据的 TLV格式处理方法的流程 图; 图 2 是根据本发明优选实施例的在客户机与服务器共享相同的开发语 言环境时的开发过程示意图; 图 3 是根据本发明优选实施例的使用不同的开发语言环境时的开发过 程; 图 4 是根据本发明优选实施例的客户机与服务器使用的开发语言环境 和协议版本都不同的开发过程示意图; 图 5是根据本发明优选实施例的 ESNACC C++基本类类型继承体系示 意图; 图 6是根据本发明优选实施例的 TLV整体解码功能流程图。 具体实施方式 功能相克述 考虑到相关技术中存在的 Client和 Server端的 4艮文协议版本不一致时二 者之间无法互通的问题,本发明实施例提供一种用于通信数据的 TLV格式处 理方法, 在本实施例中, 在 ASN.1格式中增加了扩展 T的方法, 并以扩展后 的 ASN.1格式填写报文, 能够克服协议不同版本不能互通的缺陷, 可以实现 ASN.1不同版本的互通, 以及能够实现 TLV的面向对象的方法。 下面将参考附图并结合实施例, 来详细说明本发明。 如果不沖突, 本发 明实施例以及实施例中的特征可以相互组合。 需要说明的是, 在附图的流程 图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且, 虽然在流程图中示出了逻辑顺序, 但是在某些情况下, 可以以不同于此处的 顺序执行所示出或描述的步骤。 图 1示出了根据本发明实施例的用于通信数据的 TLV格式处理方法的 流程图, 包括以下步骤: 步骤 S10, 在 ASN.1格式中定义整数类型的类型 T; 步骤 S20, 发送方填写 ASN.1格式的报文, 报文包括数据结构实例; 步骤 S30, 发送方将 4艮文编码为码流, 报文中的数据结构实例的码流包 括值 V, 或者包括 、 V的整数类型、 V的长度 L。 该 TLV格式处理方法因为在 ASN.1格式中采用了扩展 T的方法, 所以 能够克服协议不同版本不能互通的缺陷, 可以实现 ASN.1不同版本的互通, 以及能够实现 TLV的面向对象的方法。 下面详细说明上述处理过程。 (一) 步骤 S10 在 ASN.1格式中定义整数类型的操作具体可以包括: 设置 ASN.1格式 允许定义整数类型; 以 "字符串类型名 [X] ::=定义结构" 的格式定义整数类 型的结构, 其中 X指整数类型。 即, 在 ASN.1的语法中加入扩展语法支持自 定义类型 X (即 TLV中的 T ), 以可选方式定义在类型名称和符号 "::=,'。 如 果无 X, 则按 0处理, 这种数据在对应码流中只有 V, 而没有 X、 L。 具体地, 上述以 "字符串类型名 [X]::=定义结构" 的格式定义整数类型 的结构的操作具体包括: 设置整数类型的结构为同类型名的 SEQUENCE, SET或 CHOICE类型, 规定要修_改其成员, 则仅允许净增力口或净减少成员, 并且只能变动末尾的成员, 不可以 ^"改类型。 按照这样的原则, 就可以实现 协议报文的新旧兼容。 为了便于协议报文类型的管理, 可以要求新版本协议 只能在旧版本协议类型上扩展,扩展成员只能在父类型的末尾, 而不能减少。 在步骤 S10中, 由于设置 ASN.1格式允许定义整数类型, 这样, 可以 对 ASN.1格式的编译器设置处理整数类型的功能。 优选地, 在 ASN.1格式 的 C+十类型中通过函数获取整数类型。 (二) 步骤 S20 发送方将报文编码为码流的操作具体包括:通过整体编码函数调用值编 码函数, 长度编码函数, 以及整数类型编码函数, 或者通过整体编码函数仅 调用值编码函数以将报文编码为码流; 整数类型编码函数用于根据数据结构 实例中的数据编码得到码流中的整数类型; 具体地, 对于简单数据类型的数 据结构实例,值编码函数用于将数据结构实例中的简单数据编成码流中的 V; 对于 SEQUENSE或 SET类型的数据结构实例, 值编码函数用于依次调用数 据结构实例中的各成员的整体编码函数; 对于 SEQUENSE OF或 SET OF类 型的数据结构实例, 值编码函数用于依次调用数据结构实例中的数组各元素 的整体编码函数; 对于 CHOICE类型的数据结构实例, 值编码函数用于将数 据结构实例中选定的成员编成码流中的 V,其中,V包括选定成员在 CHOICE 中的序号和选定成员。 优选地, 当整数类型为 0或不存在时, 则整体编码函数仅调用值编码函 数, 即, 码流只包括 V或者包括 V和整数类型 =0。 当整数类型不为 0时, 则通过整体编码函数调用值编码函数、 长度编码函数、 以及整数类型编码函 数, 即, 码流包括 V, V的长度 L、 和整数类型。 以上描述了发送方对 TLV格式的处理, 对于接收方而言, 该 TLV格式 处理方法还包括: 接收方将码流解码。 优选地, 将码流解码的操作具体包括: 通过整体解码函数调用值解码函数、 长度解码函数、 以及整数类型解码 函数, 或者通过整体解码函数仅调用值解码函数来进行码流解码; 整数类型 解码函数用于根据码流中的整数类型来解码码流; 对于简单数据类型的数据 结构实例, 值解码函数用于将码流中的 V解成数据结构实例中的简单数据; 对于 SEQUENSE或 SET类型的数据结构实例, 值解码函数用于将码流中的 V依次解成数据结构实例中的各成员数据; 对于 SEQUENSE OF或 SET OF 类型的数据结构实例, 值解码函数用于将码流中的 V依次解成数据结构实例 中的数组各元素; 解码 V的过程中判断本结构内解码流长度是否小于 L , 如 果小于 L, 则继续解码, 否则, 停止本结构内解码; 对于 CHOICE类型的数 据结构实例, 值解码函数用于解码码流中的序号和序号对应的成员, 如果序 号对应的成员在本结构中不存在, 则结束值解码函数。 优选地, 上述通过整体解码函数调用值解码函数、 长度解码函数、 以及 整数类型解码函数, 或者通过整体解码函数仅调用值解码函数以将码流解码 的操作具体包括: 通过整体解码函数判断整数类型是否为 0或者是否存在; 如果不为 0或者存在, 则调用值解码函数、 长度解码函数、 以及整数类型解 码函数, 其中, 调用值解码函数解码码流中的整数类型, 验证得到的整数类 型是否和自身的整数类型一致, 如果不一致, 则认为解码异常, 然后再调用 长度解码函数解码码流中的 L , 进而调用值编码函数解码码流中的 V , 如果 解码 V得到的长度 vL小于 L, 则跳过 L-vL字节; 如果为 0或者不存在, 则 仅调用值解码函数。 整体解码函数首先判断自身 T是否为 0。 如果不为 0 , 则解码 T , 验证
T是否和自身 T一致, 不一致则认为解码异常, 再解码 L , 再解码 V , 如果 解码 V的长度 vL小于 L, 则跳过 L-vL字节, 平衡本类型内的长度; 如果为 0 , 直接按 V解码。 可以在 ASN.1 C十十基 模块中 ASN.1基类中添加上述编码函数和解码 函数所要求的虚函数; 以及在 ASN.1 C++编译器中上述编码函数和解码函数 所要求的类及其成员函数功能。 上述优选实施例包括两个功能模块: 基础模块、 编译器。 基础模块实现 支持 TLV 的基类和一些支持功能, 编译器实现分析 ASN.1 文件, 生成各 ASN.1类型对应的类及其成员函数。 在应用程序中, 用这种 TLV协议定义的 4艮文, 不但可以同版本协议 4艮文的交互, 还可以让新老协议 4艮文的 client端 和 Server端交互, 为不同版本协议的 C/S交互提供的编码规则保障。 本发明 的实施例可以独立实现, 也可以在已有的任何 ASN.1 编译器平台上扩展实 现。 图 2示出了才艮据本发明优选实施例的在 Client与 Server共享相同的开发 语言环境时的开发过程, Client和 Server都采用 C++开发。 包括: A. 接口制 定者定义 ASN.1接口文件, 并用 Asn.1 C++编译器生成接口文件. h和接口文 件. cpp; B. Server开发者编写 Server 4弋码、 和接口文件 .h、 接口文件. cpp— 起编译成可执行的 server程序; C. Client开发者编写 Client代码, 和接口文 件 .h、 接口文件. cpp—起编译成可执行的 client程序; D. 可执行的 Client程 序和可执行的 Server程序在执行时利用 Asn. l C++基础模块交互通信。 图 3 示出了根据本发明优选实施例的使用不同的开发语言环境时的开 发过程, Client采用 java开发, Server采用 C++开发。 包括: A. 接口制定者 定义 ASN.1接口文件, 为 C++开发人员用 Asn.l C++编译器生成接口文件 .h、 接口文件. cpp, 为 java开发人员用 Asn. l java编译器生成接口文件 .java; B. Server开发者编写 Server «码、 和接口文件 .h、 接口文件. cpp—起编译成可 执行的 server程序; C . Client开发者编写 Client代码, 和接口文件 .j ava一起 编译成可执行的 client程序; D. 可执行的 Client程序和可执行的 Server程序 在执行时利用各自语言的 Asn.l基 模块交互通信。 图 4示出了才艮据本发明优选实施例的 Client与 Server使用的开发语言环 境和协议版本都不同的开发过程, Server是老版本, Client采用 java开发, Server采用 C++开发, 这是一种较复杂的开发过程, 在实现步骤中 Client和 Server都采用 C++开发。 该过程包括:
A. 接口制定者 居在老版本时定义的接口文件版本 l.asn, 在开发新版 本时定义了接口文件版本 2.asn。 对两个版本分别编译生成 C++和 Java的接 口实现文件; B. Server开发者在老版本中编写 Server代码, 和接口文件版本 1.h、 接 口文件版本 l.cpp一起编译成可执行的 server执行文件;
C. Client开发者在新版本编写 Client代码, 和接口文件 2.java—起编译 成可执行的 client执行文件;
D. 可执行的 Client程序和可执行的 Server程序在执行时利用各自语言 的 Asn.1基础模块交互通信。 图 5示出了根据本发明优选实施例的 ESNACC C++基本类类型继承体 系。 AsnType的顶层基类。 ESNACC基本类继承关系层次图, ESNACC基本 基类为 AsnType, AsnType为抽象基类。在此之上继承了一些简单的类型来支 持基本 ASN.1 数据类型如 Asnlnt、 AsnReal、 AsnRelativeOid、 AsnAny、 AsnOcts、 AsnBooK AsnNulK asnString , 其中, Asnlnt也由 PERGgeneral派 生, AsnEnum由 Asnlnt派生, AsnOid由 AsnRelativeOid派生; AsnList是实 现其它 Asn. l类的中间类型、 AsnSetOf、 AsnSeqOf由 AsnList派生; 使用了 标准模板库的 std::string、 std::list来进一步支持 SEQUENCE OF、 SET OF等。 一些应用 的字符串类型如 VisibleString、 GraphicString、 Ia5 String、 PrintableString、 NumericString是由基本字符串类型 AsnString派生来的。 其 中 GeneralizedTime、 UTCTime由 VisibleString派生。 图 6示出了根据本发明优选实施例的 TLV整体解码功能流程图。 下面结合一个网管的需求, 基于 ASN.1开源的 ESNACC编译平台, 实 现 TLV 4艮文编解码规则, 本发明可以适用于任何面向对象程序语言实现, 本 文主要结合 C++讨论, 也可以使用其它面向对象的程序语言, 如 JAVA语言 实现。
(一) 需求来源 在网管中,一个网管经常要管理各种设备网元, 不同的设备存在不同的 版本, 而网管自身也存在不同的版本, 网管和设备软件间需要报文交互, 为 了使网管和设备软件间的版本依赖较小, 需要网管能版本兼容的管理网元。 这就要求一种协议规则来支持此需求。
(二) 编译平台
ESNACC是开放源码的 ASN.1编译器, 支持 BER, PER编码, 编译器 提供的 ASN.1基础模块: ASN.1编译器通常提供编译器和基 支持模块, 编 译器将 ASN.1文件编译生成特定程序语言代码, 如 C++、 Java, 将 ASN.1的 类型编译成程序语言的类。 基础支持模块为生成的代码执行提供支持。 通过 爹改编译器和基础支持模块来实现 TLV编解码规则。
(三) 特定 TLV编码规则的实现 在实现过程中, 由于要求码流具有一定的可调试性, TLV 码流需要一 定的可读性, 因此 T采用 2个字节, L采用 4个字节, 格式都采用网络序。 在实现中也可以采用其它格式来存储 T和 L,比如 BER中关于长度的表示格 式。
1.在 ASN.1中扩充语法, 支持自定义 T。 如: QxString32 [10 ]::= GraphicString ( 32 ) NameAndStringValue-E [30] ::= SEQUENCE
{ name QxString32 ,value QxString32
} 在 "::=,' 前的方括号中填写 T, T可以采用各种格式表示, 如十进制, 十六进制。 该语法是可选项, 不存在表示 Τ为 0。
2.如下方式定义的 4艮文可以在旧版本和新版本互通。
( 1 ) 旧版本定义:
ANode [OxFOO 1 ]: := SEQUENCE
{ al QxUInt8, a2 QxUInt32,
}
BNode [0xF003]::= SEQUENCE
{ bl QxUInt32, b2 QxUIntl6, c3 QxUInt32
}
CNode [0xF005]::= SEQUENCE
{ a ANode, b BNode }
( 2 ) 新版本定义
ANode [OxFOO 1 ]: := SEQUENCE
{ al QxUInt8, a2 QxUInt32, d3 QxUInt32, d4 QxUInt32
} BNode [0xF003]::= SEQUENCE
{ bl QxUInt32, b2 QxUIntl6,
} CNode [0xF005]::= SEQUENCE
{ a ANode, b BNode
} 新旧版本中, ANode在新版本末尾增加了成员 d3、 d4 , 而 BNode减少 了成员 c3. 它们和 CNode都能按本文方法版本兼容交互。 旧版 4艮文码流到新 版 4艮文中 d3、 d4 采用缺省值, 而 c3的码流被忽略掉。 新版 4艮文码流到旧版 •t艮文中 d3、 d4的码流被忽略掉, 而 c3的值采用了缺省值。 其它数据在新旧 版本中是一致的。
3. 修改 ESNACC的 ASN.1语法文件, 支持编译器对 T的扫描分析。 在实现中, 把 T放入了类的 META类描述信息中。
4.在 ESNACC的基础基类中加入编码解码函数,主要是整体编码函数、 值编码函数、 整体解码函数, 值解码函数; 函数原形可以如下: 整体编码函数: virtual AsnLen TlvEnc ( AsnBuf &_b );
V编码函数: virtual AsnLen TlvEncContent ( AsnBuf &_b ); 整体解码码函数: virtual AsnLen TlvDec ( AsnBuf &—b, AsnLen &bytesDecoded ); 值解码函数: virtual AsnLen TlvDecContent ( AsnBuf &—b,short iT,
AsnLen iL, AsnLen & bytesDecoded ); 其中— b为码流参数, byteDecoded为一个报文码流解码的累积字节数, iT为码流中的 T, iL为码流中的 L , TlvEnc、 TlvEncContent的返回值为编 码码流的长度。 TlvDec、 TlvDecContext返回值为函数内解码的字节数。 才艮据 实现方式函数原形可以才艮据需要变化。
5. 在 ESNACC中爹改编译器实现生成各类型的编码和解码函数^ 马, 主要是值编码和值解码函数, 因为整体编解码函数可以通用于各种类型, 编 解码过程已经在图 5和上述码流编解码的操作过程中进行了描述。
6. 艮据对上述步骤 S10的详细描述, 制定新 /老版本接口文件. asn, 生 成接口 4艮文 .h、接口 4艮文. cpp, client和 server都采用 C+十编写, 这样类似图 3 方式, 就可以实现 client和 Server的不同版本交互通信了。 应当理解的是, 对本领域普通技术人员来说, 可以根据本发明的技术方 案的说明和具体实施方式做出各种可能的改变或替换, 如 T的位置和格式, L的格式, 以及可能采用压缩和加密格式, 实现的函数方式都可能不同, 甚 至不采用成员函数而采用编码算子方式实现。 从以上的描述中, 可以看出, 本发明实现了如下技术效果:
1.可以通过编码方法把类型转换成码流。 2.可以通过解码方法 4巴码流解码为类实例。
3.不同版本的协议可以互通。
4.可以自定义类型丁。
5.可以在不同语言的程序间互通。 6.由于采用面向对象语言虚函数机制, 有很高的抽象处理能力。 本 TLV格式处理方法本身是通用的, 不依赖于特定的 ASN.1编译器和 特定的面向对象语言, 甚至在结构化语言中也能实现这种 TLV编解码。 显然, 本领域的技术人员应该明白, 上述的本发明的各模块或各步骤可 以用通用的计算装置来实现, 它们可以集中在单个的计算装置上, 或者分布 在多个计算装置所组成的网络上, 可选地, 它们可以用计算装置可执行的程 序代码来实现, 从而, 可以将它们存储在存储装置中由计算装置来执行, 或 者将它们分别制作成各个集成电路模块, 或者将它们中的多个模块或步骤制 作成单个集成电路模块来实现。 这样, 本发明不限制于任何特定的硬件和软 件结合。 以上所述仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本 领域的技术人员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和 原则之内, 所作的任何修改、 等同替换、 改进等, 均应包含在本发明的保护 范围之内。

Claims

权 利 要 求 书
1. 一种用于通信数据的 TLV格式处理方法, 其特征在于, 包括以下步骤: 在 ASN.1格式中定义整数类型的类型 T;
发送方填写所述 ASN.1格式的报文, 所述报文包括数据结构实例; 所述发送方将所述 4艮文编码为码流,所述 4艮文中的所述数据结构实 例的码流包括值 V, 或者包括 、 V的所述整数类型、 V的长度 L。
2. 根据权利要求 1所述的 TLV格式处理方法, 其特征在于, 在 ASN.1格 式中定义整数类型具体包括:
设置 ASN.1格式允许定义所述整数类型;
以 "字符串类型名 [X] :: =定义结构" 的格式定义所述整数类型的 结构, 其中 X指所述整数类型。
3. 根据权利要求 2所述的 TLV格式处理方法, 其特征在于, 以 "字符串类 型名 [X]::=定义结构" 的格式定义所述整数类型的结构具体包括:
设置所述整数类型的结构为同类型名的 SEQUENCE , SET 或 CHOICE类型, 规定要爹改其成员, 则仅允许净增加或净减少成员, 并 且只能变动末尾的成员, 不允许爹改类型。
4. 根据权利要求 3所述的 TLV格式处理方法, 其特征在于, 还包括:
对所述 ASN.1格式的编译器设置处理所述整数类型的功能。
5. 根据权利要求 4所述的 TLV格式处理方法, 其特征在于, 还包括:
在所述 ASN.1格式的 C+十类型中通过函数获取所述整数类型。
6. 根据权利要求 1所述的 TLV格式处理方法, 其特征在于, 所述发送方将 所述 4艮文编码为码流包括:
通过整体编码函数调用值编码函数、 长度编码函数、 以及整数类型 编码函数, 或者通过所述整体编码函数仅调用值编码函数以将所述 4艮文 编码为码流; 所述整数类型编码函数用于才艮据所述数据结构实例中的数据编码 得到所述码流中的所述整数类型;
对于简单数据类型的所述数据结构实例,所述值编码函数用于将所 述数据结构实例中的简单数据编成所述码流中的 V;
对于 SEQUENSE或 SET类型的所述数据结构实例, 所述值编码函 数用于依次调用所述数据结构实例中的各成员的整体编码函数;
对于 SEQUENSE OF或 SET OF类型的所述数据结构实例,所述值 编码函数用于依次调用所述数据结构实例中的数组各元素的整体编码函 数;
对于 CHOICE 类型的所述数据结构实例, 所述值编码函数用于将 所述数据结构实例中选定的成员编成所述码流中的 V, 其中, V包括选 定成员在 CHOICE中的序号和所述选定成员。
7. 根据权利要求 6所述的 TLV格式处理方法, 其特征在于, 当所述整数类 型为 0或不存在, 则整体编码函数仅调用值编码函数; 当所述整数类型 不为 0, 则所述码流包括 、 V的长度 L、 和整数类型。
8. 根据权利要求 1所述的 TLV格式处理方法, 其特征在于, 还包括: 接收 方将所述码流解码。
9. 根据权利要求 8所述的 TLV格式处理方法, 其特征在于, 将所述码流解 码具体包括:
通过整体解码函数调用值解码函数、 长度解码函数、 以及整数类型 解码函数, 或者通过所述整体解码函数仅调用值解码函数以将所述码流 解码;
所述整数类型解码函数用于才艮据码流中的所述整数类型解码所述 码流;
对于简单数据类型的所述数据结构实例,所述值解码函数用于将所 述码流中的 V解成所述数据结构实例中的简单数据;
对于 SEQUENSE或 SET类型的所述数据结构实例, 所述值解码函 数用于将所述码流中的 V依次解成所述数据结构实例中的各成员数据; 对于 SEQUENSE OF或 SET OF类型的所述数据结构实例,所述值 解码函数用于将所述码流中的 V依次解成所述数据结构实例中的数组各 元素; 解码 V的过程中判断本结构内解码流长度是否小于 L , 如果小于 L则继续解码, 否则停止本结构内解码;
对于 CHOICE 类型的所述数据结构实例, 所述值解码函数用于解 码所述码流中的序号和所述序号对应的成员, 如果所述序号对应的成员 在本结构中不存在则结束值解码函数。 根据权利要求 9所述的 TLV格式处理方法, 其特征在于, 通过整体解码 函数调用值解码函数、 长度解码函数、 以及整数类型解码函数, 或者通 过所述整体解码函数仅调用值解码函数以将所述码流解码具体包括: 通过所述整体解码函数判断所述整数类型是否为 0或者是否存在; 如果不为 0或者存在, 则调用所述值解码函数、 长度解码函数、 以 及整数类型解码函数, 其中, 调用所述值解码函数解码所述码流中的所 述整数类型, 验证得到的整数类型是否和自身的整数类型一致, 如果不 一致, 则认为解码异常, 调用所述长度解码函数解码所述码流中的 L , 再调用所述值编码函数解码所述码流中的 V ,如果解码 V得到的长度 vL 小于 L, 则跳过 L-vL字节;
如果为 0或者不存在, 则仅调用所述值解码函数。
PCT/CN2009/070391 2008-07-02 2009-02-10 用于通信数据的tlv格式处理方法 WO2010000139A1 (zh)

Priority Applications (5)

Application Number Priority Date Filing Date Title
US13/001,978 US20110134939A1 (en) 2008-07-02 2009-02-10 Method for processing tlv format of communication data
RU2011103630/08A RU2473180C2 (ru) 2008-07-02 2009-02-10 Способ обработки данных связи tlv-формата
ES09771909.0T ES2659396T3 (es) 2008-07-02 2009-02-10 Método para procesar formato TLV de datos de comunicación
EP09771909.0A EP2302864B1 (en) 2008-07-02 2009-02-10 Method for processing tlv format of communication data
BRPI0915217-2A BRPI0915217B1 (pt) 2008-07-02 2009-02-10 Método para processar um formato tlv de dados de comunicação

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN200810137647.3 2008-07-02
CN2008101376473A CN101316241B (zh) 2008-07-02 2008-07-02 用于通信数据的tlv格式处理方法

Publications (1)

Publication Number Publication Date
WO2010000139A1 true WO2010000139A1 (zh) 2010-01-07

Family

ID=40107085

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2009/070391 WO2010000139A1 (zh) 2008-07-02 2009-02-10 用于通信数据的tlv格式处理方法

Country Status (7)

Country Link
US (1) US20110134939A1 (zh)
EP (1) EP2302864B1 (zh)
CN (1) CN101316241B (zh)
BR (1) BRPI0915217B1 (zh)
ES (1) ES2659396T3 (zh)
RU (1) RU2473180C2 (zh)
WO (1) WO2010000139A1 (zh)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101316241B (zh) * 2008-07-02 2013-05-01 中兴通讯股份有限公司 用于通信数据的tlv格式处理方法
CN103246671A (zh) * 2012-02-09 2013-08-14 中兴通讯股份有限公司 抽象语法标记文件的处理方法及装置
CN103036877A (zh) * 2012-12-10 2013-04-10 北京中创信测科技股份有限公司 一种基于tlv格式协议的编解码代码生成装置及方法
US10109983B2 (en) 2016-04-28 2018-10-23 Hewlett Packard Enterprise Development Lp Devices with quantum dots
US10566765B2 (en) 2016-10-27 2020-02-18 Hewlett Packard Enterprise Development Lp Multi-wavelength semiconductor lasers
US10680407B2 (en) 2017-04-10 2020-06-09 Hewlett Packard Enterprise Development Lp Multi-wavelength semiconductor comb lasers
US10396521B2 (en) 2017-09-29 2019-08-27 Hewlett Packard Enterprise Development Lp Laser
RU2683613C1 (ru) * 2018-03-30 2019-03-29 Публичное Акционерное Общество "Сбербанк России" (Пао Сбербанк) Система управления сетью pos-терминалов
CN109298866A (zh) * 2018-09-26 2019-02-01 杭州米加科技股份有限公司 基于c语言的tlv格式协议快速解析方法
US11271792B2 (en) * 2019-01-18 2022-03-08 Hewlett Packard Enterprise Development Lp Using a recursive parser tree to implement a smaller code segment for an embedded simple network management protocol agent
CN113742294A (zh) * 2021-08-23 2021-12-03 宜通世纪科技股份有限公司 一种asn.1-per信令消息解码方法、系统、装置及介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1359065A (zh) * 2000-12-15 2002-07-17 国际商业机器公司 将抽象句法表示法1数据模型化成对象模型的方法及系统
CN1627757A (zh) * 2003-12-12 2005-06-15 华为技术有限公司 通用消息解释器的实现方法
CN101149753A (zh) * 2007-10-25 2008-03-26 中兴通讯股份有限公司 复杂抽象语法标识对象的存储方法
CN101316241A (zh) * 2008-07-02 2008-12-03 中兴通讯股份有限公司 用于通信数据的tlv格式处理方法

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5473691A (en) * 1993-11-05 1995-12-05 Microsoft Corporation System and method for computer data transmission
US5649189A (en) * 1995-11-29 1997-07-15 3Com Corporation Method and apparatus for single pass data encoding of binary words using a stack for writing in reverse order
US6356955B1 (en) * 1996-02-15 2002-03-12 International Business Machines Corporation Method of mapping GDMO templates and ASN.1 defined types into C++ classes using an object-oriented programming interface
JP3531536B2 (ja) * 1999-05-28 2004-05-31 日本電気株式会社 抽象構文記法を用いたデータ構造定義における型情報の動的割り当て方法
FI20002720A (fi) * 2000-12-12 2002-06-13 Nokia Corp Menetelmä konversioiden suorittamiseksi
EP1400784A1 (de) * 2002-09-14 2004-03-24 Leica Geosystems AG Verfahren und Vorrichtungen zur Nutzung von Daten in nicht direkt verarbeitbaren Datenformaten
US20050181787A1 (en) * 2004-02-18 2005-08-18 Judd Tom D. Systems and methods for encoding and decoding data messages
US6999010B2 (en) * 2004-04-16 2006-02-14 Ares International Corporaton Table look-up method for abstract syntax notation encoding/decoding system
CN101197818A (zh) * 2006-12-08 2008-06-11 中兴通讯股份有限公司 一种asn.1报文面向对象的处理方法
CN101159743B (zh) * 2007-10-22 2010-06-23 中兴通讯股份有限公司 Asn.1编解码函数自动生成中的数据类型选择方法
US7996523B2 (en) * 2008-01-17 2011-08-09 Fluke Corporation Free string match encoding and preview

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1359065A (zh) * 2000-12-15 2002-07-17 国际商业机器公司 将抽象句法表示法1数据模型化成对象模型的方法及系统
CN1627757A (zh) * 2003-12-12 2005-06-15 华为技术有限公司 通用消息解释器的实现方法
CN101149753A (zh) * 2007-10-25 2008-03-26 中兴通讯股份有限公司 复杂抽象语法标识对象的存储方法
CN101316241A (zh) * 2008-07-02 2008-12-03 中兴通讯股份有限公司 用于通信数据的tlv格式处理方法

Also Published As

Publication number Publication date
EP2302864A4 (en) 2013-11-20
RU2011103630A (ru) 2012-08-10
CN101316241B (zh) 2013-05-01
BRPI0915217B1 (pt) 2020-10-06
ES2659396T3 (es) 2018-03-15
EP2302864A1 (en) 2011-03-30
EP2302864B1 (en) 2017-11-15
CN101316241A (zh) 2008-12-03
BRPI0915217A2 (pt) 2016-09-13
RU2473180C2 (ru) 2013-01-20
US20110134939A1 (en) 2011-06-09

Similar Documents

Publication Publication Date Title
WO2010000139A1 (zh) 用于通信数据的tlv格式处理方法
EP2124419B1 (en) An object oriented management device for asn.1 message
Neira‐Ayuso et al. Communicating between the kernel and user‐space in Linux using Netlink sockets
US9124466B2 (en) System and method for exposing distributed transaction services as web services
WO2017054531A1 (zh) 一种基于yang模型的编译方法、及对应的接口、组件和系统
US8424020B2 (en) Annotating portions of a message with state properties
Käbisch et al. Efficient and flexible XML-based data-exchange in microcontroller-based sensor actor networks
WO2006014766A2 (en) Method and apparatus for converting network management protocol to markup language
US6976263B2 (en) Mechanism for encoding and decoding upgradeable RPC/XDR structures
WO2005057873A1 (fr) Procede de mise en oeuvre d'un dispositif universel expliquant les messages
KR100751449B1 (ko) OSGi 서비스 플랫폼 기반의 스텁 번들 생성 방법
JP2004234405A (ja) プロトコル符号化/復号化装置
Qiang et al. ASN. 1 application in parsing ISUP PDUs
Coulson et al. Experiences in implementing a distributed object platform for multimedia applications
KR100660057B1 (ko) 패스트 인포셋을 이용한 이진 엑스엠엘 저장 방법 및 복원방법
Alliance Network Device: Gateway Specification
Lu A CORBA-based Interface-centric Approach to Signaling for IP-based Telephony Services
US7730103B2 (en) Apparatus and method for efficient encoding of application definition using contiguous arrays
Triglia ASN. 1 for More Effective Network Standards
Andriescu Dynamic Data Adaptation for the Synthesis and Deployment of Protocol Mediators
Selic Extending the Unified Modeling Language for Large-Scale Highly-Dependable Distributed Systems
Konovalov et al. with Symbolic Computation Software Composability Protocol
Layka et al. Web Services
Carrilho et al. Policy-based Management of DiffServ using XML Technologies.
Taylor et al. Web Services Protocols

Legal Events

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

Ref document number: 09771909

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 141/MUMNP/2011

Country of ref document: IN

REEP Request for entry into the european phase

Ref document number: 2009771909

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2009771909

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2011103630

Country of ref document: RU

WWE Wipo information: entry into national phase

Ref document number: 13001978

Country of ref document: US

REG Reference to national code

Ref country code: BR

Ref legal event code: B01E

Ref document number: PI0915217

Country of ref document: BR

Free format text: SOLICITA-SE A REGULARIZACAO DA PAGINA DE RESUMO, POR ESTA NAO APRESENTAR TITULO.

ENP Entry into the national phase

Ref document number: PI0915217

Country of ref document: BR

Kind code of ref document: A2

Effective date: 20110103