return error >= OFPERR_OFS && error < OFPERR_OFS + OFPERR_N_ERRORS;
}
-/* Returns true if 'error' is a valid OFPERR_* value that designates a whole
- * category of errors instead of a particular error, e.g. if it is an
- * OFPERR_OFPET_* value, and false otherwise. */
-bool
-ofperr_is_category(enum ofperr error)
-{
- return (ofperr_is_valid(error)
- && ofperr_of10.errors[error - OFPERR_OFS].code == -1
- && ofperr_of11.errors[error - OFPERR_OFS].code == -1);
-}
/* Returns true if 'error' can be encoded as an OpenFlow error message in
* 'domain', false otherwise.
*
return domain ? domain->decode(type, code) : 0;
}
-/* Returns the OFPERR_* value that corresponds to the category 'type' within
- * 'version', or 0 if either no such OFPERR_* value exists or 'version' is
- * unknown. */
-enum ofperr
-ofperr_decode_type(enum ofp_version version, uint16_t type)
-{
- const struct ofperr_domain *domain = ofperr_domain_from_version(version);
- return domain ? domain->decode_type(type) : 0;
-}
-
/* Returns the name of 'error', e.g. "OFPBRC_BAD_TYPE" if 'error' is
* OFPBRC_BAD_TYPE, or "<invalid>" if 'error' is not a valid OFPERR_* value.
*
code = ntohs(nve->code);
}
- /* Translate the error type and code into an ofperr.
- * If we don't know the error type and code, at least try for the type. */
+ /* Translate the error type and code into an ofperr. */
error = ofperr_decode(oh->version, type, code);
- if (!error) {
- error = ofperr_decode_type(oh->version, type);
- }
if (error && payload) {
ofpbuf_use_const(payload, b.data, b.size);
}
/* ## OFPET_HELLO_FAILED ## */
/* ## ------------------ ## */
- /* OF1.0+(0). Hello protocol failed. */
- OFPERR_OFPET_HELLO_FAILED = OFPERR_OFS,
-
/* OF1.0+(0,0). No compatible version. */
- OFPERR_OFPHFC_INCOMPATIBLE,
+ OFPERR_OFPHFC_INCOMPATIBLE = OFPERR_OFS,
/* OF1.0+(0,1). Permissions error. */
OFPERR_OFPHFC_EPERM,
/* ## OFPET_BAD_REQUEST ## */
/* ## ----------------- ## */
- /* OF1.0+(1). Request was not understood. */
- OFPERR_OFPET_BAD_REQUEST,
-
/* OF1.0+(1,0). ofp_header.version not supported. */
OFPERR_OFPBRC_BAD_VERSION,
/* ## OFPET_BAD_ACTION ## */
/* ## ---------------- ## */
- /* OF1.0+(2). Error in action description. */
- OFPERR_OFPET_BAD_ACTION,
-
/* OF1.0+(2,0). Unknown action type. */
OFPERR_OFPBAC_BAD_TYPE,
/* ## OFPET_BAD_INSTRUCTION ## */
/* ## --------------------- ## */
- /* OF1.1+(3). Error in instruction list. */
- OFPERR_OFPIT_BAD_INSTRUCTION,
-
/* OF1.1+(3,0). Unknown instruction. */
OFPERR_OFPBIC_UNKNOWN_INST,
/* ## OFPET_BAD_MATCH ## */
/* ## --------------- ## */
- /* OF1.1+(4). Error in match. */
- OFPERR_OFPET_BAD_MATCH,
-
/* OF1.1+(4,0). Unsupported match type specified by the match */
OFPERR_OFPBMC_BAD_TYPE,
/* ## OFPET_FLOW_MOD_FAILED ## */
/* ## --------------------- ## */
- /* OF1.0(3), OF1.1+(5). Problem modifying flow entry. */
- OFPERR_OFPET_FLOW_MOD_FAILED,
-
/* OF1.1+(5,0). Unspecified error. */
OFPERR_OFPFMFC_UNKNOWN,
/* ## OFPET_GROUP_MOD_FAILED ## */
/* ## ---------------------- ## */
- /* OF1.1+(6). Problem modifying group entry. */
- OFPERR_OFPET_GROUP_MOD_FAILED,
-
/* OF1.1+(6,0). Group not added because a group ADD attempted to replace
* an already-present group. */
OFPERR_OFPGMFC_GROUP_EXISTS,
/* ## OFPET_PORT_MOD_FAILED ## */
/* ## --------------------- ## */
- /* OF1.0(4), OF1.1+(7). OFPT_PORT_MOD failed. */
- OFPERR_OFPET_PORT_MOD_FAILED,
-
/* OF1.0(4,0), OF1.1+(7,0). Specified port does not exist. */
OFPERR_OFPPMFC_BAD_PORT,
/* ## OFPET_TABLE_MOD_FAILED ## */
/* ## ---------------------- ## */
- /* OF1.1+(8). Table mod request failed. */
- OFPERR_OFPET_TABLE_MOD_FAILED,
-
/* OF1.1+(8,0). Specified table does not exist. */
OFPERR_OFPTMFC_BAD_TABLE,
/* ## OFPET_QUEUE_OP_FAILED ## */
/* ## --------------------- ## */
- /* OF1.0(5), OF1.1+(9). Queue operation failed. */
- OFPERR_OFPET_QUEUE_OP_FAILED,
-
/* OF1.0(5,0), OF1.1+(9,0). Invalid port (or port does not exist). */
OFPERR_OFPQOFC_BAD_PORT,
/* ## OFPET_SWITCH_CONFIG_FAILED ## */
/* ## -------------------------- ## */
- /* OF1.1+(10). Switch config request failed. */
- OFPERR_OFPET_SWITCH_CONFIG_FAILED,
-
/* OF1.1+(10,0). Specified flags is invalid. */
OFPERR_OFPSCFC_BAD_FLAGS,
/* ## OFPET_ROLE_REQUEST_FAILED ## */
/* ## ------------------------- ## */
- /* OF1.2+(11). Controller Role request failed. */
- OFPERR_OFPET_ROLE_REQUEST_FAILED,
-
/* OF1.2+(11,0). Stale Message: old generation_id. */
OFPERR_OFPRRFC_STALE,
/* ## OFPET_METER_MOD_FAILED ## */
/* ## ---------------------- ## */
- /* OF1.3+(12). Error in meter. */
- OFPERR_OFPET_METER_MOD_FAILED,
-
/* OF1.3+(12,0). Unspecified error. */
OFPERR_OFPMMFC_UNKNOWN,
/* ## OFPET_TABLE_FEATURES_FAILED ## */
/* ## --------------------------- ## */
- /* OF1.3+(13). Setting table features failed. */
- OFPERR_OFPET_TABLE_FEATURES_FAILED,
-
/* OF1.3+(13,0). Specified table does not exist. */
OFPERR_OFPTFFC_BAD_TABLE,
/* ## ------------------ ## */
/* ## OFPET_EXPERIMENTER ## */
/* ## ------------------ ## */
-
- /* OF1.2+(0xffff). Experimenter error messages. */
- OFPERR_OFPET_EXPERIMENTER,
};
const char *ofperr_domain_get_name(enum ofp_version);
bool ofperr_is_valid(enum ofperr);
-bool ofperr_is_category(enum ofperr);
bool ofperr_is_encodable(enum ofperr, enum ofp_version);
enum ofperr ofperr_decode(enum ofp_version, uint16_t type, uint16_t code);
-enum ofperr ofperr_decode_type(enum ofp_version, uint16_t type);
enum ofperr ofperr_from_name(const char *);
enum ofperr ofperr_decode_msg(const struct ofp_header *,