loci: remove setup-from-add functions
Indigo hasn't used these in a long time.
diff --git a/c_gen/c_test_gen.py b/c_gen/c_test_gen.py
index f0c9b0f..3eaaf82 100644
--- a/c_gen/c_test_gen.py
+++ b/c_gen/c_test_gen.py
@@ -349,7 +349,6 @@
extern int run_scalar_acc_tests(void);
extern int run_list_tests(void);
extern int run_message_tests(void);
-extern int run_setup_from_add_tests(void);
extern int run_validator_tests(void);
diff --git a/c_gen/templates/loci_setup_from_add_fns.c b/c_gen/templates/loci_setup_from_add_fns.c
deleted file mode 100644
index 5f63d29..0000000
--- a/c_gen/templates/loci_setup_from_add_fns.c
+++ /dev/null
@@ -1,250 +0,0 @@
-:: # Copyright 2013, Big Switch Networks, Inc.
-:: #
-:: # LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
-:: # the following special exception:
-:: #
-:: # LOXI Exception
-:: #
-:: # As a special exception to the terms of the EPL, you may distribute libraries
-:: # generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
-:: # that copyright and licensing notices generated by LoxiGen are not altered or removed
-:: # from the LoxiGen Libraries and the notice provided below is (i) included in
-:: # the LoxiGen Libraries, if distributed in source code form and (ii) included in any
-:: # documentation for the LoxiGen Libraries, if distributed in binary form.
-:: #
-:: # Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
-:: #
-:: # You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
-:: # a copy of the EPL at:
-:: #
-:: # http://www.eclipse.org/legal/epl-v10.html
-:: #
-:: # Unless required by applicable law or agreed to in writing, software
-:: # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-:: # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-:: # EPL for the specific language governing permissions and limitations
-:: # under the EPL.
-:: include('_copyright.c')
-#include <loci/loci.h>
-#include <loci/of_object.h>
-#include "loci_log.h"
-#include "loci_int.h"
-
-/* Flow stats entry setup for all versions */
-
-static int
-flow_stats_entry_setup_from_flow_add_common(of_flow_stats_entry_t *obj,
- of_flow_add_t *flow_add,
- of_object_t *effects,
- int entry_match_offset,
- int add_match_offset)
-{
- int entry_len, add_len;
- of_wire_buffer_t *wbuf;
- int abs_offset;
- int delta;
- uint16_t val16;
- uint64_t cookie;
- of_octets_t match_octets;
-
- /* Transfer the match underlying object from add to stats entry */
- wbuf = OF_OBJECT_TO_WBUF(obj);
- entry_len = _WIRE_MATCH_PADDED_LEN(obj, entry_match_offset);
- add_len = _WIRE_MATCH_PADDED_LEN(flow_add, add_match_offset);
-
- match_octets.bytes = add_len;
- match_octets.data = OF_OBJECT_BUFFER_INDEX(flow_add, add_match_offset);
-
- /* Copy data into flow entry */
- abs_offset = OF_OBJECT_ABSOLUTE_OFFSET(obj, entry_match_offset);
- of_wire_buffer_replace_data(wbuf, abs_offset, entry_len,
- match_octets.data, add_len);
-
- /* Not scalar, update lengths if needed */
- delta = add_len - entry_len;
- if (delta != 0) {
- /* Update parent(s) */
- of_object_parent_length_update((of_object_t *)obj, delta);
- }
-
- of_flow_add_cookie_get(flow_add, &cookie);
- of_flow_stats_entry_cookie_set(obj, cookie);
-
- of_flow_add_priority_get(flow_add, &val16);
- of_flow_stats_entry_priority_set(obj, val16);
-
- of_flow_add_idle_timeout_get(flow_add, &val16);
- of_flow_stats_entry_idle_timeout_set(obj, val16);
-
- of_flow_add_hard_timeout_get(flow_add, &val16);
- of_flow_stats_entry_hard_timeout_set(obj, val16);
-
- /* Effects may come from different places */
- if (effects != NULL) {
- if (obj->version == OF_VERSION_1_0) {
- OF_TRY(of_flow_stats_entry_actions_set(obj,
- (of_list_action_t *)effects));
- } else {
- OF_TRY(of_flow_stats_entry_instructions_set(obj,
- (of_list_instruction_t *)effects));
- }
- } else {
- if (obj->version == OF_VERSION_1_0) {
- of_list_action_t actions;
- of_flow_add_actions_bind(flow_add, &actions);
- OF_TRY(of_flow_stats_entry_actions_set(obj, &actions));
- } else {
- of_list_instruction_t instructions;
- of_flow_add_instructions_bind(flow_add, &instructions);
- OF_TRY(of_flow_stats_entry_instructions_set(obj, &instructions));
- }
- }
-
- return OF_ERROR_NONE;
-}
-
-/* Flow removed setup for all versions */
-
-static int
-flow_removed_setup_from_flow_add_common(of_flow_removed_t *obj,
- of_flow_add_t *flow_add,
- int removed_match_offset,
- int add_match_offset)
-{
- int add_len, removed_len;
- of_wire_buffer_t *wbuf;
- int abs_offset;
- int delta;
- uint16_t val16;
- uint64_t cookie;
- of_octets_t match_octets;
-
- /* Transfer the match underlying object from add to removed obj */
- wbuf = OF_OBJECT_TO_WBUF(obj);
- removed_len = _WIRE_MATCH_PADDED_LEN(obj, removed_match_offset);
- add_len = _WIRE_MATCH_PADDED_LEN(flow_add, add_match_offset);
-
- match_octets.bytes = add_len;
- match_octets.data = OF_OBJECT_BUFFER_INDEX(flow_add, add_match_offset);
-
- /* Copy data into flow removed */
- abs_offset = OF_OBJECT_ABSOLUTE_OFFSET(obj, removed_match_offset);
- of_wire_buffer_replace_data(wbuf, abs_offset, removed_len,
- match_octets.data, add_len);
-
- /* Not scalar, update lengths if needed */
- delta = add_len - removed_len;
- if (delta != 0) {
- /* Update parent(s) */
- of_object_parent_length_update((of_object_t *)obj, delta);
- }
-
- of_flow_add_cookie_get(flow_add, &cookie);
- of_flow_removed_cookie_set(obj, cookie);
-
- of_flow_add_priority_get(flow_add, &val16);
- of_flow_removed_priority_set(obj, val16);
-
- of_flow_add_idle_timeout_get(flow_add, &val16);
- of_flow_removed_idle_timeout_set(obj, val16);
-
- if (obj->version >= OF_VERSION_1_2) {
- of_flow_add_hard_timeout_get(flow_add, &val16);
- of_flow_removed_hard_timeout_set(obj, val16);
- }
-
- return OF_ERROR_NONE;
-}
-
-/* Set up a flow removed message from the original add */
-
-int
-of_flow_removed_setup_from_flow_add(of_flow_removed_t *obj,
- of_flow_add_t *flow_add)
-{
- switch (obj->version) {
- case OF_VERSION_1_0:
- return flow_removed_setup_from_flow_add_common(obj, flow_add,
- 8, 8);
- break;
- case OF_VERSION_1_1:
- case OF_VERSION_1_2:
- case OF_VERSION_1_3:
- return flow_removed_setup_from_flow_add_common(obj, flow_add,
- 48, 48);
- break;
- default:
- return OF_ERROR_VERSION;
- break;
- }
-
- return OF_ERROR_NONE;
-}
-
-
-/* Set up a packet in message from the original add */
-
-int
-of_packet_in_setup_from_flow_add(of_packet_in_t *obj,
- of_flow_add_t *flow_add)
-{
- int add_len, pkt_in_len;
- of_wire_buffer_t *wbuf;
- int abs_offset;
- int delta;
- const int pkt_in_match_offset = 16;
- const int add_match_offset = 48;
- of_octets_t match_octets;
-
- if (obj->version < OF_VERSION_1_2) {
- /* Nothing to be done before OF 1.2 */
- return OF_ERROR_NONE;
- }
-
- /* Transfer match struct from flow add to packet in object */
- wbuf = OF_OBJECT_TO_WBUF(obj);
- pkt_in_len = _WIRE_MATCH_PADDED_LEN(obj, pkt_in_match_offset);
- add_len = _WIRE_MATCH_PADDED_LEN(flow_add, add_match_offset);
-
- match_octets.bytes = add_len;
- match_octets.data = OF_OBJECT_BUFFER_INDEX(flow_add, add_match_offset);
-
- /* Copy data into pkt_in msg */
- abs_offset = OF_OBJECT_ABSOLUTE_OFFSET(obj, pkt_in_match_offset);
- of_wire_buffer_replace_data(wbuf, abs_offset, pkt_in_len,
- match_octets.data, add_len);
-
- /* Not scalar, update lengths if needed */
- delta = add_len - pkt_in_len;
- if (delta != 0) {
- /* Update parent(s) */
- of_object_parent_length_update((of_object_t *)obj, delta);
- }
-
- return OF_ERROR_NONE;
-}
-
-/* Set up a stats entry from the original add */
-
-int
-of_flow_stats_entry_setup_from_flow_add(of_flow_stats_entry_t *obj,
- of_flow_add_t *flow_add,
- of_object_t *effects)
-{
- switch (obj->version) {
- case OF_VERSION_1_0:
- return flow_stats_entry_setup_from_flow_add_common(obj, flow_add,
- effects, 4, 8);
- break;
- case OF_VERSION_1_1:
- case OF_VERSION_1_2:
- case OF_VERSION_1_3:
- return flow_stats_entry_setup_from_flow_add_common(obj, flow_add,
- effects, 48, 48);
- break;
- default:
- return OF_ERROR_VERSION;
- }
-
- return OF_ERROR_NONE;
-}
diff --git a/c_gen/templates/locitest/main.c b/c_gen/templates/locitest/main.c
index 86f7ae6..36bf60c 100644
--- a/c_gen/templates/locitest/main.c
+++ b/c_gen/templates/locitest/main.c
@@ -33,7 +33,6 @@
TEST_ASSERT(run_scalar_acc_tests() == TEST_PASS);
TEST_ASSERT(run_list_tests() == TEST_PASS);
TEST_ASSERT(run_message_tests() == TEST_PASS);
- TEST_ASSERT(run_setup_from_add_tests() == TEST_PASS);
TEST_ASSERT(run_validator_tests() == TEST_PASS);
diff --git a/c_gen/templates/locitest/test_setup_from_add.c b/c_gen/templates/locitest/test_setup_from_add.c
deleted file mode 100644
index ebb4968..0000000
--- a/c_gen/templates/locitest/test_setup_from_add.c
+++ /dev/null
@@ -1,133 +0,0 @@
-:: # Copyright 2013, Big Switch Networks, Inc.
-:: #
-:: # LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
-:: # the following special exception:
-:: #
-:: # LOXI Exception
-:: #
-:: # As a special exception to the terms of the EPL, you may distribute libraries
-:: # generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
-:: # that copyright and licensing notices generated by LoxiGen are not altered or removed
-:: # from the LoxiGen Libraries and the notice provided below is (i) included in
-:: # the LoxiGen Libraries, if distributed in source code form and (ii) included in any
-:: # documentation for the LoxiGen Libraries, if distributed in binary form.
-:: #
-:: # Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
-:: #
-:: # You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
-:: # a copy of the EPL at:
-:: #
-:: # http://www.eclipse.org/legal/epl-v10.html
-:: #
-:: # Unless required by applicable law or agreed to in writing, software
-:: # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-:: # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-:: # EPL for the specific language governing permissions and limitations
-:: # under the EPL.
-::
-:: include('_copyright.c')
-
-/**
- * Test code for setup from flow add routines
- */
-
-#include <locitest/test_common.h>
-
-/* mcheck is a glibc extension */
-#if defined(__linux__)
-#include <mcheck.h>
-#define MCHECK_INIT mcheck(NULL)
-#else
-#define MCHECK_INIT do { } while (0)
-#endif
-
-
-static int
-test_removed_setup_from_add(void)
-{
- of_flow_removed_t *removed;
- of_flow_add_t *add;
- of_match_t m1, m2;
-
- TEST_ASSERT((add = of_flow_add_new(OF_VERSION_1_0)) != NULL);
- TEST_ASSERT((removed = of_flow_removed_new(OF_VERSION_1_0)) != NULL);
-
- TEST_ASSERT(of_flow_add_OF_VERSION_1_0_populate(add, 1) != 0);
- TEST_ASSERT(of_flow_add_match_get(add, &m1) == 0);
-
- TEST_ASSERT(of_flow_removed_setup_from_flow_add(removed, add) == 0);
- TEST_ASSERT(of_flow_removed_match_get(removed, &m2) == 0);
- TEST_ASSERT(memcmp(&m1, &m2, sizeof(m1)) == 0);
-
- of_flow_add_delete(add);
- of_flow_removed_delete(removed);
-
- return TEST_PASS;
-}
-
-
-static int
-test_stats_entry_setup_from_add(void)
-{
- of_flow_add_t *add;
- of_flow_stats_entry_t *entry;
- of_match_t m1, m2;
- of_list_action_t *list;
- of_list_action_t list_out;
-
- TEST_ASSERT((add = of_flow_add_new(OF_VERSION_1_0)) != NULL);
- TEST_ASSERT((entry = of_flow_stats_entry_new(OF_VERSION_1_0)) != NULL);
-
- TEST_ASSERT(of_flow_add_OF_VERSION_1_0_populate(add, 1) != 0);
- TEST_ASSERT(of_flow_add_match_get(add, &m1) == 0);
-
- TEST_ASSERT(of_flow_stats_entry_setup_from_flow_add(entry, add, NULL) == 0);
- TEST_ASSERT(of_flow_stats_entry_match_get(entry, &m2) == 0);
- TEST_ASSERT(memcmp(&m1, &m2, sizeof(m1)) == 0);
-
- of_flow_add_delete(add);
- of_flow_stats_entry_delete(entry);
-
- /* @todo check action lists agree */
-
- /* Same with an external action list */
-
- TEST_ASSERT((add = of_flow_add_new(OF_VERSION_1_0)) != NULL);
- TEST_ASSERT((entry = of_flow_stats_entry_new(OF_VERSION_1_0)) != NULL);
-
- TEST_ASSERT(of_flow_add_OF_VERSION_1_0_populate(add, 1) != 0);
- TEST_ASSERT(of_flow_add_match_get(add, &m1) == 0);
-
- list = of_list_action_new(OF_VERSION_1_0);
- TEST_ASSERT(list != NULL);
- TEST_ASSERT(of_list_action_OF_VERSION_1_0_populate(list, 1) != 0);
-
- /* Verify matches agree */
- TEST_ASSERT(of_flow_stats_entry_setup_from_flow_add(entry, add, list) == 0);
- TEST_ASSERT(of_flow_stats_entry_match_get(entry, &m2) == 0);
- TEST_ASSERT(memcmp(&m1, &m2, sizeof(m1)) == 0);
-
- of_list_action_init(&list_out, OF_VERSION_1_0, 0, 1);
- of_flow_stats_entry_actions_bind(entry, &list_out);
-
- /* Verify lists agree */
- TEST_ASSERT(list->length == list_out.length);
- TEST_ASSERT(memcmp(WBUF_BUF(list->wbuf),
- WBUF_BUF(list_out.wbuf),
- list->length));
-
- of_flow_add_delete(add);
- of_list_action_delete(list);
- of_flow_stats_entry_delete(entry);
-
- return TEST_PASS;
-}
-
-
-int run_setup_from_add_tests(void)
-{
- RUN_TEST(removed_setup_from_add);
- RUN_TEST(stats_entry_setup_from_add);
-
- return TEST_PASS;
-}
diff --git a/lang_c.py b/lang_c.py
index 037c1d7..1969a83 100644
--- a/lang_c.py
+++ b/lang_c.py
@@ -84,7 +84,6 @@
'loci/src/of_object.c': static,
'loci/src/of_utils.c': static,
'loci/src/of_wire_buf.c': static,
- 'loci/src/loci_setup_from_add_fns.c': static,
# Static LOCI documentation
'loci/README': static,
@@ -107,7 +106,6 @@
'locitest/src/test_ext.c': static,
'locitest/src/test_list_limits.c': static,
'locitest/src/test_match_utils.c': static,
- 'locitest/src/test_setup_from_add.c': static,
'locitest/src/test_utils.c': static,
'locitest/src/test_validator.c': static,
'locitest/src/main.c': static,