# US 2010/0303098 A1 · Auto code generation to generate packet header generation library for switch diagnostics

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2010/0303098 A1
- Document ID: US20100303098A1
- Status: Published application
- Kind: A1
- Application number: 12/474,907
- Filed: 2009-05-29
- Published: 2010-12-02
- Earliest claimed: 2009-05-29
- Assignees: Cisco Technology, Inc.
- Inventors: Stephen Ong; Ali Haeri
- Web page: https://patentgrep.com/patent/US20100303098A1

## CPC

- H04L 49/555: {Error detection}
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

Techniques are disclosed for describing packet headers in a format that can be used by a code generation tool to generate source code that can generate any type of packet header when compiled and invoked within switch/router firmware. Such packet headers may then be used in a variety of switch diagnostic/testing functions. A code generation tool may be configured to receive a description of a packet header in the description format. The packet description language provides an easily used approach for defining fields in a packet header. Further, the code generation tool may be configured to generate packet header library for use by firmware on a network device, e.g., for testing and diagnostic functions.

## Claims

### Claim 1

A system, comprising:
a processor; and
a memory containing a code generation program, which when executed on the processor is configured to perform an operation for generating source code for representing a packet header in firmware on a switching device, the operation comprising:
receiving a description of the packet header in a description format, wherein the description format includes a definition for each of a plurality of header fields present in the packet header, and
generating, from the description of the packet header, a header library for inclusion in the firmware of the switching device.

### Claim 2 (depends on 1)

The system of claim 1, wherein the definition for each of the plurality of header fields includes a field name, a field type, and a field size.

### Claim 3 (depends on 1)

The system of claim 1, wherein the packet header library defines a plurality of invokable functions for an object class representing the packet header.

### Claim 4 (depends on 3)

The system of claim 3, wherein the plurality of functions include at least a function to get an attribute value and a function to set the attribute value for each of the plurality of header fields.

### Claim 5 (depends on 1)

The system of claim 1, wherein the operation further comprises, generating, from the description of the packet header library, a binding between the packet header library and a scripting language.

### Claim 6 (depends on 5)

The system of claim 5, wherein the operation further comprises, receiving a script configured to invoke one or more of a plurality of invokable functions for an object class representing the packet header.

### Claim 7 (depends on 6)

The system of claim 6, wherein the script invokes at least one of the functions in the header library in order to generate at least a first packet header configured according to the packet header described in the description format.

### Claim 8

A computer-implemented method for generating source code for representing a packet header in a firmware on a switching device, the method comprising:
receiving a description of the packet header in a description format, wherein the description format includes a definition for each of a plurality of header fields present in the packet header;
generating, from the description of the packet header, a header library for inclusion in the firmware of a switching device;
compiling the header library as part of the firmware of the switching device; and
installing the firmware on the switching device.

### Claim 9 (depends on 8)

The computer-implemented method of claim 8, wherein the definition for each of the plurality of header fields includes a field name, a field type, and a field size.

### Claim 10 (depends on 8)

The computer-implemented method of claim 8, wherein the packet header library defines a plurality of invokable functions for an object class representing the packet header.

### Claim 11 (depends on 10)

The computer-implemented method of claim 10, wherein the plurality of functions include at least a function to get an attribute value and a function to set the attribute value for each of the plurality of header fields.

### Claim 12 (depends on 8)

The computer-implemented method of claim 8, further comprising, generating, from the description of the packet header library, a binding between the packet header library and a scripting language.

### Claim 13 (depends on 12)

The computer-implemented method of claim 12, further comprising, receiving a script configured to invoke one or more of a plurality of invokable functions for an object class representing the packet header.

### Claim 14 (depends on 13)

The computer-implemented method of claim 13, wherein the script invokes at least one of the functions in the header library in order to generate at least a first packet header configured according to the packet header described in the description format.

### Claim 15

A computer-readable storage medium containing a program, which when executed on a processor is configured to perform an operation for generating source code for representing a packet header in a firmware on a switching device, the operation comprising:
receiving a description of the packet header in a description format, wherein the description format includes a definition for each of a plurality of header fields present in the packet header;
generating, from the description of the packet header, a header library for inclusion in the firmware of a switching device;
compiling the header library as part of the firmware of the switching device; and
installing the firmware on the switching device.

### Claim 16 (depends on 15)

The computer-readable storage medium of claim 15, wherein the definition for each of the plurality of header fields includes a field name, a field type, and a field size.

### Claim 17 (depends on 15)

The computer-readable storage medium of claim 15, wherein the packet header library defines a plurality of invokable functions for an object class representing the packet header, including at least a function to get an attribute value and a function to set the attribute value for each of the plurality of header fields.

### Claim 18 (depends on 15)

The computer-readable storage medium of claim 15, wherein the operation further comprises, generating, from the description of the packet header library, a binding between the packet header library and a scripting language.

### Claim 19 (depends on 18)

The computer-readable storage medium of claim 18, wherein the operation further comprises, receiving a script configured to invoke one or more of a plurality of invokable functions for an object class representing the packet header.

### Claim 20 (depends on 19)

The computer-readable storage medium of claim 19, wherein the script invokes at least one of the functions in the header library in order to generate at least a first packet header configured according to the packet header described in the description format.
