static int test_validate_tlv16_list(void) { of_flow_modify_t *obj = of_flow_modify_new(OF_VERSION_1_0); of_list_action_t list; of_action_set_tp_dst_t element1; of_action_output_t element2; of_message_t msg; of_flow_modify_actions_bind(obj, &list); of_action_set_tp_dst_init(&element1, OF_VERSION_1_0, -1, 1); of_list_action_append_bind(&list, (of_action_t *)&element1); of_action_output_init(&element2, OF_VERSION_1_0, -1, 1); of_list_action_append_bind(&list, (of_action_t *)&element2); msg = OF_OBJECT_TO_MESSAGE(obj); TEST_ASSERT(of_validate_message(msg, of_message_length_get(msg)) == 0); of_message_length_set(msg, of_message_length_get(msg) - 1); TEST_ASSERT(of_validate_message(msg, of_message_length_get(msg)) == -1); of_message_length_set(msg, of_message_length_get(msg) + 2); TEST_ASSERT(of_validate_message(msg, of_message_length_get(msg)) == -1); of_flow_modify_delete(obj); return TEST_PASS; }
/** * Create a copy of actions into a new variable of type of_list_action_t from * a of_flow_modify instance. * * @param obj Pointer to the source of type of_flow_modify_t * @returns A pointer to a new instance of type of_list_action_t whose contents * match that of actions from source * @returns NULL if an error occurs */ of_list_action_t * of_flow_modify_actions_get(of_flow_modify_t *obj) { of_list_action_t _actions; of_list_action_t *_actions_ptr; of_flow_modify_actions_bind(obj, &_actions); _actions_ptr = (of_list_action_t *)of_object_dup(&_actions); return _actions_ptr; }