Book Image

OpenFlow Cookbook

Book Image

OpenFlow Cookbook

Overview of this book

Table of Contents (17 chapters)
16
Index

Common OpenFlow headers

This section covers the OpenFlow header formats that are common to one or more messages. This includes the following header information.

OpenFlow Header

Every OpenFlow message begins with the OpenFlow header, and the format is as follows:

/* Header on all OpenFlow packets. */
struct ofp_header {
uint8_t version;   /* OFP_VERSION. */
uint8_t type;      /* One of the OFPT_ constants. */
uint16_t length;   /* Length including this ofp_header. */
uint32_t xid;      /* Transaction id associated with this packet.
                      Replies use the same id as was in the 
                      Request to facilitate pairing. */
};

The version specifies the OpenFlow protocol version being used. The type field represents the message type being sent, which can take any one of the following values:

enum ofp_type {
            /* Immutable messages. */
OFPT_HELLO = 0,            /* Symmetric message */
OFPT_ERROR = 1,            /* Symmetric message */
OFPT_ECHO_REQUEST = 2,  ...