loci: remove dead code
diff --git a/c_gen/c_code_gen.py b/c_gen/c_code_gen.py
index d9592e8..640687f 100644
--- a/c_gen/c_code_gen.py
+++ b/c_gen/c_code_gen.py
@@ -426,7 +426,6 @@
of_match_t *match);
extern int of_wire_buffer_of_match_set(of_object_t *obj, int offset,
of_match_t *match, int cur_len);
-extern void of_extension_object_id_set(of_object_t *obj, of_object_id_t id);
""")
# gen_base_types(out)
diff --git a/c_gen/c_type_maps.py b/c_gen/c_type_maps.py
index 09ee486..b0775d1 100644
--- a/c_gen/c_type_maps.py
+++ b/c_gen/c_type_maps.py
@@ -1094,92 +1094,6 @@
""")
- # Generate the function that sets the object type fields
- out.write("""
-
-/**
- * Map a message in a wire buffer object to its OF object id.
- * @param wbuf Pointer to a wire buffer object, populated with an OF message
- * @returns The object ID of the message
- * @returns OF_OBJECT_INVALID if unable to parse the message type
- *
- * Version must be set in the buffer prior to calling this routine
- */
-
-static inline int
-of_wire_message_object_id_set(of_wire_buffer_t *wbuf, of_object_id_t id)
-{
- int type;
- of_version_t ver;
- of_message_t msg;
-
- msg = (of_message_t)WBUF_BUF(wbuf);
-
- ver = of_message_version_get(msg);
-
- /* ASSERT(id is a message object) */
-
- if ((type = of_object_to_wire_type(id, ver)) < 0) {
- return OF_ERROR_PARAM;
- }
- of_message_type_set(msg, type);
-
- if ((type = of_object_to_stats_type(id, ver)) >= 0) {
- /* It's a stats obj */
- of_message_stats_type_set(msg, type);
- if (type == OF_STATS_TYPE_EXPERIMENTER) {
- switch (id) {
- case OF_BSN_LACP_STATS_REQUEST:
- case OF_BSN_LACP_STATS_REPLY:
- of_message_stats_experimenter_id_set(msg, OF_EXPERIMENTER_ID_BSN);
- of_message_stats_experimenter_subtype_set(msg, 1);
- break;
- case OF_BSN_SWITCH_PIPELINE_STATS_REQUEST:
- case OF_BSN_SWITCH_PIPELINE_STATS_REPLY:
- of_message_stats_experimenter_id_set(msg, OF_EXPERIMENTER_ID_BSN);
- of_message_stats_experimenter_subtype_set(msg, 6);
- break;
- case OF_BSN_PORT_COUNTER_STATS_REQUEST:
- case OF_BSN_PORT_COUNTER_STATS_REPLY:
- of_message_stats_experimenter_id_set(msg, OF_EXPERIMENTER_ID_BSN);
- of_message_stats_experimenter_subtype_set(msg, 8);
- break;
- case OF_BSN_VLAN_COUNTER_STATS_REQUEST:
- case OF_BSN_VLAN_COUNTER_STATS_REPLY:
- of_message_stats_experimenter_id_set(msg, OF_EXPERIMENTER_ID_BSN);
- of_message_stats_experimenter_subtype_set(msg, 9);
- break;
- default:
- break;
- }
- }
- }
- if ((type = of_object_to_error_type(id, ver)) >= 0) {
- /* It's an error obj */
- of_message_error_type_set(msg, type);
- }
- if ((type = of_object_to_flow_mod_command(id, ver)) >= 0) {
- /* It's a flow mod obj */
- of_message_flow_mod_command_set(msg, ver, type);
- }
- if ((type = of_object_to_group_mod_command(id, ver)) >= 0) {
- /* It's a group mod obj */
- of_message_group_mod_command_set(msg, type);
- }
- if (of_object_id_is_extension(id, ver)) {
- uint32_t val32;
-
- /* Set the experimenter and subtype codes */
- val32 = of_extension_to_experimenter_id(id, ver);
- of_message_experimenter_id_set(msg, val32);
- val32 = of_extension_to_experimenter_subtype(id, ver);
- of_message_experimenter_subtype_set(msg, val32);
- }
-
- return OF_ERROR_NONE;
-}
-""")
-
def gen_type_data_header(out):
out.write("""
@@ -1249,15 +1163,11 @@
extern void of_object_message_wire_length_set(of_object_t *obj, int bytes);
extern void of_oxm_wire_length_get(of_object_t *obj, int *bytes);
-extern void of_oxm_wire_length_set(of_object_t *obj, int bytes);
extern void of_oxm_wire_object_id_get(of_object_t *obj, of_object_id_t *id);
-extern void of_oxm_wire_object_id_set(of_object_t *obj, of_object_id_t id);
extern void of_tlv16_wire_length_get(of_object_t *obj, int *bytes);
extern void of_tlv16_wire_length_set(of_object_t *obj, int bytes);
-extern void of_tlv16_wire_object_id_set(of_object_t *obj, of_object_id_t id);
-
/* Wire length is uint16 at front of structure */
extern void of_u16_len_wire_length_get(of_object_t *obj, int *bytes);
extern void of_u16_len_wire_length_set(of_object_t *obj, int bytes);
diff --git a/c_gen/templates/of_message.h b/c_gen/templates/of_message.h
index befda2f..df74231 100644
--- a/c_gen/templates/of_message.h
+++ b/c_gen/templates/of_message.h
@@ -105,11 +105,6 @@
return (of_version_t)msg[OF_MESSAGE_VERSION_OFFSET];
}
-static inline void
-of_message_version_set(of_message_t msg, of_version_t version) {
- buf_u8_set(msg, (uint8_t)version);
-}
-
/**
* @brief Get/set OpenFlow type of a message
* @param msg Pointer to the message buffer of sufficient length
@@ -122,11 +117,6 @@
return msg[OF_MESSAGE_TYPE_OFFSET];
}
-static inline void
-of_message_type_set(of_message_t msg, uint8_t value) {
- buf_u8_set(msg + OF_MESSAGE_TYPE_OFFSET, value);
-}
-
/**
* @brief Get/set in-buffer length of a message
* @param msg Pointer to the message buffer of sufficient length
@@ -161,11 +151,6 @@
return val;
}
-static inline void
-of_message_xid_set(of_message_t msg, uint32_t xid) {
- buf_u32_set(msg + OF_MESSAGE_XID_OFFSET, xid);
-}
-
/**
* @brief Get/set stats type of a message
* @param msg Pointer to the message buffer of sufficient length
@@ -180,11 +165,6 @@
return val;
}
-static inline void
-of_message_stats_type_set(of_message_t msg, uint16_t type) {
- buf_u16_set(msg + OF_MESSAGE_STATS_TYPE_OFFSET, type);
-}
-
/**
* @brief Get/set error type of a message
* @param msg Pointer to the message buffer of sufficient length
@@ -199,11 +179,6 @@
return val;
}
-static inline void
-of_message_error_type_set(of_message_t msg, uint16_t type) {
- buf_u16_set(msg + OF_MESSAGE_ERROR_TYPE_OFFSET, type);
-}
-
/**
* @brief Get/set experimenter ID of a message
@@ -219,11 +194,6 @@
return val;
}
-static inline void
-of_message_experimenter_id_set(of_message_t msg, uint32_t experimenter_id) {
- buf_u32_set(msg + OF_MESSAGE_EXPERIMENTER_ID_OFFSET, experimenter_id);
-}
-
/**
* @brief Get/set experimenter message type (subtype) of a message
@@ -239,13 +209,6 @@
return val;
}
-static inline void
-of_message_experimenter_subtype_set(of_message_t msg,
- uint32_t subtype) {
- buf_u32_set(msg + OF_MESSAGE_EXPERIMENTER_SUBTYPE_OFFSET,
- subtype);
-}
-
/**
* Flow mod command changed from 16 to 8 bits on the wire from 1.0 to 1.1
*/
@@ -263,19 +226,6 @@
return val8;
}
-static inline void
-of_message_flow_mod_command_set(of_message_t msg, of_version_t version,
- uint8_t command) {
- uint16_t val16;
-
- if (version == OF_VERSION_1_0) {
- val16 = command;
- buf_u16_set(msg + OF_MESSAGE_FLOW_MOD_COMMAND_OFFSET(version), val16);
- } else {
- buf_u8_set(msg + OF_MESSAGE_FLOW_MOD_COMMAND_OFFSET(version), command);
- }
-}
-
/**
* @brief Get/set stats request/reply experimenter ID of a message
* @param msg Pointer to the message buffer of sufficient length
@@ -290,11 +240,6 @@
return val;
}
-static inline void
-of_message_stats_experimenter_id_set(of_message_t msg, uint32_t experimenter_id) {
- buf_u32_set(msg + OF_MESSAGE_STATS_EXPERIMENTER_ID_OFFSET, experimenter_id);
-}
-
/**
* @brief Get/set stats request/reply experimenter subtype of a message
* @param msg Pointer to the message buffer of sufficient length
@@ -309,11 +254,6 @@
return val;
}
-static inline void
-of_message_stats_experimenter_subtype_set(of_message_t msg, uint32_t subtype) {
- buf_u32_set(msg + OF_MESSAGE_STATS_EXPERIMENTER_SUBTYPE_OFFSET, subtype);
-}
-
/**
* @brief Get/set group mod command of a message
* @param msg Pointer to the message buffer of sufficient length
@@ -328,9 +268,4 @@
return val;
}
-static inline void
-of_message_group_mod_command_set(of_message_t msg, uint16_t command) {
- buf_u16_set(msg + OF_MESSAGE_GROUP_MOD_COMMAND_OFFSET, command);
-}
-
#endif /* _OF_MESSAGE_H_ */
diff --git a/c_gen/templates/of_type_maps.c b/c_gen/templates/of_type_maps.c
index 2314d67..4b35dcc 100644
--- a/c_gen/templates/of_type_maps.c
+++ b/c_gen/templates/of_type_maps.c
@@ -139,30 +139,6 @@
}
/**
- * Set the object ID based on the wire buffer for any TLV object
- * @param obj The object being referenced
- * @param id The ID value representing what should be stored.
- */
-
-void
-of_tlv16_wire_object_id_set(of_object_t *obj, of_object_id_t id)
-{
- int wire_type;
- of_wire_buffer_t *wbuf = OF_OBJECT_TO_WBUF(obj);
- ASSERT(wbuf != NULL);
-
- wire_type = of_object_to_type_map[obj->version][id];
- ASSERT(wire_type >= 0);
-
- of_wire_buffer_u16_set(wbuf,
- OF_OBJECT_ABSOLUTE_OFFSET(obj, TLV16_WIRE_TYPE_OFFSET), wire_type);
-
- if (wire_type == OF_EXPERIMENTER_TYPE) {
- of_extension_object_id_set(obj, id);
- }
-}
-
-/**
* Get the object ID of an extended action
* @param obj The object being referenced
* @param id Where to store the object ID
@@ -209,44 +185,6 @@
}
/**
- * Set wire data for extension objects, not messages.
- */
-
-void
-of_extension_object_id_set(of_object_t *obj, of_object_id_t id)
-{
- uint8_t *buf = OF_OBJECT_BUFFER_INDEX(obj, 0);
-
- switch (id) {
- case OF_ACTION_BSN_MIRROR:
- case OF_ACTION_ID_BSN_MIRROR:
- buf_u32_set(buf + OF_ACTION_EXPERIMENTER_ID_OFFSET,
- OF_EXPERIMENTER_ID_BSN);
- buf_u32_set(buf + OF_ACTION_EXPERIMENTER_SUBTYPE_OFFSET, 1);
- break;
- case OF_ACTION_BSN_SET_TUNNEL_DST:
- case OF_ACTION_ID_BSN_SET_TUNNEL_DST:
- buf_u32_set(buf + OF_ACTION_EXPERIMENTER_ID_OFFSET,
- OF_EXPERIMENTER_ID_BSN);
- buf_u32_set(buf + OF_ACTION_EXPERIMENTER_SUBTYPE_OFFSET, 2);
- break;
- case OF_ACTION_NICIRA_DEC_TTL:
- case OF_ACTION_ID_NICIRA_DEC_TTL:
- buf_u32_set(buf + OF_ACTION_EXPERIMENTER_ID_OFFSET,
- OF_EXPERIMENTER_ID_NICIRA);
- buf_u16_set(buf + OF_ACTION_EXPERIMENTER_SUBTYPE_OFFSET, 18);
- break;
- case OF_INSTRUCTION_BSN_DISABLE_SRC_MAC_CHECK:
- buf_u32_set(buf + OF_INSTRUCTION_EXPERIMENTER_ID_OFFSET,
- OF_EXPERIMENTER_ID_BSN);
- buf_u32_set(buf + OF_INSTRUCTION_EXPERIMENTER_SUBTYPE_OFFSET, 0);
- break;
- default:
- break;
- }
-}
-
-/**
* Get the object ID of an extended action
* @param obj The object being referenced
* @param id Where to store the object ID
@@ -551,27 +489,6 @@
}
/**
- * Set the length of an OXM object in the wire buffer
- * @param obj The object whose wire buffer is an OXM type
- * @param bytes Value to store in wire buffer
- */
-
-void
-of_oxm_wire_length_set(of_object_t *obj, int bytes)
-{
- uint32_t type_len;
- of_wire_buffer_t *wbuf;
-
- ASSERT(bytes >= 0 && bytes < 256);
-
- /* Read-modify-write */
- _GET_OXM_TYPE_LEN(obj, &type_len, wbuf);
- OF_OXM_LENGTH_SET(type_len, bytes);
- of_wire_buffer_u32_set(wbuf,
- OF_OBJECT_ABSOLUTE_OFFSET(obj, OXM_HDR_OFFSET), type_len);
-}
-
-/**
* Get the object ID of an OXM object based on the wire buffer type
* @param obj The object whose wire buffer is an OXM type
* @param id (out) Where the ID is stored
@@ -587,80 +504,6 @@
*id = of_oxm_to_object_id(type_len, obj->version);
}
-/**
- * Set the wire type of an OXM object based on the object ID passed
- * @param obj The object whose wire buffer is an OXM type
- * @param id The object ID mapped to an OXM wire type which is stored
- */
-
-void
-of_oxm_wire_object_id_set(of_object_t *obj, of_object_id_t id)
-{
- uint32_t type_len;
- int wire_type;
- of_wire_buffer_t *wbuf;
-
- ASSERT(OF_OXM_VALID_ID(id));
-
- /* Read-modify-write */
- _GET_OXM_TYPE_LEN(obj, &type_len, wbuf);
-
- switch (id) {
- case OF_OXM_BSN_IN_PORTS_128:
- type_len = 0x00030000 | (type_len & 0xff);
- break;
- case OF_OXM_BSN_IN_PORTS_128_MASKED:
- type_len = 0x00030100 | (type_len & 0xff);
- break;
- case OF_OXM_BSN_LAG_ID:
- type_len = 0x00030200 | (type_len & 0xff);
- break;
- case OF_OXM_BSN_LAG_ID_MASKED:
- type_len = 0x00030300 | (type_len & 0xff);
- break;
- case OF_OXM_BSN_VRF:
- type_len = 0x00030400 | (type_len & 0xff);
- break;
- case OF_OXM_BSN_VRF_MASKED:
- type_len = 0x00030500 | (type_len & 0xff);
- break;
- case OF_OXM_BSN_GLOBAL_VRF_ALLOWED:
- type_len = 0x00030600 | (type_len & 0xff);
- break;
- case OF_OXM_BSN_GLOBAL_VRF_ALLOWED_MASKED:
- type_len = 0x00030700 | (type_len & 0xff);
- break;
- case OF_OXM_BSN_L3_INTERFACE_CLASS_ID:
- type_len = 0x00030800 | (type_len & 0xff);
- break;
- case OF_OXM_BSN_L3_INTERFACE_CLASS_ID_MASKED:
- type_len = 0x00030900 | (type_len & 0xff);
- break;
- case OF_OXM_BSN_L3_SRC_CLASS_ID:
- type_len = 0x00030a00 | (type_len & 0xff);
- break;
- case OF_OXM_BSN_L3_SRC_CLASS_ID_MASKED:
- type_len = 0x00030b00 | (type_len & 0xff);
- break;
- case OF_OXM_BSN_L3_DST_CLASS_ID:
- type_len = 0x00030c00 | (type_len & 0xff);
- break;
- case OF_OXM_BSN_L3_DST_CLASS_ID_MASKED:
- type_len = 0x00030d00 | (type_len & 0xff);
- break;
- default:
- wire_type = of_object_to_wire_type(id, obj->version);
- ASSERT(wire_type >= 0);
- type_len = 0x80000000 | (wire_type << 8) | (type_len & 0xff);
- break;
- }
-
- of_wire_buffer_u32_set(wbuf,
- OF_OBJECT_ABSOLUTE_OFFSET(obj, OXM_HDR_OFFSET), type_len);
-}
-
-
-
#define OF_U16_LEN_LENGTH_OFFSET 0
/**