Zsolt Haraszti | f1c3c03 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2008 The Board of Trustees of The Leland Stanford |
| 2 | * Junior University |
| 3 | * Copyright (c) 2011, 2012 Open Networking Foundation |
| 4 | * |
| 5 | * We are making the OpenFlow specification and associated documentation |
| 6 | * (Software) available for public use and benefit with the expectation |
| 7 | * that others will use, modify and enhance the Software and contribute |
| 8 | * those enhancements back to the community. However, since we would |
| 9 | * like to make the Software available for broadest use, with as few |
| 10 | * restrictions as possible permission is hereby granted, free of |
| 11 | * charge, to any person obtaining a copy of this Software to deal in |
| 12 | * the Software under the copyrights without restriction, including |
| 13 | * without limitation the rights to use, copy, modify, merge, publish, |
| 14 | * distribute, sublicense, and/or sell copies of the Software, and to |
| 15 | * permit persons to whom the Software is furnished to do so, subject to |
| 16 | * the following conditions: |
| 17 | * |
| 18 | * The above copyright notice and this permission notice shall be |
| 19 | * included in all copies or substantial portions of the Software. |
| 20 | * |
| 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 22 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 23 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 24 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 25 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 26 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 27 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 28 | * SOFTWARE. |
| 29 | * |
| 30 | * The name and trademarks of copyright holder(s) may NOT be used in |
| 31 | * advertising or publicity pertaining to the Software or any |
| 32 | * derivatives without specific, written prior permission. |
| 33 | */ |
| 34 | |
| 35 | /* OpenFlow: protocol between controller and datapath. */ |
| 36 | |
| 37 | /* |
| 38 | * - all pad fields dropped |
| 39 | * - for each enum value above 0x7fffffff the MSB is dropped. For example, |
| 40 | * 0xffffffff is now 0x7fffffff. |
| 41 | * - '<type> thing[...]' is replaced with 'repeated <type> thing' |
| 42 | * - 'char thing[...]' is replaced with 'string thing' |
| 43 | * - 'uint8_t data[...]' is replaced with 'bytes data' |
| 44 | * - the following systematic changes are done to various integer types: |
| 45 | * uint8_t -> uint32 |
| 46 | * uint16_t -> uint32 |
| 47 | * uint32_t -> uint32 |
| 48 | * uint64_t -> uint64 |
| 49 | * |
| 50 | */ |
| 51 | syntax = "proto3"; |
| 52 | |
| 53 | package openflow.v13; |
| 54 | |
| 55 | |
| 56 | /* Version number: |
| 57 | * OpenFlow versions released: 0x01 = 1.0 ; 0x02 = 1.1 ; 0x03 = 1.2 |
| 58 | * 0x04 = 1.3 |
| 59 | */ |
| 60 | /* The most significant bit in the version field is reserved and must |
| 61 | * be set to zero. |
| 62 | */ |
| 63 | //#define OFP_VERSION 0x04 |
| 64 | //#define PIPELINE_TABLES 64 |
| 65 | //#define OFP_MAX_TABLE_NAME_LEN 32 |
| 66 | //#define OFP_MAX_PORT_NAME_LEN 16 |
| 67 | /* Official IANA registered port for OpenFlow. */ |
| 68 | //#define OFP_TCP_PORT 6653 |
| 69 | //#define OFP_SSL_PORT 6653 |
| 70 | |
| 71 | //#define OFP_ETH_ALEN 6 /* Bytes in an Ethernet address. */ |
| 72 | |
| 73 | /* Port numbering. Ports are numbered starting from 1. */ |
| 74 | enum ofp_port_no { |
| 75 | OFPP_INVALID = 0; |
| 76 | |
| 77 | /* Maximum number of physical and logical switch ports. */ |
| 78 | OFPP_MAX = 0x7fffff00; |
| 79 | |
| 80 | /* Reserved OpenFlow Port (fake output "ports"). */ |
| 81 | OFPP_IN_PORT = 0x7ffffff8; /* Send the packet out the input port. This |
| 82 | reserved port must be explicitly used |
| 83 | in order to send back out of the input |
| 84 | port. */ |
| 85 | OFPP_TABLE = 0x7ffffff9; /* Submit the packet to the first flow table |
| 86 | NB: This destination port can only be |
| 87 | used in packet-out messages. */ |
| 88 | OFPP_NORMAL = 0x7ffffffa; /* Forward using non-OpenFlow pipeline. */ |
| 89 | OFPP_FLOOD = 0x7ffffffb; /* Flood using non-OpenFlow pipeline. */ |
| 90 | OFPP_ALL = 0x7ffffffc; /* All standard ports except input port. */ |
| 91 | OFPP_CONTROLLER = 0x7ffffffd; /* Send to controller. */ |
| 92 | OFPP_LOCAL = 0x7ffffffe; /* Local openflow "port". */ |
| 93 | OFPP_ANY = 0x7fffffff; /* Special value used in some requests when |
| 94 | no port is specified (i.e. wildcarded). */ |
| 95 | }; |
| 96 | |
| 97 | enum ofp_type { |
| 98 | /* Immutable messages. */ |
| 99 | OFPT_HELLO = 0; /* Symmetric message */ |
| 100 | OFPT_ERROR = 1; /* Symmetric message */ |
| 101 | OFPT_ECHO_REQUEST = 2; /* Symmetric message */ |
| 102 | OFPT_ECHO_REPLY = 3; /* Symmetric message */ |
| 103 | OFPT_EXPERIMENTER = 4; /* Symmetric message */ |
| 104 | |
| 105 | /* Switch configuration messages. */ |
| 106 | OFPT_FEATURES_REQUEST = 5; /* Controller/switch message */ |
| 107 | OFPT_FEATURES_REPLY = 6; /* Controller/switch message */ |
| 108 | OFPT_GET_CONFIG_REQUEST = 7; /* Controller/switch message */ |
| 109 | OFPT_GET_CONFIG_REPLY = 8; /* Controller/switch message */ |
| 110 | OFPT_SET_CONFIG = 9; /* Controller/switch message */ |
| 111 | |
| 112 | /* Asynchronous messages. */ |
| 113 | OFPT_PACKET_IN = 10; /* Async message */ |
| 114 | OFPT_FLOW_REMOVED = 11; /* Async message */ |
| 115 | OFPT_PORT_STATUS = 12; /* Async message */ |
| 116 | |
| 117 | /* Controller command messages. */ |
| 118 | OFPT_PACKET_OUT = 13; /* Controller/switch message */ |
| 119 | OFPT_FLOW_MOD = 14; /* Controller/switch message */ |
| 120 | OFPT_GROUP_MOD = 15; /* Controller/switch message */ |
| 121 | OFPT_PORT_MOD = 16; /* Controller/switch message */ |
| 122 | OFPT_TABLE_MOD = 17; /* Controller/switch message */ |
| 123 | |
| 124 | /* Multipart messages. */ |
| 125 | OFPT_MULTIPART_REQUEST = 18; /* Controller/switch message */ |
| 126 | OFPT_MULTIPART_REPLY = 19; /* Controller/switch message */ |
| 127 | |
| 128 | /* Barrier messages. */ |
| 129 | OFPT_BARRIER_REQUEST = 20; /* Controller/switch message */ |
| 130 | OFPT_BARRIER_REPLY = 21; /* Controller/switch message */ |
| 131 | |
| 132 | /* Queue Configuration messages. */ |
| 133 | OFPT_QUEUE_GET_CONFIG_REQUEST = 22; /* Controller/switch message */ |
| 134 | OFPT_QUEUE_GET_CONFIG_REPLY = 23; /* Controller/switch message */ |
| 135 | |
| 136 | /* Controller role change request messages. */ |
| 137 | OFPT_ROLE_REQUEST = 24; /* Controller/switch message */ |
| 138 | OFPT_ROLE_REPLY = 25; /* Controller/switch message */ |
| 139 | |
| 140 | /* Asynchronous message configuration. */ |
| 141 | OFPT_GET_ASYNC_REQUEST = 26; /* Controller/switch message */ |
| 142 | OFPT_GET_ASYNC_REPLY = 27; /* Controller/switch message */ |
| 143 | OFPT_SET_ASYNC = 28; /* Controller/switch message */ |
| 144 | |
| 145 | /* Meters and rate limiters configuration messages. */ |
| 146 | OFPT_METER_MOD = 29; /* Controller/switch message */ |
| 147 | }; |
| 148 | |
| 149 | /* Header on all OpenFlow packets. */ |
| 150 | message ofp_header { |
| 151 | uint32 version = 1; /* OFP_VERSION. */ |
| 152 | uint32 type = 2; /* One of the OFPT_ constants. */ |
| 153 | uint32 length = 3; /* Length including this ofp_header. */ |
| 154 | uint32 xid = 4; /* Transaction id associated with this packet. |
| 155 | Replies use the same id as was in the request |
| 156 | to facilitate pairing. */ |
| 157 | }; |
| 158 | |
| 159 | /* Hello elements types. |
| 160 | */ |
| 161 | enum ofp_hello_elem_type { |
| 162 | OFPHET_INVALID = 0; |
| 163 | OFPHET_VERSIONBITMAP = 1; /* Bitmap of version supported. */ |
| 164 | }; |
| 165 | |
| 166 | /* Common header for all Hello Elements */ |
| 167 | message ofp_hello_elem_header { |
| 168 | uint32 type = 1; /* One of OFPHET_*. */ |
| 169 | uint32 length = 2; /* Length in bytes of the element, |
| 170 | including this header, excluding padding. */ |
| 171 | }; |
| 172 | |
| 173 | /* Version bitmap Hello Element */ |
| 174 | message ofp_hello_elem_versionbitmap { |
| 175 | uint32 type = 1; /* OFPHET_VERSIONBITMAP. */ |
| 176 | uint32 length = 2; /* Length in bytes of this element, |
| 177 | including this header, excluding padding. */ |
| 178 | /* Followed by: |
| 179 | * - Exactly (length - 4) bytes containing the bitmaps, then |
| 180 | * - Exactly (length + 7)/8*8 - (length) (between 0 and 7) |
| 181 | * bytes of all-zero bytes */ |
| 182 | repeated uint32 bitmaps = 3; /* List of bitmaps - supported versions */ |
| 183 | }; |
| 184 | |
| 185 | /* OFPT_HELLO. This message includes zero or more hello elements having |
| 186 | * variable size. Unknown elements types must be ignored/skipped, to allow |
| 187 | * for future extensions. */ |
| 188 | message ofp_hello { |
| 189 | ofp_header header = 1; |
| 190 | |
| 191 | /* Hello element list */ |
| 192 | repeated ofp_hello_elem_header elements = 2; /* List of elements - 0 or more */ |
| 193 | }; |
| 194 | |
| 195 | //#define OFP_DEFAULT_MISS_SEND_LEN 128 |
| 196 | |
| 197 | enum ofp_config_flags { |
| 198 | /* Handling of IP fragments. */ |
| 199 | OFPC_FRAG_NORMAL = 0; /* No special handling for fragments. */ |
| 200 | OFPC_FRAG_DROP = 1; /* Drop fragments. */ |
| 201 | OFPC_FRAG_REASM = 2; /* Reassemble (only if OFPC_IP_REASM set). */ |
| 202 | OFPC_FRAG_MASK = 3; /* Bitmask of flags dealing with frag. */ |
| 203 | }; |
| 204 | |
| 205 | /* Switch configuration. */ |
| 206 | message ofp_switch_config { |
| 207 | ofp_header header = 1; |
| 208 | uint32 flags = 2; /* Bitmap of OFPC_* flags. */ |
| 209 | uint32 miss_send_len = 3; /* Max bytes of packet that datapath |
| 210 | should send to the controller. See |
| 211 | ofp_controller_max_len for valid values. |
| 212 | */ |
| 213 | }; |
| 214 | |
| 215 | /* Flags to configure the table. Reserved for future use. */ |
| 216 | enum ofp_table_config { |
| 217 | OFPTC_INVALID = 0; |
| 218 | OFPTC_DEPRECATED_MASK = 3; /* Deprecated bits */ |
| 219 | }; |
| 220 | |
| 221 | /* Table numbering. Tables can use any number up to OFPT_MAX. */ |
| 222 | enum ofp_table { |
| 223 | OFPTT_INVALID = 0; |
| 224 | /* Last usable table number. */ |
| 225 | OFPTT_MAX = 0xfe; |
| 226 | |
| 227 | /* Fake tables. */ |
| 228 | OFPTT_ALL = 0xff; /* Wildcard table used for table config, |
| 229 | flow stats and flow deletes. */ |
| 230 | }; |
| 231 | |
| 232 | |
| 233 | /* Configure/Modify behavior of a flow table */ |
| 234 | message ofp_table_mod { |
| 235 | ofp_header header = 1; |
| 236 | uint32 table_id = 2; /* ID of the table, OFPTT_ALL indicates all tables */ |
| 237 | uint32 config = 3; /* Bitmap of OFPTC_* flags */ |
| 238 | }; |
| 239 | |
| 240 | /* Capabilities supported by the datapath. */ |
| 241 | enum ofp_capabilities { |
| 242 | OFPC_INVALID = 0; |
| 243 | OFPC_FLOW_STATS = 1; /* Flow statistics. */ |
| 244 | OFPC_TABLE_STATS = 2; /* Table statistics. */ |
| 245 | OFPC_PORT_STATS = 4; /* Port statistics. */ |
| 246 | OFPC_GROUP_STATS = 8; /* Group statistics. */ |
| 247 | OFPC_IP_REASM = 32; /* Can reassemble IP fragments. */ |
| 248 | OFPC_QUEUE_STATS = 64; /* Queue statistics. */ |
| 249 | OFPC_PORT_BLOCKED = 256; /* Switch will block looping ports. */ |
| 250 | }; |
| 251 | |
| 252 | /* Flags to indicate behavior of the physical port. These flags are |
| 253 | * used in ofp_port to describe the current configuration. They are |
| 254 | * used in the ofp_port_mod message to configure the port's behavior. |
| 255 | */ |
| 256 | enum ofp_port_config { |
| 257 | OFPPC_INVALID = 0; |
| 258 | OFPPC_PORT_DOWN = 1; /* Port is administratively down. */ |
| 259 | |
| 260 | OFPPC_NO_RECV = 4; /* Drop all packets received by port. */ |
| 261 | OFPPC_NO_FWD = 32; /* Drop packets forwarded to port. */ |
| 262 | OFPPC_NO_PACKET_IN = 64; /* Do not send packet-in msgs for port. */ |
| 263 | }; |
| 264 | |
| 265 | /* Current state of the physical port. These are not configurable from |
| 266 | * the controller. |
| 267 | */ |
| 268 | enum ofp_port_state { |
| 269 | OFPPS_INVALID = 0; |
| 270 | OFPPS_LINK_DOWN = 1; /* No physical link present. */ |
| 271 | OFPPS_BLOCKED = 2; /* Port is blocked */ |
| 272 | OFPPS_LIVE = 4; /* Live for Fast Failover Group. */ |
| 273 | }; |
| 274 | |
| 275 | /* Features of ports available in a datapath. */ |
| 276 | enum ofp_port_features { |
| 277 | OFPPF_INVALID = 0; |
| 278 | OFPPF_10MB_HD = 1; /* 10 Mb half-duplex rate support. */ |
| 279 | OFPPF_10MB_FD = 2; /* 10 Mb full-duplex rate support. */ |
| 280 | OFPPF_100MB_HD = 4; /* 100 Mb half-duplex rate support. */ |
| 281 | OFPPF_100MB_FD = 8; /* 100 Mb full-duplex rate support. */ |
| 282 | OFPPF_1GB_HD = 16; /* 1 Gb half-duplex rate support. */ |
| 283 | OFPPF_1GB_FD = 32; /* 1 Gb full-duplex rate support. */ |
| 284 | OFPPF_10GB_FD = 64; /* 10 Gb full-duplex rate support. */ |
| 285 | OFPPF_40GB_FD = 128; /* 40 Gb full-duplex rate support. */ |
| 286 | OFPPF_100GB_FD = 256; /* 100 Gb full-duplex rate support. */ |
| 287 | OFPPF_1TB_FD = 512; /* 1 Tb full-duplex rate support. */ |
| 288 | OFPPF_OTHER = 1024; /* Other rate, not in the list. */ |
| 289 | |
| 290 | OFPPF_COPPER = 2048; /* Copper medium. */ |
| 291 | OFPPF_FIBER = 4096; /* Fiber medium. */ |
| 292 | OFPPF_AUTONEG = 8192; /* Auto-negotiation. */ |
| 293 | OFPPF_PAUSE = 16384; /* Pause. */ |
| 294 | OFPPF_PAUSE_ASYM = 32768; /* Asymmetric pause. */ |
| 295 | }; |
| 296 | |
| 297 | /* Description of a port */ |
| 298 | message ofp_port { |
| 299 | uint32 port_no = 1; |
| 300 | repeated uint32 hw_addr = 2; // [OFP_ETH_ALEN]; |
| 301 | string name = 3; /* Null-terminated */ |
| 302 | |
| 303 | uint32 config = 4; /* Bitmap of OFPPC_* flags. */ |
| 304 | uint32 state = 5; /* Bitmap of OFPPS_* flags. */ |
| 305 | |
| 306 | /* Bitmaps of OFPPF_* that describe features. All bits zeroed if |
| 307 | * unsupported or unavailable. */ |
| 308 | uint32 curr = 6; /* Current features. */ |
| 309 | uint32 advertised = 7; /* Features being advertised by the port. */ |
| 310 | uint32 supported = 8; /* Features supported by the port. */ |
| 311 | uint32 peer = 9; /* Features advertised by peer. */ |
| 312 | |
| 313 | uint32 curr_speed = 10; /* Current port bitrate in kbps. */ |
| 314 | uint32 max_speed = 11; /* Max port bitrate in kbps */ |
| 315 | }; |
| 316 | |
| 317 | /* Switch features. */ |
| 318 | message ofp_switch_features { |
| 319 | ofp_header header = 1; |
| 320 | uint64 datapath_id = 2; /* Datapath unique ID. The lower 48-bits are for |
| 321 | a MAC address, while the upper 16-bits are |
| 322 | implementer-defined. */ |
| 323 | |
| 324 | uint32 n_buffers = 3; /* Max packets buffered at once. */ |
| 325 | |
| 326 | uint32 n_tables = 4; /* Number of tables supported by datapath. */ |
| 327 | uint32 auxiliary_id = 5; /* Identify auxiliary connections */ |
| 328 | |
| 329 | /* Features. */ |
| 330 | uint32 capabilities = 6; /* Bitmap of support "ofp_capabilities". */ |
| 331 | }; |
| 332 | |
| 333 | /* What changed about the physical port */ |
| 334 | enum ofp_port_reason { |
| 335 | OFPPR_ADD = 0; /* The port was added. */ |
| 336 | OFPPR_DELETE = 1; /* The port was removed. */ |
| 337 | OFPPR_MODIFY = 2; /* Some attribute of the port has changed. */ |
| 338 | }; |
| 339 | |
| 340 | /* A physical port has changed in the datapath */ |
| 341 | message ofp_port_status { |
| 342 | ofp_header header = 1; |
| 343 | uint32 reason = 2; /* One of OFPPR_*. */ |
| 344 | ofp_port desc = 3; |
| 345 | }; |
| 346 | |
| 347 | /* Modify behavior of the physical port */ |
| 348 | message ofp_port_mod { |
| 349 | ofp_header header = 1; |
| 350 | uint32 port_no = 2; |
| 351 | repeated uint32 hw_addr = 3; //[OFP_ETH_ALEN]; |
| 352 | /* The hardware address is not |
| 353 | configurable. This is used to |
| 354 | sanity-check the request, so it must |
| 355 | be the same as returned in an |
| 356 | ofp_port struct. */ |
| 357 | uint32 config = 4; /* Bitmap of OFPPC_* flags. */ |
| 358 | uint32 mask = 5; /* Bitmap of OFPPC_* flags to be changed. */ |
| 359 | |
| 360 | uint32 advertise = 6; /* Bitmap of OFPPF_*. Zero all bits to prevent |
| 361 | any action taking place. */ |
| 362 | }; |
| 363 | |
| 364 | /* ## -------------------------- ## */ |
| 365 | /* ## OpenFlow Extensible Match. ## */ |
| 366 | /* ## -------------------------- ## */ |
| 367 | |
| 368 | /* The match type indicates the match structure (set of fields that compose the |
| 369 | * match) in use. The match type is placed in the type field at the beginning |
| 370 | * of all match structures. The "OpenFlow Extensible Match" type corresponds |
| 371 | * to OXM TLV format described below and must be supported by all OpenFlow |
| 372 | * switches. Extensions that define other match types may be published on the |
| 373 | * ONF wiki. Support for extensions is optional. |
| 374 | */ |
| 375 | enum ofp_match_type { |
| 376 | OFPMT_STANDARD = 0; /* Deprecated. */ |
| 377 | OFPMT_OXM = 1; /* OpenFlow Extensible Match */ |
| 378 | }; |
| 379 | |
| 380 | /* Fields to match against flows */ |
| 381 | message ofp_match { |
| 382 | uint32 type = 1; /* One of OFPMT_* */ |
| 383 | uint32 length = 2; /* Length of ofp_match (excluding padding) */ |
| 384 | /* Followed by: |
| 385 | * - Exactly (length - 4) (possibly 0) bytes containing OXM TLVs, then |
| 386 | * - Exactly ((length + 7)/8*8 - length) (between 0 and 7) bytes of |
| 387 | * all-zero bytes |
| 388 | * In summary, ofp_match is padded as needed, to make its overall size |
| 389 | * a multiple of 8, to preserve alignment in structures using it. |
| 390 | */ |
| 391 | repeated uint32 oxm_fields = 3; /* 0 or more OXM match fields */ |
| 392 | }; |
| 393 | |
| 394 | /* Components of a OXM TLV header. |
| 395 | * Those macros are not valid for the experimenter class, macros for the |
| 396 | * experimenter class will depend on the experimenter header used. */ |
| 397 | //#define OXM_HEADER__(CLASS, FIELD, HASMASK, LENGTH) \ |
| 398 | // (((CLASS) << 16) | ((FIELD) << 9) | ((HASMASK) << 8) | (LENGTH)) |
| 399 | //#define OXM_HEADER(CLASS, FIELD, LENGTH) \ |
| 400 | // OXM_HEADER__(CLASS, FIELD, 0, LENGTH) |
| 401 | //#define OXM_HEADER_W(CLASS, FIELD, LENGTH) \ |
| 402 | // OXM_HEADER__(CLASS, FIELD, 1, (LENGTH) * 2) |
| 403 | //#define OXM_CLASS(HEADER) ((HEADER) >> 16) |
| 404 | //#define OXM_FIELD(HEADER) (((HEADER) >> 9) & 0x7f) |
| 405 | //#define OXM_TYPE(HEADER) (((HEADER) >> 9) & 0x7fffff) |
| 406 | //#define OXM_HASMASK(HEADER) (((HEADER) >> 8) & 1) |
| 407 | //#define OXM_LENGTH(HEADER) ((HEADER) & 0xff) |
| 408 | // |
| 409 | //#define OXM_MAKE_WILD_HEADER(HEADER) \ |
| 410 | // OXM_HEADER_W(OXM_CLASS(HEADER), OXM_FIELD(HEADER), OXM_LENGTH(HEADER)) |
| 411 | |
| 412 | /* OXM Class IDs. |
| 413 | * The high order bit differentiate reserved classes from member classes. |
| 414 | * Classes 0x0000 to 0x7FFF are member classes, allocated by ONF. |
| 415 | * Classes 0x8000 to 0xFFFE are reserved classes, reserved for standardisation. |
| 416 | */ |
| 417 | enum ofp_oxm_class { |
| 418 | OFPXMC_NXM_0 = 0x0000; /* Backward compatibility with NXM */ |
| 419 | OFPXMC_NXM_1 = 0x0001; /* Backward compatibility with NXM */ |
| 420 | OFPXMC_OPENFLOW_BASIC = 0x8000; /* Basic class for OpenFlow */ |
| 421 | OFPXMC_EXPERIMENTER = 0xFFFF; /* Experimenter class */ |
| 422 | }; |
| 423 | |
| 424 | /* OXM Flow match field types for OpenFlow basic class. */ |
| 425 | enum oxm_ofb_match_fields { |
| 426 | OFPXMT_OFB_IN_PORT = 0; /* Switch input port. */ |
| 427 | OFPXMT_OFB_IN_PHY_PORT = 1; /* Switch physical input port. */ |
| 428 | OFPXMT_OFB_METADATA = 2; /* Metadata passed between tables. */ |
| 429 | OFPXMT_OFB_ETH_DST = 3; /* Ethernet destination address. */ |
| 430 | OFPXMT_OFB_ETH_SRC = 4; /* Ethernet source address. */ |
| 431 | OFPXMT_OFB_ETH_TYPE = 5; /* Ethernet frame type. */ |
| 432 | OFPXMT_OFB_VLAN_VID = 6; /* VLAN id. */ |
| 433 | OFPXMT_OFB_VLAN_PCP = 7; /* VLAN priority. */ |
| 434 | OFPXMT_OFB_IP_DSCP = 8; /* IP DSCP (6 bits in ToS field). */ |
| 435 | OFPXMT_OFB_IP_ECN = 9; /* IP ECN (2 bits in ToS field). */ |
| 436 | OFPXMT_OFB_IP_PROTO = 10; /* IP protocol. */ |
| 437 | OFPXMT_OFB_IPV4_SRC = 11; /* IPv4 source address. */ |
| 438 | OFPXMT_OFB_IPV4_DST = 12; /* IPv4 destination address. */ |
| 439 | OFPXMT_OFB_TCP_SRC = 13; /* TCP source port. */ |
| 440 | OFPXMT_OFB_TCP_DST = 14; /* TCP destination port. */ |
| 441 | OFPXMT_OFB_UDP_SRC = 15; /* UDP source port. */ |
| 442 | OFPXMT_OFB_UDP_DST = 16; /* UDP destination port. */ |
| 443 | OFPXMT_OFB_SCTP_SRC = 17; /* SCTP source port. */ |
| 444 | OFPXMT_OFB_SCTP_DST = 18; /* SCTP destination port. */ |
| 445 | OFPXMT_OFB_ICMPV4_TYPE = 19; /* ICMP type. */ |
| 446 | OFPXMT_OFB_ICMPV4_CODE = 20; /* ICMP code. */ |
| 447 | OFPXMT_OFB_ARP_OP = 21; /* ARP opcode. */ |
| 448 | OFPXMT_OFB_ARP_SPA = 22; /* ARP source IPv4 address. */ |
| 449 | OFPXMT_OFB_ARP_TPA = 23; /* ARP target IPv4 address. */ |
| 450 | OFPXMT_OFB_ARP_SHA = 24; /* ARP source hardware address. */ |
| 451 | OFPXMT_OFB_ARP_THA = 25; /* ARP target hardware address. */ |
| 452 | OFPXMT_OFB_IPV6_SRC = 26; /* IPv6 source address. */ |
| 453 | OFPXMT_OFB_IPV6_DST = 27; /* IPv6 destination address. */ |
| 454 | OFPXMT_OFB_IPV6_FLABEL = 28; /* IPv6 Flow Label */ |
| 455 | OFPXMT_OFB_ICMPV6_TYPE = 29; /* ICMPv6 type. */ |
| 456 | OFPXMT_OFB_ICMPV6_CODE = 30; /* ICMPv6 code. */ |
| 457 | OFPXMT_OFB_IPV6_ND_TARGET = 31; /* Target address for ND. */ |
| 458 | OFPXMT_OFB_IPV6_ND_SLL = 32; /* Source link-layer for ND. */ |
| 459 | OFPXMT_OFB_IPV6_ND_TLL = 33; /* Target link-layer for ND. */ |
| 460 | OFPXMT_OFB_MPLS_LABEL = 34; /* MPLS label. */ |
| 461 | OFPXMT_OFB_MPLS_TC = 35; /* MPLS TC. */ |
| 462 | OFPXMT_OFB_MPLS_BOS = 36; /* MPLS BoS bit. */ |
| 463 | OFPXMT_OFB_PBB_ISID = 37; /* PBB I-SID. */ |
| 464 | OFPXMT_OFB_TUNNEL_ID = 38; /* Logical Port Metadata. */ |
| 465 | OFPXMT_OFB_IPV6_EXTHDR = 39; /* IPv6 Extension Header pseudo-field */ |
| 466 | }; |
| 467 | |
| 468 | //#define OFPXMT_OFB_ALL ((UINT64_C(1) << 40) - 1) |
| 469 | |
| 470 | /* OpenFlow port on which the packet was received. |
| 471 | * May be a physical port, a logical port, or the reserved port OFPP_LOCAL |
| 472 | * |
| 473 | * Prereqs: None. |
| 474 | * |
| 475 | * Format: 32-bit integer in network byte order. |
| 476 | * |
| 477 | * Masking: Not maskable. */ |
| 478 | //#define OXM_OF_IN_PORT OXM_HEADER (0x8000, OFPXMT_OFB_IN_PORT, 4) |
| 479 | |
| 480 | /* Physical port on which the packet was received. |
| 481 | * |
| 482 | * Consider a packet received on a tunnel interface defined over a link |
| 483 | * aggregation group (LAG) with two physical port members. If the tunnel |
| 484 | * interface is the logical port bound to OpenFlow. In this case, |
| 485 | * OFPXMT_OF_IN_PORT is the tunnel's port number and OFPXMT_OF_IN_PHY_PORT is |
| 486 | * the physical port number of the LAG on which the tunnel is configured. |
| 487 | * |
| 488 | * When a packet is received directly on a physical port and not processed by a |
| 489 | * logical port, OFPXMT_OF_IN_PORT and OFPXMT_OF_IN_PHY_PORT have the same |
| 490 | * value. |
| 491 | * |
| 492 | * This field is usually not available in a regular match and only available |
| 493 | * in ofp_packet_in messages when it's different from OXM_OF_IN_PORT. |
| 494 | * |
| 495 | * Prereqs: OXM_OF_IN_PORT must be present. |
| 496 | * |
| 497 | * Format: 32-bit integer in network byte order. |
| 498 | * |
| 499 | * Masking: Not maskable. */ |
| 500 | //#define OXM_OF_IN_PHY_PORT OXM_HEADER (0x8000, OFPXMT_OFB_IN_PHY_PORT, 4) |
| 501 | |
| 502 | /* Table metadata. |
| 503 | * |
| 504 | * Prereqs: None. |
| 505 | * |
| 506 | * Format: 64-bit integer in network byte order. |
| 507 | * |
| 508 | * Masking: Arbitrary masks. |
| 509 | */ |
| 510 | //#define OXM_OF_METADATA OXM_HEADER (0x8000, OFPXMT_OFB_METADATA, 8) |
| 511 | //#define OXM_OF_METADATA_W OXM_HEADER_W(0x8000, OFPXMT_OFB_METADATA, 8) |
| 512 | |
| 513 | /* Source or destination address in Ethernet header. |
| 514 | * |
| 515 | * Prereqs: None. |
| 516 | * |
| 517 | * Format: 48-bit Ethernet MAC address. |
| 518 | * |
| 519 | * Masking: Arbitrary masks. */ |
| 520 | //#define OXM_OF_ETH_DST OXM_HEADER (0x8000, OFPXMT_OFB_ETH_DST, 6) |
| 521 | //#define OXM_OF_ETH_DST_W OXM_HEADER_W(0x8000, OFPXMT_OFB_ETH_DST, 6) |
| 522 | //#define OXM_OF_ETH_SRC OXM_HEADER (0x8000, OFPXMT_OFB_ETH_SRC, 6) |
| 523 | //#define OXM_OF_ETH_SRC_W OXM_HEADER_W(0x8000, OFPXMT_OFB_ETH_SRC, 6) |
| 524 | |
| 525 | /* Packet's Ethernet type. |
| 526 | * |
| 527 | * Prereqs: None. |
| 528 | * |
| 529 | * Format: 16-bit integer in network byte order. |
| 530 | * |
| 531 | * Masking: Not maskable. */ |
| 532 | //#define OXM_OF_ETH_TYPE OXM_HEADER (0x8000, OFPXMT_OFB_ETH_TYPE, 2) |
| 533 | |
| 534 | /* The VLAN id is 12-bits, so we can use the entire 16 bits to indicate |
| 535 | * special conditions. |
| 536 | */ |
| 537 | enum ofp_vlan_id { |
| 538 | OFPVID_NONE = 0x0000; /* No VLAN id was set. */ |
| 539 | OFPVID_PRESENT = 0x1000; /* Bit that indicate that a VLAN id is set */ |
| 540 | }; |
| 541 | /* Define for compatibility */ |
| 542 | //#define OFP_VLAN_NONE OFPVID_NONE |
| 543 | |
| 544 | /* 802.1Q VID. |
| 545 | * |
| 546 | * For a packet with an 802.1Q header, this is the VLAN-ID (VID) from the |
| 547 | * outermost tag, with the CFI bit forced to 1. For a packet with no 802.1Q |
| 548 | * header, this has value OFPVID_NONE. |
| 549 | * |
| 550 | * Prereqs: None. |
| 551 | * |
| 552 | * Format: 16-bit integer in network byte order with bit 13 indicating |
| 553 | * presence of VLAN header and 3 most-significant bits forced to 0. |
| 554 | * Only the lower 13 bits have meaning. |
| 555 | * |
| 556 | * Masking: Arbitrary masks. |
| 557 | * |
| 558 | * This field can be used in various ways: |
| 559 | * |
| 560 | * - If it is not constrained at all, the nx_match matches packets without |
| 561 | * an 802.1Q header or with an 802.1Q header that has any VID value. |
| 562 | * |
| 563 | * - Testing for an exact match with 0x0 matches only packets without |
| 564 | * an 802.1Q header. |
| 565 | * |
| 566 | * - Testing for an exact match with a VID value with CFI=1 matches packets |
| 567 | * that have an 802.1Q header with a specified VID. |
| 568 | * |
| 569 | * - Testing for an exact match with a nonzero VID value with CFI=0 does |
| 570 | * not make sense. The switch may reject this combination. |
| 571 | * |
| 572 | * - Testing with nxm_value=0, nxm_mask=0x0fff matches packets with no 802.1Q |
| 573 | * header or with an 802.1Q header with a VID of 0. |
| 574 | * |
| 575 | * - Testing with nxm_value=0x1000, nxm_mask=0x1000 matches packets with |
| 576 | * an 802.1Q header that has any VID value. |
| 577 | */ |
| 578 | //#define OXM_OF_VLAN_VID OXM_HEADER (0x8000, OFPXMT_OFB_VLAN_VID, 2) |
| 579 | //#define OXM_OF_VLAN_VID_W OXM_HEADER_W(0x8000, OFPXMT_OFB_VLAN_VID, 2) |
| 580 | |
| 581 | /* 802.1Q PCP. |
| 582 | * |
| 583 | * For a packet with an 802.1Q header, this is the VLAN-PCP from the |
| 584 | * outermost tag. For a packet with no 802.1Q header, this has value |
| 585 | * 0. |
| 586 | * |
| 587 | * Prereqs: OXM_OF_VLAN_VID must be different from OFPVID_NONE. |
| 588 | * |
| 589 | * Format: 8-bit integer with 5 most-significant bits forced to 0. |
| 590 | * Only the lower 3 bits have meaning. |
| 591 | * |
| 592 | * Masking: Not maskable. |
| 593 | */ |
| 594 | //#define OXM_OF_VLAN_PCP OXM_HEADER (0x8000, OFPXMT_OFB_VLAN_PCP, 1) |
| 595 | |
| 596 | /* The Diff Serv Code Point (DSCP) bits of the IP header. |
| 597 | * Part of the IPv4 ToS field or the IPv6 Traffic Class field. |
| 598 | * |
| 599 | * Prereqs: OXM_OF_ETH_TYPE must be either 0x0800 or 0x86dd. |
| 600 | * |
| 601 | * Format: 8-bit integer with 2 most-significant bits forced to 0. |
| 602 | * Only the lower 6 bits have meaning. |
| 603 | * |
| 604 | * Masking: Not maskable. */ |
| 605 | //#define OXM_OF_IP_DSCP OXM_HEADER (0x8000, OFPXMT_OFB_IP_DSCP, 1) |
| 606 | |
| 607 | /* The ECN bits of the IP header. |
| 608 | * Part of the IPv4 ToS field or the IPv6 Traffic Class field. |
| 609 | * |
| 610 | * Prereqs: OXM_OF_ETH_TYPE must be either 0x0800 or 0x86dd. |
| 611 | * |
| 612 | * Format: 8-bit integer with 6 most-significant bits forced to 0. |
| 613 | * Only the lower 2 bits have meaning. |
| 614 | * |
| 615 | * Masking: Not maskable. */ |
| 616 | //#define OXM_OF_IP_ECN OXM_HEADER (0x8000, OFPXMT_OFB_IP_ECN, 1) |
| 617 | |
| 618 | /* The "protocol" byte in the IP header. |
| 619 | * |
| 620 | * Prereqs: OXM_OF_ETH_TYPE must be either 0x0800 or 0x86dd. |
| 621 | * |
| 622 | * Format: 8-bit integer. |
| 623 | * |
| 624 | * Masking: Not maskable. */ |
| 625 | //#define OXM_OF_IP_PROTO OXM_HEADER (0x8000, OFPXMT_OFB_IP_PROTO, 1) |
| 626 | |
| 627 | /* The source or destination address in the IP header. |
| 628 | * |
| 629 | * Prereqs: OXM_OF_ETH_TYPE must match 0x0800 exactly. |
| 630 | * |
| 631 | * Format: 32-bit integer in network byte order. |
| 632 | * |
| 633 | * Masking: Arbitrary masks. |
| 634 | */ |
| 635 | //#define OXM_OF_IPV4_SRC OXM_HEADER (0x8000, OFPXMT_OFB_IPV4_SRC, 4) |
| 636 | //#define OXM_OF_IPV4_SRC_W OXM_HEADER_W(0x8000, OFPXMT_OFB_IPV4_SRC, 4) |
| 637 | //#define OXM_OF_IPV4_DST OXM_HEADER (0x8000, OFPXMT_OFB_IPV4_DST, 4) |
| 638 | //#define OXM_OF_IPV4_DST_W OXM_HEADER_W(0x8000, OFPXMT_OFB_IPV4_DST, 4) |
| 639 | |
| 640 | /* The source or destination port in the TCP header. |
| 641 | * |
| 642 | * Prereqs: |
| 643 | * OXM_OF_ETH_TYPE must be either 0x0800 or 0x86dd. |
| 644 | * OXM_OF_IP_PROTO must match 6 exactly. |
| 645 | * |
| 646 | * Format: 16-bit integer in network byte order. |
| 647 | * |
| 648 | * Masking: Not maskable. */ |
| 649 | //#define OXM_OF_TCP_SRC OXM_HEADER (0x8000, OFPXMT_OFB_TCP_SRC, 2) |
| 650 | //#define OXM_OF_TCP_DST OXM_HEADER (0x8000, OFPXMT_OFB_TCP_DST, 2) |
| 651 | |
| 652 | /* The source or destination port in the UDP header. |
| 653 | * |
| 654 | * Prereqs: |
| 655 | * OXM_OF_ETH_TYPE must match either 0x0800 or 0x86dd. |
| 656 | * OXM_OF_IP_PROTO must match 17 exactly. |
| 657 | * |
| 658 | * Format: 16-bit integer in network byte order. |
| 659 | * |
| 660 | * Masking: Not maskable. */ |
| 661 | //#define OXM_OF_UDP_SRC OXM_HEADER (0x8000, OFPXMT_OFB_UDP_SRC, 2) |
| 662 | //#define OXM_OF_UDP_DST OXM_HEADER (0x8000, OFPXMT_OFB_UDP_DST, 2) |
| 663 | |
| 664 | /* The source or destination port in the SCTP header. |
| 665 | * |
| 666 | * Prereqs: |
| 667 | * OXM_OF_ETH_TYPE must match either 0x0800 or 0x86dd. |
| 668 | * OXM_OF_IP_PROTO must match 132 exactly. |
| 669 | * |
| 670 | * Format: 16-bit integer in network byte order. |
| 671 | * |
| 672 | * Masking: Not maskable. */ |
| 673 | //#define OXM_OF_SCTP_SRC OXM_HEADER (0x8000, OFPXMT_OFB_SCTP_SRC, 2) |
| 674 | //#define OXM_OF_SCTP_DST OXM_HEADER (0x8000, OFPXMT_OFB_SCTP_DST, 2) |
| 675 | |
| 676 | /* The type or code in the ICMP header. |
| 677 | * |
| 678 | * Prereqs: |
| 679 | * OXM_OF_ETH_TYPE must match 0x0800 exactly. |
| 680 | * OXM_OF_IP_PROTO must match 1 exactly. |
| 681 | * |
| 682 | * Format: 8-bit integer. |
| 683 | * |
| 684 | * Masking: Not maskable. */ |
| 685 | //#define OXM_OF_ICMPV4_TYPE OXM_HEADER (0x8000, OFPXMT_OFB_ICMPV4_TYPE, 1) |
| 686 | //#define OXM_OF_ICMPV4_CODE OXM_HEADER (0x8000, OFPXMT_OFB_ICMPV4_CODE, 1) |
| 687 | |
| 688 | /* ARP opcode. |
| 689 | * |
| 690 | * For an Ethernet+IP ARP packet, the opcode in the ARP header. Always 0 |
| 691 | * otherwise. |
| 692 | * |
| 693 | * Prereqs: OXM_OF_ETH_TYPE must match 0x0806 exactly. |
| 694 | * |
| 695 | * Format: 16-bit integer in network byte order. |
| 696 | * |
| 697 | * Masking: Not maskable. */ |
| 698 | //#define OXM_OF_ARP_OP OXM_HEADER (0x8000, OFPXMT_OFB_ARP_OP, 2) |
| 699 | |
| 700 | /* For an Ethernet+IP ARP packet, the source or target protocol address |
| 701 | * in the ARP header. Always 0 otherwise. |
| 702 | * |
| 703 | * Prereqs: OXM_OF_ETH_TYPE must match 0x0806 exactly. |
| 704 | * |
| 705 | * Format: 32-bit integer in network byte order. |
| 706 | * |
| 707 | * Masking: Arbitrary masks. |
| 708 | */ |
| 709 | //#define OXM_OF_ARP_SPA OXM_HEADER (0x8000, OFPXMT_OFB_ARP_SPA, 4) |
| 710 | //#define OXM_OF_ARP_SPA_W OXM_HEADER_W(0x8000, OFPXMT_OFB_ARP_SPA, 4) |
| 711 | //#define OXM_OF_ARP_TPA OXM_HEADER (0x8000, OFPXMT_OFB_ARP_TPA, 4) |
| 712 | //#define OXM_OF_ARP_TPA_W OXM_HEADER_W(0x8000, OFPXMT_OFB_ARP_TPA, 4) |
| 713 | |
| 714 | /* For an Ethernet+IP ARP packet, the source or target hardware address |
| 715 | * in the ARP header. Always 0 otherwise. |
| 716 | * |
| 717 | * Prereqs: OXM_OF_ETH_TYPE must match 0x0806 exactly. |
| 718 | * |
| 719 | * Format: 48-bit Ethernet MAC address. |
| 720 | * |
| 721 | * Masking: Not maskable. */ |
| 722 | //#define OXM_OF_ARP_SHA OXM_HEADER (0x8000, OFPXMT_OFB_ARP_SHA, 6) |
| 723 | //#define OXM_OF_ARP_SHA_W OXM_HEADER_W (0x8000, OFPXMT_OFB_ARP_SHA, 6) |
| 724 | //#define OXM_OF_ARP_THA OXM_HEADER (0x8000, OFPXMT_OFB_ARP_THA, 6) |
| 725 | //#define OXM_OF_ARP_THA_W OXM_HEADER_W (0x8000, OFPXMT_OFB_ARP_THA, 6) |
| 726 | |
| 727 | |
| 728 | /* The source or destination address in the IPv6 header. |
| 729 | * |
| 730 | * Prereqs: OXM_OF_ETH_TYPE must match 0x86dd exactly. |
| 731 | * |
| 732 | * Format: 128-bit IPv6 address. |
| 733 | * |
| 734 | * Masking: Arbitrary masks. |
| 735 | */ |
| 736 | //#define OXM_OF_IPV6_SRC OXM_HEADER (0x8000, OFPXMT_OFB_IPV6_SRC, 16) |
| 737 | //#define OXM_OF_IPV6_SRC_W OXM_HEADER_W(0x8000, OFPXMT_OFB_IPV6_SRC, 16) |
| 738 | //#define OXM_OF_IPV6_DST OXM_HEADER (0x8000, OFPXMT_OFB_IPV6_DST, 16) |
| 739 | //#define OXM_OF_IPV6_DST_W OXM_HEADER_W(0x8000, OFPXMT_OFB_IPV6_DST, 16) |
| 740 | |
| 741 | /* The IPv6 Flow Label |
| 742 | * |
| 743 | * Prereqs: |
| 744 | * OXM_OF_ETH_TYPE must match 0x86dd exactly |
| 745 | * |
| 746 | * Format: 32-bit integer with 12 most-significant bits forced to 0. |
| 747 | * Only the lower 20 bits have meaning. |
| 748 | * |
| 749 | * Masking: Arbitrary masks. |
| 750 | */ |
| 751 | //#define OXM_OF_IPV6_FLABEL OXM_HEADER (0x8000, OFPXMT_OFB_IPV6_FLABEL, 4) |
| 752 | //#define OXM_OF_IPV6_FLABEL_W OXM_HEADER_W(0x8000, OFPXMT_OFB_IPV6_FLABEL, 4) |
| 753 | |
| 754 | /* The type or code in the ICMPv6 header. |
| 755 | * |
| 756 | * Prereqs: |
| 757 | * OXM_OF_ETH_TYPE must match 0x86dd exactly. |
| 758 | * OXM_OF_IP_PROTO must match 58 exactly. |
| 759 | * |
| 760 | * Format: 8-bit integer. |
| 761 | * |
| 762 | * Masking: Not maskable. */ |
| 763 | //#define OXM_OF_ICMPV6_TYPE OXM_HEADER (0x8000, OFPXMT_OFB_ICMPV6_TYPE, 1) |
| 764 | //#define OXM_OF_ICMPV6_CODE OXM_HEADER (0x8000, OFPXMT_OFB_ICMPV6_CODE, 1) |
| 765 | |
| 766 | /* The target address in an IPv6 Neighbor Discovery message. |
| 767 | * |
| 768 | * Prereqs: |
| 769 | * OXM_OF_ETH_TYPE must match 0x86dd exactly. |
| 770 | * OXM_OF_IP_PROTO must match 58 exactly. |
| 771 | * OXM_OF_ICMPV6_TYPE must be either 135 or 136. |
| 772 | * |
| 773 | * Format: 128-bit IPv6 address. |
| 774 | * |
| 775 | * Masking: Not maskable. */ |
| 776 | //#define OXM_OF_IPV6_ND_TARGET OXM_HEADER (0x8000, OFPXMT_OFB_IPV6_ND_TARGET, 16) |
| 777 | |
| 778 | /* The source link-layer address option in an IPv6 Neighbor Discovery |
| 779 | * message. |
| 780 | * |
| 781 | * Prereqs: |
| 782 | * OXM_OF_ETH_TYPE must match 0x86dd exactly. |
| 783 | * OXM_OF_IP_PROTO must match 58 exactly. |
| 784 | * OXM_OF_ICMPV6_TYPE must be exactly 135. |
| 785 | * |
| 786 | * Format: 48-bit Ethernet MAC address. |
| 787 | * |
| 788 | * Masking: Not maskable. */ |
| 789 | //#define OXM_OF_IPV6_ND_SLL OXM_HEADER (0x8000, OFPXMT_OFB_IPV6_ND_SLL, 6) |
| 790 | |
| 791 | /* The target link-layer address option in an IPv6 Neighbor Discovery |
| 792 | * message. |
| 793 | * |
| 794 | * Prereqs: |
| 795 | * OXM_OF_ETH_TYPE must match 0x86dd exactly. |
| 796 | * OXM_OF_IP_PROTO must match 58 exactly. |
| 797 | * OXM_OF_ICMPV6_TYPE must be exactly 136. |
| 798 | * |
| 799 | * Format: 48-bit Ethernet MAC address. |
| 800 | * |
| 801 | * Masking: Not maskable. */ |
| 802 | //#define OXM_OF_IPV6_ND_TLL OXM_HEADER (0x8000, OFPXMT_OFB_IPV6_ND_TLL, 6) |
| 803 | |
| 804 | /* The LABEL in the first MPLS shim header. |
| 805 | * |
| 806 | * Prereqs: |
| 807 | * OXM_OF_ETH_TYPE must match 0x8847 or 0x8848 exactly. |
| 808 | * |
| 809 | * Format: 32-bit integer in network byte order with 12 most-significant |
| 810 | * bits forced to 0. Only the lower 20 bits have meaning. |
| 811 | * |
| 812 | * Masking: Not maskable. */ |
| 813 | //#define OXM_OF_MPLS_LABEL OXM_HEADER (0x8000, OFPXMT_OFB_MPLS_LABEL, 4) |
| 814 | |
| 815 | /* The TC in the first MPLS shim header. |
| 816 | * |
| 817 | * Prereqs: |
| 818 | * OXM_OF_ETH_TYPE must match 0x8847 or 0x8848 exactly. |
| 819 | * |
| 820 | * Format: 8-bit integer with 5 most-significant bits forced to 0. |
| 821 | * Only the lower 3 bits have meaning. |
| 822 | * |
| 823 | * Masking: Not maskable. */ |
| 824 | //#define OXM_OF_MPLS_TC OXM_HEADER (0x8000, OFPXMT_OFB_MPLS_TC, 1) |
| 825 | |
| 826 | /* The BoS bit in the first MPLS shim header. |
| 827 | * |
| 828 | * Prereqs: |
| 829 | * OXM_OF_ETH_TYPE must match 0x8847 or 0x8848 exactly. |
| 830 | * |
| 831 | * Format: 8-bit integer with 7 most-significant bits forced to 0. |
| 832 | * Only the lowest bit have a meaning. |
| 833 | * |
| 834 | * Masking: Not maskable. */ |
| 835 | //#define OXM_OF_MPLS_BOS OXM_HEADER (0x8000, OFPXMT_OFB_MPLS_BOS, 1) |
| 836 | |
| 837 | /* IEEE 802.1ah I-SID. |
| 838 | * |
| 839 | * For a packet with a PBB header, this is the I-SID from the |
| 840 | * outermost service tag. |
| 841 | * |
| 842 | * Prereqs: |
| 843 | * OXM_OF_ETH_TYPE must match 0x88E7 exactly. |
| 844 | * |
| 845 | * Format: 24-bit integer in network byte order. |
| 846 | * |
| 847 | * Masking: Arbitrary masks. */ |
| 848 | //#define OXM_OF_PBB_ISID OXM_HEADER (0x8000, OFPXMT_OFB_PBB_ISID, 3) |
| 849 | //#define OXM_OF_PBB_ISID_W OXM_HEADER_W(0x8000, OFPXMT_OFB_PBB_ISID, 3) |
| 850 | |
| 851 | /* Logical Port Metadata. |
| 852 | * |
| 853 | * Metadata associated with a logical port. |
| 854 | * If the logical port performs encapsulation and decapsulation, this |
| 855 | * is the demultiplexing field from the encapsulation header. |
| 856 | * For example, for a packet received via GRE tunnel including a (32-bit) key, |
| 857 | * the key is stored in the low 32-bits and the high bits are zeroed. |
| 858 | * For a MPLS logical port, the low 20 bits represent the MPLS Label. |
| 859 | * For a VxLAN logical port, the low 24 bits represent the VNI. |
| 860 | * If the packet is not received through a logical port, the value is 0. |
| 861 | * |
| 862 | * Prereqs: None. |
| 863 | * |
| 864 | * Format: 64-bit integer in network byte order. |
| 865 | * |
| 866 | * Masking: Arbitrary masks. */ |
| 867 | //#define OXM_OF_TUNNEL_ID OXM_HEADER (0x8000, OFPXMT_OFB_TUNNEL_ID, 8) |
| 868 | //#define OXM_OF_TUNNEL_ID_W OXM_HEADER_W(0x8000, OFPXMT_OFB_TUNNEL_ID, 8) |
| 869 | |
| 870 | /* The IPv6 Extension Header pseudo-field. |
| 871 | * |
| 872 | * Prereqs: |
| 873 | * OXM_OF_ETH_TYPE must match 0x86dd exactly |
| 874 | * |
| 875 | * Format: 16-bit integer with 7 most-significant bits forced to 0. |
| 876 | * Only the lower 9 bits have meaning. |
| 877 | * |
| 878 | * Masking: Maskable. */ |
| 879 | //#define OXM_OF_IPV6_EXTHDR OXM_HEADER (0x8000, OFPXMT_OFB_IPV6_EXTHDR, 2) |
| 880 | //#define OXM_OF_IPV6_EXTHDR_W OXM_HEADER_W(0x8000, OFPXMT_OFB_IPV6_EXTHDR, 2) |
| 881 | |
| 882 | /* Bit definitions for IPv6 Extension Header pseudo-field. */ |
| 883 | enum ofp_ipv6exthdr_flags { |
| 884 | OFPIEH_INVALID = 0; |
| 885 | OFPIEH_NONEXT = 1; /* "No next header" encountered. */ |
| 886 | OFPIEH_ESP = 2; /* Encrypted Sec Payload header present. */ |
| 887 | OFPIEH_AUTH = 4; /* Authentication header present. */ |
| 888 | OFPIEH_DEST = 8; /* 1 or 2 dest headers present. */ |
| 889 | OFPIEH_FRAG = 16; /* Fragment header present. */ |
| 890 | OFPIEH_ROUTER = 32; /* Router header present. */ |
| 891 | OFPIEH_HOP = 64; /* Hop-by-hop header present. */ |
| 892 | OFPIEH_UNREP = 128; /* Unexpected repeats encountered. */ |
| 893 | OFPIEH_UNSEQ = 256; /* Unexpected sequencing encountered. */ |
| 894 | }; |
| 895 | |
| 896 | /* Header for OXM experimenter match fields. |
| 897 | * The experimenter class should not use OXM_HEADER() macros for defining |
| 898 | * fields due to this extra header. */ |
| 899 | message ofp_oxm_experimenter_header { |
| 900 | uint32 oxm_header = 1; /* oxm_class = OFPXMC_EXPERIMENTER */ |
| 901 | uint32 experimenter = 2; /* Experimenter ID which takes the same |
| 902 | form as in struct ofp_experimenter_header. */ |
| 903 | }; |
| 904 | |
| 905 | /* ## ----------------- ## */ |
| 906 | /* ## OpenFlow Actions. ## */ |
| 907 | /* ## ----------------- ## */ |
| 908 | |
| 909 | enum ofp_action_type { |
| 910 | OFPAT_OUTPUT = 0; /* Output to switch port. */ |
| 911 | OFPAT_COPY_TTL_OUT = 11; /* Copy TTL "outwards" -- from next-to-outermost |
| 912 | to outermost */ |
| 913 | OFPAT_COPY_TTL_IN = 12; /* Copy TTL "inwards" -- from outermost to |
| 914 | next-to-outermost */ |
| 915 | OFPAT_SET_MPLS_TTL = 15; /* MPLS TTL */ |
| 916 | OFPAT_DEC_MPLS_TTL = 16; /* Decrement MPLS TTL */ |
| 917 | |
| 918 | OFPAT_PUSH_VLAN = 17; /* Push a new VLAN tag */ |
| 919 | OFPAT_POP_VLAN = 18; /* Pop the outer VLAN tag */ |
| 920 | OFPAT_PUSH_MPLS = 19; /* Push a new MPLS tag */ |
| 921 | OFPAT_POP_MPLS = 20; /* Pop the outer MPLS tag */ |
| 922 | OFPAT_SET_QUEUE = 21; /* Set queue id when outputting to a port */ |
| 923 | OFPAT_GROUP = 22; /* Apply group. */ |
| 924 | OFPAT_SET_NW_TTL = 23; /* IP TTL. */ |
| 925 | OFPAT_DEC_NW_TTL = 24; /* Decrement IP TTL. */ |
| 926 | OFPAT_SET_FIELD = 25; /* Set a header field using OXM TLV format. */ |
| 927 | OFPAT_PUSH_PBB = 26; /* Push a new PBB service tag (I-TAG) */ |
| 928 | OFPAT_POP_PBB = 27; /* Pop the outer PBB service tag (I-TAG) */ |
| 929 | OFPAT_EXPERIMENTER = 0xffff; |
| 930 | }; |
| 931 | |
| 932 | /* Action header that is common to all actions. The length includes the |
| 933 | * header and any padding used to make the action 64-bit aligned. |
| 934 | * NB: The length of an action *must* always be a multiple of eight. */ |
| 935 | message ofp_action_header { |
| 936 | uint32 type = 1; /* One of OFPAT_*. */ |
| 937 | uint32 len = 2; /* Length of action, including this |
| 938 | header. This is the length of action, |
| 939 | including any padding to make it |
| 940 | 64-bit aligned. */ |
| 941 | }; |
| 942 | |
| 943 | enum ofp_controller_max_len { |
| 944 | OFPCML_INVALID = 0; |
| 945 | OFPCML_MAX = 0xffe5; /* maximum max_len value which can be used |
| 946 | to request a specific byte length. */ |
| 947 | OFPCML_NO_BUFFER = 0xffff; /* indicates that no buffering should be |
| 948 | applied and the whole packet is to be |
| 949 | sent to the controller. */ |
| 950 | }; |
| 951 | |
| 952 | /* Action structure for OFPAT_OUTPUT, which sends packets out 'port'. |
| 953 | * When the 'port' is the OFPP_CONTROLLER, 'max_len' indicates the max |
| 954 | * number of bytes to send. A 'max_len' of zero means no bytes of the |
| 955 | * packet should be sent. A 'max_len' of OFPCML_NO_BUFFER means that |
| 956 | * the packet is not buffered and the complete packet is to be sent to |
| 957 | * the controller. */ |
| 958 | message ofp_action_output { |
| 959 | uint32 type = 1; /* OFPAT_OUTPUT. */ |
| 960 | uint32 len = 2; /* Length is 16. */ |
| 961 | uint32 port = 3; /* Output port. */ |
| 962 | uint32 max_len = 4; /* Max length to send to controller. */ |
| 963 | }; |
| 964 | |
| 965 | /* Action structure for OFPAT_SET_MPLS_TTL. */ |
| 966 | message ofp_action_mpls_ttl { |
| 967 | uint32 type = 1; /* OFPAT_SET_MPLS_TTL. */ |
| 968 | uint32 len = 2; /* Length is 8. */ |
| 969 | uint32 mpls_ttl = 3; /* MPLS TTL */ |
| 970 | }; |
| 971 | |
| 972 | /* Action structure for OFPAT_PUSH_VLAN/MPLS/PBB. */ |
| 973 | message ofp_action_push { |
| 974 | uint32 type = 1; /* OFPAT_PUSH_VLAN/MPLS/PBB. */ |
| 975 | uint32 len = 2; /* Length is 8. */ |
| 976 | uint32 ethertype = 3; /* Ethertype */ |
| 977 | }; |
| 978 | |
| 979 | /* Action structure for OFPAT_POP_MPLS. */ |
| 980 | message ofp_action_pop_mpls { |
| 981 | uint32 type = 1; /* OFPAT_POP_MPLS. */ |
| 982 | uint32 len = 2; /* Length is 8. */ |
| 983 | uint32 ethertype = 3; /* Ethertype */ |
| 984 | }; |
| 985 | |
| 986 | /* Action structure for OFPAT_GROUP. */ |
| 987 | message ofp_action_group { |
| 988 | uint32 type = 1; /* OFPAT_GROUP. */ |
| 989 | uint32 len = 2; /* Length is 8. */ |
| 990 | uint32 group_id = 3; /* Group identifier. */ |
| 991 | }; |
| 992 | |
| 993 | /* Action structure for OFPAT_SET_NW_TTL. */ |
| 994 | message ofp_action_nw_ttl { |
| 995 | uint32 type = 1; /* OFPAT_SET_NW_TTL. */ |
| 996 | uint32 len = 2; /* Length is 8. */ |
| 997 | uint32 nw_ttl = 3; /* IP TTL */ |
| 998 | }; |
| 999 | |
| 1000 | /* Action structure for OFPAT_SET_FIELD. */ |
| 1001 | message ofp_action_set_field { |
| 1002 | uint32 type = 1; /* OFPAT_SET_FIELD. */ |
| 1003 | uint32 len = 2; /* Length is padded to 64 bits. */ |
| 1004 | /* Followed by: |
| 1005 | * - Exactly (4 + oxm_length) bytes containing a single OXM TLV, then |
| 1006 | * - Exactly ((8 + oxm_length) + 7)/8*8 - (8 + oxm_length) |
| 1007 | * (between 0 and 7) bytes of all-zero bytes |
| 1008 | */ |
| 1009 | repeated uint32 field = 3; //[4]; /* OXM TLV - Make compiler happy */ |
| 1010 | }; |
| 1011 | |
| 1012 | /* Action header for OFPAT_EXPERIMENTER. |
| 1013 | * The rest of the body is experimenter-defined. */ |
| 1014 | message ofp_action_experimenter_header { |
| 1015 | uint32 type = 1; /* OFPAT_EXPERIMENTER. */ |
| 1016 | uint32 len = 2; /* Length is a multiple of 8. */ |
| 1017 | uint32 experimenter = 3; /* Experimenter ID which takes the same |
| 1018 | form as in struct |
| 1019 | ofp_experimenter_header. */ |
| 1020 | }; |
| 1021 | |
| 1022 | /* ## ---------------------- ## */ |
| 1023 | /* ## OpenFlow Instructions. ## */ |
| 1024 | /* ## ---------------------- ## */ |
| 1025 | |
| 1026 | enum ofp_instruction_type { |
| 1027 | OFPIT_INVALID = 0; |
| 1028 | OFPIT_GOTO_TABLE = 1; /* Setup the next table in the lookup |
| 1029 | pipeline */ |
| 1030 | OFPIT_WRITE_METADATA = 2; /* Setup the metadata field for use later in |
| 1031 | pipeline */ |
| 1032 | OFPIT_WRITE_ACTIONS = 3; /* Write the action(s) onto the datapath action |
| 1033 | set */ |
| 1034 | OFPIT_APPLY_ACTIONS = 4; /* Applies the action(s) immediately */ |
| 1035 | OFPIT_CLEAR_ACTIONS = 5; /* Clears all actions from the datapath |
| 1036 | action set */ |
| 1037 | OFPIT_METER = 6; /* Apply meter (rate limiter) */ |
| 1038 | |
| 1039 | OFPIT_EXPERIMENTER = 0xFFFF; /* Experimenter instruction */ |
| 1040 | }; |
| 1041 | |
| 1042 | /* Instruction header that is common to all instructions. The length includes |
| 1043 | * the header and any padding used to make the instruction 64-bit aligned. |
| 1044 | * NB: The length of an instruction *must* always be a multiple of eight. */ |
| 1045 | message ofp_instruction { |
| 1046 | uint32 type = 1; /* Instruction type */ |
| 1047 | uint32 len = 2; /* Length of this struct in bytes. */ |
| 1048 | }; |
| 1049 | |
| 1050 | /* Instruction structure for OFPIT_GOTO_TABLE */ |
| 1051 | message ofp_instruction_goto_table { |
| 1052 | uint32 type = 1; /* OFPIT_GOTO_TABLE */ |
| 1053 | uint32 len = 2; /* Length of this struct in bytes. */ |
| 1054 | uint32 table_id = 3; /* Set next table in the lookup pipeline */ |
| 1055 | }; |
| 1056 | |
| 1057 | /* Instruction structure for OFPIT_WRITE_METADATA */ |
| 1058 | message ofp_instruction_write_metadata { |
| 1059 | uint32 type = 1; /* OFPIT_WRITE_METADATA */ |
| 1060 | uint32 len = 2; /* Length of this struct in bytes. */ |
| 1061 | uint64 metadata = 3; /* Metadata value to write */ |
| 1062 | uint64 metadata_mask = 4; /* Metadata write bitmask */ |
| 1063 | }; |
| 1064 | |
| 1065 | /* Instruction structure for OFPIT_WRITE/APPLY/CLEAR_ACTIONS */ |
| 1066 | message ofp_instruction_actions { |
| 1067 | uint32 type = 1; /* One of OFPIT_*_ACTIONS */ |
| 1068 | uint32 len = 2; /* Length of this struct in bytes. */ |
| 1069 | repeated ofp_action_header actions = 3; /* 0 or more actions associated with |
| 1070 | OFPIT_WRITE_ACTIONS and |
| 1071 | OFPIT_APPLY_ACTIONS */ |
| 1072 | }; |
| 1073 | |
| 1074 | /* Instruction structure for OFPIT_METER */ |
| 1075 | message ofp_instruction_meter { |
| 1076 | uint32 type = 1; /* OFPIT_METER */ |
| 1077 | uint32 len = 2; /* Length is 8. */ |
| 1078 | uint32 meter_id = 3; /* Meter instance. */ |
| 1079 | }; |
| 1080 | |
| 1081 | /* Instruction structure for experimental instructions */ |
| 1082 | message ofp_instruction_experimenter { |
| 1083 | uint32 type = 1; /* OFPIT_EXPERIMENTER */ |
| 1084 | uint32 len = 2; /* Length of this struct in bytes */ |
| 1085 | uint32 experimenter = 3; /* Experimenter ID which takes the same form |
| 1086 | as in struct ofp_experimenter_header. */ |
| 1087 | /* Experimenter-defined arbitrary additional data. */ |
| 1088 | }; |
| 1089 | |
| 1090 | /* ## --------------------------- ## */ |
| 1091 | /* ## OpenFlow Flow Modification. ## */ |
| 1092 | /* ## --------------------------- ## */ |
| 1093 | |
| 1094 | enum ofp_flow_mod_command { |
| 1095 | OFPFC_ADD = 0; /* New flow. */ |
| 1096 | OFPFC_MODIFY = 1; /* Modify all matching flows. */ |
| 1097 | OFPFC_MODIFY_STRICT = 2; /* Modify entry strictly matching wildcards and |
| 1098 | priority. */ |
| 1099 | OFPFC_DELETE = 3; /* Delete all matching flows. */ |
| 1100 | OFPFC_DELETE_STRICT = 4; /* Delete entry strictly matching wildcards and |
| 1101 | priority. */ |
| 1102 | }; |
| 1103 | |
| 1104 | /* Value used in "idle_timeout" and "hard_timeout" to indicate that the entry |
| 1105 | * is permanent. */ |
| 1106 | //#define OFP_FLOW_PERMANENT 0 |
| 1107 | |
| 1108 | /* By default, choose a priority in the middle. */ |
| 1109 | //#define OFP_DEFAULT_PRIORITY 0x8000 |
| 1110 | |
| 1111 | enum ofp_flow_mod_flags { |
| 1112 | OFPFF_INVALID = 0; |
| 1113 | OFPFF_SEND_FLOW_REM = 1; /* Send flow removed message when flow |
| 1114 | * expires or is deleted. */ |
| 1115 | OFPFF_CHECK_OVERLAP = 2; /* Check for overlapping entries first. */ |
| 1116 | OFPFF_RESET_COUNTS = 4; /* Reset flow packet and byte counts. */ |
| 1117 | OFPFF_NO_PKT_COUNTS = 8; /* Don't keep track of packet count. */ |
| 1118 | OFPFF_NO_BYT_COUNTS = 16; /* Don't keep track of byte count. */ |
| 1119 | }; |
| 1120 | |
| 1121 | /* Flow setup and teardown (controller -> datapath). */ |
| 1122 | message ofp_flow_mod { |
| 1123 | ofp_header header = 1; |
| 1124 | uint64 cookie = 2; /* Opaque controller-issued identifier. */ |
| 1125 | uint64 cookie_mask = 3; /* Mask used to restrict the cookie bits |
| 1126 | that must match when the command is |
| 1127 | OFPFC_MODIFY* or OFPFC_DELETE*. A value |
| 1128 | of 0 indicates no restriction. */ |
| 1129 | uint32 table_id = 4; /* ID of the table to put the flow in. |
| 1130 | For OFPFC_DELETE_* commands, OFPTT_ALL |
| 1131 | can also be used to delete matching |
| 1132 | flows from all tables. */ |
| 1133 | uint32 command = 5; /* One of OFPFC_*. */ |
| 1134 | uint32 idle_timeout = 6; /* Idle time before discarding (seconds). */ |
| 1135 | uint32 hard_timeout = 7; /* Max time before discarding (seconds). */ |
| 1136 | uint32 priority = 8; /* Priority level of flow entry. */ |
| 1137 | uint32 buffer_id = 9; /* Buffered packet to apply to, or |
| 1138 | OFP_NO_BUFFER. |
| 1139 | Not meaningful for OFPFC_DELETE*. */ |
| 1140 | uint32 out_port = 10; /* For OFPFC_DELETE* commands, require |
| 1141 | matching entries to include this as an |
| 1142 | output port. A value of OFPP_ANY |
| 1143 | indicates no restriction. */ |
| 1144 | uint32 out_group = 11; /* For OFPFC_DELETE* commands, require |
| 1145 | matching entries to include this as an |
| 1146 | output group. A value of OFPG_ANY |
| 1147 | indicates no restriction. */ |
| 1148 | uint32 flags = 12; /* Bitmap of OFPFF_* flags. */ |
| 1149 | ofp_match match = 13; /* Fields to match. Variable size. */ |
| 1150 | /* The variable size and padded match is always followed by instructions. */ |
| 1151 | /*struct ofp_instruction instructions[0];*/ /* Instruction set - 0 or more. |
| 1152 | The length of the instruction |
| 1153 | set is inferred from the |
| 1154 | length field in the header. */ |
| 1155 | }; |
| 1156 | |
| 1157 | /* Group numbering. Groups can use any number up to OFPG_MAX. */ |
| 1158 | enum ofp_group { |
| 1159 | OFPG_INVALID = 0; |
| 1160 | /* Last usable group number. */ |
| 1161 | OFPG_MAX = 0x7fffff00; |
| 1162 | |
| 1163 | /* Fake groups. */ |
| 1164 | OFPG_ALL = 0x7ffffffc; /* Represents all groups for group delete |
| 1165 | commands. */ |
| 1166 | OFPG_ANY = 0x7fffffff; /* Special wildcard: no group specified. */ |
| 1167 | }; |
| 1168 | |
| 1169 | /* Group commands */ |
| 1170 | enum ofp_group_mod_command { |
| 1171 | OFPGC_ADD = 0; /* New group. */ |
| 1172 | OFPGC_MODIFY = 1; /* Modify all matching groups. */ |
| 1173 | OFPGC_DELETE = 2; /* Delete all matching groups. */ |
| 1174 | }; |
| 1175 | |
| 1176 | /* Bucket for use in groups. */ |
| 1177 | message ofp_bucket { |
| 1178 | uint32 len = 1; /* Length of the bucket in bytes, including |
| 1179 | this header and any padding to make it |
| 1180 | 64-bit aligned. */ |
| 1181 | uint32 weight = 2; /* Relative weight of bucket. Only |
| 1182 | defined for select groups. */ |
| 1183 | uint32 watch_port = 3; /* Port whose state affects whether this |
| 1184 | bucket is live. Only required for fast |
| 1185 | failover groups. */ |
| 1186 | uint32 watch_group = 4; /* Group whose state affects whether this |
| 1187 | bucket is live. Only required for fast |
| 1188 | failover groups. */ |
| 1189 | repeated ofp_action_header actions = 5; /* 0 or more actions associated with |
| 1190 | the bucket - The action list length |
| 1191 | is inferred from the length |
| 1192 | of the bucket. */ |
| 1193 | }; |
| 1194 | |
| 1195 | /* Group setup and teardown (controller -> datapath). */ |
| 1196 | message ofp_group_mod { |
| 1197 | ofp_header header = 1; |
| 1198 | uint32 command = 2; /* One of OFPGC_*. */ |
| 1199 | uint32 type = 3; /* One of OFPGT_*. */ |
| 1200 | uint32 group_id = 4; /* Group identifier. */ |
| 1201 | repeated ofp_bucket buckets = 5; /* The length of the bucket array is inferred |
| 1202 | from the length field in the header. */ |
| 1203 | }; |
| 1204 | |
| 1205 | /* Group types. Values in the range [128; 255] are reserved for experimental |
| 1206 | * use. */ |
| 1207 | enum ofp_group_type { |
| 1208 | OFPGT_ALL = 0; /* All (multicast/broadcast) group. */ |
| 1209 | OFPGT_SELECT = 1; /* Select group. */ |
| 1210 | OFPGT_INDIRECT = 2; /* Indirect group. */ |
| 1211 | OFPGT_FF = 3; /* Fast failover group. */ |
| 1212 | }; |
| 1213 | |
| 1214 | /* Special buffer-id to indicate 'no buffer' */ |
| 1215 | //#define OFP_NO_BUFFER 0xffffffff |
| 1216 | |
| 1217 | /* Send packet (controller -> datapath). */ |
| 1218 | message ofp_packet_out { |
| 1219 | ofp_header header = 1; |
| 1220 | uint32 buffer_id = 2; /* ID assigned by datapath (OFP_NO_BUFFER |
| 1221 | if none). */ |
| 1222 | uint32 in_port = 3; /* Packet's input port or OFPP_CONTROLLER. */ |
| 1223 | uint32 actions_len = 4; /* Size of action array in bytes. */ |
| 1224 | repeated ofp_action_header actions = 5; /* Action list - 0 or more. */ |
| 1225 | /* The variable size action list is optionally followed by packet data. |
| 1226 | * This data is only present and meaningful if buffer_id == -1. |
| 1227 | * uint32 data[0]; Packet data. The length is inferred |
| 1228 | from the length field in the header. */ |
| 1229 | }; |
| 1230 | |
| 1231 | /* Why is this packet being sent to the controller? */ |
| 1232 | enum ofp_packet_in_reason { |
| 1233 | OFPR_NO_MATCH = 0; /* No matching flow (table-miss flow entry). */ |
| 1234 | OFPR_ACTION = 1; /* Action explicitly output to controller. */ |
| 1235 | OFPR_INVALID_TTL = 2; /* Packet has invalid TTL */ |
| 1236 | }; |
| 1237 | |
| 1238 | /* Packet received on port (datapath -> controller). */ |
| 1239 | message ofp_packet_in { |
| 1240 | ofp_header header = 1; |
| 1241 | uint32 buffer_id = 2; /* ID assigned by datapath. */ |
| 1242 | uint32 total_len = 3; /* Full length of frame. */ |
| 1243 | uint32 reason = 4; /* Reason packet is being sent (one of OFPR_*) */ |
| 1244 | uint32 table_id = 5; /* ID of the table that was looked up */ |
| 1245 | uint64 cookie = 6; /* Cookie of the flow entry that was looked up. */ |
| 1246 | ofp_match match = 7;/* Packet metadata. Variable size. */ |
| 1247 | /* The variable size and padded match is always followed by: |
| 1248 | * - Exactly 2 all-zero padding bytes, then |
| 1249 | * - An Ethernet frame whose length is inferred from header.length. |
| 1250 | * The padding bytes preceding the Ethernet frame ensure that the IP |
| 1251 | * header (if any) following the Ethernet header is 32-bit aligned. |
| 1252 | */ |
| 1253 | //uint32 pad[2]; /* Align to 64 bit + 16 bit */ |
| 1254 | //uint32 data[0]; /* Ethernet frame */ |
| 1255 | }; |
| 1256 | |
| 1257 | /* Why was this flow removed? */ |
| 1258 | enum ofp_flow_removed_reason { |
| 1259 | OFPRR_IDLE_TIMEOUT = 0; /* Flow idle time exceeded idle_timeout. */ |
| 1260 | OFPRR_HARD_TIMEOUT = 1; /* Time exceeded hard_timeout. */ |
| 1261 | OFPRR_DELETE = 2; /* Evicted by a DELETE flow mod. */ |
| 1262 | OFPRR_GROUP_DELETE = 3; /* Group was removed. */ |
| 1263 | OFPRR_METER_DELETE = 4; /* Meter was removed */ |
| 1264 | }; |
| 1265 | |
| 1266 | /* Flow removed (datapath -> controller). */ |
| 1267 | message ofp_flow_removed { |
| 1268 | ofp_header header = 1; |
| 1269 | uint64 cookie = 2; /* Opaque controller-issued identifier. */ |
| 1270 | |
| 1271 | uint32 priority = 3; /* Priority level of flow entry. */ |
| 1272 | uint32 reason = 4; /* One of OFPRR_*. */ |
| 1273 | uint32 table_id = 5; /* ID of the table */ |
| 1274 | |
| 1275 | uint32 duration_sec = 6; /* Time flow was alive in seconds. */ |
| 1276 | uint32 duration_nsec = 7; /* Time flow was alive in nanoseconds beyond |
| 1277 | duration_sec. */ |
| 1278 | uint32 idle_timeout = 8; /* Idle timeout from original flow mod. */ |
| 1279 | uint32 hard_timeout = 9; /* Hard timeout from original flow mod. */ |
| 1280 | uint64 packet_count = 10; |
| 1281 | uint64 byte_count = 11; |
| 1282 | ofp_match match = 12; /* Description of fields. Variable size. */ |
| 1283 | }; |
| 1284 | |
| 1285 | /* Meter numbering. Flow meters can use any number up to OFPM_MAX. */ |
| 1286 | enum ofp_meter { |
| 1287 | OFPM_ZERO = 0; |
| 1288 | /* Last usable meter. */ |
| 1289 | OFPM_MAX = 0x7fff0000; |
| 1290 | |
| 1291 | /* Virtual meters. */ |
| 1292 | OFPM_SLOWPATH = 0x7ffffffd; /* Meter for slow datapath. */ |
| 1293 | OFPM_CONTROLLER = 0x7ffffffe; /* Meter for controller connection. */ |
| 1294 | OFPM_ALL = 0x7fffffff; /* Represents all meters for stat requests |
| 1295 | commands. */ |
| 1296 | }; |
| 1297 | |
| 1298 | /* Meter band types */ |
| 1299 | enum ofp_meter_band_type { |
| 1300 | OFPMBT_INVALID = 0; |
| 1301 | OFPMBT_DROP = 1; /* Drop packet. */ |
| 1302 | OFPMBT_DSCP_REMARK = 2; /* Remark DSCP in the IP header. */ |
| 1303 | OFPMBT_EXPERIMENTER = 0xFFFF; /* Experimenter meter band. */ |
| 1304 | }; |
| 1305 | |
| 1306 | /* Common header for all meter bands */ |
| 1307 | message ofp_meter_band_header { |
| 1308 | uint32 type = 1; /* One of OFPMBT_*. */ |
| 1309 | uint32 len = 2; /* Length in bytes of this band. */ |
| 1310 | uint32 rate = 3; /* Rate for this band. */ |
| 1311 | uint32 burst_size = 4;/* Size of bursts. */ |
| 1312 | }; |
| 1313 | |
| 1314 | /* OFPMBT_DROP band - drop packets */ |
| 1315 | message ofp_meter_band_drop { |
| 1316 | uint32 type = 1; /* OFPMBT_DROP. */ |
| 1317 | uint32 len = 2; /* Length in bytes of this band. */ |
| 1318 | uint32 rate = 3; /* Rate for dropping packets. */ |
| 1319 | uint32 burst_size = 4;/* Size of bursts. */ |
| 1320 | }; |
| 1321 | |
| 1322 | /* OFPMBT_DSCP_REMARK band - Remark DSCP in the IP header */ |
| 1323 | message ofp_meter_band_dscp_remark { |
| 1324 | uint32 type = 1; /* OFPMBT_DSCP_REMARK. */ |
| 1325 | uint32 len = 2; /* Length in bytes of this band. */ |
| 1326 | uint32 rate = 3; /* Rate for remarking packets. */ |
| 1327 | uint32 burst_size = 4;/* Size of bursts. */ |
| 1328 | uint32 prec_level = 5;/* Number of drop precedence level to add. */ |
| 1329 | }; |
| 1330 | |
| 1331 | /* OFPMBT_EXPERIMENTER band - Experimenter type. |
| 1332 | * The rest of the band is experimenter-defined. */ |
| 1333 | message ofp_meter_band_experimenter { |
| 1334 | uint32 type = 1; /* One of OFPMBT_*. */ |
| 1335 | uint32 len = 2; /* Length in bytes of this band. */ |
| 1336 | uint32 rate = 3; /* Rate for this band. */ |
| 1337 | uint32 burst_size = 4; /* Size of bursts. */ |
| 1338 | uint32 experimenter = 5;/* Experimenter ID which takes the same |
| 1339 | form as in struct |
| 1340 | ofp_experimenter_header. */ |
| 1341 | }; |
| 1342 | |
| 1343 | /* Meter commands */ |
| 1344 | enum ofp_meter_mod_command { |
| 1345 | OFPMC_ADD = 0; /* New meter. */ |
| 1346 | OFPMC_MODIFY = 1; /* Modify specified meter. */ |
| 1347 | OFPMC_DELETE = 2; /* Delete specified meter. */ |
| 1348 | }; |
| 1349 | |
| 1350 | /* Meter configuration flags */ |
| 1351 | enum ofp_meter_flags { |
| 1352 | OFPMF_INVALID = 0; |
| 1353 | OFPMF_KBPS = 1; /* Rate value in kb/s (kilo-bit per second). */ |
| 1354 | OFPMF_PKTPS = 2; /* Rate value in packet/sec. */ |
| 1355 | OFPMF_BURST = 4; /* Do burst size. */ |
| 1356 | OFPMF_STATS = 8; /* Collect statistics. */ |
| 1357 | }; |
| 1358 | |
| 1359 | /* Meter configuration. OFPT_METER_MOD. */ |
| 1360 | message ofp_meter_mod { |
| 1361 | ofp_header header = 1; |
| 1362 | uint32 command = 2; /* One of OFPMC_*. */ |
| 1363 | uint32 flags = 3; /* Bitmap of OFPMF_* flags. */ |
| 1364 | uint32 meter_id = 4; /* Meter instance. */ |
| 1365 | repeated ofp_meter_band_header bands = 5; /* The band list length is |
| 1366 | inferred from the length field |
| 1367 | in the header. */ |
| 1368 | }; |
| 1369 | |
| 1370 | /* Values for 'type' in ofp_error_message. These values are immutable: they |
| 1371 | * will not change in future versions of the protocol (although new values may |
| 1372 | * be added). */ |
| 1373 | enum ofp_error_type { |
| 1374 | OFPET_HELLO_FAILED = 0; /* Hello protocol failed. */ |
| 1375 | OFPET_BAD_REQUEST = 1; /* Request was not understood. */ |
| 1376 | OFPET_BAD_ACTION = 2; /* Error in action description. */ |
| 1377 | OFPET_BAD_INSTRUCTION = 3; /* Error in instruction list. */ |
| 1378 | OFPET_BAD_MATCH = 4; /* Error in match. */ |
| 1379 | OFPET_FLOW_MOD_FAILED = 5; /* Problem modifying flow entry. */ |
| 1380 | OFPET_GROUP_MOD_FAILED = 6; /* Problem modifying group entry. */ |
| 1381 | OFPET_PORT_MOD_FAILED = 7; /* Port mod request failed. */ |
| 1382 | OFPET_TABLE_MOD_FAILED = 8; /* Table mod request failed. */ |
| 1383 | OFPET_QUEUE_OP_FAILED = 9; /* Queue operation failed. */ |
| 1384 | OFPET_SWITCH_CONFIG_FAILED = 10; /* Switch config request failed. */ |
| 1385 | OFPET_ROLE_REQUEST_FAILED = 11; /* Controller Role request failed. */ |
| 1386 | OFPET_METER_MOD_FAILED = 12; /* Error in meter. */ |
| 1387 | OFPET_TABLE_FEATURES_FAILED = 13; /* Setting table features failed. */ |
| 1388 | OFPET_EXPERIMENTER = 0xffff; /* Experimenter error messages. */ |
| 1389 | }; |
| 1390 | |
| 1391 | /* ofp_error_msg 'code' values for OFPET_HELLO_FAILED. 'data' contains an |
| 1392 | * ASCII text string that may give failure details. */ |
| 1393 | enum ofp_hello_failed_code { |
| 1394 | OFPHFC_INCOMPATIBLE = 0; /* No compatible version. */ |
| 1395 | OFPHFC_EPERM = 1; /* Permissions error. */ |
| 1396 | }; |
| 1397 | |
| 1398 | /* ofp_error_msg 'code' values for OFPET_BAD_REQUEST. 'data' contains at least |
| 1399 | * the first 64 bytes of the failed request. */ |
| 1400 | enum ofp_bad_request_code { |
| 1401 | OFPBRC_BAD_VERSION = 0; /* ofp_header.version not supported. */ |
| 1402 | OFPBRC_BAD_TYPE = 1; /* ofp_header.type not supported. */ |
| 1403 | OFPBRC_BAD_MULTIPART = 2; /* ofp_multipart_request.type not supported. */ |
| 1404 | OFPBRC_BAD_EXPERIMENTER = 3; /* Experimenter id not supported |
| 1405 | * (in ofp_experimenter_header or |
| 1406 | * ofp_multipart_request or |
| 1407 | * ofp_multipart_reply). */ |
| 1408 | OFPBRC_BAD_EXP_TYPE = 4; /* Experimenter type not supported. */ |
| 1409 | OFPBRC_EPERM = 5; /* Permissions error. */ |
| 1410 | OFPBRC_BAD_LEN = 6; /* Wrong request length for type. */ |
| 1411 | OFPBRC_BUFFER_EMPTY = 7; /* Specified buffer has already been used. */ |
| 1412 | OFPBRC_BUFFER_UNKNOWN = 8; /* Specified buffer does not exist. */ |
| 1413 | OFPBRC_BAD_TABLE_ID = 9; /* Specified table-id invalid or does not |
| 1414 | * exist. */ |
| 1415 | OFPBRC_IS_SLAVE = 10; /* Denied because controller is slave. */ |
| 1416 | OFPBRC_BAD_PORT = 11; /* Invalid port. */ |
| 1417 | OFPBRC_BAD_PACKET = 12; /* Invalid packet in packet-out. */ |
| 1418 | OFPBRC_MULTIPART_BUFFER_OVERFLOW = 13; /* ofp_multipart_request |
| 1419 | overflowed the assigned buffer. */ |
| 1420 | }; |
| 1421 | |
| 1422 | /* ofp_error_msg 'code' values for OFPET_BAD_ACTION. 'data' contains at least |
| 1423 | * the first 64 bytes of the failed request. */ |
| 1424 | enum ofp_bad_action_code { |
| 1425 | OFPBAC_BAD_TYPE = 0; /* Unknown or unsupported action type. */ |
| 1426 | OFPBAC_BAD_LEN = 1; /* Length problem in actions. */ |
| 1427 | OFPBAC_BAD_EXPERIMENTER = 2; /* Unknown experimenter id specified. */ |
| 1428 | OFPBAC_BAD_EXP_TYPE = 3; /* Unknown action for experimenter id. */ |
| 1429 | OFPBAC_BAD_OUT_PORT = 4; /* Problem validating output port. */ |
| 1430 | OFPBAC_BAD_ARGUMENT = 5; /* Bad action argument. */ |
| 1431 | OFPBAC_EPERM = 6; /* Permissions error. */ |
| 1432 | OFPBAC_TOO_MANY = 7; /* Can't handle this many actions. */ |
| 1433 | OFPBAC_BAD_QUEUE = 8; /* Problem validating output queue. */ |
| 1434 | OFPBAC_BAD_OUT_GROUP = 9; /* Invalid group id in forward action. */ |
| 1435 | OFPBAC_MATCH_INCONSISTENT = 10; /* Action can't apply for this match, |
| 1436 | or Set-Field missing prerequisite. */ |
| 1437 | OFPBAC_UNSUPPORTED_ORDER = 11; /* Action order is unsupported for the |
| 1438 | action list in an Apply-Actions instruction */ |
| 1439 | OFPBAC_BAD_TAG = 12; /* Actions uses an unsupported |
| 1440 | tag/encap. */ |
| 1441 | OFPBAC_BAD_SET_TYPE = 13; /* Unsupported type in SET_FIELD action. */ |
| 1442 | OFPBAC_BAD_SET_LEN = 14; /* Length problem in SET_FIELD action. */ |
| 1443 | OFPBAC_BAD_SET_ARGUMENT = 15; /* Bad argument in SET_FIELD action. */ |
| 1444 | }; |
| 1445 | |
| 1446 | /* ofp_error_msg 'code' values for OFPET_BAD_INSTRUCTION. 'data' contains at least |
| 1447 | * the first 64 bytes of the failed request. */ |
| 1448 | enum ofp_bad_instruction_code { |
| 1449 | OFPBIC_UNKNOWN_INST = 0; /* Unknown instruction. */ |
| 1450 | OFPBIC_UNSUP_INST = 1; /* Switch or table does not support the |
| 1451 | instruction. */ |
| 1452 | OFPBIC_BAD_TABLE_ID = 2; /* Invalid Table-ID specified. */ |
| 1453 | OFPBIC_UNSUP_METADATA = 3; /* Metadata value unsupported by datapath. */ |
| 1454 | OFPBIC_UNSUP_METADATA_MASK = 4; /* Metadata mask value unsupported by |
| 1455 | datapath. */ |
| 1456 | OFPBIC_BAD_EXPERIMENTER = 5; /* Unknown experimenter id specified. */ |
| 1457 | OFPBIC_BAD_EXP_TYPE = 6; /* Unknown instruction for experimenter id. */ |
| 1458 | OFPBIC_BAD_LEN = 7; /* Length problem in instructions. */ |
| 1459 | OFPBIC_EPERM = 8; /* Permissions error. */ |
| 1460 | }; |
| 1461 | |
| 1462 | /* ofp_error_msg 'code' values for OFPET_BAD_MATCH. 'data' contains at least |
| 1463 | * the first 64 bytes of the failed request. */ |
| 1464 | enum ofp_bad_match_code { |
| 1465 | OFPBMC_BAD_TYPE = 0; /* Unsupported match type specified by the |
| 1466 | match */ |
| 1467 | OFPBMC_BAD_LEN = 1; /* Length problem in match. */ |
| 1468 | OFPBMC_BAD_TAG = 2; /* Match uses an unsupported tag/encap. */ |
| 1469 | OFPBMC_BAD_DL_ADDR_MASK = 3; /* Unsupported datalink addr mask - switch |
| 1470 | does not support arbitrary datalink |
| 1471 | address mask. */ |
| 1472 | OFPBMC_BAD_NW_ADDR_MASK = 4; /* Unsupported network addr mask - switch |
| 1473 | does not support arbitrary network |
| 1474 | address mask. */ |
| 1475 | OFPBMC_BAD_WILDCARDS = 5; /* Unsupported combination of fields masked |
| 1476 | or omitted in the match. */ |
| 1477 | OFPBMC_BAD_FIELD = 6; /* Unsupported field type in the match. */ |
| 1478 | OFPBMC_BAD_VALUE = 7; /* Unsupported value in a match field. */ |
| 1479 | OFPBMC_BAD_MASK = 8; /* Unsupported mask specified in the match, |
| 1480 | field is not dl-address or nw-address. */ |
| 1481 | OFPBMC_BAD_PREREQ = 9; /* A prerequisite was not met. */ |
| 1482 | OFPBMC_DUP_FIELD = 10; /* A field type was duplicated. */ |
| 1483 | OFPBMC_EPERM = 11; /* Permissions error. */ |
| 1484 | }; |
| 1485 | |
| 1486 | /* ofp_error_msg 'code' values for OFPET_FLOW_MOD_FAILED. 'data' contains |
| 1487 | * at least the first 64 bytes of the failed request. */ |
| 1488 | enum ofp_flow_mod_failed_code { |
| 1489 | OFPFMFC_UNKNOWN = 0; /* Unspecified error. */ |
| 1490 | OFPFMFC_TABLE_FULL = 1; /* Flow not added because table was full. */ |
| 1491 | OFPFMFC_BAD_TABLE_ID = 2; /* Table does not exist */ |
| 1492 | OFPFMFC_OVERLAP = 3; /* Attempted to add overlapping flow with |
| 1493 | CHECK_OVERLAP flag set. */ |
| 1494 | OFPFMFC_EPERM = 4; /* Permissions error. */ |
| 1495 | OFPFMFC_BAD_TIMEOUT = 5; /* Flow not added because of unsupported |
| 1496 | idle/hard timeout. */ |
| 1497 | OFPFMFC_BAD_COMMAND = 6; /* Unsupported or unknown command. */ |
| 1498 | OFPFMFC_BAD_FLAGS = 7; /* Unsupported or unknown flags. */ |
| 1499 | }; |
| 1500 | |
| 1501 | /* ofp_error_msg 'code' values for OFPET_GROUP_MOD_FAILED. 'data' contains |
| 1502 | * at least the first 64 bytes of the failed request. */ |
| 1503 | enum ofp_group_mod_failed_code { |
| 1504 | OFPGMFC_GROUP_EXISTS = 0; /* Group not added because a group ADD |
| 1505 | attempted to replace an |
| 1506 | already-present group. */ |
| 1507 | OFPGMFC_INVALID_GROUP = 1; /* Group not added because Group |
| 1508 | specified is invalid. */ |
| 1509 | OFPGMFC_WEIGHT_UNSUPPORTED = 2; /* Switch does not support unequal load |
| 1510 | sharing with select groups. */ |
| 1511 | OFPGMFC_OUT_OF_GROUPS = 3; /* The group table is full. */ |
| 1512 | OFPGMFC_OUT_OF_BUCKETS = 4; /* The maximum number of action buckets |
| 1513 | for a group has been exceeded. */ |
| 1514 | OFPGMFC_CHAINING_UNSUPPORTED = 5; /* Switch does not support groups that |
| 1515 | forward to groups. */ |
| 1516 | OFPGMFC_WATCH_UNSUPPORTED = 6; /* This group cannot watch the watch_port |
| 1517 | or watch_group specified. */ |
| 1518 | OFPGMFC_LOOP = 7; /* Group entry would cause a loop. */ |
| 1519 | OFPGMFC_UNKNOWN_GROUP = 8; /* Group not modified because a group |
| 1520 | MODIFY attempted to modify a |
| 1521 | non-existent group. */ |
| 1522 | OFPGMFC_CHAINED_GROUP = 9; /* Group not deleted because another |
| 1523 | group is forwarding to it. */ |
| 1524 | OFPGMFC_BAD_TYPE = 10; /* Unsupported or unknown group type. */ |
| 1525 | OFPGMFC_BAD_COMMAND = 11; /* Unsupported or unknown command. */ |
| 1526 | OFPGMFC_BAD_BUCKET = 12; /* Error in bucket. */ |
| 1527 | OFPGMFC_BAD_WATCH = 13; /* Error in watch port/group. */ |
| 1528 | OFPGMFC_EPERM = 14; /* Permissions error. */ |
| 1529 | }; |
| 1530 | |
| 1531 | /* ofp_error_msg 'code' values for OFPET_PORT_MOD_FAILED. 'data' contains |
| 1532 | * at least the first 64 bytes of the failed request. */ |
| 1533 | enum ofp_port_mod_failed_code { |
| 1534 | OFPPMFC_BAD_PORT = 0; /* Specified port number does not exist. */ |
| 1535 | OFPPMFC_BAD_HW_ADDR = 1; /* Specified hardware address does not |
| 1536 | * match the port number. */ |
| 1537 | OFPPMFC_BAD_CONFIG = 2; /* Specified config is invalid. */ |
| 1538 | OFPPMFC_BAD_ADVERTISE = 3; /* Specified advertise is invalid. */ |
| 1539 | OFPPMFC_EPERM = 4; /* Permissions error. */ |
| 1540 | }; |
| 1541 | |
| 1542 | /* ofp_error_msg 'code' values for OFPET_TABLE_MOD_FAILED. 'data' contains |
| 1543 | * at least the first 64 bytes of the failed request. */ |
| 1544 | enum ofp_table_mod_failed_code { |
| 1545 | OFPTMFC_BAD_TABLE = 0; /* Specified table does not exist. */ |
| 1546 | OFPTMFC_BAD_CONFIG = 1; /* Specified config is invalid. */ |
| 1547 | OFPTMFC_EPERM = 2; /* Permissions error. */ |
| 1548 | }; |
| 1549 | |
| 1550 | /* ofp_error msg 'code' values for OFPET_QUEUE_OP_FAILED. 'data' contains |
| 1551 | * at least the first 64 bytes of the failed request */ |
| 1552 | enum ofp_queue_op_failed_code { |
| 1553 | OFPQOFC_BAD_PORT = 0; /* Invalid port (or port does not exist). */ |
| 1554 | OFPQOFC_BAD_QUEUE = 1; /* Queue does not exist. */ |
| 1555 | OFPQOFC_EPERM = 2; /* Permissions error. */ |
| 1556 | }; |
| 1557 | |
| 1558 | /* ofp_error_msg 'code' values for OFPET_SWITCH_CONFIG_FAILED. 'data' contains |
| 1559 | * at least the first 64 bytes of the failed request. */ |
| 1560 | enum ofp_switch_config_failed_code { |
| 1561 | OFPSCFC_BAD_FLAGS = 0; /* Specified flags is invalid. */ |
| 1562 | OFPSCFC_BAD_LEN = 1; /* Specified len is invalid. */ |
| 1563 | OFPSCFC_EPERM = 2; /* Permissions error. */ |
| 1564 | }; |
| 1565 | |
| 1566 | /* ofp_error_msg 'code' values for OFPET_ROLE_REQUEST_FAILED. 'data' contains |
| 1567 | * at least the first 64 bytes of the failed request. */ |
| 1568 | enum ofp_role_request_failed_code { |
| 1569 | OFPRRFC_STALE = 0; /* Stale Message: old generation_id. */ |
| 1570 | OFPRRFC_UNSUP = 1; /* Controller role change unsupported. */ |
| 1571 | OFPRRFC_BAD_ROLE = 2; /* Invalid role. */ |
| 1572 | }; |
| 1573 | |
| 1574 | /* ofp_error_msg 'code' values for OFPET_METER_MOD_FAILED. 'data' contains |
| 1575 | * at least the first 64 bytes of the failed request. */ |
| 1576 | enum ofp_meter_mod_failed_code { |
| 1577 | OFPMMFC_UNKNOWN = 0; /* Unspecified error. */ |
| 1578 | OFPMMFC_METER_EXISTS = 1; /* Meter not added because a Meter ADD |
| 1579 | * attempted to replace an existing Meter. */ |
| 1580 | OFPMMFC_INVALID_METER = 2; /* Meter not added because Meter specified |
| 1581 | * is invalid, |
| 1582 | * or invalid meter in meter action. */ |
| 1583 | OFPMMFC_UNKNOWN_METER = 3; /* Meter not modified because a Meter MODIFY |
| 1584 | * attempted to modify a non-existent Meter, |
| 1585 | * or bad meter in meter action. */ |
| 1586 | OFPMMFC_BAD_COMMAND = 4; /* Unsupported or unknown command. */ |
| 1587 | OFPMMFC_BAD_FLAGS = 5; /* Flag configuration unsupported. */ |
| 1588 | OFPMMFC_BAD_RATE = 6; /* Rate unsupported. */ |
| 1589 | OFPMMFC_BAD_BURST = 7; /* Burst size unsupported. */ |
| 1590 | OFPMMFC_BAD_BAND = 8; /* Band unsupported. */ |
| 1591 | OFPMMFC_BAD_BAND_VALUE = 9; /* Band value unsupported. */ |
| 1592 | OFPMMFC_OUT_OF_METERS = 10; /* No more meters available. */ |
| 1593 | OFPMMFC_OUT_OF_BANDS = 11; /* The maximum number of properties |
| 1594 | * for a meter has been exceeded. */ |
| 1595 | }; |
| 1596 | |
| 1597 | /* ofp_error_msg 'code' values for OFPET_TABLE_FEATURES_FAILED. 'data' contains |
| 1598 | * at least the first 64 bytes of the failed request. */ |
| 1599 | enum ofp_table_features_failed_code { |
| 1600 | OFPTFFC_BAD_TABLE = 0; /* Specified table does not exist. */ |
| 1601 | OFPTFFC_BAD_METADATA = 1; /* Invalid metadata mask. */ |
| 1602 | OFPTFFC_BAD_TYPE = 2; /* Unknown property type. */ |
| 1603 | OFPTFFC_BAD_LEN = 3; /* Length problem in properties. */ |
| 1604 | OFPTFFC_BAD_ARGUMENT = 4; /* Unsupported property value. */ |
| 1605 | OFPTFFC_EPERM = 5; /* Permissions error. */ |
| 1606 | }; |
| 1607 | |
| 1608 | /* OFPT_ERROR: Error message (datapath -> controller). */ |
| 1609 | message ofp_error_msg { |
| 1610 | ofp_header header = 1; |
| 1611 | |
| 1612 | uint32 type = 2; |
| 1613 | uint32 code = 3; |
| 1614 | bytes data = 4; /* Variable-length data. Interpreted based |
| 1615 | on the type and code. No padding. */ |
| 1616 | }; |
| 1617 | |
| 1618 | /* OFPET_EXPERIMENTER: Error message (datapath -> controller). */ |
| 1619 | message ofp_error_experimenter_msg { |
| 1620 | ofp_header header = 1; |
| 1621 | |
| 1622 | uint32 type = 2; /* OFPET_EXPERIMENTER. */ |
| 1623 | uint32 exp_type = 3; /* Experimenter defined. */ |
| 1624 | uint32 experimenter = 4; /* Experimenter ID which takes the same form |
| 1625 | as in struct ofp_experimenter_header. */ |
| 1626 | bytes data = 5; /* Variable-length data. Interpreted based |
| 1627 | on the type and code. No padding. */ |
| 1628 | }; |
| 1629 | |
| 1630 | enum ofp_multipart_type { |
| 1631 | /* Description of this OpenFlow switch. |
| 1632 | * The request body is empty. |
| 1633 | * The reply body is struct ofp_desc. */ |
| 1634 | OFPMP_DESC = 0; |
| 1635 | |
| 1636 | /* Individual flow statistics. |
| 1637 | * The request body is struct ofp_flow_stats_request. |
| 1638 | * The reply body is an array of struct ofp_flow_stats. */ |
| 1639 | OFPMP_FLOW = 1; |
| 1640 | |
| 1641 | /* Aggregate flow statistics. |
| 1642 | * The request body is struct ofp_aggregate_stats_request. |
| 1643 | * The reply body is struct ofp_aggregate_stats_reply. */ |
| 1644 | OFPMP_AGGREGATE = 2; |
| 1645 | |
| 1646 | /* Flow table statistics. |
| 1647 | * The request body is empty. |
| 1648 | * The reply body is an array of struct ofp_table_stats. */ |
| 1649 | OFPMP_TABLE = 3; |
| 1650 | |
| 1651 | /* Port statistics. |
| 1652 | * The request body is struct ofp_port_stats_request. |
| 1653 | * The reply body is an array of struct ofp_port_stats. */ |
| 1654 | OFPMP_PORT_STATS = 4; |
| 1655 | |
| 1656 | /* Queue statistics for a port |
| 1657 | * The request body is struct ofp_queue_stats_request. |
| 1658 | * The reply body is an array of struct ofp_queue_stats */ |
| 1659 | OFPMP_QUEUE = 5; |
| 1660 | |
| 1661 | /* Group counter statistics. |
| 1662 | * The request body is struct ofp_group_stats_request. |
| 1663 | * The reply is an array of struct ofp_group_stats. */ |
| 1664 | OFPMP_GROUP = 6; |
| 1665 | |
| 1666 | /* Group description. |
| 1667 | * The request body is empty. |
| 1668 | * The reply body is an array of struct ofp_group_desc. */ |
| 1669 | OFPMP_GROUP_DESC = 7; |
| 1670 | |
| 1671 | /* Group features. |
| 1672 | * The request body is empty. |
| 1673 | * The reply body is struct ofp_group_features. */ |
| 1674 | OFPMP_GROUP_FEATURES = 8; |
| 1675 | |
| 1676 | /* Meter statistics. |
| 1677 | * The request body is struct ofp_meter_multipart_requests. |
| 1678 | * The reply body is an array of struct ofp_meter_stats. */ |
| 1679 | OFPMP_METER = 9; |
| 1680 | |
| 1681 | /* Meter configuration. |
| 1682 | * The request body is struct ofp_meter_multipart_requests. |
| 1683 | * The reply body is an array of struct ofp_meter_config. */ |
| 1684 | OFPMP_METER_CONFIG = 10; |
| 1685 | |
| 1686 | /* Meter features. |
| 1687 | * The request body is empty. |
| 1688 | * The reply body is struct ofp_meter_features. */ |
| 1689 | OFPMP_METER_FEATURES = 11; |
| 1690 | |
| 1691 | /* Table features. |
| 1692 | * The request body is either empty or contains an array of |
| 1693 | * struct ofp_table_features containing the controller's |
| 1694 | * desired view of the switch. If the switch is unable to |
| 1695 | * set the specified view an error is returned. |
| 1696 | * The reply body is an array of struct ofp_table_features. */ |
| 1697 | OFPMP_TABLE_FEATURES = 12; |
| 1698 | |
| 1699 | /* Port description. |
| 1700 | * The request body is empty. |
| 1701 | * The reply body is an array of struct ofp_port. */ |
| 1702 | OFPMP_PORT_DESC = 13; |
| 1703 | |
| 1704 | /* Experimenter extension. |
| 1705 | * The request and reply bodies begin with |
| 1706 | * struct ofp_experimenter_multipart_header. |
| 1707 | * The request and reply bodies are otherwise experimenter-defined. */ |
| 1708 | OFPMP_EXPERIMENTER = 0xffff; |
| 1709 | }; |
| 1710 | |
| 1711 | /* Backward compatibility with 1.3.1 - avoid breaking the API. */ |
| 1712 | //#define ofp_multipart_types ofp_multipart_type |
| 1713 | |
| 1714 | enum ofp_multipart_request_flags { |
| 1715 | OFPMPF_REQ_INVALID = 0; |
| 1716 | OFPMPF_REQ_MORE = 1; /* More requests to follow. */ |
| 1717 | }; |
| 1718 | |
| 1719 | message ofp_multipart_request { |
| 1720 | ofp_header header = 1; |
| 1721 | uint32 type = 2; /* One of the OFPMP_* constants. */ |
| 1722 | uint32 flags = 3; /* OFPMPF_REQ_* flags. */ |
| 1723 | bytes body = 4; /* Body of the request. 0 or more bytes. */ |
| 1724 | }; |
| 1725 | |
| 1726 | enum ofp_multipart_reply_flags { |
| 1727 | OFPMPF_REPLY_INVALID = 0; |
| 1728 | OFPMPF_REPLY_MORE = 1; /* More replies to follow. */ |
| 1729 | }; |
| 1730 | |
| 1731 | message ofp_multipart_reply { |
| 1732 | ofp_header header = 1; |
| 1733 | uint32 type = 2; /* One of the OFPMP_* constants. */ |
| 1734 | uint32 flags = 3; /* OFPMPF_REPLY_* flags. */ |
| 1735 | bytes body = 4; /* Body of the reply. 0 or more bytes. */ |
| 1736 | }; |
| 1737 | |
| 1738 | //#define DESC_STR_LEN 256 |
| 1739 | //#define SERIAL_NUM_LEN 32 |
| 1740 | /* Body of reply to OFPMP_DESC request. Each entry is a NULL-terminated |
| 1741 | * ASCII string. */ |
| 1742 | message ofp_desc { |
| 1743 | string mfr_desc = 1; /* Manufacturer description. */ |
| 1744 | string hw_desc = 2; /* Hardware description. */ |
| 1745 | string sw_desc = 3; /* Software description. */ |
| 1746 | string serial_num = 4; /* Serial number. */ |
| 1747 | string dp_desc = 5; /* Human readable description of datapath. */ |
| 1748 | }; |
| 1749 | |
| 1750 | /* Body for ofp_multipart_request of type OFPMP_FLOW. */ |
| 1751 | message ofp_flow_stats_request { |
| 1752 | uint32 table_id = 1; /* ID of table to read (from ofp_table_stats), |
| 1753 | OFPTT_ALL for all tables. */ |
| 1754 | uint32 out_port = 2; /* Require matching entries to include this |
| 1755 | as an output port. A value of OFPP_ANY |
| 1756 | indicates no restriction. */ |
| 1757 | uint32 out_group = 3; /* Require matching entries to include this |
| 1758 | as an output group. A value of OFPG_ANY |
| 1759 | indicates no restriction. */ |
| 1760 | uint64 cookie = 4; /* Require matching entries to contain this |
| 1761 | cookie value */ |
| 1762 | uint64 cookie_mask = 5; /* Mask used to restrict the cookie bits that |
| 1763 | must match. A value of 0 indicates |
| 1764 | no restriction. */ |
| 1765 | ofp_match match = 6; /* Fields to match. Variable size. */ |
| 1766 | }; |
| 1767 | |
| 1768 | /* Body of reply to OFPMP_FLOW request. */ |
| 1769 | message ofp_flow_stats { |
| 1770 | uint32 length = 1; /* Length of this entry. */ |
| 1771 | uint32 table_id = 2; /* ID of table flow came from. */ |
| 1772 | uint32 duration_sec = 3; /* Time flow has been alive in seconds. */ |
| 1773 | uint32 duration_nsec = 4; /* Time flow has been alive in nanoseconds beyond |
| 1774 | duration_sec. */ |
| 1775 | uint32 priority = 5; /* Priority of the entry. */ |
| 1776 | uint32 idle_timeout = 6; /* Number of seconds idle before expiration. */ |
| 1777 | uint32 hard_timeout = 7; /* Number of seconds before expiration. */ |
| 1778 | uint32 flags = 8; /* Bitmap of OFPFF_* flags. */ |
| 1779 | uint64 cookie = 9; /* Opaque controller-issued identifier. */ |
| 1780 | uint64 packet_count = 10; /* Number of packets in flow. */ |
| 1781 | uint64 byte_count = 11; /* Number of bytes in flow. */ |
| 1782 | ofp_match match = 12; /* Description of fields. Variable size. */ |
| 1783 | /* The variable size and padded match is always followed by instructions. */ |
| 1784 | //struct ofp_instruction instructions[0]; /* Instruction set - 0 or more. */ |
| 1785 | }; |
| 1786 | |
| 1787 | /* Body for ofp_multipart_request of type OFPMP_AGGREGATE. */ |
| 1788 | message ofp_aggregate_stats_request { |
| 1789 | uint32 table_id = 1; /* ID of table to read (from ofp_table_stats) |
| 1790 | OFPTT_ALL for all tables. */ |
| 1791 | uint32 out_port = 2; /* Require matching entries to include this |
| 1792 | as an output port. A value of OFPP_ANY |
| 1793 | indicates no restriction. */ |
| 1794 | uint32 out_group = 3; /* Require matching entries to include this |
| 1795 | as an output group. A value of OFPG_ANY |
| 1796 | indicates no restriction. */ |
| 1797 | uint64 cookie = 4; /* Require matching entries to contain this |
| 1798 | cookie value */ |
| 1799 | uint64 cookie_mask = 5; /* Mask used to restrict the cookie bits that |
| 1800 | must match. A value of 0 indicates |
| 1801 | no restriction. */ |
| 1802 | ofp_match match = 6; /* Fields to match. Variable size. */ |
| 1803 | }; |
| 1804 | |
| 1805 | /* Body of reply to OFPMP_AGGREGATE request. */ |
| 1806 | message ofp_aggregate_stats_reply { |
| 1807 | uint64 packet_count = 1; /* Number of packets in flows. */ |
| 1808 | uint64 byte_count = 2; /* Number of bytes in flows. */ |
| 1809 | uint32 flow_count = 3; /* Number of flows. */ |
| 1810 | }; |
| 1811 | |
| 1812 | /* Table Feature property types. |
| 1813 | * Low order bit cleared indicates a property for a regular Flow Entry. |
| 1814 | * Low order bit set indicates a property for the Table-Miss Flow Entry. |
| 1815 | */ |
| 1816 | enum ofp_table_feature_prop_type { |
| 1817 | OFPTFPT_INSTRUCTIONS = 0; /* Instructions property. */ |
| 1818 | OFPTFPT_INSTRUCTIONS_MISS = 1; /* Instructions for table-miss. */ |
| 1819 | OFPTFPT_NEXT_TABLES = 2; /* Next Table property. */ |
| 1820 | OFPTFPT_NEXT_TABLES_MISS = 3; /* Next Table for table-miss. */ |
| 1821 | OFPTFPT_WRITE_ACTIONS = 4; /* Write Actions property. */ |
| 1822 | OFPTFPT_WRITE_ACTIONS_MISS = 5; /* Write Actions for table-miss. */ |
| 1823 | OFPTFPT_APPLY_ACTIONS = 6; /* Apply Actions property. */ |
| 1824 | OFPTFPT_APPLY_ACTIONS_MISS = 7; /* Apply Actions for table-miss. */ |
| 1825 | OFPTFPT_MATCH = 8; /* Match property. */ |
| 1826 | OFPTFPT_WILDCARDS = 10; /* Wildcards property. */ |
| 1827 | OFPTFPT_WRITE_SETFIELD = 12; /* Write Set-Field property. */ |
| 1828 | OFPTFPT_WRITE_SETFIELD_MISS = 13; /* Write Set-Field for table-miss. */ |
| 1829 | OFPTFPT_APPLY_SETFIELD = 14; /* Apply Set-Field property. */ |
| 1830 | OFPTFPT_APPLY_SETFIELD_MISS = 15; /* Apply Set-Field for table-miss. */ |
| 1831 | OFPTFPT_EXPERIMENTER = 0xFFFE; /* Experimenter property. */ |
| 1832 | OFPTFPT_EXPERIMENTER_MISS = 0xFFFF; /* Experimenter for table-miss. */ |
| 1833 | }; |
| 1834 | |
| 1835 | /* Common header for all Table Feature Properties */ |
| 1836 | message ofp_table_feature_prop_header { |
| 1837 | uint32 type = 1; /* One of OFPTFPT_*. */ |
| 1838 | uint32 length = 2; /* Length in bytes of this property. */ |
| 1839 | }; |
| 1840 | |
| 1841 | /* Instructions property */ |
| 1842 | message ofp_table_feature_prop_instructions { |
| 1843 | uint32 type = 1; /* One of OFPTFPT_INSTRUCTIONS, |
| 1844 | OFPTFPT_INSTRUCTIONS_MISS. */ |
| 1845 | uint32 length = 2; /* Length in bytes of this property. */ |
| 1846 | /* Followed by: |
| 1847 | * - Exactly (length - 4) bytes containing the instruction ids, then |
| 1848 | * - Exactly (length + 7)/8*8 - (length) (between 0 and 7) |
| 1849 | * bytes of all-zero bytes */ |
| 1850 | repeated ofp_instruction instruction_ids = 3; /* List of instructions */ |
| 1851 | }; |
| 1852 | |
| 1853 | /* Next Tables property */ |
| 1854 | message ofp_table_feature_prop_next_tables { |
| 1855 | uint32 type = 1; /* One of OFPTFPT_NEXT_TABLES, |
| 1856 | OFPTFPT_NEXT_TABLES_MISS. */ |
| 1857 | uint32 length = 2; /* Length in bytes of this property. */ |
| 1858 | /* Followed by: |
| 1859 | * - Exactly (length - 4) bytes containing the table_ids, then |
| 1860 | * - Exactly (length + 7)/8*8 - (length) (between 0 and 7) |
| 1861 | * bytes of all-zero bytes */ |
| 1862 | repeated uint32 next_table_ids = 3; /* List of table ids. */ |
| 1863 | }; |
| 1864 | |
| 1865 | /* Actions property */ |
| 1866 | message ofp_table_feature_prop_actions { |
| 1867 | uint32 type = 1; /* One of OFPTFPT_WRITE_ACTIONS, |
| 1868 | OFPTFPT_WRITE_ACTIONS_MISS, |
| 1869 | OFPTFPT_APPLY_ACTIONS, |
| 1870 | OFPTFPT_APPLY_ACTIONS_MISS. */ |
| 1871 | uint32 length = 2; /* Length in bytes of this property. */ |
| 1872 | /* Followed by: |
| 1873 | * - Exactly (length - 4) bytes containing the action_ids, then |
| 1874 | * - Exactly (length + 7)/8*8 - (length) (between 0 and 7) |
| 1875 | * bytes of all-zero bytes */ |
| 1876 | repeated ofp_action_header action_ids = 3; /* List of actions */ |
| 1877 | }; |
| 1878 | |
| 1879 | /* Match, Wildcard or Set-Field property */ |
| 1880 | message ofp_table_feature_prop_oxm { |
| 1881 | uint32 type = 1; /* One of OFPTFPT_MATCH, |
| 1882 | OFPTFPT_WILDCARDS, |
| 1883 | OFPTFPT_WRITE_SETFIELD, |
| 1884 | OFPTFPT_WRITE_SETFIELD_MISS, |
| 1885 | OFPTFPT_APPLY_SETFIELD, |
| 1886 | OFPTFPT_APPLY_SETFIELD_MISS. */ |
| 1887 | uint32 length = 2; /* Length in bytes of this property. */ |
| 1888 | /* Followed by: |
| 1889 | * - Exactly (length - 4) bytes containing the oxm_ids, then |
| 1890 | * - Exactly (length + 7)/8*8 - (length) (between 0 and 7) |
| 1891 | * bytes of all-zero bytes */ |
| 1892 | repeated uint32 oxm_ids = 3; /* Array of OXM headers */ |
| 1893 | }; |
| 1894 | |
| 1895 | /* Experimenter table feature property */ |
| 1896 | message ofp_table_feature_prop_experimenter { |
| 1897 | uint32 type = 1; /* One of OFPTFPT_EXPERIMENTER, |
| 1898 | OFPTFPT_EXPERIMENTER_MISS. */ |
| 1899 | uint32 length = 2; /* Length in bytes of this property. */ |
| 1900 | uint32 experimenter = 3; /* Experimenter ID which takes the same |
| 1901 | form as in struct |
| 1902 | ofp_experimenter_header. */ |
| 1903 | uint32 exp_type = 4; /* Experimenter defined. */ |
| 1904 | /* Followed by: |
| 1905 | * - Exactly (length - 12) bytes containing the experimenter data, then |
| 1906 | * - Exactly (length + 7)/8*8 - (length) (between 0 and 7) |
| 1907 | * bytes of all-zero bytes */ |
| 1908 | repeated uint32 experimenter_data = 5; |
| 1909 | }; |
| 1910 | |
| 1911 | /* Body for ofp_multipart_request of type OFPMP_TABLE_FEATURES./ |
| 1912 | * Body of reply to OFPMP_TABLE_FEATURES request. */ |
| 1913 | message ofp_table_features { |
| 1914 | uint32 length = 1; /* Length is padded to 64 bits. */ |
| 1915 | uint32 table_id = 2; /* Identifier of table. Lower numbered tables |
| 1916 | are consulted first. */ |
| 1917 | string name = 3; |
| 1918 | uint64 metadata_match = 4;/* Bits of metadata table can match. */ |
| 1919 | uint64 metadata_write = 5;/* Bits of metadata table can write. */ |
| 1920 | uint32 config = 6; /* Bitmap of OFPTC_* values */ |
| 1921 | uint32 max_entries = 7; /* Max number of entries supported. */ |
| 1922 | |
| 1923 | /* Table Feature Property list */ |
| 1924 | repeated ofp_table_feature_prop_header properties = 8; /* List of properties */ |
| 1925 | }; |
| 1926 | |
| 1927 | /* Body of reply to OFPMP_TABLE request. */ |
| 1928 | message ofp_table_stats { |
| 1929 | uint32 table_id = 1; /* Identifier of table. Lower numbered tables |
| 1930 | are consulted first. */ |
| 1931 | uint32 active_count = 2; /* Number of active entries. */ |
| 1932 | uint64 lookup_count = 3; /* Number of packets looked up in table. */ |
| 1933 | uint64 matched_count = 4; /* Number of packets that hit table. */ |
| 1934 | }; |
| 1935 | |
| 1936 | /* Body for ofp_multipart_request of type OFPMP_PORT. */ |
| 1937 | message ofp_port_stats_request { |
| 1938 | uint32 port_no = 1; /* OFPMP_PORT message must request statistics |
| 1939 | * either for a single port (specified in |
| 1940 | * port_no) or for all ports (if port_no == |
| 1941 | * OFPP_ANY). */ |
| 1942 | }; |
| 1943 | |
| 1944 | /* Body of reply to OFPMP_PORT request. If a counter is unsupported, set |
| 1945 | * the field to all ones. */ |
| 1946 | message ofp_port_stats { |
| 1947 | uint32 port_no = 1; |
| 1948 | uint64 rx_packets = 2; /* Number of received packets. */ |
| 1949 | uint64 tx_packets = 3; /* Number of transmitted packets. */ |
| 1950 | uint64 rx_bytes = 4; /* Number of received bytes. */ |
| 1951 | uint64 tx_bytes = 5; /* Number of transmitted bytes. */ |
| 1952 | uint64 rx_dropped = 6; /* Number of packets dropped by RX. */ |
| 1953 | uint64 tx_dropped = 7; /* Number of packets dropped by TX. */ |
| 1954 | uint64 rx_errors = 8; /* Number of receive errors. This is a super-set |
| 1955 | of more specific receive errors and should be |
| 1956 | greater than or equal to the sum of all |
| 1957 | rx_*_err values. */ |
| 1958 | uint64 tx_errors = 9; /* Number of transmit errors. This is a super-set |
| 1959 | of more specific transmit errors and should be |
| 1960 | greater than or equal to the sum of all |
| 1961 | tx_*_err values (none currently defined.) */ |
| 1962 | uint64 rx_frame_err = 10; /* Number of frame alignment errors. */ |
| 1963 | uint64 rx_over_err = 11; /* Number of packets with RX overrun. */ |
| 1964 | uint64 rx_crc_err = 12; /* Number of CRC errors. */ |
| 1965 | uint64 collisions = 13; /* Number of collisions. */ |
| 1966 | uint32 duration_sec = 14; /* Time port has been alive in seconds. */ |
| 1967 | uint32 duration_nsec = 15; /* Time port has been alive in nanoseconds beyond |
| 1968 | duration_sec. */ |
| 1969 | }; |
| 1970 | |
| 1971 | /* Body of OFPMP_GROUP request. */ |
| 1972 | message ofp_group_stats_request { |
| 1973 | uint32 group_id = 1; /* All groups if OFPG_ALL. */ |
| 1974 | }; |
| 1975 | |
| 1976 | /* Used in group stats replies. */ |
| 1977 | message ofp_bucket_counter { |
| 1978 | uint64 packet_count = 1; /* Number of packets processed by bucket. */ |
| 1979 | uint64 byte_count = 2; /* Number of bytes processed by bucket. */ |
| 1980 | }; |
| 1981 | |
| 1982 | /* Body of reply to OFPMP_GROUP request. */ |
| 1983 | message ofp_group_stats { |
| 1984 | uint32 length = 1; /* Length of this entry. */ |
| 1985 | uint32 group_id = 2; /* Group identifier. */ |
| 1986 | uint32 ref_count = 3; /* Number of flows or groups that directly forward |
| 1987 | to this group. */ |
| 1988 | uint64 packet_count = 4; /* Number of packets processed by group. */ |
| 1989 | uint64 byte_count = 5; /* Number of bytes processed by group. */ |
| 1990 | uint32 duration_sec = 6; /* Time group has been alive in seconds. */ |
| 1991 | uint32 duration_nsec = 7; /* Time group has been alive in nanoseconds beyond |
| 1992 | duration_sec. */ |
| 1993 | repeated ofp_bucket_counter bucket_stats = 8; /* One counter set per bucket. */ |
| 1994 | }; |
| 1995 | |
| 1996 | /* Body of reply to OFPMP_GROUP_DESC request. */ |
| 1997 | message ofp_group_desc { |
| 1998 | uint32 length = 1; /* Length of this entry. */ |
| 1999 | uint32 type = 2; /* One of OFPGT_*. */ |
| 2000 | uint32 pad = 3; /* Pad to 64 bits. */ |
| 2001 | uint32 group_id = 4; /* Group identifier. */ |
| 2002 | repeated ofp_bucket buckets = 5; /* List of buckets - 0 or more. */ |
| 2003 | }; |
| 2004 | |
| 2005 | /* Backward compatibility with 1.3.1 - avoid breaking the API. */ |
| 2006 | //#define ofp_group_desc_stats ofp_group_desc |
| 2007 | |
| 2008 | /* Group configuration flags */ |
| 2009 | enum ofp_group_capabilities { |
| 2010 | OFPGFC_INVALID = 0; |
| 2011 | OFPGFC_SELECT_WEIGHT = 1; /* Support weight for select groups */ |
| 2012 | OFPGFC_SELECT_LIVENESS = 2; /* Support liveness for select groups */ |
| 2013 | OFPGFC_CHAINING = 4; /* Support chaining groups */ |
| 2014 | OFPGFC_CHAINING_CHECKS = 8; /* Check chaining for loops and delete */ |
| 2015 | }; |
| 2016 | |
| 2017 | /* Body of reply to OFPMP_GROUP_FEATURES request. Group features. */ |
| 2018 | message ofp_group_features { |
| 2019 | uint32 types = 1; /* Bitmap of (1 << OFPGT_*) values supported. */ |
| 2020 | uint32 capabilities = 2; /* Bitmap of OFPGFC_* capability supported. */ |
| 2021 | repeated uint32 max_groups = 3; /* Maximum number of groups for each type. */ |
| 2022 | repeated uint32 actions = 4; /* Bitmaps of (1 << OFPAT_*) values supported. */ |
| 2023 | }; |
| 2024 | |
| 2025 | /* Body of OFPMP_METER and OFPMP_METER_CONFIG requests. */ |
| 2026 | message ofp_meter_multipart_request { |
| 2027 | uint32 meter_id = 1; /* Meter instance, or OFPM_ALL. */ |
| 2028 | }; |
| 2029 | |
| 2030 | /* Statistics for each meter band */ |
| 2031 | message ofp_meter_band_stats { |
| 2032 | uint64 packet_band_count = 1; /* Number of packets in band. */ |
| 2033 | uint64 byte_band_count = 2; /* Number of bytes in band. */ |
| 2034 | }; |
| 2035 | |
| 2036 | /* Body of reply to OFPMP_METER request. Meter statistics. */ |
| 2037 | message ofp_meter_stats { |
| 2038 | uint32 meter_id = 1; /* Meter instance. */ |
| 2039 | uint32 len = 2; /* Length in bytes of this stats. */ |
| 2040 | uint32 flow_count = 3; /* Number of flows bound to meter. */ |
| 2041 | uint64 packet_in_count = 4; /* Number of packets in input. */ |
| 2042 | uint64 byte_in_count = 5; /* Number of bytes in input. */ |
| 2043 | uint32 duration_sec = 6; /* Time meter has been alive in seconds. */ |
| 2044 | uint32 duration_nsec = 7;/* Time meter has been alive in nanoseconds beyond |
| 2045 | duration_sec. */ |
| 2046 | repeated ofp_meter_band_stats band_stats = 8; /* The band_stats length is |
| 2047 | inferred from the length field. */ |
| 2048 | }; |
| 2049 | |
| 2050 | /* Body of reply to OFPMP_METER_CONFIG request. Meter configuration. */ |
| 2051 | message ofp_meter_config { |
| 2052 | uint32 length = 1; /* Length of this entry. */ |
| 2053 | uint32 flags = 2; /* All OFPMF_* that apply. */ |
| 2054 | uint32 meter_id = 3; /* Meter instance. */ |
| 2055 | repeated ofp_meter_band_header bands = 4; /* The bands length is |
| 2056 | inferred from the length field. */ |
| 2057 | }; |
| 2058 | |
| 2059 | /* Body of reply to OFPMP_METER_FEATURES request. Meter features. */ |
| 2060 | message ofp_meter_features { |
| 2061 | uint32 max_meter = 1; /* Maximum number of meters. */ |
| 2062 | uint32 band_types = 2; /* Bitmaps of (1 << OFPMBT_*) values supported. */ |
| 2063 | uint32 capabilities = 3;/* Bitmaps of "ofp_meter_flags". */ |
| 2064 | uint32 max_bands = 4; /* Maximum bands per meters */ |
| 2065 | uint32 max_color = 5; /* Maximum color value */ |
| 2066 | }; |
| 2067 | |
| 2068 | /* Body for ofp_multipart_request/reply of type OFPMP_EXPERIMENTER. */ |
| 2069 | message ofp_experimenter_multipart_header { |
| 2070 | uint32 experimenter = 1; /* Experimenter ID which takes the same form |
| 2071 | as in struct ofp_experimenter_header. */ |
| 2072 | uint32 exp_type = 2; /* Experimenter defined. */ |
| 2073 | bytes data = 3; /* Experimenter-defined arbitrary additional data. */ |
| 2074 | }; |
| 2075 | |
| 2076 | /* Experimenter extension. */ |
| 2077 | message ofp_experimenter_header { |
| 2078 | ofp_header header = 1; /* Type OFPT_EXPERIMENTER. */ |
| 2079 | uint32 experimenter = 2; /* Experimenter ID: |
| 2080 | * - MSB 0: low-order bytes are IEEE OUI. |
| 2081 | * - MSB != 0: defined by ONF. */ |
| 2082 | uint32 exp_type = 3; /* Experimenter defined. */ |
| 2083 | bytes data = 4; /* Experimenter-defined arbitrary additional data. */ |
| 2084 | }; |
| 2085 | |
| 2086 | /* All ones is used to indicate all queues in a port (for stats retrieval). */ |
| 2087 | //#define OFPQ_ALL 0xffffffff |
| 2088 | |
| 2089 | /* Min rate > 1000 means not configured. */ |
| 2090 | //#define OFPQ_MIN_RATE_UNCFG 0xffff |
| 2091 | |
| 2092 | /* Max rate > 1000 means not configured. */ |
| 2093 | //#define OFPQ_MAX_RATE_UNCFG 0xffff |
| 2094 | |
| 2095 | enum ofp_queue_properties { |
| 2096 | OFPQT_INVALID = 0; |
| 2097 | OFPQT_MIN_RATE = 1; /* Minimum datarate guaranteed. */ |
| 2098 | OFPQT_MAX_RATE = 2; /* Maximum datarate. */ |
| 2099 | OFPQT_EXPERIMENTER = 0xffff; /* Experimenter defined property. */ |
| 2100 | }; |
| 2101 | |
| 2102 | /* Common description for a queue. */ |
| 2103 | message ofp_queue_prop_header { |
| 2104 | uint32 property = 1; /* One of OFPQT_. */ |
| 2105 | uint32 len = 2; /* Length of property, including this header. */ |
| 2106 | }; |
| 2107 | |
| 2108 | /* Min-Rate queue property description. */ |
| 2109 | message ofp_queue_prop_min_rate { |
| 2110 | ofp_queue_prop_header prop_header = 1;/* prop: OFPQT_MIN, len: 16. */ |
| 2111 | uint32 rate = 2; /* In 1/10 of a percent = 0;>1000 -> disabled. */ |
| 2112 | }; |
| 2113 | |
| 2114 | /* Max-Rate queue property description. */ |
| 2115 | message ofp_queue_prop_max_rate { |
| 2116 | ofp_queue_prop_header prop_header = 1;/* prop: OFPQT_MAX, len: 16. */ |
| 2117 | uint32 rate = 2; /* In 1/10 of a percent = 0;>1000 -> disabled. */ |
| 2118 | }; |
| 2119 | |
| 2120 | /* Experimenter queue property description. */ |
| 2121 | message ofp_queue_prop_experimenter { |
| 2122 | ofp_queue_prop_header prop_header = 1;/* prop: OFPQT_EXPERIMENTER, len: 16. */ |
| 2123 | uint32 experimenter = 2; /* Experimenter ID which takes the same |
| 2124 | form as in struct |
| 2125 | ofp_experimenter_header. */ |
| 2126 | bytes data = 3; /* Experimenter defined data. */ |
| 2127 | }; |
| 2128 | |
| 2129 | /* Full description for a queue. */ |
| 2130 | message ofp_packet_queue { |
| 2131 | uint32 queue_id = 1; /* id for the specific queue. */ |
| 2132 | uint32 port = 2; /* Port this queue is attached to. */ |
| 2133 | uint32 len = 3; /* Length in bytes of this queue desc. */ |
| 2134 | repeated ofp_queue_prop_header properties = 4; /* List of properties. */ |
| 2135 | }; |
| 2136 | |
| 2137 | /* Query for port queue configuration. */ |
| 2138 | message ofp_queue_get_config_request { |
| 2139 | ofp_header header = 1; |
| 2140 | uint32 port = 2; /* Port to be queried. Should refer |
| 2141 | to a valid physical port (i.e. <= OFPP_MAX), |
| 2142 | or OFPP_ANY to request all configured |
| 2143 | queues.*/ |
| 2144 | }; |
| 2145 | |
| 2146 | /* Queue configuration for a given port. */ |
| 2147 | message ofp_queue_get_config_reply { |
| 2148 | ofp_header header = 1; |
| 2149 | uint32 port = 2; |
| 2150 | repeated ofp_packet_queue queues = 3; /* List of configured queues. */ |
| 2151 | }; |
| 2152 | |
| 2153 | /* OFPAT_SET_QUEUE action struct: send packets to given queue on port. */ |
| 2154 | message ofp_action_set_queue { |
| 2155 | uint32 type = 1; /* OFPAT_SET_QUEUE. */ |
| 2156 | uint32 len = 2; /* Len is 8. */ |
| 2157 | uint32 queue_id = 3; /* Queue id for the packets. */ |
| 2158 | }; |
| 2159 | |
| 2160 | message ofp_queue_stats_request { |
| 2161 | uint32 port_no = 1; /* All ports if OFPP_ANY. */ |
| 2162 | uint32 queue_id = 2; /* All queues if OFPQ_ALL. */ |
| 2163 | }; |
| 2164 | |
| 2165 | message ofp_queue_stats { |
| 2166 | uint32 port_no = 1; |
| 2167 | uint32 queue_id = 2; /* Queue i.d */ |
| 2168 | uint64 tx_bytes = 3; /* Number of transmitted bytes. */ |
| 2169 | uint64 tx_packets = 4; /* Number of transmitted packets. */ |
| 2170 | uint64 tx_errors = 5; /* Number of packets dropped due to overrun. */ |
| 2171 | uint32 duration_sec = 6; /* Time queue has been alive in seconds. */ |
| 2172 | uint32 duration_nsec = 7; /* Time queue has been alive in nanoseconds beyond |
| 2173 | duration_sec. */ |
| 2174 | }; |
| 2175 | |
| 2176 | /* Configures the "role" of the sending controller. The default role is: |
| 2177 | * |
| 2178 | * - Equal (OFPCR_ROLE_EQUAL), which allows the controller access to all |
| 2179 | * OpenFlow features. All controllers have equal responsibility. |
| 2180 | * |
| 2181 | * The other possible roles are a related pair: |
| 2182 | * |
| 2183 | * - Master (OFPCR_ROLE_MASTER) is equivalent to Equal, except that there |
| 2184 | * may be at most one Master controller at a time: when a controller |
| 2185 | * configures itself as Master, any existing Master is demoted to the |
| 2186 | * Slave role. |
| 2187 | * |
| 2188 | * - Slave (OFPCR_ROLE_SLAVE) allows the controller read-only access to |
| 2189 | * OpenFlow features. In particular attempts to modify the flow table |
| 2190 | * will be rejected with an OFPBRC_EPERM error. |
| 2191 | * |
| 2192 | * Slave controllers do not receive OFPT_PACKET_IN or OFPT_FLOW_REMOVED |
| 2193 | * messages, but they do receive OFPT_PORT_STATUS messages. |
| 2194 | */ |
| 2195 | |
| 2196 | /* Controller roles. */ |
| 2197 | enum ofp_controller_role { |
| 2198 | OFPCR_ROLE_NOCHANGE = 0; /* Don't change current role. */ |
| 2199 | OFPCR_ROLE_EQUAL = 1; /* Default role, full access. */ |
| 2200 | OFPCR_ROLE_MASTER = 2; /* Full access, at most one master. */ |
| 2201 | OFPCR_ROLE_SLAVE = 3; /* Read-only access. */ |
| 2202 | }; |
| 2203 | |
| 2204 | /* Role request and reply message. */ |
| 2205 | message ofp_role_request { |
| 2206 | ofp_header header = 1; /* Type OFPT_ROLE_REQUEST/OFPT_ROLE_REPLY. */ |
| 2207 | uint32 role = 2; /* One of OFPCR_ROLE_*. */ |
| 2208 | uint64 generation_id = 3; /* Master Election Generation Id */ |
| 2209 | }; |
| 2210 | |
| 2211 | /* Asynchronous message configuration. */ |
| 2212 | message ofp_async_config { |
| 2213 | ofp_header header = 1; /* OFPT_GET_ASYNC_REPLY or OFPT_SET_ASYNC. */ |
| 2214 | repeated uint32 packet_in_mask = 2; /* Bitmasks of OFPR_* values. */ |
| 2215 | repeated uint32 port_status_mask = 3; /* Bitmasks of OFPPR_* values. */ |
| 2216 | repeated uint32 flow_removed_mask = 4;/* Bitmasks of OFPRR_* values. */ |
| 2217 | }; |
Zsolt Haraszti | e39523b | 2016-10-16 19:30:34 -0700 | [diff] [blame^] | 2218 | |
| 2219 | /* |
| 2220 | * Service API definitions and additional message types needed for it |
| 2221 | */ |
| 2222 | |
| 2223 | service OpenFlow { |
| 2224 | |
| 2225 | /* |
| 2226 | * Hello message handshake, initiated by the client (controller) |
| 2227 | */ |
| 2228 | rpc GetHello(ofp_hello) |
| 2229 | returns(ofp_hello) { |
| 2230 | // TODO http option |
| 2231 | } |
| 2232 | |
| 2233 | /* |
| 2234 | * Echo request / reply, initiated by the client (controller) |
| 2235 | */ |
| 2236 | rpc EchoRequest(ofp_header) |
| 2237 | returns(ofp_header) { |
| 2238 | // TODO http option |
| 2239 | } |
| 2240 | |
| 2241 | /* |
| 2242 | * Experimental (extension) RPC |
| 2243 | */ |
| 2244 | rpc ExperimenterRequest(ofp_experimenter_header) |
| 2245 | returns(ofp_experimenter_header) { |
| 2246 | // TODO http option |
| 2247 | } |
| 2248 | |
| 2249 | /* |
| 2250 | * Get Switch Features |
| 2251 | */ |
| 2252 | rpc GetSwitchFeatures(ofp_header) returns(ofp_switch_features) { |
| 2253 | // TODO http option |
| 2254 | } |
| 2255 | |
| 2256 | /* |
| 2257 | * Get Switch Config |
| 2258 | */ |
| 2259 | rpc GetSwitchConfig(ofp_header) returns(ofp_switch_config) { |
| 2260 | // TODO http option |
| 2261 | } |
| 2262 | |
| 2263 | /* |
| 2264 | * Set Config |
| 2265 | */ |
| 2266 | rpc SetConfig(ofp_switch_config) returns(ofp_header) { |
| 2267 | // TODO http option |
| 2268 | } |
| 2269 | |
| 2270 | /* |
| 2271 | * Receive Packet-In messages |
| 2272 | */ |
| 2273 | rpc ReceivePacketInMessages(ofp_header) returns(stream ofp_packet_in) { |
| 2274 | // TODO http option |
| 2275 | } |
| 2276 | |
| 2277 | /* |
| 2278 | * Send Packet-Out messages |
| 2279 | */ |
| 2280 | rpc SendPacketOutMessages(ofp_packet_out) returns(ofp_header) { |
| 2281 | // TODO http option |
| 2282 | } |
| 2283 | |
| 2284 | // TODO continue |
| 2285 | |
| 2286 | } |