CN100377537C - Message forming method - Google Patents

Message forming method Download PDF

Info

Publication number
CN100377537C
CN100377537C CN 200510036403 CN200510036403A CN100377537C CN 100377537 C CN100377537 C CN 100377537C CN 200510036403 CN200510036403 CN 200510036403 CN 200510036403 A CN200510036403 A CN 200510036403A CN 100377537 C CN100377537 C CN 100377537C
Authority
CN
China
Prior art keywords
packet
field
domain
length
bytes
Prior art date
Application number
CN 200510036403
Other languages
Chinese (zh)
Other versions
CN1859222A (en
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 CN 200510036403 priority Critical patent/CN100377537C/en
Publication of CN1859222A publication Critical patent/CN1859222A/en
Application granted granted Critical
Publication of CN100377537C publication Critical patent/CN100377537C/en

Links

Abstract

本发明涉及一种报文生成方法,用于生成各种数据通信协议报文,该方法包括如下步骤:将各个数据通信协议具体报文格式的各种报文域抽象分类划分为比特报文域、字节报文域、字符串报文域、长度报文域以及检验和报文域;将待生成的数据通信协议具体报文格式的各个报文域归类到所述的比特报文域、字节报文域、字符串报文域、长度报文域以及检验和报文域;根据待生成的数据通信协议具体报文格式的各个报文域在其归属的所述比特报文域、字节报文域、字符串报文域、长度报文域或检验和报文域的输入参数值,整理输出该数据通信协议报文的完整字节流。 The present invention relates to a packet generating method, for generating various data communications message protocol, the method comprising the steps of: a data communication protocol specific to each of the packet format of the various messages as a bit field abstract class division packet field , bytes of packet domain, the packet string field, and the field length of the packet and packet inspection field; to be generated specific data communication protocol packet format of each message bit fields classify the packet domain according to , bytes of packet domain, the packet string field, a length field and test packet and packet domains; data communication protocol to be generated for each specific packet format messages in its home domain of the bit field message , bytes of packet domain, the packet string field, or the length of the packet field values ​​of input parameters and test packet domain, and outputs the sort data communication protocol packets unbroken stream of bytes. 本发明可实现生成任意数据通信协议的报文。 The present invention may be implemented to generate arbitrary data communication protocol packets.

Description

才艮文生成方法 Wen was Gen Generation

技术领域 FIELD

本发明涉及数据通信技术领域,更具体的说,本发明涉及一种报文生成方法。 Technical Field The present invention relates to data communications, and more particularly, the present invention relates to a method of generating packet.

背景技术 Background technique

随着互联网在全世界的普及,数据通信设备的功能、稳定性和健壮性越来越重要,而要达到这些标准,对数据通信设备进行严格的测试是必不可少的。 With the popularity of the Internet around the world, the function of data communications equipment, stability and robustness increasingly important, and to achieve these standards, data communication equipment rigorous testing is essential. 通常,数据通信设备之间的通信是通过各种协议报文的交互实现的,数据通信设备的主要功能就是要正确地处理各种协议报文,对数据通信设备的测试一般也是通过向被测设备发送各种协议报文进行测试来实现的。 Typically, the communication between the data communication device is achieved by exchanging packets of various protocols, the data communication apparatus main function is to properly handle packets of various protocols, the test of the data communication device is typically measured by the device sends test packets of various protocols to achieve. 例如, 数据通信的协议一致性测试、异常测试、攻击测试等,因此,如何构成并生成各种协议报文已成为数据通信领域测试技术的一个关键。 For example, a data communication protocol conformance testing, abnormal testing, testing and other attacks, and therefore, how to make and generate a variety of protocol packet data communication has become a key testing technology field.

现有技术中数据通信领域生成协议报文一般采用两种方式,第一种方式是利用现有测试工具的协议报文构造功能,具体生成报文主要包括下面的步 Prior art data communications protocol packets typically generated in two ways, the first way is to use a conventional test tool function configuration protocol packets, particularly packets generated mainly includes the following steps

骤: Step:

首先,捕获网上传输的协议报文;然后,对捕获的报文的某些字节进行修改以构成所需的协议报文;若修改某些字节而引起其它报文域的变化(如校验和),则重新计算需要变化的报文域的值;将所述修改后的协议报文输出作为生成的协议报文。 First, capture internet protocol packets transmitted; then, for some byte packets captured modified to form the desired protocol message; if the changes caused by modifying some other byte packet domain (e.g., school and experience), then the value change required recalculated packet domain; protocol packets to output as the modified protocol message generated.

该种方式实现较简单,但存在如下的缺点: This kind of relatively simple manner, but there are the following disadvantages:

首先,协议报文的构造往往取决于网上传输的报文,不可预知; First, the protocol packet structure often depends on the packets transmitted over the Internet, unpredictable;

其次,对捕获报文的字节流里的字节进行修改比较困难。 Secondly, the captured packet byte stream in bytes modifications more difficult. 由于要在一长 Due to a long

串字节流里找到要修改的字节;并且,有时修改某个字节会引起其它报文域的变化,如校验和域,这样就要重新计算要发生变化的报文域,比较费时费 Byte string you want to modify the stream of bytes; and, sometimes modify a byte packets can cause changes in other domains, such as the checksum field, this recalculation to change the packet domain, time-consuming fee

力; force;

再次, 一些新出现的数据通信协议,往往在网上捕获不到这些协议的净艮文,这样就无法构造这些协议的报文了,另外,也不容易构造一些特殊报文, 因为特殊报文很难在网上捕获。 Again, some of the emerging data communications protocols, the Internet often capture less than net Gen text of these protocols, so you can not construct the message of these agreements, the other is not easy to construct some special message, because the message is very special difficult to capture online.

第二种方式主要是利用TCL语言技术,用TCL扩展命令来封装生成协议净艮文,某种协议的一种报文往往对应一个TCL扩展命令。 The second way is the use of language technology TCL, TCL with extended protocol command to generate a net Gen encapsulated packet A packet corresponding to a certain protocol is often extended command TCL. 对于某种具体的协议报文,该方法要求输入该协议报文的具体参数。 For some specific protocol packets, this method requires specific input parameters in the protocol message. 如构造一个ARP报文,则需要类似如下方式的描述: The configuration of an ARP packet, it is necessary to describe a similar manner:

MakeArpPacket -seth mac -sip ip一addr -deth mac -dip ip—addr -oper oper 注:-seth mac表示源MAC3也it; -sip ip—addr表示源IPv4》也i止;-deth mac A MakeArpPacket -seth mac -sip ip addr -deth mac -dip ip-addr -oper oper NOTE: -seth mac represented MAC3 source also it; -sip ip-addr represents the source IPv4 "i also stop; -deth mac

表示目的MAC地址;-dip ip—addr表示目的IPv斗地址;-oper oper表示表示操作 It represents a destination MAC address; -dip ip-addr is the destination address IPv bucket; -oper oper represents showing operation

类型,1表示ARP请求,2表示ARP应答。 , 1 indicates an ARP request, an ARP reply represents 2.

该种方法存在如下缺点: This method has the following disadvantages:

首先, 一种协议中的一种报文往往需要对应一个TCL扩展命令,如要构造多个协议的多种报文时,则需要开发的TCL扩展命令数目巨大; First a message in a protocol corresponding to a TCL often require extended command, when configured for a plurality of packets as a plurality of protocols, the need to develop a great number of commands TCL extension;

其次,开发相应的TCL扩展命令比较复杂,需要用C语言编写代码,这对测试人员要求比较高; Second, the development of the corresponding expansion of TCL command is more complex, the need to write code in C language, which the testers requirements are relatively high;

再次,对于新出现的数据通信协议,没有现成的TCL扩展命令来构造这些协议的报文,只能继续投入人力来开发构造这些协议报文的TCL扩展命令。 Again, for data communications protocols emerging, there is no ready-made TCL extension command to construct packets of these protocols can only continue to invest in human resources to develop these protocol packets constructed extension of TCL command.

再次,也不容易构造一些特殊报文,因为特殊报文往往具有不确定性, 很难预先用TCL命令实现。 Again, not easy to construct some special messages, special message because often uncertain, it is difficult to achieve in advance with the TCL command.

发明内容 SUMMARY

本发明解决的技术问题是提供一种通用的报文生成方法,以实现构造任意的数据通信协议报文。 The present invention solves the technical problem of providing a general packet generation method, an arbitrary configuration to achieve a data communication protocol packets.

为解决上述问题,本发明的报文生成方法,用于生成各种数据通信协i义 To solve the above problems, the packet generation method of the present invention, for generating various kinds of data communication protocols i Yi

报文,该方法包括如下步骤: Packet, the method comprising the steps of:

a、 将各个数据通信协议具体报文格式的各种报文域抽象分类划分为比特报文域、字节报文域、字符串报文域、长度报文域以及^H睑和报文域; a, the data communication protocol of each particular packet format various fields Abstract classified packets divided into packets of bits field, bytes of packet domain, the packet string field, and the field length of the packet and the packet eyelid ^ H domain ;

b、 将待生成的数据通信协议具体报文格式的各个报文域归类到所述的比特报文域、字节报文域、字符串报文域、长度报文域以及检验和报文域; B, will be generated a data communication protocol for each specific packet format fields classify packets into the packet field bits, bytes of packet domain, the packet string field, and the field length of the packet and packet inspection area;

c 、根据待生成的数据通信协议具体报文格式的各个报文域在其归属的所述比特报文域、字节报文域、字符串报文域、长度报文域或检验和报文域的输入参数值,整理输出该数据通信协议报文的完整字节流。 C, each message fields to be generated according to a data communication protocol specific message format of the bit in its home packet field, bytes of packet domain, the packet string field, length of the packet and the packet domain or inspection field of input parameter values, outputs the complete finishing of the byte stream data communication protocol packets.

其中,步骤b包括: Wherein step b comprises:

bl 、按照数据通信协议报文具体格式中的报文域顺序依次对归类的报文域进行编号; bl, according to the communication protocol data packets encapsulated domain sequence specific format collation packets sequentially numbered field;

b2、确定归类到所述的比特报文域、字节报文域、字符串报文域中的各个报文域在待生成数据通信协议具体报文格式里所占长度及值,以及所述的长度报文域所占长度、所代表的长度单位、所代表长度范围的起始报文域序号和结束报文域序号,所述的检验和报文域所占长度、所检验范围的起始报文域序号和结束报文域序号以及所采用的检验和算法; b2, bit packet is determined to be classified according to the domain, the domain byte packets, each message packet string field to be generated in the domain of packet data communication protocol format and length values ​​in percentage, as well as Exposition of the length of the packet length occupied, represented by the unit of length, the length of the field represented by the packet sequence number and a starting end of packet sequence number field, the test field and the packet length occupied, the scope of the survey starting packet sequence number field and the end serial number, and the message field checksum algorithm employed;

b3、按照报文域的编号顺序,依次输入该报文的所有报文域参数值,若是长度报文域或检验和报文域,则输入报文域的值置为0; b3, according to the sequence number of the packet domain, all packets sequentially input parameter value field of the packet, if the packet length field or the checksum packet domain, the packet input field value is set to 0;

步骤c包括: Step c comprises:

Cl、根据输入报文域的参数值,依次生成各个报文域的比特流,并把该 Cl, according to the value of the input parameter packet fields sequentially generating each bit stream packet domain, and to the

比特流附加到该报文已生成比特流的尾部; Attached to the tail of the bitstream packet has been generated bit stream;

c2、 4巴该净艮文的完整比特流转换为字节流; c2, 4 bar net Gen the complete text bit stream into a byte stream;

c3、根据所述长度报文域所代表长度范围的起始报文域序号和结束报文域序号确定所述长度报文域的值,然后把得到的值填入该长度报文域在上述才艮文字节流的相应位置; c3, determining the value of the field length of the packet according to the length of the packet length field represents the starting packet sequence number field and an end field packets sequence number, then the value obtained by filling the packet length field in the above Gen only the corresponding position of the throttle text;

c4、按照从最后一个检验和报文域到最前一个检验和报文域的顺序,依次根据所述检验和报文域所检验范围的起始报文域序号和结束报文域序号, 以及所采用的检验和算法确定所述检验和报文域的值,然后把得到的值填入该检验和报文域在上述报文字节流的相应位置; c4, in order from the last test and the foremost packet domain to a packet checksum field, sequentially according to the test packet domain and the test range of the starting packet sequence number field and an end field packets sequence number, as well as checksum algorithm and the determined value of said test packet domain, then the value obtained by filling the test message and the corresponding position of the field of text messages throttle;

c5、输出该报文的完整字节流。 Complete byte stream c5, the output of the packet.

与现有技术相比,本发明具有以下有益效果: Compared with the prior art, the present invention has the following advantages:

本发明通过将各个数据通信协议具体报文格式的各种报文域抽象分类划分为比特报文域、字节报文域、字符串报文域、长度报文域以及检验和报文域;然后将待生成的数据通信协议具体报文格、式的各个报文域归类到所述的比特报文域、字节报文域、字符串报文域、长度报文域以及检验和报文域; 根据待生成的数据通信协议具体报文格式的各个报文域在其归属的所述比特报文域、字节报文域、字符串报文域、长度报文域或检验和报文域的参数值, 整理输出该数据通信协议报文的完整字节流。 By respective data communication protocol of the present invention, various specific packet format packets into a bit field abstract class division packet field, bytes of packet domain, the packet string field, a length field and a verification message and message field; then be generated data packet format specific communication protocol, each packet type field to classify the packet field bits, bytes of packet domain, the packet string field, and the field length of the packet and packet inspection text field; each message fields to be generated according to a data communication protocol specific message format of the bit in its home packet field, bytes of packet domain, the packet string field, length of the packet and the packet domain or inspection parameter value of the text field, finishing the output of the full byte stream data communication protocol packets. 基于上述的报文生成方法可实现任意数据通信协议报文,数据通信测试人员不需要再花费大量的时间去开发其它的报文构造工具或相应的TCL扩展命令,可大大节省人力物力,加快对数据通信现有协议和新增协议的测试进度。 The above-described method of generating packet data communications protocols may be implemented in any packet-based data communication tester does not need to spend a lot of time to develop other construction tool or packets corresponding TCL extended command, can greatly save resources, accelerate test schedule data communication existing agreements and additional protocols.

附图说明 BRIEF DESCRIPTION

图1是是RFC791中关于IPv4首部格式的描述; 图2是本发明报文生成方法的具体实现示意图。 FIG 1 is on is described in RFC791 IPv4 header format; FIG. 2 is a specific method for generating packets of the present invention is implemented. FIG. 务体实施方式数据通信的一个协议通常与一篇或多篇RFC文档相对应,在所述的RFC 文档里有该协议所有报文的格式描述。 A protocol service data communication according to the embodiment generally corresponds to that one or more RFC documents, that agreement of all messages in the format described in the RFC documents. 报文格式描述是以报文域为单位的, 报文域的内容可以是多个字节、多个比特、甚至是一个比特,数据通信报文最终在网络线路上传输的是O或1的比特流。 Message format is described in units of packet domain, the packet field contents may be a plurality of bytes, a plurality of bits, one bit is even, the final data communication message transmitted on the network line 1 is O or bitstream. 例如,参考图1,该图是RFC791 中关于IPv4首部格式的描述,图中的一个单词或词组表示一个报文域。 For example, referring to FIG. 1, which is a description of the RFC791 IPv4 header format, a word or phrase FIG text field represents a message. 该数据通信协议的报文由14个报文域组成。 The packet data communication protocol packets by 14 domains. 本发明根据数据通信协议报文是由多个报文域构成的事实,对各种报文域进行抽象分类和定义。 According to the present invention is the fact that the data packet communications protocol is formed of a plurality of packet domains, domains of the various packets abstract classification and definition. 对于与协议一致的报文,测试人员可以按照相应RFC 文档里的报文格式,把一个报文分成多个报文域,给出每个报文域的输入参数,将其归属到其分类的抽象报文域中,根据各个报文域的输入参数便可以输出所要的报文;同样地,对于异常报文,测试人员只要给出组成该报文的所有报文域的输入参数,将其归属到其分类的抽象报文域中,根据各个报文域的输入参数便可以输出所要的异常报文。 For packets consistent with, the test can according to the corresponding RFC documents in the packet format, the packet is divided into a plurality of packet fields, the input parameters given to each packet domain, which was attributed to its classification abstract packet field, according to the input parameters of each packet domain can be of output packets; Similarly, for the abnormal message, the tester is given as long as the composition of the input parameters of all the packets of the packet domain, which abstract attributed to packet classification field, according to the input parameters of each packet domain can output packets to the anomaly. 本发明对数据通信协议报文的报文域进行了抽象分类,定义了如下五种报文域类型,数据通信协议报文的报文域可以被这五种报文域类型所涵盖:*比特报文域:该种报文域里包含一个或多个比特,归属该种类型的报文域输入的l^t有:■ 比特数目;■ 该报文域的值;*字节报文域:该种报文域里包含一个或多个字节,归属该种类型的 The present invention is a data communication protocol packets of the packet domain abstract classification defines the following five types of message field, a data communication protocol packets of the packet fields may be covered five packet field types: * bit message field: this type of packet domain comprises one or more bits, the home packet type field entered l ^ t: ■ the number of bits; ■ packet field value; * byte of the message field : this type of packet domain comprises one or more bytes, the type of home

报文域输入的参数有:■ 字节数目;■ 该报丈城的值;*字符串报文域:该种^R文域的内容是一个字符串,归属该种类型的报文域输入的参数有:画一个字符串,如"helloworld"; *长度报文域:该种报文域的填充内容是该报文某段内容的长度,归属该种类型的^^文域输入的参数有:■ 该报文域所表示的长度的单位:以1字节为单位(如IPv6首部中的静荷长度报文域);以4字节为单位(如IPv4首部中的首部长度报文域);以8字节为单位,且该报文域所表示的长度(字节数)=(该报文域的值+ 1) * 8,(如IPv6报文中路由扩展首部中的长度报文域);■ 该报文域本身所占位置的宽度,如IPv4首部中的首部长度报文域占4个比特宽度,IPv6首部中的静荷长度报文域占2个字节宽度;■ 该报文域所表示的长度的起始报文域序号;■ 该报文域所表示的长度的结束报文域序号;• Parameter input field packets: ■ the number of bytes; ■ value city newspaper feet; * message string field: This type of content R ^ is a text string field, the type of the home domain input packet of parameters: a draw string, such as "helloworld"; * length of the packet field: this kind of filling contents packet field is a length of a piece of content packet, the home domain input parameters ^^ packets of the type : ■ the length of the unit of packet domain represented by: in 1-byte units (e.g., static load the length of the packet field of the IPv6 header portion); 4-byte units (e.g. degrees packet header length IPv4 header of domain); in units of 8 bytes, and the length (number of bytes) indicated by the message field = (packet field value + 1) * 8, (such as IPv6 packet routing header extension length of the packet domain); ■ width of the paper itself, the position occupied by the text field, such as the IPv4 header of the header length of the packet field is four bits width, the IPv6 header of the static load the length of the message field 2 bytes width; ■ starting packet sequence number field in the packet length field represents; end of packet sequence number field ■ packet length field represents; • 验和报文域:该种报文域的填充内容是该报文某段内容的检验和的值,归属该种类型的报文域输入的参数有:■ 该报文域本身所占字节数,如IPv4首部中的首部检验和报文域占2个字节;■ 该检验和所采用的算法名称,如反码求和检验和、ISO检验和、 CRC检验和等;園该检验和要计算的报文内容的起始报文域序号;■该检验和要计算的报文内容的结束报文^号; 以上几种类型报文域的组合所能构造的报文几乎可以涵盖数振通倌领域的所有协议报文,也可以构造出其它任意的异常报文。 Inspection and packet domains: the kind of filling contents packet field values ​​and a test piece of content of the packet, the home packet type field of the input parameters: ■ the bytes occupied by the packet domain itself number, such as the IPv4 header in the header inspection and packet field occupies 2 bytes; ■ the checksum algorithm name used, such as the inverted sum check and, ISO checksum, CRC inspection and the like; garden of the test and starting packet sequence number field of the packet content to be calculated; ■ the test and the message contents to be calculated end packet number ^; combinations of the above types of packet field can be configured to cover almost the number of packets All packets pass groom field transducer may be constructed of any other abnormal packets. 参考图2,该图是本发明基于上述定义的报文域类型的报文生成方法的具体实现流程图,主要包括如下步骤:步骤11,将各个数据通信协议具体报文格式的各种报文域抽象分类划分为比特报文域、字节报文域、字符串报文域、长度报文域以及检验和报文域;步骤12,按照数据通信协议^L文具体格式中的报文域顺序依次对归类的报文域进行编号;步骤13,确定归类到所述的比特报文域、字节报文域、字符串报文域中的各个报文域在待生成数据通信协议具体报文格式里所占长度及值,以及所迷的长度报文域所占长度、所代表的长度单位、所代表长度范围的起始报文域序号和结束报文域序号,所述的检验和报文域所占长度、所检验范围的起始报文域序号和结束报文域序号以及所采用的检验和算法;步骤14,按照报文域的编号顺序,依次输入该报文的所有报文 Referring to Figure 2, which is a message generation method based on the packet type field of the above-defined specific implementation of the present invention, a flow diagram, including the following steps: step 11, various data communications protocols, each packet message format specific abstract classification field is divided into packets of bits field, byte packet domain, the packet string field, and the field length of the packet and packet inspection field; step 12, according to the communication protocol data packets ^ L domain specific text format the order of the classified packets domain ID; step 13, to determine the classification of the bit field message, the message byte field, the string of packets the respective fields in the packet domain data communication protocol to be generated occupied by the length and value of the specific packet format, the fans and the length of the packet occupied by the length field, the length of the units represented by the start and end of packet sequence number field sequence number packet length field representing said inspection and packet length occupied field, the start and end of the packet sequence number field packet sequence number field and a verification algorithm employed and the test range; step 14, the sequential order of the packet domain, the packet is sequentially input All messages 参数值, 若是长度报文域或检验和报文域,则输入报文域的值置为0;步骤15,根据输入报文域的参数值,依次生成各个报文域的比特流,并把该比特流附加到该报文已生成比特流的尾部;步骤16,把该报文的完整比特流转换为字节流;步骤17,根据所述长度报文域所代表长度范围的起始报文域序号和结束报文域序号确定所述长度报文域的值,然后把得到的值填入该长度报文域在上述^L文字节流的相应位置;步骤18,按照从最后一个裣:验和报文域到最前一个检验和报文域的顺序, Parameter values, if the length of the packet domain or checksum packet domain, the input value is set to the packet field is 0; step 15, in accordance with the parameter values ​​of the input packet fields sequentially generating a bit stream of each packet domain, and the attached to the tail of the bitstream packet the generated bit stream; step 16, the complete bit stream to convert the byte stream packet; step 17, according to the length of the packet length field represents the starting packet text field and an end packet sequence number field value of the sequence number is determined packet length field, and the value obtained by filling the packet length field in the above respective positions of the throttle character ^ L; step 18, in order from the last Lian : inspection and packet domain to examine and foremost a sequential packet domain,

依次根据所述检验和报文域所检验范围的起始报文域序号和结束报文域序号,以及所采用的检验和算法确定所述检验和报文域的值,然后把得到的值i真入该检验和寺艮文i或在上述净艮文字节流的相应位置;步骤19,输出该报文的完整字节流。 Successively determining the value of the test packet and the packet domain according to the starting sequence number field and the end of the packet sequence number field test packets and the test range of domains, and the checksum algorithm used, and the obtained value i the temple and the real test packet i Gen or corresponding character position in the above-described net Gen throttled; step 19, the output byte stream the message is complete. 下面举例说明。 Exemplified below. 第一个例子为构造PingRequest报文,该报文的具体内容如表1所示,报文域的值为16进制:以太网目的地址,占6个字节,值为e0000af0c661 以太网源地址,占6个字节,值为000c76dd94e6帧类型,占2个字节,值为0800 IP版本,占4个比特,值为4IP首部长度,占4个比特,值需要计算 服务类型,占1个字节,值为oo总长度,占2个字节,值为需要计算 标识,占2个字节,值为1739标志,占3个比特,值为0 片偏移,占13个比特,值为00生存时间,占1个字节,值为80 协议,占1个字节,值为OlIP首部检验和,占2个字节,值需要计算 源IPv4地址,占4个字节,值为0a6eb50c目的IPv4地址,占4个字节,值为0a6eb55e ICMP类型,占l个字节,值为08代码,占l个字节,值为oo ICMP检验和,占2个字节,值需要计算标识符,占2个字节,值为0400 序号,占2个字节,值为0900数据, 占32 个字节, 值为616263646566 The first example is hexadecimal 16 is configured PingRequest packets, the specific content of the message as shown in Table 1 packet fields: Ethernet destination address, accounting for 6 bytes, Ethernet source address value e0000af0c661 , accounting for 6 bytes, frame type is 000c76dd94e6, 2 bytes, version 0800 IP value, representing four bits, 4IP header length value, representing four bits, values ​​need to be calculated service type, accounting for a byte, oo value of the total length, 2 bytes, identification is necessary to calculate, 2 bytes, the value of flag 1739, representing three bits, an offset value of 0, representing 13 bits, values 00 is a survival time is 1 byte, the value of the protocol 80, 1 byte, checksum value OlIP header, 2 bytes, values ​​need to be calculated IPv4 address, 4 bytes, the value of 0a6eb50c destination IPv4 address, 4 bytes, is 0a6eb55e ICMP type, accounting l bytes, the code is 08, l bytes representing, oo ICMP checksum value is, 2 bytes, values ​​need to be calculated identifier 2 bytes, the serial number is 0400, 2 bytes, the data value 0900, accounting for 32 bytes, the value 616 263 646 566 6768696a6b6c6d6e6f707172737475767761626364656667 6869 按顺序输入如下数据:1. 字节才艮文i或,占6个字节,值为e0000afDc661;2. 字节报文域,占6个字节,值为000c76dd94e6;3. 字节报文城,占2个字节,值为0800;4. 比特才艮文域,占4个比特,值为4;5. 长度报文域,以4字节为单位,占4个比特,起始报文域序号为4,结束报文域序号为15;6. 字节报文域,占1个字节,值为00;7. 长度报文域,以l字节为单位,占2个字节,起始报文域序号为4,结束报文域序号为21;8. 字节报文域,占2个字节,值为1739;9. 比特报文域,占3个比特,值为0;10. 比特才艮文域,占13个比特,值为00;11. 字节报文域,占l个字节,值为80;12. 字节报文域,占l个字节字节,值为01;13. 检验和报文域,占2个字节,采用反码求和算法,起始报文域序号为4, 结束报文域序号为15;14. 字节报文域,占4个字节,值为0a6eb50c;15. 字节 6768696a6b6c6d6e6f707172737475767761626364656667 6869 sequentially inputs the following data: only 1 byte packet i or Burgundy, accounting for 6 bytes, is e0000afDc661; 2-byte message field, accounting for 6 bytes, is 000c76dd94e6; 3 bytes. packets City, 2 bytes, is 0800;. Gen text field only 4 bits, 4 bits representing a value of 4; 5 packet length field, in units of 4 bytes, representing four bits, starting packet sequence number field is 4, the end of the packet sequence number field 15; 6 bytes of packet field, 1 byte, is 00; 7 packet length field, in bytes l, accounting 2 bytes starting packet sequence number field is 4, the end of the packet sequence number field 21; 8-byte message field, 2 bytes, is 1739; 9-bit packet domain, representing 3 bit value of 0; 10 bit field before text Burgundy, 13 bits representing a value of 00; 11 bytes of packet domain, l bytes representing a value of 80; 12 bytes of packet fields, representing l bytes byte, is 01; and 13 test packet field, 2 bytes, using inverted summation algorithm, the starting packet sequence number field is 4, the end of the packet sequence number field 15; 14 byte packet field, 4 bytes, is 0a6eb50c; 15 bytes. 文域,占4个字节,值为0a6eb55e;16. 字节报文域,占1个字节,值为08;17. 字节报文域,占1个字节,值为00;18. 检验和报文域,占2个字节,采用反码求和算法,起始报文域序号为16, 结束^Jl域序号为21;19. 字节报文域,占2个字节,值为0400;20. 字节报文域,占2个字节,值为0900;21. 字节报文域, 占32 个字节,值为<table>table see original document page 13</column></row> <table> Text field, 4 bytes, is 0a6eb55e;. 16 bytes of packet field, 1 byte, is 08; 17 bytes of packet field, 1 byte, the value of 00; 18 inspection and packet field, 2 bytes, using inverted summation algorithm, the starting packet sequence number field 16, the end of the sequence number field 21 ^ Jl; 19 bytes of packet field, 2 bytes , a value of 0400; 20 bytes of packet field, 2 bytes, a value of 0900; 21 bytes of packet field, accounting for 32 bytes, the value of <table> table see original document page 13 </ column> </ row> <table>

按顺序输入如下数据:1. 字节报文域,占6个字节,值为01005e000009;2. 字节净艮丈域,占6个字节,值为00c0dfb279af;3. 字节报文域,占2个字节,值为0800;4. 比特^J:域,占4个比特,值为4;5. 长度报文域,以4字节为单位,占4个比特,起始报文域序号为4,结束报文域序号为16;6. 字节报文域,占1个字节,值为00;7. 长度报文域,以l字节为单位,占2个字节,起始报文域序号为4,结束报文域序号为20;8. 字节报文域,占2个字节,值为7cl9;9. 比特报文域,占3个比特,值为0;10. 比特净艮文域,占13个比特,值为00;11. 字节净艮文域,占1个字节,值为01;12. 字节报文域,占i个字节字节,值为02;13. 检验和报文域,占2个字节,采用反码求和算法,起始报文域序号为4, 结束报文域序号为16;14. 字节报文域,占4个字节,值为0a6e8a41;15. 字节报文域,占4个字节,值为e0000009;16. 字节报 Order the following entries:... 1 byte message field, accounting for 6 bytes, is 01005e000009; 2-byte field net Gen feet, accounting for 6 bytes, is 00c0dfb279af; 3 bytes of packet field , 2 bytes, a value of 0800; 4 bits ^ J:.. domain, is four bits, the value 4; 5 packet length field, in units of 4 bytes, representing four bits, starting reported text field for the sequence number 4, the end of the packet sequence number field 16; 6 bytes of packet field, 1 byte, is 00; 7 packet length field, in bytes l, occupies two words section, the starting packet sequence number field is 4, the end of the packet sequence number field 20; 8-byte message field, 2 bytes, is 7cl9;. 9-bit packet domain, representing three bits, values 0; 10-bit net Gen text field, 13 bits representing a value of 00; 11 byte packets net Gen field, 1 byte, is 01;. 12 bytes of packet field, accounting for the i byte byte value of 02; and a test packet field 13, 2 bytes, using inverted summation algorithm, the starting packet sequence number field is 4, the end of the packet sequence number field 16;., 14 section packet field, 4 bytes, is 0a6e8a41;. 15 bytes of packet field, 4 bytes, is e0000009;. 16-byte packets 域,占4个字节,值为94040000;17. 字节报文域,占l个字节,值为16;18. 字节报文域,占l个字节,值为00;19. 检验和报文域,占2个字节,采用反码求和算法,起始报文域序号为17, 结束报文域序号为20;20. 字节报文域,占4个字节,值为e0000009;21.字节才艮文域,占14个字节,值为0000000000000000000000000000;按照图2所示本发明的实现流程,可输出该报文完整的字节流为: 01005e00000900c0dfb279af0800460000207c 190000010234060a6e8a41 e0000009 94040000160009伤e00000090000000000000000000000000000。 Field, 4 bytes, is 94040000; 17 bytes of packet domain, l bytes representing a value of 16; 18 bytes of packet domain, l bytes representing a value of 00; 19. inspection and packet field, 2 bytes, using inverted summation algorithm, the starting packet sequence number field 17, the end of the packet sequence number field 20; 20 bytes of packet field, 4 bytes, a value e0000009; 21-byte packet before Gen field, accounting for 14 bytes, is 0000000000000000000000000000; implemented in accordance with the flow shown in FIG. 2 of the present invention, a complete packet output stream of bytes: 01005e00000900c0dfb279af0800460000207c 190000010234060a6e8a41 e0000009 94040000160009 injury e00000090000000000000000000000000000. 以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以作出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。 The above are only preferred embodiments of the present invention, it should be noted that those of ordinary skill in the art, in the present invention without departing from the principles of the premise, further improvements and modifications may be made, these improvements and modifications should also be the protection scope of the present invention.

Claims (2)

1、一种报文生成方法,用于生成各种数据通信协议报文,其特征在于,包括如下步骤: a、将各个数据通信协议具体报文格式的各种报文域抽象分类划分为比特报文域、字节报文域、字符串报文域、长度报文域以及检验和报文域; b、将待生成的数据通信协议具体报文格式的各个报文域归类到所述的比特报文域、字节报文域、字符串报文域、长度报文域以及检验和报文域; c、根据待生成的数据通信协议具体报文格式的各个报文域在其归属的所述比特报文域、字节报文域、字符串报文域、长度报文域或检验和报文域的输入参数值,整理输出该数据通信协议报文的完整字节流。 A packet generating method, for generating various data communications protocol packets, characterized by comprising the steps of: a, various packet fields abstract class division of each particular data communication protocol packet format is a bit packet field, bytes of packet domain, the packet string field, and the field length of the packet and packet inspection field; B, will be generated a data communication protocol for each specific packet format to classify the packet domain bit field message, bytes of packet domain, the packet string field, the packet length field and checksum packet domain; C, according to the data communication protocol to be generated for each specific packet format messages in its home domain the bit field message, bytes of packet domain, the packet string field, or the length of the packet field values ​​of input parameters and test packet domain, and outputs the sort data communication protocol packets unbroken stream of bytes.
2、 根据权利要求1所述的报文生成方法,其特征在于,步骤b包括:bl、按照数据通信协议报文具体格式中的报文域顺序依次对归类的报文域进行编号;b2、确定归类到所述的比特报文域、字节报文域、字符串报文域中的各个报文域在待生成数据通信协议具体报文格式里所占长度及值,以及所述的长度报文域所占长度、所代表的长度单位、所代表长度范围的起始报文域序号和结束报文域序号,所述的检验和报文域所占长度、所检验范围的起始报文域序号和结束^^文域序号以及所采用的检验和算法;b3、按照报文域的编号顺序,依次输入该报文的所有报文域参数值,若是长度报文域或检验和报文域,则输入报文域的值置为0;步骤c包括:cl、根据输入报文域的参数值,依次生成各个报文域的比特流,并把该比特流附加到该报文已生成比特流的尾部;c2、把该 2. The packet generating method according to claim 1, wherein step b comprises: bl, sequentially classify packets based on the packet domain numbering domain sequence specific data communication protocol packet format; B2 , to determine the classification of the bit field message, the message byte fields, each message packet string field to be generated in the domain of data communications protocols and the length occupied in the value of the specific packet format, and the the length of the packet occupied by the length field, the length of the units represented by the length of the field represented by the packet sequence number and a starting end of packet sequence number field, the test field and the packet length occupied, since the scope of the test ^^ start packet sequence number field and the text field number and the checksum algorithm used end; B3, sequential order packet fields, text fields sequentially input parameter values ​​for all packets of the packet, if the packet length field or inspection and message fields, enter the packet field value is set to 0; step c comprises: cl, according to the value of the input parameter packet fields sequentially generating a bit stream of each packet domain, and to the bit stream to the newspaper tail bits generated text stream; c2, to the 报文的完整比特流转换为字节流;c3 、根据所述长度报文域所代表长度范围的起始报文域序号和结束报文域序号确定所述长度报文域的值,然后把得到的值填入该长度报文域在上迷才艮文字节流的相应位置;c4、 4姿照从最后一个检—睑和才艮文i或到最前一个检—险和才艮文&戈的顺序,依次根据所述检验和报文域所检验范围的起始报文域序号和结束报文域序号, 以及所采用的检验和算法确定所述检验和报文域的值,然后把得到的值填入该检验和报文域在上述报文字节流的相应位置;c5、输出该报文的完整字节流。 Full conversion bitstream packet stream of bytes; C3, according to the length of the packet length field represents the starting packet sequence number field and an end packet sequence number field value of the determined packet length field, and then a value obtained by filling the packet length field in the fan only position corresponding to the text Gen throttle; c4, 4 from the final pose as a subject - and only eyelid Gen packet i or to a forwardmost subject - and only Gen text & insurance the order of Ge, and sequentially determining the value of the test packet domain according to the starting sequence number field and a packet end packet sequence number field, and the checksum algorithm used in the test range of the test packets and domain, and then a value obtained by filling the test packet and the position of the respective domains text message throttling; c5, the output byte stream the message is complete.
CN 200510036403 2005-08-09 2005-08-09 Message forming method CN100377537C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200510036403 CN100377537C (en) 2005-08-09 2005-08-09 Message forming method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200510036403 CN100377537C (en) 2005-08-09 2005-08-09 Message forming method

Publications (2)

Publication Number Publication Date
CN1859222A CN1859222A (en) 2006-11-08
CN100377537C true CN100377537C (en) 2008-03-26

Family

ID=37298087

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200510036403 CN100377537C (en) 2005-08-09 2005-08-09 Message forming method

Country Status (1)

Country Link
CN (1) CN100377537C (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103227757B (en) 2012-08-31 2016-12-28 杭州华三通信技术有限公司 OSPF packets forwarding method and apparatus
CN103595632B (en) * 2013-11-20 2017-01-04 大连梯耐德网络技术有限公司 An adjustable rate custom multi-packet transmission system and its implementation method

Also Published As

Publication number Publication date
CN1859222A (en) 2006-11-08

Similar Documents

Publication Publication Date Title
Donahoo et al. TCP/IP sockets in C: practical guide for programmers
CN101322374B (en) Systems and methods for voice over multiprotocol label switching
CA2445751C (en) Dynamic packet filter utilizing session tracking
CN101494649B (en) Virtual private network mechanism incorporating security association processor
US6947430B2 (en) Network adapter with embedded deep packet processing
US6904057B2 (en) Method and apparatus for providing multi-protocol, multi-stage, real-time frame classification
US6028846A (en) Method and system for testing real-time delivery of packets of data
US6782503B1 (en) Generating a signature to add to a test packet to achieve a target check value
US8050175B2 (en) Distributed packet group identification for network testing
US7089240B2 (en) Longest prefix match lookup using hash function
CN101827084B (en) Efficient application identification with network devices
US5822520A (en) Method and apparatus for building network test packets
US6424650B1 (en) Network address filter device
US7020716B2 (en) Method and system for verifying the hardware implementation of TCP/IP
CN103999430B (en) For software defined network flexibility and scalability of the process stream forwarding element
Magoni et al. Internet topology modeler based on map sampling
US6665725B1 (en) Processing protocol specific information in packets specified by a protocol description language
US6728929B1 (en) System and method to insert a TCP checksum in a protocol neutral manner
US6915456B2 (en) Apparatus and method of diagnosing network protocol errors using XML documents
CN101656677B (en) Message diversion processing method and device
US20130133064A1 (en) Reverse nfa generation and processing
WO2006028557A2 (en) Method and apparatus for placing a timestamp in a frame
CN1377548A (en) Parsing packet header
WO2007076883A1 (en) Method and system for secure communication between a public network and a local network
Miltchev et al. A study of the relative costs of network security protocols

Legal Events

Date Code Title Description
C06 Publication
C10 Entry into substantive examination
C14 Grant of patent or utility model
EXPY Termination of patent right or utility model