of_instruction_t * of_instruction_new(of_version_t version) { of_instruction_t *obj; int bytes; bytes = of_object_fixed_len[version][OF_INSTRUCTION] + of_object_extra_len[version][OF_INSTRUCTION]; /* Allocate a maximum-length wire buffer assuming we'll be appending to it. */ if ((obj = (of_instruction_t *)of_object_new(OF_WIRE_BUFFER_MAX_LENGTH)) == NULL) { return NULL; } of_instruction_init(obj, version, bytes, 0); return obj; }
int of_list_instruction_first(of_list_instruction_t *list, of_object_t *obj) { int rv; of_instruction_init(obj, list->version, -1, 1); if ((rv = of_list_first(list, obj)) < 0) { return rv; } of_instruction_wire_object_id_get(obj, &obj->object_id); of_tlv16_wire_length_get(obj, &obj->length); return rv; }