summaryrefslogtreecommitdiffstats
path: root/ctrl/libhicnctrl/src/object_private.h
diff options
context:
space:
mode:
Diffstat (limited to 'ctrl/libhicnctrl/src/object_private.h')
-rw-r--r--ctrl/libhicnctrl/src/object_private.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/ctrl/libhicnctrl/src/object_private.h b/ctrl/libhicnctrl/src/object_private.h
new file mode 100644
index 000000000..2be12fd5e
--- /dev/null
+++ b/ctrl/libhicnctrl/src/object_private.h
@@ -0,0 +1,35 @@
+#ifndef HICNCTRL_OBJECT_PRIVATE_H
+#define HICNCTRL_OBJECT_PRIVATE_H
+
+#define INT_CMP(x, y) ((x > y) ? 1 : (x < y) ? -1 : 0)
+
+// XXX Those are always true
+#define IS_VALID_ADDRESS(x) (1)
+#define IS_VALID_CONNECTION_ID(x) (1) // XXX ID
+#define IS_VALID_ROUTE_COST(x) (1)
+#define IS_VALID_PREFIX_LEN(x) (1)
+#define IS_VALID_POLICY(x) (1)
+#define IS_VALID_ID(x) (1)
+#define IS_VALID_INTERFACE_NAME(x) (1)
+#define IS_VALID_NAME(x) (1)
+#define IS_VALID_TYPE(x) IS_VALID_ENUM_TYPE(FACE_TYPE, x)
+#define IS_VALID_FACE_STATE(x) (1)
+
+#define IS_VALID_ADDR_TYPE(x) ((x >= ADDR_INET) && (x <= ADDR_UNIX))
+
+#define IS_VALID_CONNECTION_TYPE(x) IS_VALID_ENUM_TYPE(CONNECTION_TYPE, x)
+
+#define GENERATE_FIND(TYPE) \
+ int hc_##TYPE##_find(hc_data_t *data, const hc_##TYPE##_t *element, \
+ hc_##TYPE##_t **found) { \
+ foreach_type(hc_##TYPE##_t, x, data) { \
+ if (hc_##TYPE##_cmp(x, element) == 0) { \
+ *found = x; \
+ return 0; \
+ } \
+ }; \
+ *found = NULL; /* this is optional */ \
+ return 0; \
+ }
+
+#endif /* HICNCTRL_OBJECT_PRIVATE_H */