struct ofpbuf *buffer;
buffer = make_add_flow(rule, buffer_id, idle_timeout, sizeof *oao);
- ofputil_put_OFPAT_OUTPUT(buffer)->port = htons(out_port);
+ ofputil_put_OFPAT10_OUTPUT(buffer)->port = htons(out_port);
return buffer;
} else {
return make_add_flow(rule, buffer_id, idle_timeout, 0);
: ofp10_port + OFPP11_OFFSET);
}
-/* Checks that 'port' is a valid output port for the OFPAT_OUTPUT action, given
+/* Checks that 'port' is a valid output port for the OFPAT10_OUTPUT action, given
* that the switch will never have more than 'max_ports' ports. Returns 0 if
* 'port' is valid, otherwise an OpenFlow return code. */
enum ofperr
error = 0;
switch ((enum ofputil_action_code) code) {
- case OFPUTIL_OFPAT_OUTPUT:
+ case OFPUTIL_OFPAT10_OUTPUT:
error = ofputil_check_output_port(ntohs(a->output.port),
max_ports);
break;
- case OFPUTIL_OFPAT_SET_VLAN_VID:
+ case OFPUTIL_OFPAT10_SET_VLAN_VID:
if (a->vlan_vid.vlan_vid & ~htons(0xfff)) {
error = OFPERR_OFPBAC_BAD_ARGUMENT;
}
break;
- case OFPUTIL_OFPAT_SET_VLAN_PCP:
+ case OFPUTIL_OFPAT10_SET_VLAN_PCP:
if (a->vlan_pcp.vlan_pcp & ~7) {
error = OFPERR_OFPBAC_BAD_ARGUMENT;
}
break;
- case OFPUTIL_OFPAT_ENQUEUE:
+ case OFPUTIL_OFPAT10_ENQUEUE:
port = ntohs(((const struct ofp_action_enqueue *) a)->port);
if (port >= max_ports && port != OFPP_IN_PORT
&& port != OFPP_LOCAL) {
}
break;
- case OFPUTIL_OFPAT_STRIP_VLAN:
- case OFPUTIL_OFPAT_SET_NW_SRC:
- case OFPUTIL_OFPAT_SET_NW_DST:
- case OFPUTIL_OFPAT_SET_NW_TOS:
- case OFPUTIL_OFPAT_SET_TP_SRC:
- case OFPUTIL_OFPAT_SET_TP_DST:
- case OFPUTIL_OFPAT_SET_DL_SRC:
- case OFPUTIL_OFPAT_SET_DL_DST:
+ case OFPUTIL_OFPAT10_STRIP_VLAN:
+ case OFPUTIL_OFPAT10_SET_NW_SRC:
+ case OFPUTIL_OFPAT10_SET_NW_DST:
+ case OFPUTIL_OFPAT10_SET_NW_TOS:
+ case OFPUTIL_OFPAT10_SET_TP_SRC:
+ case OFPUTIL_OFPAT10_SET_TP_DST:
+ case OFPUTIL_OFPAT10_SET_DL_SRC:
+ case OFPUTIL_OFPAT10_SET_DL_DST:
case OFPUTIL_NXAST_RESUBMIT:
case OFPUTIL_NXAST_SET_TUNNEL:
case OFPUTIL_NXAST_SET_QUEUE:
static const struct ofputil_action *
ofputil_decode_ofpat_action(const union ofp_action *a)
{
- enum ofp_action_type type = ntohs(a->type);
+ enum ofp10_action_type type = ntohs(a->type);
switch (type) {
-#define OFPAT_ACTION(ENUM, STRUCT, NAME) \
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME) \
case ENUM: { \
static const struct ofputil_action action = { \
OFPUTIL_##ENUM, \
}
#include "ofp-util.def"
- case OFPAT_VENDOR:
+ case OFPAT10_VENDOR:
default:
return &action_bad_type;
}
}
}
-/* Parses 'a' to determine its type. Returns a nonnegative OFPUTIL_OFPAT_* or
+/* Parses 'a' to determine its type. Returns a nonnegative OFPUTIL_OFPAT10_* or
* OFPUTIL_NXAST_* constant if successful, otherwise a negative OFPERR_* error
* code.
*
const struct ofputil_action *action;
uint16_t len = ntohs(a->header.len);
- if (a->type != htons(OFPAT_VENDOR)) {
+ if (a->type != htons(OFPAT10_VENDOR)) {
action = ofputil_decode_ofpat_action(a);
} else {
switch (ntohl(a->vendor.vendor)) {
: -OFPERR_OFPBAC_BAD_LEN);
}
-/* Parses 'a' and returns its type as an OFPUTIL_OFPAT_* or OFPUTIL_NXAST_*
+/* Parses 'a' and returns its type as an OFPUTIL_OFPAT10_* or OFPUTIL_NXAST_*
* constant. The caller must have already validated that 'a' is a valid action
* understood by Open vSwitch (e.g. by a previous successful call to
* ofputil_decode_action()). */
{
const struct ofputil_action *action;
- if (a->type != htons(OFPAT_VENDOR)) {
+ if (a->type != htons(OFPAT10_VENDOR)) {
action = ofputil_decode_ofpat_action(a);
} else {
action = ofputil_decode_nxast_action(a);
}
/* Returns the 'enum ofputil_action_code' corresponding to 'name' (e.g. if
- * 'name' is "output" then the return value is OFPUTIL_OFPAT_OUTPUT), or -1 if
+ * 'name' is "output" then the return value is OFPUTIL_OFPAT10_OUTPUT), or -1 if
* 'name' is not the name of any action.
*
* ofp-util.def lists the mapping from names to action. */
ofputil_action_code_from_name(const char *name)
{
static const char *names[OFPUTIL_N_ACTIONS] = {
-#define OFPAT_ACTION(ENUM, STRUCT, NAME) NAME,
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME) NAME,
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) NAME,
#include "ofp-util.def"
};
ofputil_put_action(enum ofputil_action_code code, struct ofpbuf *buf)
{
switch (code) {
-#define OFPAT_ACTION(ENUM, STRUCT, NAME) \
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME) \
case OFPUTIL_##ENUM: return ofputil_put_##ENUM(buf);
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \
case OFPUTIL_##ENUM: return ofputil_put_##ENUM(buf);
NOT_REACHED();
}
-#define OFPAT_ACTION(ENUM, STRUCT, NAME) \
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME) \
void \
ofputil_init_##ENUM(struct STRUCT *s) \
{ \
ofputil_init_##ENUM(struct STRUCT *s) \
{ \
memset(s, 0, sizeof *s); \
- s->type = htons(OFPAT_VENDOR); \
+ s->type = htons(OFPAT10_VENDOR); \
s->len = htons(sizeof *s); \
s->vendor = htonl(NX_VENDOR_ID); \
s->subtype = htons(ENUM); \
action_outputs_to_port(const union ofp_action *action, ovs_be16 port)
{
switch (ntohs(action->type)) {
- case OFPAT_OUTPUT:
+ case OFPAT10_OUTPUT:
return action->output.port == port;
- case OFPAT_ENQUEUE:
+ case OFPAT10_ENQUEUE:
return ((const struct ofp_action_enqueue *) action)->port == port;
default:
return false;