This is a first pass at adding include/openflow/openflow-1.2.h to
include enum and struct definitions for Open Flow 1.2 that
are not already covered by Open Flow 1.1.

Signed-off-by: Simon Horman <ho...@verge.net.au>
---
 include/openflow/automake.mk       |    3 +
 include/openflow/openflow-1.2.h    |  339 ++++++++++++++++++++++++++++++++++++
 include/openflow/openflow-common.h |    1 +
 include/openflow/openflow.h        |    1 +
 4 files changed, 344 insertions(+), 0 deletions(-)
 create mode 100644 include/openflow/openflow-1.2.h

diff --git a/include/openflow/automake.mk b/include/openflow/automake.mk
index ac7412b..4b7bc07 100644
--- a/include/openflow/automake.mk
+++ b/include/openflow/automake.mk
@@ -2,6 +2,7 @@ noinst_HEADERS += \
        include/openflow/nicira-ext.h \
        include/openflow/openflow-1.0.h \
        include/openflow/openflow-1.1.h \
+       include/openflow/openflow-1.2.h \
        include/openflow/openflow-common.h \
        include/openflow/openflow.h
 
@@ -16,6 +17,7 @@ HSTAMP_FILES = \
        include/openflow/nicira.hstamp \
        include/openflow/openflow-1.0.hstamp \
        include/openflow/openflow-1.1.hstamp \
+       include/openflow/openflow-1.2.hstamp \
        include/openflow/openflow.hstamp
 CLEANFILES += $(HSTAMP_FILES)
 ALL_LOCAL += $(HSTAMP_FILES)
@@ -26,6 +28,7 @@ include/openflow/openflow-1.1.hstamp: 
include/openflow/openflow-common.h
 include/openflow/nicira-ext.hstamp: \
        include/openflow/openflow-1.0.h \
        include/openflow/openflow-1.1.h \
+       include/openflow/openflow-1.2.h \
        include/openflow/openflow-common.h \
        include/openflow/openflow.h
 endif
diff --git a/include/openflow/openflow-1.2.h b/include/openflow/openflow-1.2.h
new file mode 100644
index 0000000..10144d9
--- /dev/null
+++ b/include/openflow/openflow-1.2.h
@@ -0,0 +1,339 @@
+/* Copyright (c) 2008, 2011, 2012 The Board of Trustees of The Leland Stanford
+ * Junior University
+ *
+ * We are making the OpenFlow specification and associated documentation
+ * (Software) available for public use and benefit with the expectation
+ * that others will use, modify and enhance the Software and contribute
+ * those enhancements back to the community. However, since we would
+ * like to make the Software available for broadest use, with as few
+ * restrictions as possible permission is hereby granted, free of
+ * charge, to any person obtaining a copy of this Software to deal in
+ * the Software under the copyrights without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * The name and trademarks of copyright holder(s) may NOT be used in
+ * advertising or publicity pertaining to the Software or any
+ * derivatives without specific, written prior permission.
+ */
+
+/*
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira Networks.
+ * Copyright (c) 2012 Horms Solutions Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* OpenFlow: protocol between controller and datapath. */
+
+#ifndef OPENFLOW_12_H
+#define OPENFLOW_12_H 1
+
+#include "openflow/openflow-1.1.h"
+
+/* OpenFlow 1.2 specific message types, in addition to the common message
+ * types. */
+enum ofp12_type {
+    /* Controller role change request messages. */
+    OFPT12_ROLE_REQUEST = 24,   /* Controller/switch message */
+    OFPT12_ROLE_REPLY,          /* Controller/switch message */
+};
+
+/* Fields to match against flows */
+struct ofp12_match {
+    uint16_t type;        /* One of OFPMT_* */
+    uint16_t length;      /* Length of ofp12_match (excluding padding) */
+    /* Followed by:
+     * - Exactly (length - 4) (possibly 0) bytes containing OXM TLVs, then
+     * - Exactly ((length + 7)/8*8 - length) (between 0 and 7) bytes of
+     *    all-zero bytes
+     * In summary, ofp12_match is padded as needed, to make its overall size
+     * a multiple of 8, to preserve alignment in structures using it.
+     */
+   uint8_t oxm_fields[4]; /* OXMs start here - Make compiler happy */
+};
+OFP_ASSERT(sizeof(struct ofp12_match) == 8);
+
+/* The match type indicates the match structure (set of fields that compose the
+ * match) in use. The match type is placed in the type field at the beginning
+ * of all match structures. The "OpenFlow Extensible Match" type corresponds
+ * to OXM TLV format described below and must be supported by all OpenFlow
+ * switches. Extensions that define other match types may be published on the
+ * ONF wiki. Support for extensions is optional.
+ */
+enum ofp12_match_type {
+    OFPMT_STANDARD = 0, /* Deprecated. */
+    OFPMT_OXM = 1,      /* OpenFlow Extensible Match */
+};
+
+/*
+ * OXM Class IDs.
+ * The high order bit differentiate reserved classes from member classes.
+ * Classes 0x0000 to 0x7FFF are member classes, allocated by ONF.
+ * Classes 0x8000 to 0xFFFE are reserved classes, reserved for standardisation.
+ */
+enum ofp12_oxm_class {
+    OFPXMC12_NXM_0          = 0x0000, /* Backward compatibility with NXM */
+    OFPXMC12_NXM_1          = 0x0001, /* Backward compatibility with NXM */
+    OFPXMC12_OPENFLOW_BASIC = 0x0000, /* Basic class for OpenFlow */
+    OFPXMC12_EXPERIMENTER   = 0x0000, /* Experimenter class */
+};
+
+/* OXM Flow match field types for OpenFlow basic class. */
+enum oxm12_ofb_match_fields {
+    OFPXMT12_OFB_IN_PORT,        /* Switch input port. */
+    OFPXMT12_OFB_IN_PHY_PORT,    /* Switch physical input port. */
+    OFPXMT12_OFB_METADATA,       /* Metadata passed between tables. */
+    OFPXMT12_OFB_ETH_DST,        /* Ethernet destination address. */
+    OFPXMT12_OFB_ETH_SRC,        /* Ethernet source address. */
+    OFPXMT12_OFB_ETH_TYPE,       /* Ethernet frame type. */
+    OFPXMT12_OFB_VLAN_VID,       /* VLAN id. */
+    OFPXMT12_OFB_VLAN_PCP,       /* VLAN priority. */
+    OFPXMT12_OFB_IP_DSCP,        /* IP DSCP (6 bits in ToS field). */
+    OFPXMT12_OFB_IP_ECN,         /* IP ECN (2 bits in ToS field). */
+    OFPXMT12_OFB_IP_PROTO,       /* IP protocol. */
+    OFPXMT12_OFB_IPV4_SRC,       /* IPv4 source address. */
+    OFPXMT12_OFB_IPV4_DST,       /* IPv4 destination address. */
+    OFPXMT12_OFB_TCP_SRC,        /* TCP source port. */
+    OFPXMT12_OFB_TCP_DST,        /* TCP destination port. */
+    OFPXMT12_OFB_UDP_SRC,        /* UDP source port. */
+    OFPXMT12_OFB_UDP_DST,        /* UDP destination port. */
+    OFPXMT12_OFB_SCTP_SRC,       /* SCTP source port. */
+    OFPXMT12_OFB_SCTP_DST,       /* SCTP destination port. */
+    OFPXMT12_OFB_ICMPV4_TYPE,    /* ICMP type. */
+    OFPXMT12_OFB_ICMPV4_CODE,    /* ICMP code. */
+    OFPXMT12_OFB_ARP_OP,         /* ARP opcode. */
+    OFPXMT12_OFB_ARP_SPA,        /* ARP source IPv4 address. */
+    OFPXMT12_OFB_ARP_TPA,        /* ARP target IPv4 address. */
+    OFPXMT12_OFB_ARP_SHA,        /* ARP source hardware address. */
+    OFPXMT12_OFB_ARP_THA,        /* ARP target hardware address. */
+    OFPXMT12_OFB_IPV6_SRC,       /* IPv6 source address. */
+    OFPXMT12_OFB_IPV6_DST,       /* IPv6 destination address. */
+    OFPXMT12_OFB_IPV6_FLABEL,    /* IPv6 Flow Label */
+    OFPXMT12_OFB_ICMPV6_TYPE,    /* ICMPv6 type. */
+    OFPXMT12_OFB_ICMPV6_CODE,    /* ICMPv6 code. */
+    OFPXMT12_OFB_IPV6_ND_TARGET, /* Target address for ND. */
+    OFPXMT12_OFB_IPV6_ND_SLL,    /* Source link-layer for ND. */
+    OFPXMT12_OFB_IPV6_ND_TLL,    /* Target link-layer for ND. */
+    OFPXMT12_OFB_MPLS_LABEL,     /* MPLS label. */
+    OFPXMT12_OFB_MPLS_TC,        /* MPLS TC. */
+};
+
+/* The VLAN id is 12-bits, so we can use the entire 16 bits to indicate
+ * special conditions.
+ */
+enum ofp12_vlan_id {
+    OFPVID12_PRESENT = 0x1000, /* Bit that indicate that a VLAN id is set */
+    OFPVID12_NONE    = 0x0000, /* No VLAN id was set. */
+};
+
+/* Header for OXM experimenter match fields. */
+struct ofp12_oxm_experimenter_header {
+    uint32_t oxm_header;   /* oxm_class = OFPXMC_EXPERIMENTER */
+    uint32_t experimenter; /* Experimenter ID which takes the same
+                              form as in struct ofp11_experimenter_header. */
+};
+OFP_ASSERT(sizeof(struct ofp12_oxm_experimenter_header) == 8);
+
+enum ofp12_action_type {
+    OFPAT12_OUTPUT       = 0,  /* Output to switch port. */
+    OFPAT12_COPY_TTL_OUT = 11, /* Copy TTL "outwards" -- from next-to-outermost
+                                  to outermost */
+    OFPAT12_COPY_TTL_IN,       /* Copy TTL "inwards" -- from outermost to
+                                  next-to-outermost */
+    OFPAT12_SET_MPLS_TTL,      /* MPLS TTL */
+    OFPAT12_DEC_MPLS_TTL,      /* Decrement MPLS TTL */
+    OFPAT12_PUSH_VLAN,         /* Push a new VLAN tag */
+    OFPAT12_POP_VLAN,          /* Pop the outer VLAN tag */
+    OFPAT12_PUSH_MPLS,         /* Push a new MPLS tag */
+    OFPAT12_POP_MPLS,          /* Pop the outer MPLS tag */
+    OFPAT12_SET_QUEUE,         /* Set queue id when outputting to a port */
+    OFPAT12_GROUP,             /* Apply group. */
+    OFPAT12_SET_NW_TTL,        /* IP TTL. */
+    OFPAT12_DEC_NW_TTL,        /* Decrement IP TTL. */
+    OFPAT12_SET_FIELD,         /* Set a header field using OXM TLV format. */
+    OFPAT12_EXPERIMENTER = 0xffff
+};
+
+enum ofp12_controller_max_len {
+       OFPCML12_MAX       = 0xffe5, /* maximum max_len value which can be used
+                                     * to request a specific byte length. */
+       OFPCML12_NO_BUFFER = 0xffff  /* indicates that no buffering should be
+                                     * applied and the whole packet is to be
+                                     * sent to the controller. */
+};
+
+/* Flow setup and teardown (controller -> datapath). */
+struct ofp12_flow_mod {
+    struct ofp_header header;
+    uint64_t cookie;             /* Opaque controller-issued identifier. */
+    uint64_t cookie_mask;        /* Mask used to restrict the cookie bits
+                                    that must match when the command is
+                                    OFPFC_MODIFY* or OFPFC_DELETE*. A value
+                                    of 0 indicates no restriction. */
+
+    /* Flow actions. */
+    uint8_t table_id;             /* ID of the table to put the flow in.
+                                     For OFPFC_DELETE_* commands, OFPTT_ALL
+                                     can also be used to delete matching
+                                     flows from all tables. */
+    uint8_t command;              /* One of OFPFC_*. */
+    uint16_t idle_timeout;        /* Idle time before discarding (seconds). */
+    uint16_t hard_timeout;        /* Max time before discarding (seconds). */
+    uint16_t priority;            /* Priority level of flow entry. */
+    uint32_t buffer_id;           /* Buffered packet to apply to, or
+                                     OFP_NO_BUFFER.
+                                     Not meaningful for OFPFC_DELETE*. */
+    uint32_t out_port;            /* For OFPFC_DELETE* commands, require
+                                     matching entries to include this as an
+                                     output port.  A value of OFPP_ANY
+                                     indicates no restriction. */
+    uint32_t out_group;           /* For OFPFC_DELETE* commands, require
+                                     matching entries to include this as an
+                                     output group.  A value of OFPG_ANY
+                                     indicates no restriction. */
+    uint16_t flags;               /* One of OFPFF_*. */
+    uint8_t pad[2];
+    struct ofp12_match match;       /* Fields to match. Variable size. */
+    /* struct ofp11_instruction instructions[0]; */ /* Instruction set */
+};
+OFP_ASSERT(sizeof(struct ofp12_flow_mod) == 56);
+
+/* OpenFlow 1.2 specific flags
+ * (struct ofp12_flow_mod, member flags). */
+enum ofp12_flow_mod_flags {
+    OFPFF12_RESET_COUNTS  = 1 << 2   /* Reset flow packet and byte counts. */
+};
+
+/* OpenFlow 1.2 specific capabilities
+ * (struct ofp_switch_features, member capabilities). */
+enum ofp12_capabilities {
+    OFPC12_PORT_BLOCKED   = 1 << 8   /* Switch will block looping ports. */
+};
+
+/* OpenFlow 1.2 specific types
+ * (struct ofp11_stats_request/reply, member type). */
+enum ofp12_stats_types {
+    /* Group features.
+     * The request body is empty.
+     * The reply body is struct ofp12_group_features_stats. */
+    OFPST12_GROUP_FEATURES = 8
+};
+
+/* Body of reply to OFPST_TABLE request. */
+struct ofp12_table_stats {
+    uint8_t table_id;        /* Identifier of table.  Lower numbered tables
+                                are consulted first. */
+    uint8_t pad[7];          /* Align to 64-bits. */
+    char name[OFP_MAX_TABLE_NAME_LEN];
+    uint64_t match;          /* Bitmap of (1 << OFPXMT_*) that indicate the
+                                fields the table can match on. */
+    uint64_t wildcards;      /* Bitmap of (1 << OFPXMT_*) wildcards that are
+                                supported by the table. */
+    uint32_t write_actions;  /* Bitmap of OFPAT_* that are supported
+                                by the table with OFPIT_WRITE_ACTIONS. */
+    uint32_t apply_actions;  /* Bitmap of OFPAT_* that are supported
+                                by the table with OFPIT_APPLY_ACTIONS. */
+    uint64_t write_setfields;/* Bitmap of (1 << OFPXMT_*) header fields that
+                                can be set with OFPIT_WRITE_ACTIONS. */
+    uint64_t apply_setfields;/* Bitmap of (1 << OFPXMT_*) header fields that
+                                can be set with OFPIT_APPLY_ACTIONS. */
+    uint64_t metadata_match; /* Bits of metadata table can match. */
+    uint64_t metadata_write; /* Bits of metadata table can write. */
+    uint32_t instructions;   /* Bitmap of OFPIT_* values supported. */
+    uint32_t config;         /* Bitmap of OFPTC_* values */
+    uint32_t max_entries;    /* Max number of entries supported. */
+    uint32_t active_count;   /* Number of active entries. */
+    uint64_t lookup_count;   /* Number of packets looked up in table. */
+    uint64_t matched_count;  /* Number of packets that hit table. */
+};
+OFP_ASSERT(sizeof(struct ofp12_table_stats) == 128);
+
+/* Role request and reply message. */
+struct ofp12_role_request {
+    struct ofp_header header; /* Type OFPT12_ROLE_REQUEST/OFPT12_ROLE_REPLY. */
+    uint32_t role;            /* One of OFPCR12_ROLE_*. */
+    uint8_t pad[4];           /* Align to 64 bits. */
+    uint64_t generation_id;   /* Master Election Generation Id */
+};
+OFP_ASSERT(sizeof(struct ofp12_role_request) == 24);
+
+/* Controller roles. */
+enum ofp12_controller_role {
+    OFPCR12_ROLE_NOCHANGE,    /* Don't change current role. */
+    OFPCR12_ROLE_EQUAL,       /* Default role, full access. */
+    OFPCR12_ROLE_MASTER,      /* Full access, at most one master. */
+    OFPCR12_ROLE_SLAVE,       /* Read-only access. */
+};
+
+/* Packet received on port (datapath -> controller). */
+struct ofp12_packet_in {
+    struct ofp_header header;
+    uint32_t buffer_id;     /* ID assigned by datapath. */
+    uint16_t total_len;     /* Full length of frame. */
+    uint8_t reason;         /* Reason packet is being sent (one of OFPR_*) */
+    uint8_t table_id;       /* ID of the table that was looked up */
+    struct ofp12_match match; /* Packet metadata. Variable size. */
+    /* Followed by:
+     *   - Exactly 2 all-zero padding bytes, then
+     *   - An Ethernet frame whose length is inferred from header.length.
+     * The padding bytes preceding the Ethernet frame ensure that the IP
+     * header (if any) following the Ethernet header is 32-bit aligned.
+     */
+    /* uint8_t pad[2];         Align to 64 bit + 16 bit */
+    /* uint8_t data[0];        Ethernet frame */
+};
+OFP_ASSERT(sizeof(struct ofp12_packet_in) == 24);
+
+/* Why is this packet being sent to the controller?
+ * OpenFlow 1.2 specific reasons
+ * (struct ofp12_packet_in, member reason). */
+enum ofp12_packet_in_reason {
+    OFPR12_INVALID_TTL = 2,   /* Packet has invalid TTL */
+};
+
+/* Flow removed (datapath -> controller). */
+struct ofp12_flow_removed {
+    struct ofp_header header;
+    uint64_t cookie;          /* Opaque controller-issued identifier. */
+
+    uint16_t priority;        /* Priority level of flow entry. */
+    uint8_t reason;           /* One of OFPRR_*. */
+    uint8_t table_id;         /* ID of the table */
+
+    uint32_t duration_sec;    /* Time flow was alive in seconds. */
+    uint32_t duration_nsec;   /* Time flow was alive in nanoseconds beyond
+                                 duration_sec. */
+    uint16_t idle_timeout;    /* Idle timeout from original flow mod. */
+    uint16_t hard_timeout;    /* Hard timeout from original flow mod. */
+    uint64_t packet_count;
+    uint64_t byte_count;
+    struct ofp12_match match;   /* Description of fields. Variable size. */
+};
+OFP_ASSERT(sizeof(struct ofp12_flow_removed) == 56);
+
+#endif /* openflow/openflow-1.2.h */
diff --git a/include/openflow/openflow-common.h 
b/include/openflow/openflow-common.h
index 89c191b..1a956a7 100644
--- a/include/openflow/openflow-common.h
+++ b/include/openflow/openflow-common.h
@@ -73,6 +73,7 @@
  */
 #define OFP10_VERSION   0x01
 #define OFP11_VERSION   0x02
+#define OFP12_VERSION   0x03
 
 #define OFP_MAX_TABLE_NAME_LEN 32
 #define OFP_MAX_PORT_NAME_LEN  16
diff --git a/include/openflow/openflow.h b/include/openflow/openflow.h
index 769a0ad..7ae750a 100644
--- a/include/openflow/openflow.h
+++ b/include/openflow/openflow.h
@@ -19,5 +19,6 @@
 
 #include "openflow/openflow-1.0.h"
 #include "openflow/openflow-1.1.h"
+#include "openflow/openflow-1.2.h"
 
 #endif /* openflow/openflow.h */
-- 
1.7.6.3

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to