Make switches send error messages when they receive a bad request.
[sliver-openvswitch.git] / include / openflow.h
index 27550c5..0309b4c 100644 (file)
@@ -117,7 +117,8 @@ enum ofp_type {
     OFPT_STATS_REQUEST,       /* 13 Controller/switch message */
     OFPT_STATS_REPLY,         /* 14 Controller/switch message */
     OFPT_ECHO_REQUEST,        /* 15 Symmetric message */
-    OFPT_ECHO_REPLY           /* 16 Symmetric message */
+    OFPT_ECHO_REPLY,          /* 16 Symmetric message */
+    OFPT_VENDOR = 0xff        /* 255 Vendor extension */
 };
 
 /* Header on all OpenFlow packets. */
@@ -450,6 +451,18 @@ struct ofp_flow_expired {
 };
 OFP_ASSERT(sizeof(struct ofp_flow_expired) == 72);
 
+enum ofp_error_type {
+    OFPET_BAD_REQUEST           /* Request was not understood. */
+};
+
+enum ofp_bad_request_code {
+    OFPBRC_BAD_VERSION,         /* ofp_header.version not supported. */
+    OFPBRC_BAD_TYPE,            /* ofp_header.type not supported. */
+    OFPBRC_BAD_STAT,            /* ofp_stats_request.type not supported. */
+    OFPBRC_BAD_VENDOR           /* Vendor not supported (in ofp_vendor or
+                                 * ofp_stats_request or ofp_stats_reply). */
+};
+
 /* Error message (datapath -> controller). */
 struct ofp_error_msg {
     struct ofp_header header;
@@ -493,7 +506,13 @@ enum ofp_stats_types {
      * key-value pairs are included.
      * The reply body is an ASCII string of key-value pairs in the form
      * "key=value\n". */
-    OFPST_SWITCH
+    OFPST_SWITCH,
+
+    /* Vendor extension.
+     * The request and reply bodies begin with a 32-bit vendor ID, which takes
+     * the same form as in "struct ofp_vendor".  The request and reply bodies
+     * are otherwise vendor-defined. */
+    OFPST_VENDOR = 0xffff
 };
 
 struct ofp_stats_request {
@@ -610,4 +629,15 @@ struct ofp_port_stats {
 };
 OFP_ASSERT(sizeof(struct ofp_port_stats) == 104);
 
+/* Vendor extension. */
+struct ofp_vendor {
+    struct ofp_header header;   /* Type OFPT_VENDOR. */
+    uint32_t vendor;            /* Vendor ID:
+                                 * - MSB 0: low-order bytes are Ethernet OUI.
+                                 * - MSB != 0: defined by OpenFlow
+                                 *   consortium. */
+    /* Vendor-defined arbitrary additional data. */
+};
+OFP_ASSERT(sizeof(struct ofp_vendor) == 12);
+
 #endif /* openflow.h */