コード例 #1
0
/**
 * Set value in an object of type of_oxm_bsn_l3_interface_class_id.
 * @param obj Pointer to an object of type of_oxm_bsn_l3_interface_class_id.
 * @param value The value to write into the object
 */
void
of_oxm_bsn_l3_interface_class_id_value_set(
    of_oxm_bsn_l3_interface_class_id_t *obj,
    uint32_t value)
{
    of_wire_buffer_t *wbuf;
    int offset = 0; /* Offset of value relative to the start obj */
    int abs_offset; /* Offset of value relative to start of wbuf */
    of_version_t ver;

    ASSERT(obj->object_id == OF_OXM_BSN_L3_INTERFACE_CLASS_ID);
    ver = obj->version;
    wbuf = OF_OBJECT_TO_WBUF(obj);
    ASSERT(wbuf != NULL);

    /* By version, determine offset and current length (where needed) */
    switch (ver) {
    case OF_VERSION_1_2:
    case OF_VERSION_1_3:
        offset = 4;
        break;
    default:
        ASSERT(0);
    }

    abs_offset = OF_OBJECT_ABSOLUTE_OFFSET(obj, offset);
    ASSERT(abs_offset >= 0);
    of_wire_buffer_u32_set(wbuf, abs_offset, value);

    OF_LENGTH_CHECK_ASSERT(obj);

    return ;
}
コード例 #2
0
ファイル: of_hello.c プロジェクト: milouxk/loxigen-artifacts
/**
 * Set xid in an object of type of_hello.
 * @param obj Pointer to an object of type of_hello.
 * @param xid The value to write into the object
 */
void
of_hello_xid_set(
    of_hello_t *obj,
    uint32_t xid)
{
    of_wire_buffer_t *wbuf;
    int offset = 0; /* Offset of value relative to the start obj */
    int abs_offset; /* Offset of value relative to start of wbuf */
    of_version_t ver;

    ASSERT(obj->object_id == OF_HELLO);
    ver = obj->version;
    wbuf = OF_OBJECT_TO_WBUF(obj);
    ASSERT(wbuf != NULL);

    /* By version, determine offset and current length (where needed) */
    switch (ver) {
    case OF_VERSION_1_0:
    case OF_VERSION_1_1:
    case OF_VERSION_1_2:
    case OF_VERSION_1_3:
        offset = 4;
        break;
    default:
        ASSERT(0);
    }

    abs_offset = OF_OBJECT_ABSOLUTE_OFFSET(obj, offset);
    ASSERT(abs_offset >= 0);
    of_wire_buffer_u32_set(wbuf, abs_offset, xid);

    OF_LENGTH_CHECK_ASSERT(obj);

    return ;
}
コード例 #3
0
/**
 * Set subtype in an object of type of_action_id_bsn_set_tunnel_dst.
 * @param obj Pointer to an object of type of_action_id_bsn_set_tunnel_dst.
 * @param subtype The value to write into the object
 */
void
of_action_id_bsn_set_tunnel_dst_subtype_set(
    of_action_id_bsn_set_tunnel_dst_t *obj,
    uint32_t subtype)
{
    of_wire_buffer_t *wbuf;
    int offset = 0; /* Offset of value relative to the start obj */
    int abs_offset; /* Offset of value relative to start of wbuf */
    of_version_t ver;

    ASSERT(obj->object_id == OF_ACTION_ID_BSN_SET_TUNNEL_DST);
    ver = obj->version;
    wbuf = OF_OBJECT_TO_WBUF(obj);
    ASSERT(wbuf != NULL);

    /* By version, determine offset and current length (where needed) */
    switch (ver) {
    case OF_VERSION_1_3:
        offset = 8;
        break;
    default:
        ASSERT(0);
    }

    abs_offset = OF_OBJECT_ABSOLUTE_OFFSET(obj, offset);
    ASSERT(abs_offset >= 0);
    of_wire_buffer_u32_set(wbuf, abs_offset, subtype);

    OF_LENGTH_CHECK_ASSERT(obj);

    return ;
}
コード例 #4
0
/**
 * Set role in an object of type of_bsn_controller_connection.
 * @param obj Pointer to an object of type of_bsn_controller_connection.
 * @param role The value to write into the object
 */
void
of_bsn_controller_connection_role_set(
    of_bsn_controller_connection_t *obj,
    uint32_t role)
{
    of_wire_buffer_t *wbuf;
    int offset = 0; /* Offset of value relative to the start obj */
    int abs_offset; /* Offset of value relative to start of wbuf */
    of_version_t ver;

    ASSERT(obj->object_id == OF_BSN_CONTROLLER_CONNECTION);
    ver = obj->version;
    wbuf = OF_OBJECT_TO_WBUF(obj);
    ASSERT(wbuf != NULL);

    /* By version, determine offset and current length (where needed) */
    switch (ver) {
    case OF_VERSION_1_3:
        offset = 4;
        break;
    default:
        ASSERT(0);
    }

    abs_offset = OF_OBJECT_ABSOLUTE_OFFSET(obj, offset);
    ASSERT(abs_offset >= 0);
    of_wire_buffer_u32_set(wbuf, abs_offset, role);

    OF_LENGTH_CHECK_ASSERT(obj);

    return ;
}
コード例 #5
0
/**
 * Set burst_size in an object of type of_meter_band_drop.
 * @param obj Pointer to an object of type of_meter_band_drop.
 * @param burst_size The value to write into the object
 */
void
of_meter_band_drop_burst_size_set(
    of_meter_band_drop_t *obj,
    uint32_t burst_size)
{
    of_wire_buffer_t *wbuf;
    int offset = 0; /* Offset of value relative to the start obj */
    int abs_offset; /* Offset of value relative to start of wbuf */
    of_version_t ver;

    ASSERT(obj->object_id == OF_METER_BAND_DROP);
    ver = obj->version;
    wbuf = OF_OBJECT_TO_WBUF(obj);
    ASSERT(wbuf != NULL);

    /* By version, determine offset and current length (where needed) */
    switch (ver) {
    case OF_VERSION_1_3:
        offset = 8;
        break;
    default:
        ASSERT(0);
    }

    abs_offset = OF_OBJECT_ABSOLUTE_OFFSET(obj, offset);
    ASSERT(abs_offset >= 0);
    of_wire_buffer_u32_set(wbuf, abs_offset, burst_size);

    OF_LENGTH_CHECK_ASSERT(obj);

    return ;
}
コード例 #6
0
/**
 * Set experimenter in an object of type of_bsn_set_lacp_request.
 * @param obj Pointer to an object of type of_bsn_set_lacp_request.
 * @param experimenter The value to write into the object
 */
void
of_bsn_set_lacp_request_experimenter_set(
    of_bsn_set_lacp_request_t *obj,
    uint32_t experimenter)
{
    of_wire_buffer_t *wbuf;
    int offset = 0; /* Offset of value relative to the start obj */
    int abs_offset; /* Offset of value relative to start of wbuf */
    of_version_t ver;

    ASSERT(obj->object_id == OF_BSN_SET_LACP_REQUEST);
    ver = obj->version;
    wbuf = OF_OBJECT_TO_WBUF(obj);
    ASSERT(wbuf != NULL);

    /* By version, determine offset and current length (where needed) */
    switch (ver) {
    case OF_VERSION_1_3:
        offset = 8;
        break;
    default:
        ASSERT(0);
    }

    abs_offset = OF_OBJECT_ABSOLUTE_OFFSET(obj, offset);
    ASSERT(abs_offset >= 0);
    of_wire_buffer_u32_set(wbuf, abs_offset, experimenter);

    OF_LENGTH_CHECK_ASSERT(obj);

    return ;
}
コード例 #7
0
/**
 * Set out_group in an object of type of_flow_modify.
 * @param obj Pointer to an object of type of_flow_modify.
 * @param out_group The value to write into the object
 */
void
of_flow_modify_out_group_set(
    of_flow_modify_t *obj,
    uint32_t out_group)
{
    of_wire_buffer_t *wbuf;
    int offset = 0; /* Offset of value relative to the start obj */
    int abs_offset; /* Offset of value relative to start of wbuf */
    of_version_t ver;

    ASSERT(IS_FLOW_MOD_SUBTYPE(obj->object_id));
    ver = obj->version;
    wbuf = OF_OBJECT_TO_WBUF(obj);
    ASSERT(wbuf != NULL);

    /* By version, determine offset and current length (where needed) */
    switch (ver) {
    case OF_VERSION_1_1:
    case OF_VERSION_1_2:
    case OF_VERSION_1_3:
        offset = 40;
        break;
    default:
        ASSERT(0);
    }

    abs_offset = OF_OBJECT_ABSOLUTE_OFFSET(obj, offset);
    ASSERT(abs_offset >= 0);
    of_wire_buffer_u32_set(wbuf, abs_offset, out_group);

    OF_LENGTH_CHECK_ASSERT(obj);

    return ;
}
/**
 * Set subtype in an object of type of_bsn_gentable_entry_desc_stats_reply.
 * @param obj Pointer to an object of type of_bsn_gentable_entry_desc_stats_reply.
 * @param subtype The value to write into the object
 */
void
of_bsn_gentable_entry_desc_stats_reply_subtype_set(
    of_bsn_gentable_entry_desc_stats_reply_t *obj,
    uint32_t subtype)
{
    of_wire_buffer_t *wbuf;
    int offset = 0; /* Offset of value relative to the start obj */
    int abs_offset; /* Offset of value relative to start of wbuf */
    of_version_t ver;

    ASSERT(obj->object_id == OF_BSN_GENTABLE_ENTRY_DESC_STATS_REPLY);
    ver = obj->version;
    wbuf = OF_OBJECT_TO_WBUF(obj);
    ASSERT(wbuf != NULL);

    /* By version, determine offset and current length (where needed) */
    switch (ver) {
    case OF_VERSION_1_3:
        offset = 20;
        break;
    default:
        ASSERT(0);
    }

    abs_offset = OF_OBJECT_ABSOLUTE_OFFSET(obj, offset);
    ASSERT(abs_offset >= 0);
    of_wire_buffer_u32_set(wbuf, abs_offset, subtype);

    OF_LENGTH_CHECK_ASSERT(obj);

    return ;
}
コード例 #9
0
/**
 * Set experimenter in an object of type of_experimenter_error_msg.
 * @param obj Pointer to an object of type of_experimenter_error_msg.
 * @param experimenter The value to write into the object
 */
void
of_experimenter_error_msg_experimenter_set(
    of_experimenter_error_msg_t *obj,
    uint32_t experimenter)
{
    of_wire_buffer_t *wbuf;
    int offset = 0; /* Offset of value relative to the start obj */
    int abs_offset; /* Offset of value relative to start of wbuf */
    of_version_t ver;

    ASSERT(obj->object_id == OF_EXPERIMENTER_ERROR_MSG);
    ver = obj->version;
    wbuf = OF_OBJECT_TO_WBUF(obj);
    ASSERT(wbuf != NULL);

    /* By version, determine offset and current length (where needed) */
    switch (ver) {
    case OF_VERSION_1_2:
    case OF_VERSION_1_3:
        offset = 12;
        break;
    default:
        ASSERT(0);
    }

    abs_offset = OF_OBJECT_ABSOLUTE_OFFSET(obj, offset);
    ASSERT(abs_offset >= 0);
    of_wire_buffer_u32_set(wbuf, abs_offset, experimenter);

    OF_LENGTH_CHECK_ASSERT(obj);

    return ;
}
コード例 #10
0
int
of_object_xid_set(of_object_t *obj, uint32_t xid)
{
    of_wire_buffer_t *wbuf;

    if ((wbuf = OF_OBJECT_TO_WBUF(obj)) == NULL) {
        return OF_ERROR_PARAM;
    }
    of_wire_buffer_u32_set(wbuf, 
        OF_OBJECT_ABSOLUTE_OFFSET(obj, OF_MESSAGE_XID_OFFSET), xid);
    return OF_ERROR_NONE;
}
コード例 #11
0
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);
}
コード例 #12
0
ファイル: of_type_maps.c プロジェクト: capveg/loxigen
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);
    wire_type = of_object_to_wire_type(id, obj->version);
    ASSERT(wire_type >= 0);
    OF_OXM_MASKED_TYPE_SET(type_len, wire_type);
    of_wire_buffer_u32_set(wbuf, 
           OF_OBJECT_ABSOLUTE_OFFSET(obj, OXM_HDR_OFFSET), type_len);
}
コード例 #13
0
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);
}