ofp-actions: Use specific error code for oxm_hasmask=1 in Set-Field.
[cascardo/ovs.git] / lib / ofp-errors.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef OFP_ERRORS_H
18 #define OFP_ERRORS_H 1
19
20 #include <stdbool.h>
21 #include <stddef.h>
22 #include <stdint.h>
23
24 #include "openflow/openflow.h"
25
26 struct ds;
27 struct ofpbuf;
28
29 /* Error codes.
30  *
31  * We embed system errno values and OpenFlow standard and vendor extension
32  * error codes into the positive range of "int":
33  *
34  *   - Errno values are assumed to use the range 1 through 2**30 - 1.
35  *
36  *     (C and POSIX say that errno values are positive.  We assume that they
37  *     are less than 2**29.  They are actually less than 65536 on at least
38  *     Linux, FreeBSD, OpenBSD, and Windows.)
39  *
40  *   - OpenFlow standard and vendor extension error codes use the range
41  *     starting at 2**30 (OFPERR_OFS).
42  *
43  * Zero and negative values are not used.
44  */
45
46 #define OFPERR_OFS (1 << 30)
47
48 /* OpenFlow error codes.
49  *
50  * The comments below are parsed by the extract-ofp-errors program at build
51  * time and used to determine the mapping between "enum ofperr" constants and
52  * error type/code values used in the OpenFlow protocol:
53  *
54  *   - The first part of each comment specifies the vendor, OpenFlow versions,
55  *     type, and sometimes a code for each protocol that supports the error:
56  *
57  *         # The vendor is OF for standard OpenFlow error codes.  Otherwise it
58  *           is one of the *_VENDOR_ID codes defined in openflow-common.h.
59  *
60  *         # The version can specify a specific OpenFlow version, a version
61  *           range delimited by "-", or an open-ended range with "+".
62  *
63  *         # Standard OpenFlow errors have both a type and a code.  Extension
64  *           errors generally have only a type, no code.  There is one
65  *           exception: Nicira extension (NX) errors for OpenFlow 1.0 and 1.1
66  *           have both a type and a code.  (This means that the version
67  *           specification for NX errors may not include version 1.0 or 1.1 (or
68  *           both) along with version 1.2 or later, because the requirements
69  *           for those versions are different.)
70  *
71  *   - Additional text is a human-readable description of the meaning of each
72  *     error, used to explain the error to the user.  Any text enclosed in
73  *     square brackets is omitted; this can be used to explain rationale for
74  *     choice of error codes in the case where this is desirable. */
75 enum ofperr {
76 /* Expected duplications. */
77
78     /* Expected: 0x0,3,5 in OF1.1 means both OFPBIC_BAD_EXPERIMENTER and
79      * OFPBIC_BAD_EXP_TYPE. */
80
81 /* ## ------------------ ## */
82 /* ## OFPET_HELLO_FAILED ## */
83 /* ## ------------------ ## */
84
85     /* OF1.0+(0,0).  No compatible version. */
86     OFPERR_OFPHFC_INCOMPATIBLE = OFPERR_OFS,
87
88     /* OF1.0+(0,1).  Permissions error. */
89     OFPERR_OFPHFC_EPERM,
90
91 /* ## ----------------- ## */
92 /* ## OFPET_BAD_REQUEST ## */
93 /* ## ----------------- ## */
94
95     /* OF1.0+(1,0).  ofp_header.version not supported. */
96     OFPERR_OFPBRC_BAD_VERSION,
97
98     /* OF1.0+(1,1).  ofp_header.type not supported. */
99     OFPERR_OFPBRC_BAD_TYPE,
100
101     /* OF1.0+(1,2).  ofp_stats_msg.type not supported. */
102     OFPERR_OFPBRC_BAD_STAT,
103
104     /* OF1.0+(1,3).  Vendor not supported (in ofp_vendor_header or
105      * ofp_stats_msg). */
106     OFPERR_OFPBRC_BAD_VENDOR,
107
108     /* OF1.0+(1,4).  Vendor subtype not supported. */
109     OFPERR_OFPBRC_BAD_SUBTYPE,
110
111     /* OF1.0+(1,5).  Permissions error. */
112     OFPERR_OFPBRC_EPERM,
113
114     /* OF1.0+(1,6).  Wrong request length for type. */
115     OFPERR_OFPBRC_BAD_LEN,
116
117     /* OF1.0+(1,7).  Specified buffer has already been used. */
118     OFPERR_OFPBRC_BUFFER_EMPTY,
119
120     /* OF1.0+(1,8).  Specified buffer does not exist. */
121     OFPERR_OFPBRC_BUFFER_UNKNOWN,
122
123     /* NX1.0(1,512), OF1.1+(1,9).  Specified table-id invalid or does not exist.
124      * [ A non-standard error (1,512), formerly OFPERR_NXBRC_BAD_TABLE_ID,
125      *   is used for OpenFlow 1.0 as there seems to be no appropriate error
126      *   code defined the specification. ] */
127     OFPERR_OFPBRC_BAD_TABLE_ID,
128
129     /* OF1.2+(1,10).  Denied because controller is slave. */
130     OFPERR_OFPBRC_IS_SLAVE,
131
132     /* NX1.0-1.1(1,514), OF1.2+(1,11).  Invalid port.  [ A non-standard error
133      * (1,514), formerly OFPERR_NXBRC_BAD_IN_PORT is used for OpenFlow 1.0 and
134      * 1.1 as there seems to be no appropriate error code defined the
135      * specifications. ] */
136     OFPERR_OFPBRC_BAD_PORT,
137
138     /* OF1.2+(1,12).  Invalid packet in packet-out. */
139     OFPERR_OFPBRC_BAD_PACKET,
140
141     /* OF1.3+(1,13).  Multipart request overflowed the assigned buffer. */
142     OFPERR_OFPBRC_MULTIPART_BUFFER_OVERFLOW,
143
144     /* NX1.0-1.1(1,256), NX1.2+(2).  Invalid NXM flow match. */
145     OFPERR_NXBRC_NXM_INVALID,
146
147     /* NX1.0-1.1(1,257), NX1.2+(3).  The nxm_type, or nxm_type taken in
148      * combination with nxm_hasmask or nxm_length or both, is invalid or not
149      * implemented. */
150     OFPERR_NXBRC_NXM_BAD_TYPE,
151
152     /* NX1.0-1.1(1,515), NX1.2+(4).  Must-be-zero field had nonzero value. */
153     OFPERR_NXBRC_MUST_BE_ZERO,
154
155     /* NX1.0-1.1(1,516), NX1.2+(5).  The reason in an ofp_port_status message
156      * is not valid. */
157     OFPERR_NXBRC_BAD_REASON,
158
159     /* NX1.0-1.1(1,520), NX1.2+(9).  The 'event' in an NXST_FLOW_MONITOR reply
160      * does not specify one of the NXFME_ABBREV, NXFME_ADD, NXFME_DELETE, or
161      * NXFME_MODIFY. */
162     OFPERR_NXBRC_FM_BAD_EVENT,
163
164     /* NX1.0-1.1(1,521), NX1.2+(10).  The error that occurred cannot be
165      * represented in this OpenFlow version. */
166     OFPERR_NXBRC_UNENCODABLE_ERROR,
167
168 /* ## ---------------- ## */
169 /* ## OFPET_BAD_ACTION ## */
170 /* ## ---------------- ## */
171
172     /* OF1.0+(2,0).  Unknown action type. */
173     OFPERR_OFPBAC_BAD_TYPE,
174
175     /* OF1.0+(2,1).  Length problem in actions. */
176     OFPERR_OFPBAC_BAD_LEN,
177
178     /* OF1.0+(2,2).  Unknown experimenter id specified. */
179     OFPERR_OFPBAC_BAD_VENDOR,
180
181     /* OF1.0+(2,3).  Unknown action type for experimenter id. */
182     OFPERR_OFPBAC_BAD_VENDOR_TYPE,
183
184     /* OF1.0+(2,4).  Problem validating output port. */
185     OFPERR_OFPBAC_BAD_OUT_PORT,
186
187     /* OF1.0+(2,5).  Bad action argument. */
188     OFPERR_OFPBAC_BAD_ARGUMENT,
189
190     /* OF1.0+(2,6).  Permissions error. */
191     OFPERR_OFPBAC_EPERM,
192
193     /* OF1.0+(2,7).  Can't handle this many actions. */
194     OFPERR_OFPBAC_TOO_MANY,
195
196     /* OF1.0+(2,8).  Problem validating output queue. */
197     OFPERR_OFPBAC_BAD_QUEUE,
198
199     /* OF1.1+(2,9).  Invalid group id in forward action. */
200     OFPERR_OFPBAC_BAD_OUT_GROUP,
201
202     /* NX1.0(1,522), OF1.1+(2,10).  Action can't apply for this match or a
203      * prerequisite for use of this field is unmet. */
204     OFPERR_OFPBAC_MATCH_INCONSISTENT,
205
206     /* OF1.1+(2,11).  Action order is unsupported for the action list in an
207      * Apply-Actions instruction */
208     OFPERR_OFPBAC_UNSUPPORTED_ORDER,
209
210     /* OF1.1+(2,12).  Actions uses an unsupported tag/encap. */
211     OFPERR_OFPBAC_BAD_TAG,
212
213     /* NX1.0-1.1(1,523), OF1.2+(2,13).  Action uses unknown or unsupported OXM
214      * or NXM field. */
215     OFPERR_OFPBAC_BAD_SET_TYPE,
216
217     /* NX1.0-1.1(1,524), OF1.2+(2,14).  Action references past the end of an
218      * OXM or NXM field, or uses a length of zero. */
219     OFPERR_OFPBAC_BAD_SET_LEN,
220
221     /* NX1.0-1.1(1,525), OF1.2+(2,15).  Action sets a field to an invalid or
222      * unsupported value, or modifies a read-only field. */
223     OFPERR_OFPBAC_BAD_SET_ARGUMENT,
224
225     /* NX1.3-1.4(14), OF1.5+(2,16).  Field in Set-Field action has Has-Mask bit
226      * set to 1. */
227     OFPERR_OFPBAC_BAD_SET_MASK,
228
229     /* NX1.0-1.1(2,256), NX1.2+(11).  Must-be-zero action argument had nonzero
230      * value. */
231     OFPERR_NXBAC_MUST_BE_ZERO,
232
233 /* ## --------------------- ## */
234 /* ## OFPET_BAD_INSTRUCTION ## */
235 /* ## --------------------- ## */
236
237     /* OF1.1+(3,0).  Unknown instruction. */
238     OFPERR_OFPBIC_UNKNOWN_INST,
239
240     /* NX1.0(2,257), OF1.1+(3,1).  Switch or table does not support the
241      * instruction. */
242     OFPERR_OFPBIC_UNSUP_INST,
243
244     /* OF1.1+(3,2).  Invalid Table-ID specified. */
245     OFPERR_OFPBIC_BAD_TABLE_ID,
246
247     /* OF1.1+(3,3).  Metadata value unsupported by datapath. */
248     OFPERR_OFPBIC_UNSUP_METADATA,
249
250     /* OF1.1+(3,4).  Metadata mask value unsupported by datapath. */
251     OFPERR_OFPBIC_UNSUP_METADATA_MASK,
252
253     /* OF1.1+(3,5).  Unknown experimenter id specified. */
254     OFPERR_OFPBIC_BAD_EXPERIMENTER,
255
256     /* OF1.1(3,5), OF1.2+(3,6).  Unknown instruction for experimenter id. */
257     OFPERR_OFPBIC_BAD_EXP_TYPE,
258
259     /* OF1.2+(3,7).  Length problem in instructions. */
260     OFPERR_OFPBIC_BAD_LEN,
261
262     /* OF1.2+(3,8).  Permissions error. */
263     OFPERR_OFPBIC_EPERM,
264
265     /* ONF1.1-1.3(2600), OF1.4+(3,9).  Duplicate instruction. */
266     OFPERR_OFPBIC_DUP_INST,
267
268 /* ## --------------- ## */
269 /* ## OFPET_BAD_MATCH ## */
270 /* ## --------------- ## */
271
272     /* OF1.1+(4,0).  Unsupported match type specified by the match */
273     OFPERR_OFPBMC_BAD_TYPE,
274
275     /* OF1.1+(4,1).  Length problem in match. */
276     OFPERR_OFPBMC_BAD_LEN,
277
278     /* OF1.1+(4,2).  Match uses an unsupported tag/encap. */
279     OFPERR_OFPBMC_BAD_TAG,
280
281     /* OF1.1+(4,3).  Unsupported datalink addr mask - switch does not support
282      * arbitrary datalink address mask. */
283     OFPERR_OFPBMC_BAD_DL_ADDR_MASK,
284
285     /* OF1.1+(4,4).  Unsupported network addr mask - switch does not support
286      * arbitrary network address mask. */
287     OFPERR_OFPBMC_BAD_NW_ADDR_MASK,
288
289     /* OF1.1+(4,5).  Unsupported wildcard specified in the match. */
290     OFPERR_OFPBMC_BAD_WILDCARDS,
291
292     /* OF1.1+(4,6).  Unsupported field in the match. */
293     OFPERR_OFPBMC_BAD_FIELD,
294
295     /* NX1.0(1,258), OF1.1+(4,7).  Unsupported value in a match
296      * field. */
297     OFPERR_OFPBMC_BAD_VALUE,
298
299     /* NX1.0-1.1(1,259), OF1.2+(4,8).  Unsupported mask specified in the match,
300      * field is not dl-address or nw-address. */
301     OFPERR_OFPBMC_BAD_MASK,
302
303     /* NX1.0-1.1(1,260), OF1.2+(4,9).  A prerequisite was not met. */
304     OFPERR_OFPBMC_BAD_PREREQ,
305
306     /* NX1.0-1.1(1,261), OF1.2+(4,10).  A field type was duplicated. */
307     OFPERR_OFPBMC_DUP_FIELD,
308
309     /* OF1.2+(4,11).  Permissions error. */
310     OFPERR_OFPBMC_EPERM,
311
312 /* ## --------------------- ## */
313 /* ## OFPET_FLOW_MOD_FAILED ## */
314 /* ## --------------------- ## */
315
316     /* OF1.1+(5,0).  Unspecified error. */
317     OFPERR_OFPFMFC_UNKNOWN,
318
319     /* OF1.0(3,0), OF1.1+(5,1).  Flow not added because of full table(s). */
320     OFPERR_OFPFMFC_TABLE_FULL,
321
322     /* OF1.1+(5,2).  Table does not exist */
323     OFPERR_OFPFMFC_BAD_TABLE_ID,
324
325     /* OF1.0(3,1), OF1.1+(5,3).  Attempted to add overlapping flow with
326      * CHECK_OVERLAP flag set. */
327     OFPERR_OFPFMFC_OVERLAP,
328
329     /* OF1.0(3,2), OF1.1+(5,4).  Permissions error. */
330     OFPERR_OFPFMFC_EPERM,
331
332     /* OF1.1+(5,5).  Flow not added because of unsupported idle/hard
333      * timeout. */
334     OFPERR_OFPFMFC_BAD_TIMEOUT,
335
336     /* OF1.0(3,3).  Flow not added because of non-zero idle/hard timeout. */
337     OFPERR_OFPFMFC_BAD_EMERG_TIMEOUT,
338
339     /* OF1.0(3,4), OF1.1+(5,6).  Unsupported or unknown command. */
340     OFPERR_OFPFMFC_BAD_COMMAND,
341
342     /* NX1.0(3,258), NX1.1(5,258), OF1.2+(5,7).  Unsupported or unknown
343      * flags. */
344     OFPERR_OFPFMFC_BAD_FLAGS,
345
346     /* OF1.0(3,5).  Unsupported action list - cannot process in the order
347      * specified. */
348     OFPERR_OFPFMFC_UNSUPPORTED,
349
350     /* NX1.0-1.1(5,256), NX1.2+(12).  Generic hardware error. */
351     OFPERR_NXFMFC_HARDWARE,
352
353     /* NX1.0-1.1(5,257), NX1.2+(13).  A nonexistent table ID was specified in
354      * the "command" field of struct ofp_flow_mod, when the
355      * nxt_flow_mod_table_id extension is enabled. */
356     OFPERR_NXFMFC_BAD_TABLE_ID,
357
358 /* ## ---------------------- ## */
359 /* ## OFPET_GROUP_MOD_FAILED ## */
360 /* ## ---------------------- ## */
361
362     /* OF1.1+(6,0).  Group not added because a group ADD attempted to replace
363      * an already-present group. */
364     OFPERR_OFPGMFC_GROUP_EXISTS,
365
366     /* OF1.1+(6,1).  Group not added because Group specified is invalid. */
367     OFPERR_OFPGMFC_INVALID_GROUP,
368
369     /* OF1.1+(6,2).  Switch does not support unequal load sharing with select
370      * groups. */
371     OFPERR_OFPGMFC_WEIGHT_UNSUPPORTED,
372
373     /* OF1.1+(6,3).  The group table is full. */
374     OFPERR_OFPGMFC_OUT_OF_GROUPS,
375
376     /* OF1.1+(6,4).  The maximum number of action buckets for a group has been
377      * exceeded. */
378     OFPERR_OFPGMFC_OUT_OF_BUCKETS,
379
380     /* OF1.1+(6,5).  Switch does not support groups that forward to groups. */
381     OFPERR_OFPGMFC_CHAINING_UNSUPPORTED,
382
383     /* OF1.1+(6,6).  This group cannot watch the watch_port or watch_group
384      * specified. */
385     OFPERR_OFPGMFC_WATCH_UNSUPPORTED,
386
387     /* OF1.1+(6,7).  Group entry would cause a loop. */
388     OFPERR_OFPGMFC_LOOP,
389
390     /* OF1.1+(6,8).  Group not modified because a group MODIFY attempted to
391      * modify a non-existent group. */
392     OFPERR_OFPGMFC_UNKNOWN_GROUP,
393
394     /* OF1.2+(6,9).  Group not deleted because another
395                     group is forwarding to it. */
396     OFPERR_OFPGMFC_CHAINED_GROUP,
397
398     /* OF1.2+(6,10).  Unsupported or unknown group type. */
399     OFPERR_OFPGMFC_BAD_TYPE,
400
401     /* OF1.2+(6,11).  Unsupported or unknown command. */
402     OFPERR_OFPGMFC_BAD_COMMAND,
403
404     /* OF1.2+(6,12).  Error in bucket. */
405     OFPERR_OFPGMFC_BAD_BUCKET,
406
407     /* OF1.2+(6,13).  Error in watch port/group. */
408     OFPERR_OFPGMFC_BAD_WATCH,
409
410     /* OF1.2+(6,14).  Permissions error. */
411     OFPERR_OFPGMFC_EPERM,
412
413 /* ## --------------------- ## */
414 /* ## OFPET_PORT_MOD_FAILED ## */
415 /* ## --------------------- ## */
416
417     /* OF1.0(4,0), OF1.1+(7,0).  Specified port does not exist. */
418     OFPERR_OFPPMFC_BAD_PORT,
419
420     /* OF1.0(4,1), OF1.1+(7,1).  Specified hardware address does not match the
421      * port number. */
422     OFPERR_OFPPMFC_BAD_HW_ADDR,
423
424     /* OF1.1+(7,2).  Specified config is invalid. */
425     OFPERR_OFPPMFC_BAD_CONFIG,
426
427     /* OF1.1+(7,3).  Specified advertise is invalid. */
428     OFPERR_OFPPMFC_BAD_ADVERTISE,
429
430     /* OF1.2+(7,4).  Permissions error. */
431     OFPERR_OFPPMFC_EPERM,
432
433 /* ## ---------------------- ## */
434 /* ## OFPET_TABLE_MOD_FAILED ## */
435 /* ## ---------------------- ## */
436
437     /* OF1.1+(8,0).  Specified table does not exist. */
438     OFPERR_OFPTMFC_BAD_TABLE,
439
440     /* OF1.1+(8,1).  Specified config is invalid. */
441     OFPERR_OFPTMFC_BAD_CONFIG,
442
443     /* OF1.2+(8,2).  Permissions error. */
444     OFPERR_OFPTMFC_EPERM,
445
446 /* ## --------------------- ## */
447 /* ## OFPET_QUEUE_OP_FAILED ## */
448 /* ## --------------------- ## */
449
450     /* OF1.0(5,0), OF1.1+(9,0).  Invalid port (or port does not exist). */
451     OFPERR_OFPQOFC_BAD_PORT,
452
453     /* OF1.0(5,1), OF1.1+(9,1).  Queue does not exist. */
454     OFPERR_OFPQOFC_BAD_QUEUE,
455
456     /* OF1.0(5,2), OF1.1+(9,2).  Permissions error. */
457     OFPERR_OFPQOFC_EPERM,
458
459 /* ## -------------------------- ## */
460 /* ## OFPET_SWITCH_CONFIG_FAILED ## */
461 /* ## -------------------------- ## */
462
463     /* OF1.1+(10,0).  Specified flags is invalid. */
464     OFPERR_OFPSCFC_BAD_FLAGS,
465
466     /* OF1.1+(10,1).  Specified len is invalid. */
467     OFPERR_OFPSCFC_BAD_LEN,
468
469     /* OF1.2+(10,2).  Permissions error. */
470     OFPERR_OFPSCFC_EPERM,
471
472 /* ## ------------------------- ## */
473 /* ## OFPET_ROLE_REQUEST_FAILED ## */
474 /* ## ------------------------- ## */
475
476     /* OF1.2+(11,0).  Stale Message: old generation_id. */
477     OFPERR_OFPRRFC_STALE,
478
479     /* OF1.2+(11,1).  Controller role change unsupported. */
480     OFPERR_OFPRRFC_UNSUP,
481
482     /* NX1.0-1.1(1,513), OF1.2+(11,2).  Invalid role. */
483     OFPERR_OFPRRFC_BAD_ROLE,
484
485 /* ## ---------------------- ## */
486 /* ## OFPET_METER_MOD_FAILED ## */
487 /* ## ---------------------- ## */
488
489     /* OF1.3+(12,0).  Unspecified error. */
490     OFPERR_OFPMMFC_UNKNOWN,
491
492     /* OF1.3+(12,1).  Meter not added because a Meter ADD attempted to
493      * replace an existing Meter. */
494     OFPERR_OFPMMFC_METER_EXISTS,
495
496     /* OF1.3+(12,2).  Meter not added because Meter specified is invalid. */
497     OFPERR_OFPMMFC_INVALID_METER,
498
499     /* OF1.3+(12,3).  Meter not modified because a Meter MODIFY attempted
500      * to modify a non-existent Meter. */
501     OFPERR_OFPMMFC_UNKNOWN_METER,
502
503     /* OF1.3+(12,4).  Unsupported or unknown command. */
504     OFPERR_OFPMMFC_BAD_COMMAND,
505
506     /* OF1.3+(12,5).  Flag configuration unsupported. */
507     OFPERR_OFPMMFC_BAD_FLAGS,
508
509     /* OF1.3+(12,6).  Rate unsupported. */
510     OFPERR_OFPMMFC_BAD_RATE,
511
512     /* OF1.3+(12,7).  Burst size unsupported. */
513     OFPERR_OFPMMFC_BAD_BURST,
514
515     /* OF1.3+(12,8).  Band unsupported. */
516     OFPERR_OFPMMFC_BAD_BAND,
517
518     /* OF1.3+(12,9).  Band value unsupported. */
519     OFPERR_OFPMMFC_BAD_BAND_VALUE,
520
521     /* OF1.3+(12,10).  No more meters available. */
522     OFPERR_OFPMMFC_OUT_OF_METERS,
523
524     /* OF1.3+(12,11).  The maximum number of properties for a meter has
525      * been exceeded. */
526     OFPERR_OFPMMFC_OUT_OF_BANDS,
527
528 /* ## --------------------------- ## */
529 /* ## OFPET_TABLE_FEATURES_FAILED ## */
530 /* ## --------------------------- ## */
531
532     /* OF1.3+(13,0).  Specified table does not exist. */
533     OFPERR_OFPTFFC_BAD_TABLE,
534
535     /* OF1.3+(13,1).  Invalid metadata mask. */
536     OFPERR_OFPTFFC_BAD_METADATA,
537
538     /* OF1.3+(13,5).  Permissions error. */
539     OFPERR_OFPTFFC_EPERM,
540
541 /* ## ------------------ ## */
542 /* ## OFPET_BAD_PROPERTY ## */
543 /* ## ------------------ ## */
544
545     /* OF1.3(13,2), OF1.4+(14,0).  Unknown property type.
546      *
547      * [Known as OFPTFFC_BAD_TYPE in OF1.3.] */
548     OFPERR_OFPBPC_BAD_TYPE,
549
550     /* OF1.3(13,3), OF1.4+(14,1).  Length problem in property.
551      *
552      * [Known as OFPTFFC_BAD_LEN in OF1.3.] */
553     OFPERR_OFPBPC_BAD_LEN,
554
555     /* OF1.3(13,4), OF1.4+(14,2).  Unsupported property value.
556      *
557      * [Known as OFPTFFC_BAD_ARGUMENT in OF1.3.] */
558     OFPERR_OFPBPC_BAD_VALUE,
559
560     /* OF1.4+(14,3).  Can't handle this many properties. */
561     OFPERR_OFPBPC_TOO_MANY,
562
563     /* OF1.4+(14,4).  A property type was duplicated. */
564     OFPERR_OFPBPC_DUP_TYPE,
565
566     /* OF1.4+(14,5).  Unknown experimenter id specified. */
567     OFPERR_OFPBPC_BAD_EXPERIMENTER,
568
569     /* OF1.4+(14,6).  Unknown exp_type for experimenter id. */
570     OFPERR_OFPBPC_BAD_EXP_TYPE,
571
572     /* OF1.4+(14,7).  Unknown value for experimenter id. */
573     OFPERR_OFPBPC_BAD_EXP_VALUE,
574
575     /* OF1.4+(14,8).  Permissions error. */
576     OFPERR_OFPBPC_EPERM,
577
578 /* ## -------------------- ## */
579 /* ## OFPET_BUNDLE_FAILED  ## */
580 /* ## -------------------- ## */
581
582     /* OF1.4+(17,0).  Unspecified error. */
583     OFPERR_OFPBFC_UNKNOWN,
584
585     /* OF1.4+(17,1).  Permissions error. */
586     OFPERR_OFPBFC_EPERM,
587
588     /* OF1.4+(17,2).  Bundle ID doesn't exist. */
589     OFPERR_OFPBFC_BAD_ID,
590
591     /* OF1.4+(17,3).  Bundle ID already exists. */
592     OFPERR_OFPBFC_BUNDLE_EXIST,
593
594     /* OF1.4+(17,4).  Bundle ID is closed. */
595     OFPERR_OFPBFC_BUNDLE_CLOSED,
596
597     /* OF1.4+(17,5).  Too many bundle IDs. */
598     OFPERR_OFPBFC_OUT_OF_BUNDLES,
599
600     /* OF1.4+(17,6).  Unsupported of unknown message control type. */
601     OFPERR_OFPBFC_BAD_TYPE,
602
603     /* OF1.4+(17,7).  Unsupported, unknown, or inconsistent flags. */
604     OFPERR_OFPBFC_BAD_FLAGS,
605
606     /* OF1.4+(17,8).  Length problem in included message. */
607     OFPERR_OFPBFC_MSG_BAD_LEN,
608
609     /* OF1.4+(17,9).  Inconsistent or duplicate XID. */
610     OFPERR_OFPBFC_MSG_BAD_XID,
611
612     /* OF1.4+(17,10).  Unsupported message in this bundle. */
613     OFPERR_OFPBFC_MSG_UNSUP,
614
615     /* OF1.4+(17,11).  Unsupported message combination in this bundle. */
616     OFPERR_OFPBFC_MSG_CONFLICT,
617
618     /* OF1.4+(17,12).  Cant handle this many messages in bundle. */
619     OFPERR_OFPBFC_MSG_TOO_MANY,
620
621     /* OF1.4+(17,13).  One message in bundle failed. */
622     OFPERR_OFPBFC_MSG_FAILED,
623
624     /* OF1.4+(17,14).  Bundle is taking too long. */
625     OFPERR_OFPBFC_TIMEOUT,
626
627     /* OF1.4+(17,15).  Bundle is locking the resource. */
628     OFPERR_OFPBFC_BUNDLE_IN_PROGRESS,
629
630 /* ## ------------------------- ## */
631 /* ## OFPET_FLOW_MONITOR_FAILED ## */
632 /* ## ------------------------- ## */
633
634     /* OF1.4+(16,0).  Unspecified error. */
635     OFPERR_OFPMOFC_UNKNOWN,
636
637     /* NX1.0-1.1(1,517), NX1.2-1.3(6), OF1.4+(16,1).  Monitor not added
638      * because a Monitor ADD attempted to replace an existing Monitor. */
639     OFPERR_OFPMOFC_MONITOR_EXISTS,
640
641     /* OF1.4+(16,2).  Monitor not added because
642      * Monitor specified is invalid. */
643     OFPERR_OFPMOFC_INVALID_MONITOR,
644
645     /* NX1.0-1.1(1,519), NX1.2-1.3(8), OF1.4+(16,3).  Monitor not modified
646      * because a Monitor MODIFY attempted to modify a non-existent Monitor. */
647     OFPERR_OFPMOFC_UNKNOWN_MONITOR,
648
649     /* OF1.4+(16,4).  Unsupported or unknown command. */
650     OFPERR_OFPMOFC_BAD_COMMAND,
651
652     /* NX1.0-1.1(1,518), NX1.2-1.3(7), OF1.4+(16,5).  Flag configuration
653      * unsupported. */
654     OFPERR_OFPMOFC_BAD_FLAGS,
655
656     /* OF1.4+(16,6).  Specified table does not exist. */
657     OFPERR_OFPMOFC_BAD_TABLE_ID,
658
659     /* OF1.4+(16,7).  Error in output port/group. */
660     OFPERR_OFPMOFC_BAD_OUT,
661
662 /* ## ------------------ ## */
663 /* ## OFPET_EXPERIMENTER ## */
664 /* ## ------------------ ## */
665 };
666
667 const char *ofperr_domain_get_name(enum ofp_version);
668
669 bool ofperr_is_valid(enum ofperr);
670
671 enum ofperr ofperr_from_name(const char *);
672
673 enum ofperr ofperr_decode_msg(const struct ofp_header *,
674                               struct ofpbuf *payload);
675 struct ofpbuf *ofperr_encode_reply(enum ofperr, const struct ofp_header *);
676 struct ofpbuf *ofperr_encode_hello(enum ofperr, enum ofp_version ofp_version,
677                                    const char *);
678 int ofperr_get_vendor(enum ofperr, enum ofp_version);
679 int ofperr_get_type(enum ofperr, enum ofp_version);
680 int ofperr_get_code(enum ofperr, enum ofp_version);
681
682 const char *ofperr_get_name(enum ofperr);
683 const char *ofperr_get_description(enum ofperr);
684
685 void ofperr_format(struct ds *, enum ofperr);
686 const char *ofperr_to_string(enum ofperr);
687
688 #endif /* ofp-errors.h */