blob: 1df03bb8411a5a27c03d346c160b381cf2578018 [file] [log] [blame]
Rich Lanea06d0c32013-03-25 08:52:03 -07001// Copyright 2013, Big Switch Networks, Inc.
2//
3// LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
4// the following special exception:
5//
6// LOXI Exception
7//
8// As a special exception to the terms of the EPL, you may distribute libraries
9// generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
10// that copyright and licensing notices generated by LoxiGen are not altered or removed
11// from the LoxiGen Libraries and the notice provided below is (i) included in
12// the LoxiGen Libraries, if distributed in source code form and (ii) included in any
13// documentation for the LoxiGen Libraries, if distributed in binary form.
14//
15// Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
16//
17// You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
18// a copy of the EPL at:
19//
20// http://www.eclipse.org/legal/epl-v10.html
21//
22// Unless required by applicable law or agreed to in writing, software
23// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
24// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
25// EPL for the specific language governing permissions and limitations
26// under the EPL.
Rich Lane5d33a622013-04-08 17:33:11 -070027//
28// Also derived from the OpenFlow header files which have these copyrights:
29// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
30// Copyright (c) 2011, 2012 Open Networking Foundation
Rich Lanea06d0c32013-03-25 08:52:03 -070031
32#version 1
33
Rich Lane5d33a622013-04-08 17:33:11 -070034enum macro_definitions {
35 OFP_MAX_TABLE_NAME_LEN = 32,
36 OFP_MAX_PORT_NAME_LEN = 16,
37
Wilson Ngd72013d2013-09-29 10:21:48 -070038 OFP_TCP_PORT = 6653,
39 OFP_SSL_PORT = 6653,
Rich Lane5d33a622013-04-08 17:33:11 -070040
41 OFP_ETH_ALEN = 6,
42
43 OFP_DEFAULT_MISS_SEND_LEN = 128,
44
45 OFP_VLAN_NONE = 0xffff,
46
47 OFPFW_ICMP_TYPE = 0x40,
48 OFPFW_ICMP_CODE = 0x80,
49
50 OFP_DL_TYPE_ETH2_CUTOFF = 0x600,
51 OFP_DL_TYPE_NOT_ETH_TYPE = 0x5ff,
52
53 OFP_FLOW_PERMANENT = 0,
54
55 OFP_DEFAULT_PRIORITY = 0x8000,
56
57 DESC_STR_LEN = 256,
58 SERIAL_NUM_LEN = 32,
59
60 OFPQ_ALL = 0xffffffff,
61 OFPQ_MIN_RATE_UNCFG = 0xffff,
62};
63
Andreas Wundsam4ee51462013-07-30 11:00:37 -070064enum ofp_type(wire_type=uint8_t) {
Rich Lane5d33a622013-04-08 17:33:11 -070065 OFPT_HELLO = 0,
66 OFPT_ERROR = 1,
67 OFPT_ECHO_REQUEST = 2,
68 OFPT_ECHO_REPLY = 3,
Rob Vaterlausfeee3712013-09-30 11:24:19 -070069 OFPT_EXPERIMENTER = 4,
Rich Lane5d33a622013-04-08 17:33:11 -070070 OFPT_FEATURES_REQUEST = 5,
71 OFPT_FEATURES_REPLY = 6,
72 OFPT_GET_CONFIG_REQUEST = 7,
73 OFPT_GET_CONFIG_REPLY = 8,
74 OFPT_SET_CONFIG = 9,
75 OFPT_PACKET_IN = 10,
76 OFPT_FLOW_REMOVED = 11,
77 OFPT_PORT_STATUS = 12,
78 OFPT_PACKET_OUT = 13,
79 OFPT_FLOW_MOD = 14,
80 OFPT_PORT_MOD = 15,
81 OFPT_STATS_REQUEST = 16,
82 OFPT_STATS_REPLY = 17,
83 OFPT_BARRIER_REQUEST = 18,
84 OFPT_BARRIER_REPLY = 19,
85 OFPT_QUEUE_GET_CONFIG_REQUEST = 20,
86 OFPT_QUEUE_GET_CONFIG_REPLY = 21,
87};
88
Andreas Wundsam4ee51462013-07-30 11:00:37 -070089enum ofp_port_config(wire_type=uint32_t, bitmask=True) {
Rich Lane5d33a622013-04-08 17:33:11 -070090 OFPPC_PORT_DOWN = 0x1,
91 OFPPC_NO_STP = 0x2,
92 OFPPC_NO_RECV = 0x4,
93 OFPPC_NO_RECV_STP = 0x8,
94 OFPPC_NO_FLOOD = 0x10,
95 OFPPC_NO_FWD = 0x20,
96 OFPPC_NO_PACKET_IN = 0x40,
Rob Vaterlaus0a8ec142013-10-10 13:27:14 -070097 OFPPC_BSN_MIRROR_DEST = 0x80000000,
Rich Lane5d33a622013-04-08 17:33:11 -070098};
99
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700100enum ofp_port_state(wire_type=uint32_t, bitmask=True) {
Rich Lane5d33a622013-04-08 17:33:11 -0700101 OFPPS_LINK_DOWN = 1,
Andreas Wundsamc1acfcc2013-09-20 13:10:20 -0700102 OFPPS_STP_LISTEN = 0,
Rich Lane5d33a622013-04-08 17:33:11 -0700103 OFPPS_STP_LEARN = 0x100,
104 OFPPS_STP_FORWARD = 0x200,
105 OFPPS_STP_BLOCK = 0x300,
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700106 OFPPS_STP_MASK(virtual=True) = 0x300,
Rich Lane5d33a622013-04-08 17:33:11 -0700107};
108
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700109// FIXME: these constants are currently 32 bit due to implementation
110// details of loci, which is in violation of the OpenFlow spec.
111// Should recast to 32 bits and fix/glue the c backend
112enum ofp_port(wire_type=uint16_t, complete=False) {
Rich Lane5d33a622013-04-08 17:33:11 -0700113 OFPP_MAX = 0xffffff00,
114 OFPP_IN_PORT = 0xfffffff8,
115 OFPP_TABLE = 0xfffffff9,
116 OFPP_NORMAL = 0xfffffffa,
117 OFPP_FLOOD = 0xfffffffb,
118 OFPP_ALL = 0xfffffffc,
119 OFPP_CONTROLLER = 0xfffffffd,
120 OFPP_LOCAL = 0xfffffffe,
121 OFPP_NONE = 0xffffffff,
122};
123
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700124enum ofp_port_features(wire_type=uint32_t, bitmask=True) {
Rich Lane5d33a622013-04-08 17:33:11 -0700125 OFPPF_10MB_HD = 0x1,
126 OFPPF_10MB_FD = 0x2,
127 OFPPF_100MB_HD = 0x4,
128 OFPPF_100MB_FD = 0x8,
129 OFPPF_1GB_HD = 0x10,
130 OFPPF_1GB_FD = 0x20,
131 OFPPF_10GB_FD = 0x40,
132 OFPPF_COPPER = 0x80,
133 OFPPF_FIBER = 0x100,
134 OFPPF_AUTONEG = 0x200,
135 OFPPF_PAUSE = 0x400,
136 OFPPF_PAUSE_ASYM = 0x800,
137};
138
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700139enum ofp_queue_properties(wire_type=uint32_t) {
Rich Lane5d33a622013-04-08 17:33:11 -0700140 OFPQT_NONE = 0,
141 OFPQT_MIN_RATE = 1,
142};
143
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700144enum ofp_flow_wildcards(wire_type=uint32_t, bitmask=True) {
Rich Lane5d33a622013-04-08 17:33:11 -0700145 OFPFW_IN_PORT = 0x1,
146 OFPFW_DL_VLAN = 0x2,
147 OFPFW_DL_SRC = 0x4,
148 OFPFW_NW_DST_BITS = 0x6,
149 OFPFW_NW_SRC_BITS = 0x6,
150 OFPFW_NW_SRC_SHIFT = 0x8,
151 OFPFW_DL_DST = 0x8,
152 OFPFW_NW_DST_SHIFT = 0xe,
153 OFPFW_DL_TYPE = 0x10,
154 OFPFW_NW_PROTO = 0x20,
155 OFPFW_TP_SRC = 0x40,
156 OFPFW_TP_DST = 0x80,
157 OFPFW_NW_SRC_ALL = 0x2000,
158 OFPFW_NW_SRC_MASK = 0x3f00,
159 OFPFW_NW_DST_ALL = 0x80000,
160 OFPFW_NW_DST_MASK = 0xfc000,
161 OFPFW_DL_VLAN_PCP = 0x100000,
162 OFPFW_NW_TOS = 0x200000,
Andreas Wundsamdfeb5942013-09-19 13:07:49 -0700163 OFPFW_ALL(virtual=True) = 0x3fffff,
Rich Lane5d33a622013-04-08 17:33:11 -0700164};
165
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700166enum ofp_action_type(wire_type=uint16_t) {
Rich Lane5d33a622013-04-08 17:33:11 -0700167 OFPAT_OUTPUT = 0,
168 OFPAT_SET_VLAN_VID = 1,
169 OFPAT_SET_VLAN_PCP = 2,
170 OFPAT_STRIP_VLAN = 3,
171 OFPAT_SET_DL_SRC = 4,
172 OFPAT_SET_DL_DST = 5,
173 OFPAT_SET_NW_SRC = 6,
174 OFPAT_SET_NW_DST = 7,
175 OFPAT_SET_NW_TOS = 8,
176 OFPAT_SET_TP_SRC = 9,
177 OFPAT_SET_TP_DST = 10,
178 OFPAT_ENQUEUE = 11,
Rob Vaterlausb3f49d92013-10-01 17:57:31 -0700179 OFPAT_EXPERIMENTER = 0xffff,
Rich Lane5d33a622013-04-08 17:33:11 -0700180};
181
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700182enum ofp_capabilities(wire_type=uint32_t, bitmask=True) {
Rich Lane5d33a622013-04-08 17:33:11 -0700183 OFPC_FLOW_STATS = 0x1,
184 OFPC_TABLE_STATS = 0x2,
185 OFPC_PORT_STATS = 0x4,
186 OFPC_STP = 0x8,
187 OFPC_RESERVED = 0x10,
188 OFPC_IP_REASM = 0x20,
189 OFPC_QUEUE_STATS = 0x40,
190 OFPC_ARP_MATCH_IP = 0x80,
191};
192
Andreas Wundsam057540b2013-11-19 16:51:36 -0800193enum ofp_config_flags(wire_type=uint16_t, bitmask=True) {
Rich Lane5d33a622013-04-08 17:33:11 -0700194 OFPC_FRAG_NORMAL = 0x0,
195 OFPC_FRAG_DROP = 0x1,
196 OFPC_FRAG_REASM = 0x2,
197 OFPC_FRAG_MASK = 0x3,
198};
199
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700200enum ofp_flow_mod_command(wire_type=uint16_t) {
Rich Lane5d33a622013-04-08 17:33:11 -0700201 OFPFC_ADD = 0,
202 OFPFC_MODIFY = 1,
203 OFPFC_MODIFY_STRICT = 2,
204 OFPFC_DELETE = 3,
205 OFPFC_DELETE_STRICT = 4,
206};
207
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700208enum ofp_flow_mod_flags(wire_type=uint16_t, bitmask=True) {
Rich Lane5d33a622013-04-08 17:33:11 -0700209 OFPFF_SEND_FLOW_REM = 0x1,
210 OFPFF_CHECK_OVERLAP = 0x2,
211 OFPFF_EMERG = 0x4,
212};
213
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700214enum ofp_stats_request_flags(wire_type=uint16_t, bitmask=True) {
215};
216
217
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700218enum ofp_stats_reply_flags(wire_type=uint16_t, bitmask=True) {
Rich Lane5d33a622013-04-08 17:33:11 -0700219 OFPSF_REPLY_MORE = 0x1,
220};
221
Rob Vaterlausfeee3712013-09-30 11:24:19 -0700222enum ofp_stats_type(wire_type=uint16_t) {
Rich Lane5d33a622013-04-08 17:33:11 -0700223 OFPST_DESC = 0,
224 OFPST_FLOW = 1,
225 OFPST_AGGREGATE = 2,
226 OFPST_TABLE = 3,
227 OFPST_PORT = 4,
228 OFPST_QUEUE = 5,
Rob Vaterlausb3f49d92013-10-01 17:57:31 -0700229 OFPST_EXPERIMENTER = 0xffff,
Rich Lane5d33a622013-04-08 17:33:11 -0700230};
231
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700232enum ofp_packet_in_reason(wire_type=uint8_t) {
Rich Lane5d33a622013-04-08 17:33:11 -0700233 OFPR_NO_MATCH = 0,
234 OFPR_ACTION = 1,
235};
236
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700237enum ofp_flow_removed_reason(wire_type=uint8_t) {
Rich Lane5d33a622013-04-08 17:33:11 -0700238 OFPRR_IDLE_TIMEOUT = 0,
239 OFPRR_HARD_TIMEOUT = 1,
240 OFPRR_DELETE = 2,
241};
242
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700243enum ofp_port_reason(wire_type=uint8_t) {
Rich Lane5d33a622013-04-08 17:33:11 -0700244 OFPPR_ADD = 0,
245 OFPPR_DELETE = 1,
246 OFPPR_MODIFY = 2,
247};
248
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700249enum ofp_error_type(wire_type=uint16_t) {
Rich Lane5d33a622013-04-08 17:33:11 -0700250 OFPET_HELLO_FAILED = 0,
251 OFPET_BAD_REQUEST = 1,
252 OFPET_BAD_ACTION = 2,
253 OFPET_FLOW_MOD_FAILED = 3,
254 OFPET_PORT_MOD_FAILED = 4,
255 OFPET_QUEUE_OP_FAILED = 5,
256};
257
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700258enum ofp_hello_failed_code(wire_type=uint16_t) {
Rich Lane5d33a622013-04-08 17:33:11 -0700259 OFPHFC_INCOMPATIBLE = 0,
260 OFPHFC_EPERM = 1,
261};
262
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700263enum ofp_bad_request_code(wire_type=uint16_t) {
Rich Lane5d33a622013-04-08 17:33:11 -0700264 OFPBRC_BAD_VERSION = 0,
265 OFPBRC_BAD_TYPE = 1,
266 OFPBRC_BAD_STAT = 2,
Rob Vaterlausb3f49d92013-10-01 17:57:31 -0700267 OFPBRC_BAD_EXPERIMENTER = 3,
Rich Lane5d33a622013-04-08 17:33:11 -0700268 OFPBRC_BAD_SUBTYPE = 4,
269 OFPBRC_EPERM = 5,
270 OFPBRC_BAD_LEN = 6,
271 OFPBRC_BUFFER_EMPTY = 7,
272 OFPBRC_BUFFER_UNKNOWN = 8,
273};
274
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700275enum ofp_bad_action_code(wire_type=uint16_t) {
Rich Lane5d33a622013-04-08 17:33:11 -0700276 OFPBAC_BAD_TYPE = 0,
277 OFPBAC_BAD_LEN = 1,
Rob Vaterlausb3f49d92013-10-01 17:57:31 -0700278 OFPBAC_BAD_EXPERIMENTER = 2,
279 OFPBAC_BAD_EXPERIMENTER_TYPE = 3,
Rich Lane5d33a622013-04-08 17:33:11 -0700280 OFPBAC_BAD_OUT_PORT = 4,
281 OFPBAC_BAD_ARGUMENT = 5,
282 OFPBAC_EPERM = 6,
283 OFPBAC_TOO_MANY = 7,
284 OFPBAC_BAD_QUEUE = 8,
285};
286
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700287enum ofp_flow_mod_failed_code(wire_type=uint16_t) {
Rich Lane5d33a622013-04-08 17:33:11 -0700288 OFPFMFC_ALL_TABLES_FULL = 0,
289 OFPFMFC_OVERLAP = 1,
290 OFPFMFC_EPERM = 2,
291 OFPFMFC_BAD_EMERG_TIMEOUT = 3,
292 OFPFMFC_BAD_COMMAND = 4,
293 OFPFMFC_UNSUPPORTED = 5,
294};
295
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700296enum ofp_port_mod_failed_code(wire_type=uint16_t) {
Rich Lane5d33a622013-04-08 17:33:11 -0700297 OFPPMFC_BAD_PORT = 0,
298 OFPPMFC_BAD_HW_ADDR = 1,
299};
300
Andreas Wundsam4ee51462013-07-30 11:00:37 -0700301enum ofp_queue_op_failed_code(wire_type=uint16_t) {
Rich Lane5d33a622013-04-08 17:33:11 -0700302 OFPQOFC_BAD_PORT = 0,
303 OFPQOFC_BAD_QUEUE = 1,
304 OFPQOFC_EPERM = 2,
305};
306
Rich Lanee9c37db2013-06-21 18:30:24 -0700307/* XXX rename to of_message */
Rich Lane68ae4d72013-05-09 10:55:19 -0700308struct of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700309 uint8_t version;
Andreas Wundsamc37ba3d2013-08-02 17:51:51 -0700310 uint8_t type == ?;
Rich Lanea06d0c32013-03-25 08:52:03 -0700311 uint16_t length;
312 uint32_t xid;
313};
314
Rich Lanee9c37db2013-06-21 18:30:24 -0700315struct of_hello : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700316 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700317 uint8_t type == 0;
Rich Lanea06d0c32013-03-25 08:52:03 -0700318 uint16_t length;
319 uint32_t xid;
320};
321
Rich Lanee9c37db2013-06-21 18:30:24 -0700322struct of_echo_request : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700323 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700324 uint8_t type == 2;
Rich Lanea06d0c32013-03-25 08:52:03 -0700325 uint16_t length;
326 uint32_t xid;
327 of_octets_t data;
328};
329
Rich Lanee9c37db2013-06-21 18:30:24 -0700330struct of_echo_reply : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700331 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700332 uint8_t type == 3;
Rich Lanea06d0c32013-03-25 08:52:03 -0700333 uint16_t length;
334 uint32_t xid;
335 of_octets_t data;
336};
337
Rich Lanee9c37db2013-06-21 18:30:24 -0700338struct of_experimenter : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700339 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700340 uint8_t type == 4;
Rich Lanea06d0c32013-03-25 08:52:03 -0700341 uint16_t length;
342 uint32_t xid;
Rich Laneb25d07c2013-08-22 17:22:43 -0700343 uint32_t experimenter == ?;
Rich Lanea06d0c32013-03-25 08:52:03 -0700344 uint32_t subtype;
345 of_octets_t data;
346};
347
Rich Lanee9c37db2013-06-21 18:30:24 -0700348struct of_barrier_request : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700349 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700350 uint8_t type == 18;
Rich Lanea06d0c32013-03-25 08:52:03 -0700351 uint16_t length;
352 uint32_t xid;
353};
354
Rich Lanee9c37db2013-06-21 18:30:24 -0700355struct of_barrier_reply : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700356 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700357 uint8_t type == 19;
Rich Lanea06d0c32013-03-25 08:52:03 -0700358 uint16_t length;
359 uint32_t xid;
360};
361
Rich Lanee9c37db2013-06-21 18:30:24 -0700362struct of_get_config_request : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700363 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700364 uint8_t type == 7;
Rich Lanea06d0c32013-03-25 08:52:03 -0700365 uint16_t length;
366 uint32_t xid;
367};
368
Rich Lanee9c37db2013-06-21 18:30:24 -0700369struct of_get_config_reply : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700370 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700371 uint8_t type == 8;
Rich Lanea06d0c32013-03-25 08:52:03 -0700372 uint16_t length;
373 uint32_t xid;
Andreas Wundsam057540b2013-11-19 16:51:36 -0800374 enum ofp_config_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700375 uint16_t miss_send_len;
376};
377
Rich Lanee9c37db2013-06-21 18:30:24 -0700378struct of_set_config : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700379 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700380 uint8_t type == 9;
Rich Lanea06d0c32013-03-25 08:52:03 -0700381 uint16_t length;
382 uint32_t xid;
Andreas Wundsam057540b2013-11-19 16:51:36 -0800383 enum ofp_config_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700384 uint16_t miss_send_len;
385};
386
Rich Lane68ae4d72013-05-09 10:55:19 -0700387struct of_port_desc {
Rich Lanea06d0c32013-03-25 08:52:03 -0700388 of_port_no_t port_no;
389 of_mac_addr_t hw_addr;
390 of_port_name_t name;
Rob Vaterlausd9d72d22013-09-23 14:50:52 -0700391 enum ofp_port_config config;
392 enum ofp_port_state state;
393 enum ofp_port_features curr;
394 enum ofp_port_features advertised;
395 enum ofp_port_features supported;
396 enum ofp_port_features peer;
Rich Lanea06d0c32013-03-25 08:52:03 -0700397};
398
Rich Lanee9c37db2013-06-21 18:30:24 -0700399struct of_features_request : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700400 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700401 uint8_t type == 5;
Rich Lanea06d0c32013-03-25 08:52:03 -0700402 uint16_t length;
403 uint32_t xid;
404};
405
Rich Lanee9c37db2013-06-21 18:30:24 -0700406struct of_features_reply : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700407 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700408 uint8_t type == 6;
Rich Lanea06d0c32013-03-25 08:52:03 -0700409 uint16_t length;
410 uint32_t xid;
411 uint64_t datapath_id;
412 uint32_t n_buffers;
413 uint8_t n_tables;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700414 pad(3);
Rob Vaterlausfeee3712013-09-30 11:24:19 -0700415 enum ofp_capabilities capabilities;
Rich Lanea06d0c32013-03-25 08:52:03 -0700416 uint32_t actions;
417 list(of_port_desc_t) ports;
418};
419
Rich Lanee9c37db2013-06-21 18:30:24 -0700420struct of_port_status : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700421 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700422 uint8_t type == 12;
Rich Lanea06d0c32013-03-25 08:52:03 -0700423 uint16_t length;
424 uint32_t xid;
Rob Vaterlausd9d72d22013-09-23 14:50:52 -0700425 enum ofp_port_reason reason;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700426 pad(7);
Rich Lanea06d0c32013-03-25 08:52:03 -0700427 of_port_desc_t desc;
428};
429
Rich Lanee9c37db2013-06-21 18:30:24 -0700430struct of_port_mod : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700431 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700432 uint8_t type == 15;
Rich Lanea06d0c32013-03-25 08:52:03 -0700433 uint16_t length;
434 uint32_t xid;
435 of_port_no_t port_no;
436 of_mac_addr_t hw_addr;
437 uint32_t config;
438 uint32_t mask;
439 uint32_t advertise;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700440 pad(4);
Rich Lanea06d0c32013-03-25 08:52:03 -0700441};
442
Rich Lanee9c37db2013-06-21 18:30:24 -0700443struct of_packet_in : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700444 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700445 uint8_t type == 10;
Rich Lanea06d0c32013-03-25 08:52:03 -0700446 uint16_t length;
447 uint32_t xid;
448 uint32_t buffer_id;
449 uint16_t total_len;
450 of_port_no_t in_port;
451 uint8_t reason;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700452 pad(1);
Rich Lanea06d0c32013-03-25 08:52:03 -0700453 of_octets_t data;
454};
455
Rich Lanee9c37db2013-06-21 18:30:24 -0700456struct of_action_output : of_action {
Rich Lane31b87142013-05-09 22:05:42 -0700457 uint16_t type == 0;
Rich Lanea06d0c32013-03-25 08:52:03 -0700458 uint16_t len;
459 of_port_no_t port;
460 uint16_t max_len;
461};
462
Rich Lanee9c37db2013-06-21 18:30:24 -0700463struct of_action_set_vlan_vid : of_action {
Rich Lane31b87142013-05-09 22:05:42 -0700464 uint16_t type == 1;
Rich Lanea06d0c32013-03-25 08:52:03 -0700465 uint16_t len;
466 uint16_t vlan_vid;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700467 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -0700468};
469
Rich Lanee9c37db2013-06-21 18:30:24 -0700470struct of_action_strip_vlan : of_action {
Rich Lane31b87142013-05-09 22:05:42 -0700471 uint16_t type == 3;
Rich Lanea06d0c32013-03-25 08:52:03 -0700472 uint16_t len;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700473 pad(4);
Rich Lanea06d0c32013-03-25 08:52:03 -0700474};
475
Rich Lanee9c37db2013-06-21 18:30:24 -0700476struct of_action_set_vlan_pcp : of_action {
Rich Lane31b87142013-05-09 22:05:42 -0700477 uint16_t type == 2;
Rich Lanea06d0c32013-03-25 08:52:03 -0700478 uint16_t len;
479 uint8_t vlan_pcp;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700480 pad(3);
Rich Lanea06d0c32013-03-25 08:52:03 -0700481};
482
Rich Lanee9c37db2013-06-21 18:30:24 -0700483struct of_action_set_dl_src : of_action {
Rich Lane31b87142013-05-09 22:05:42 -0700484 uint16_t type == 4;
Rich Lanea06d0c32013-03-25 08:52:03 -0700485 uint16_t len;
486 of_mac_addr_t dl_addr;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700487 pad(6);
Rich Lanea06d0c32013-03-25 08:52:03 -0700488};
489
Rich Lanee9c37db2013-06-21 18:30:24 -0700490struct of_action_set_dl_dst : of_action {
Rich Lane31b87142013-05-09 22:05:42 -0700491 uint16_t type == 5;
Rich Lanea06d0c32013-03-25 08:52:03 -0700492 uint16_t len;
493 of_mac_addr_t dl_addr;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700494 pad(6);
Rich Lanea06d0c32013-03-25 08:52:03 -0700495};
496
Rich Lanee9c37db2013-06-21 18:30:24 -0700497struct of_action_set_nw_src : of_action {
Rich Lane31b87142013-05-09 22:05:42 -0700498 uint16_t type == 6;
Rich Lanea06d0c32013-03-25 08:52:03 -0700499 uint16_t len;
500 uint32_t nw_addr;
501};
502
Rich Lanee9c37db2013-06-21 18:30:24 -0700503struct of_action_set_nw_dst : of_action {
Rich Lane31b87142013-05-09 22:05:42 -0700504 uint16_t type == 7;
Rich Lanea06d0c32013-03-25 08:52:03 -0700505 uint16_t len;
506 uint32_t nw_addr;
507};
508
Rich Lanee9c37db2013-06-21 18:30:24 -0700509struct of_action_set_tp_src : of_action {
Rich Lane31b87142013-05-09 22:05:42 -0700510 uint16_t type == 9;
Rich Lanea06d0c32013-03-25 08:52:03 -0700511 uint16_t len;
512 uint16_t tp_port;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700513 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -0700514};
515
Rich Lanee9c37db2013-06-21 18:30:24 -0700516struct of_action_set_tp_dst : of_action {
Rich Lane31b87142013-05-09 22:05:42 -0700517 uint16_t type == 10;
Rich Lanea06d0c32013-03-25 08:52:03 -0700518 uint16_t len;
519 uint16_t tp_port;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700520 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -0700521};
522
Rich Lanee9c37db2013-06-21 18:30:24 -0700523struct of_action_set_nw_tos : of_action {
Rich Lane31b87142013-05-09 22:05:42 -0700524 uint16_t type == 8;
Rich Lanea06d0c32013-03-25 08:52:03 -0700525 uint16_t len;
526 uint8_t nw_tos;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700527 pad(3);
Rich Lanea06d0c32013-03-25 08:52:03 -0700528};
529
Rich Lanee9c37db2013-06-21 18:30:24 -0700530struct of_action_experimenter : of_action {
Rich Lane31b87142013-05-09 22:05:42 -0700531 uint16_t type == 65535;
Rich Lanea06d0c32013-03-25 08:52:03 -0700532 uint16_t len;
Rich Laneb25d07c2013-08-22 17:22:43 -0700533 uint32_t experimenter == ?;
Rich Lanea06d0c32013-03-25 08:52:03 -0700534 of_octets_t data;
535};
536
Rich Lanee9c37db2013-06-21 18:30:24 -0700537struct of_action_enqueue : of_action {
Rich Lane31b87142013-05-09 22:05:42 -0700538 uint16_t type == 11;
Rich Lanea06d0c32013-03-25 08:52:03 -0700539 uint16_t len;
540 of_port_no_t port;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700541 pad(6);
Rich Lanea06d0c32013-03-25 08:52:03 -0700542 uint32_t queue_id;
543};
544
Rich Lane68ae4d72013-05-09 10:55:19 -0700545struct of_action {
Andreas Wundsamc37ba3d2013-08-02 17:51:51 -0700546 uint16_t type == ?;
Rich Lanea06d0c32013-03-25 08:52:03 -0700547 uint16_t len;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700548 pad(4);
Rich Lanea06d0c32013-03-25 08:52:03 -0700549};
550
Rich Lanee9c37db2013-06-21 18:30:24 -0700551struct of_packet_out : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700552 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700553 uint8_t type == 13;
Rich Lanea06d0c32013-03-25 08:52:03 -0700554 uint16_t length;
555 uint32_t xid;
556 uint32_t buffer_id;
557 of_port_no_t in_port;
558 uint16_t actions_len;
559 list(of_action_t) actions;
560 of_octets_t data;
561};
562
Rich Lane68ae4d72013-05-09 10:55:19 -0700563struct of_match_v1 {
Rich Lanea06d0c32013-03-25 08:52:03 -0700564 of_wc_bmap_t wildcards;
565 of_port_no_t in_port;
566 of_mac_addr_t eth_src;
567 of_mac_addr_t eth_dst;
568 uint16_t vlan_vid;
569 uint8_t vlan_pcp;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700570 pad(1);
Rich Lanea06d0c32013-03-25 08:52:03 -0700571 uint16_t eth_type;
572 uint8_t ip_dscp;
573 uint8_t ip_proto;
Rob Sherwood53989c82013-07-03 16:49:50 -0700574 pad(2);
Andreas Wundsamb566a162013-07-18 19:30:23 -0700575 of_ipv4_t ipv4_src;
576 of_ipv4_t ipv4_dst;
Rich Lanea06d0c32013-03-25 08:52:03 -0700577 uint16_t tcp_src;
578 uint16_t tcp_dst;
579};
580
Rich Lanee9c37db2013-06-21 18:30:24 -0700581struct of_flow_mod : of_header {
582 uint8_t version;
583 uint8_t type == 14;
584 uint16_t length;
585 uint32_t xid;
586 of_match_t match;
587 uint64_t cookie;
Andreas Wundsamc37ba3d2013-08-02 17:51:51 -0700588 of_fm_cmd_t _command == ?;
Rich Lanee9c37db2013-06-21 18:30:24 -0700589 uint16_t idle_timeout;
590 uint16_t hard_timeout;
591 uint16_t priority;
592 uint32_t buffer_id;
593 of_port_no_t out_port;
Andreas Wundsamdfeb5942013-09-19 13:07:49 -0700594 enum ofp_flow_mod_flags flags;
Rich Lanee9c37db2013-06-21 18:30:24 -0700595 list(of_action_t) actions;
596};
597
598struct of_flow_add : of_flow_mod {
Rich Lanea06d0c32013-03-25 08:52:03 -0700599 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700600 uint8_t type == 14;
Rich Lanea06d0c32013-03-25 08:52:03 -0700601 uint16_t length;
602 uint32_t xid;
603 of_match_t match;
604 uint64_t cookie;
Rich Lane31b87142013-05-09 22:05:42 -0700605 of_fm_cmd_t _command == 0;
Rich Lanea06d0c32013-03-25 08:52:03 -0700606 uint16_t idle_timeout;
607 uint16_t hard_timeout;
608 uint16_t priority;
609 uint32_t buffer_id;
610 of_port_no_t out_port;
Andreas Wundsamdfeb5942013-09-19 13:07:49 -0700611 enum ofp_flow_mod_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700612 list(of_action_t) actions;
613};
614
Rich Lanee9c37db2013-06-21 18:30:24 -0700615struct of_flow_modify : of_flow_mod {
Rich Lanea06d0c32013-03-25 08:52:03 -0700616 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700617 uint8_t type == 14;
Rich Lanea06d0c32013-03-25 08:52:03 -0700618 uint16_t length;
619 uint32_t xid;
620 of_match_t match;
621 uint64_t cookie;
Rich Lane31b87142013-05-09 22:05:42 -0700622 of_fm_cmd_t _command == 1;
Rich Lanea06d0c32013-03-25 08:52:03 -0700623 uint16_t idle_timeout;
624 uint16_t hard_timeout;
625 uint16_t priority;
626 uint32_t buffer_id;
627 of_port_no_t out_port;
Andreas Wundsamdfeb5942013-09-19 13:07:49 -0700628 enum ofp_flow_mod_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700629 list(of_action_t) actions;
630};
631
Rich Lanee9c37db2013-06-21 18:30:24 -0700632struct of_flow_modify_strict : of_flow_mod {
Rich Lanea06d0c32013-03-25 08:52:03 -0700633 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700634 uint8_t type == 14;
Rich Lanea06d0c32013-03-25 08:52:03 -0700635 uint16_t length;
636 uint32_t xid;
637 of_match_t match;
638 uint64_t cookie;
Rich Lane31b87142013-05-09 22:05:42 -0700639 of_fm_cmd_t _command == 2;
Rich Lanea06d0c32013-03-25 08:52:03 -0700640 uint16_t idle_timeout;
641 uint16_t hard_timeout;
642 uint16_t priority;
643 uint32_t buffer_id;
644 of_port_no_t out_port;
Andreas Wundsamdfeb5942013-09-19 13:07:49 -0700645 enum ofp_flow_mod_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700646 list(of_action_t) actions;
647};
648
Rich Lanee9c37db2013-06-21 18:30:24 -0700649struct of_flow_delete : of_flow_mod {
Rich Lanea06d0c32013-03-25 08:52:03 -0700650 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700651 uint8_t type == 14;
Rich Lanea06d0c32013-03-25 08:52:03 -0700652 uint16_t length;
653 uint32_t xid;
654 of_match_t match;
655 uint64_t cookie;
Rich Lane31b87142013-05-09 22:05:42 -0700656 of_fm_cmd_t _command == 3;
Rich Lanea06d0c32013-03-25 08:52:03 -0700657 uint16_t idle_timeout;
658 uint16_t hard_timeout;
659 uint16_t priority;
660 uint32_t buffer_id;
661 of_port_no_t out_port;
Andreas Wundsamdfeb5942013-09-19 13:07:49 -0700662 enum ofp_flow_mod_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700663 list(of_action_t) actions;
664};
665
Rich Lanee9c37db2013-06-21 18:30:24 -0700666struct of_flow_delete_strict : of_flow_mod {
Rich Lanea06d0c32013-03-25 08:52:03 -0700667 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700668 uint8_t type == 14;
Rich Lanea06d0c32013-03-25 08:52:03 -0700669 uint16_t length;
670 uint32_t xid;
671 of_match_t match;
672 uint64_t cookie;
Rich Lane31b87142013-05-09 22:05:42 -0700673 of_fm_cmd_t _command == 4;
Rich Lanea06d0c32013-03-25 08:52:03 -0700674 uint16_t idle_timeout;
675 uint16_t hard_timeout;
676 uint16_t priority;
677 uint32_t buffer_id;
678 of_port_no_t out_port;
Andreas Wundsamdfeb5942013-09-19 13:07:49 -0700679 enum ofp_flow_mod_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700680 list(of_action_t) actions;
681};
682
Rich Lanee9c37db2013-06-21 18:30:24 -0700683struct of_flow_removed : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700684 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700685 uint8_t type == 11;
Rich Lanea06d0c32013-03-25 08:52:03 -0700686 uint16_t length;
687 uint32_t xid;
688 of_match_t match;
689 uint64_t cookie;
690 uint16_t priority;
691 uint8_t reason;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700692 pad(1);
Rich Lanea06d0c32013-03-25 08:52:03 -0700693 uint32_t duration_sec;
694 uint32_t duration_nsec;
695 uint16_t idle_timeout;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700696 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -0700697 uint64_t packet_count;
698 uint64_t byte_count;
699};
700
Rich Lanee9c37db2013-06-21 18:30:24 -0700701struct of_error_msg : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700702 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700703 uint8_t type == 1;
Rich Lanea06d0c32013-03-25 08:52:03 -0700704 uint16_t length;
705 uint32_t xid;
Rob Vaterlausfeee3712013-09-30 11:24:19 -0700706 uint16_t err_type == ?;
707};
708
709struct of_hello_failed_error_msg : of_error_msg {
710 uint8_t version;
711 uint8_t type == 1;
712 uint16_t length;
713 uint32_t xid;
714 uint16_t err_type == 0;
715 enum ofp_hello_failed_code code;
716 of_octets_t data;
717};
718
719struct of_bad_request_error_msg : of_error_msg {
720 uint8_t version;
721 uint8_t type == 1;
722 uint16_t length;
723 uint32_t xid;
724 uint16_t err_type == 1;
725 enum ofp_bad_request_code code;
726 of_octets_t data;
727};
728
729struct of_bad_action_error_msg : of_error_msg {
730 uint8_t version;
731 uint8_t type == 1;
732 uint16_t length;
733 uint32_t xid;
734 uint16_t err_type == 2;
735 enum ofp_bad_action_code code;
736 of_octets_t data;
737};
738
739struct of_flow_mod_failed_error_msg : of_error_msg {
740 uint8_t version;
741 uint8_t type == 1;
742 uint16_t length;
743 uint32_t xid;
744 uint16_t err_type == 3;
745 enum ofp_flow_mod_failed_code code;
746 of_octets_t data;
747};
748
749struct of_port_mod_failed_error_msg : of_error_msg {
750 uint8_t version;
751 uint8_t type == 1;
752 uint16_t length;
753 uint32_t xid;
754 uint16_t err_type == 4;
755 enum ofp_port_mod_failed_code code;
756 of_octets_t data;
757};
758
759struct of_queue_op_failed_error_msg : of_error_msg {
760 uint8_t version;
761 uint8_t type == 1;
762 uint16_t length;
763 uint32_t xid;
764 uint16_t err_type == 5;
765 enum ofp_queue_op_failed_code code;
Rich Lanea06d0c32013-03-25 08:52:03 -0700766 of_octets_t data;
767};
768
769// STATS ENTRIES: flow, table, port, queue,
Rich Lane68ae4d72013-05-09 10:55:19 -0700770struct of_flow_stats_entry {
Rich Lanea06d0c32013-03-25 08:52:03 -0700771 uint16_t length;
772 uint8_t table_id;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700773 pad(1);
Rich Lanea06d0c32013-03-25 08:52:03 -0700774 of_match_t match;
775 uint32_t duration_sec;
776 uint32_t duration_nsec;
777 uint16_t priority;
778 uint16_t idle_timeout;
779 uint16_t hard_timeout;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700780 pad(6);
Rich Lanea06d0c32013-03-25 08:52:03 -0700781 uint64_t cookie;
782 uint64_t packet_count;
783 uint64_t byte_count;
784 list(of_action_t) actions;
785};
786
Rich Lane68ae4d72013-05-09 10:55:19 -0700787struct of_table_stats_entry {
Rich Lanea06d0c32013-03-25 08:52:03 -0700788 uint8_t table_id;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700789 pad(3);
Rich Lanea06d0c32013-03-25 08:52:03 -0700790 of_table_name_t name;
791 of_wc_bmap_t wildcards;
792 uint32_t max_entries;
793 uint32_t active_count;
794 uint64_t lookup_count;
795 uint64_t matched_count;
796};
797
Rich Lane68ae4d72013-05-09 10:55:19 -0700798struct of_port_stats_entry {
Rich Lanea06d0c32013-03-25 08:52:03 -0700799 of_port_no_t port_no;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700800 pad(6);
Rich Lanea06d0c32013-03-25 08:52:03 -0700801 uint64_t rx_packets;
802 uint64_t tx_packets;
803 uint64_t rx_bytes;
804 uint64_t tx_bytes;
805 uint64_t rx_dropped;
806 uint64_t tx_dropped;
807 uint64_t rx_errors;
808 uint64_t tx_errors;
809 uint64_t rx_frame_err;
810 uint64_t rx_over_err;
811 uint64_t rx_crc_err;
812 uint64_t collisions;
813};
814
Rich Lane68ae4d72013-05-09 10:55:19 -0700815struct of_queue_stats_entry {
Rich Lanea06d0c32013-03-25 08:52:03 -0700816 of_port_no_t port_no;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700817 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -0700818 uint32_t queue_id;
819 uint64_t tx_bytes;
820 uint64_t tx_packets;
821 uint64_t tx_errors;
822};
823
824// STATS request/reply: Desc, flow, agg, table, port, queue
825
Rich Lanee9c37db2013-06-21 18:30:24 -0700826struct of_stats_request : of_header {
827 uint8_t version;
828 uint8_t type == 16;
829 uint16_t length;
830 uint32_t xid;
Andreas Wundsamc37ba3d2013-08-02 17:51:51 -0700831 uint16_t stats_type == ?;
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700832 enum ofp_stats_request_flags flags;
Rich Lanee9c37db2013-06-21 18:30:24 -0700833};
834
835struct of_stats_reply : of_header {
836 uint8_t version;
837 uint8_t type == 17;
838 uint16_t length;
839 uint32_t xid;
Andreas Wundsamc37ba3d2013-08-02 17:51:51 -0700840 uint16_t stats_type == ?;
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700841 enum ofp_stats_reply_flags flags;
Rich Lanee9c37db2013-06-21 18:30:24 -0700842};
843
844struct of_desc_stats_request : of_stats_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700845 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700846 uint8_t type == 16;
Rich Lanea06d0c32013-03-25 08:52:03 -0700847 uint16_t length;
848 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700849 uint16_t stats_type == 0;
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700850 enum ofp_stats_request_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700851};
852
Rich Lanee9c37db2013-06-21 18:30:24 -0700853struct of_desc_stats_reply : of_stats_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700854 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700855 uint8_t type == 17;
Rich Lanea06d0c32013-03-25 08:52:03 -0700856 uint16_t length;
857 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700858 uint16_t stats_type == 0;
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700859 enum ofp_stats_reply_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700860 of_desc_str_t mfr_desc;
861 of_desc_str_t hw_desc;
862 of_desc_str_t sw_desc;
863 of_serial_num_t serial_num;
864 of_desc_str_t dp_desc;
865};
866
Rich Lanee9c37db2013-06-21 18:30:24 -0700867struct of_flow_stats_request : of_stats_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700868 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700869 uint8_t type == 16;
Rich Lanea06d0c32013-03-25 08:52:03 -0700870 uint16_t length;
871 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700872 uint16_t stats_type == 1;
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700873 enum ofp_stats_request_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700874 of_match_t match;
875 uint8_t table_id;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700876 pad(1);
Rich Lanea06d0c32013-03-25 08:52:03 -0700877 of_port_no_t out_port;
878};
879
Rich Lanee9c37db2013-06-21 18:30:24 -0700880struct of_flow_stats_reply : of_stats_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700881 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700882 uint8_t type == 17;
Rich Lanea06d0c32013-03-25 08:52:03 -0700883 uint16_t length;
884 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700885 uint16_t stats_type == 1;
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700886 enum ofp_stats_reply_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700887 list(of_flow_stats_entry_t) entries;
888};
889
Rich Lanee9c37db2013-06-21 18:30:24 -0700890struct of_aggregate_stats_request : of_stats_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700891 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700892 uint8_t type == 16;
Rich Lanea06d0c32013-03-25 08:52:03 -0700893 uint16_t length;
894 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700895 uint16_t stats_type == 2;
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700896 enum ofp_stats_request_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700897 of_match_t match;
898 uint8_t table_id;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700899 pad(1);
Rich Lanea06d0c32013-03-25 08:52:03 -0700900 of_port_no_t out_port;
901};
902
Rich Lanee9c37db2013-06-21 18:30:24 -0700903struct of_aggregate_stats_reply : of_stats_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700904 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700905 uint8_t type == 17;
Rich Lanea06d0c32013-03-25 08:52:03 -0700906 uint16_t length;
907 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700908 uint16_t stats_type == 2;
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700909 enum ofp_stats_reply_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700910 uint64_t packet_count;
911 uint64_t byte_count;
912 uint32_t flow_count;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700913 pad(4);
Rich Lanea06d0c32013-03-25 08:52:03 -0700914};
915
Rich Lanee9c37db2013-06-21 18:30:24 -0700916struct of_table_stats_request : of_stats_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700917 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700918 uint8_t type == 16;
Rich Lanea06d0c32013-03-25 08:52:03 -0700919 uint16_t length;
920 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700921 uint16_t stats_type == 3;
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700922 enum ofp_stats_request_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700923};
924
Rich Lanee9c37db2013-06-21 18:30:24 -0700925struct of_table_stats_reply : of_stats_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700926 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700927 uint8_t type == 17;
Rich Lanea06d0c32013-03-25 08:52:03 -0700928 uint16_t length;
929 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700930 uint16_t stats_type == 3;
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700931 enum ofp_stats_reply_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700932 list(of_table_stats_entry_t) entries;
933};
934
Rich Lanee9c37db2013-06-21 18:30:24 -0700935struct of_port_stats_request : of_stats_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700936 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700937 uint8_t type == 16;
Rich Lanea06d0c32013-03-25 08:52:03 -0700938 uint16_t length;
939 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700940 uint16_t stats_type == 4;
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700941 enum ofp_stats_request_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700942 of_port_no_t port_no;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700943 pad(6);
Rich Lanea06d0c32013-03-25 08:52:03 -0700944};
945
Rich Lanee9c37db2013-06-21 18:30:24 -0700946struct of_port_stats_reply : of_stats_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700947 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700948 uint8_t type == 17;
Rich Lanea06d0c32013-03-25 08:52:03 -0700949 uint16_t length;
950 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700951 uint16_t stats_type == 4;
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700952 enum ofp_stats_reply_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700953 list(of_port_stats_entry_t) entries;
954};
955
Rich Lanee9c37db2013-06-21 18:30:24 -0700956struct of_queue_stats_request : of_stats_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700957 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700958 uint8_t type == 16;
Rich Lanea06d0c32013-03-25 08:52:03 -0700959 uint16_t length;
960 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700961 uint16_t stats_type == 5;
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700962 enum ofp_stats_request_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700963 of_port_no_t port_no;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700964 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -0700965 uint32_t queue_id;
966};
967
Rich Lanee9c37db2013-06-21 18:30:24 -0700968struct of_queue_stats_reply : of_stats_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700969 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700970 uint8_t type == 17;
Rich Lanea06d0c32013-03-25 08:52:03 -0700971 uint16_t length;
972 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700973 uint16_t stats_type == 5;
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700974 enum ofp_stats_reply_flags flags;
Rich Lanea06d0c32013-03-25 08:52:03 -0700975 list(of_queue_stats_entry_t) entries;
976};
977
Rich Lanee9c37db2013-06-21 18:30:24 -0700978struct of_experimenter_stats_request : of_stats_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700979 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700980 uint8_t type == 16;
Rich Lanea06d0c32013-03-25 08:52:03 -0700981 uint16_t length;
982 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700983 uint16_t stats_type == 0xffff;
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700984 enum ofp_stats_request_flags flags;
Rich Laneb25d07c2013-08-22 17:22:43 -0700985 uint32_t experimenter == ?;
Rich Lanea06d0c32013-03-25 08:52:03 -0700986 of_octets_t data;
987};
988
Rich Lanee9c37db2013-06-21 18:30:24 -0700989struct of_experimenter_stats_reply : of_stats_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700990 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700991 uint8_t type == 17;
Rich Lanea06d0c32013-03-25 08:52:03 -0700992 uint16_t length;
993 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700994 uint16_t stats_type == 0xffff;
Andreas Wundsamb47d7e82013-10-18 17:43:00 -0700995 enum ofp_stats_reply_flags flags;
Rich Laneb25d07c2013-08-22 17:22:43 -0700996 uint32_t experimenter == ?;
Rich Lanea06d0c32013-03-25 08:52:03 -0700997 of_octets_t data;
998};
999
1000// END OF STATS OBJECTS
1001
Rich Lane68ae4d72013-05-09 10:55:19 -07001002struct of_queue_prop {
Andreas Wundsamc37ba3d2013-08-02 17:51:51 -07001003 uint16_t type == ?;
Rich Lanea06d0c32013-03-25 08:52:03 -07001004 uint16_t len;
Rich Lanee2af4ee2013-05-09 11:04:06 -07001005 pad(4);
Rich Lanea06d0c32013-03-25 08:52:03 -07001006};
1007
Rich Lanee9c37db2013-06-21 18:30:24 -07001008struct of_queue_prop_min_rate : of_queue_prop {
Rich Lane31b87142013-05-09 22:05:42 -07001009 uint16_t type == 1;
Rich Lanea06d0c32013-03-25 08:52:03 -07001010 uint16_t len;
Rich Lanee2af4ee2013-05-09 11:04:06 -07001011 pad(4);
Rich Lanea06d0c32013-03-25 08:52:03 -07001012 uint16_t rate;
Rich Lanee2af4ee2013-05-09 11:04:06 -07001013 pad(6);
Rich Lanea06d0c32013-03-25 08:52:03 -07001014};
1015
Rich Lane68ae4d72013-05-09 10:55:19 -07001016struct of_packet_queue {
Rich Lanea06d0c32013-03-25 08:52:03 -07001017 uint32_t queue_id;
1018 uint16_t len;
Rich Lanee2af4ee2013-05-09 11:04:06 -07001019 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -07001020 list(of_queue_prop_t) properties;
1021};
1022
Rich Lanee9c37db2013-06-21 18:30:24 -07001023struct of_queue_get_config_request : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -07001024 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -07001025 uint8_t type == 20;
Rich Lanea06d0c32013-03-25 08:52:03 -07001026 uint16_t length;
1027 uint32_t xid;
1028 of_port_no_t port;
Rich Lanee2af4ee2013-05-09 11:04:06 -07001029 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -07001030};
1031
Rich Lanee9c37db2013-06-21 18:30:24 -07001032struct of_queue_get_config_reply : of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -07001033 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -07001034 uint8_t type == 21;
Rich Lanea06d0c32013-03-25 08:52:03 -07001035 uint16_t length;
1036 uint32_t xid;
1037 of_port_no_t port;
Rich Lanee2af4ee2013-05-09 11:04:06 -07001038 pad(6);
Rich Lanea06d0c32013-03-25 08:52:03 -07001039 list(of_packet_queue_t) queues;
1040};