of_list_uint8_t * of_list_uint8_new(of_version_t version) { of_list_uint8_t *obj; int bytes; bytes = of_object_fixed_len[version][OF_LIST_UINT8] + of_object_extra_len[version][OF_LIST_UINT8]; if ((obj = (of_list_uint8_t *)of_object_new(OF_WIRE_BUFFER_MAX_LENGTH)) == NULL) { return NULL; } of_list_uint8_init(obj, version, bytes, 0); return obj; }
/** * Bind an object of type of_list_uint8_t to the parent of type of_table_feature_prop_next_tables for * member next_table_ids * @param obj Pointer to an object of type of_table_feature_prop_next_tables. * @param next_table_ids Pointer to the child object of type * of_list_uint8_t to be filled out. * \ingroup of_table_feature_prop_next_tables * * The parameter next_table_ids is filled out to point to the same underlying * wire buffer as its parent. * */ void of_table_feature_prop_next_tables_next_table_ids_bind( of_table_feature_prop_next_tables_t *obj, of_list_uint8_t *next_table_ids) { 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; int cur_len = 0; /* Current length of object data */ ASSERT(obj->object_id == OF_TABLE_FEATURE_PROP_NEXT_TABLES); 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; cur_len = _END_LEN(obj, offset); break; default: ASSERT(0); } abs_offset = OF_OBJECT_ABSOLUTE_OFFSET(obj, offset); ASSERT(abs_offset >= 0); ASSERT(cur_len >= 0 && cur_len < 64 * 1024); /* Initialize child */ of_list_uint8_init(next_table_ids, obj->version, 0, 1); /* Attach to parent */ next_table_ids->parent = (of_object_t *)obj; next_table_ids->wire_object.wbuf = obj->wire_object.wbuf; next_table_ids->wire_object.obj_offset = abs_offset; next_table_ids->wire_object.owned = 0; next_table_ids->length = cur_len; OF_LENGTH_CHECK_ASSERT(obj); return ; }