aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/facemgr/includes/hicn/facemgr/facelet.h
diff options
context:
space:
mode:
Diffstat (limited to 'ctrl/facemgr/includes/hicn/facemgr/facelet.h')
-rw-r--r--ctrl/facemgr/includes/hicn/facemgr/facelet.h46
1 files changed, 37 insertions, 9 deletions
diff --git a/ctrl/facemgr/includes/hicn/facemgr/facelet.h b/ctrl/facemgr/includes/hicn/facemgr/facelet.h
index 476858eff..a0318b206 100644
--- a/ctrl/facemgr/includes/hicn/facemgr/facelet.h
+++ b/ctrl/facemgr/includes/hicn/facemgr/facelet.h
@@ -33,6 +33,8 @@
#define MAXSZ_FACELET 1024
+#define FACELET_MAX_ERRORS 10
+
/* NOTE: Any test should be sufficient */
#define IS_VALID_NETDEVICE(netdevice) ((netdevice.index != 0) && (netdevice.name[0] != '\0'))
@@ -116,6 +118,23 @@ typedef enum {
extern const char * facelet_status_str[];
+/* Facelet error reason */
+#define foreach_facelet_error_reason \
+ _(UNDEFINED) \
+ _(UNSPECIFIED_ERROR) \
+ _(FORWARDER_OFFLINE) \
+ _(PERMISSION_DENIED) \
+ _(INTERNAL_ERROR) \
+ _(N)
+
+typedef enum {
+#define _(x) FACELET_ERROR_REASON_ ## x,
+ foreach_facelet_error_reason
+#undef _
+} facelet_error_reason_t;
+
+extern const char * facelet_error_reason_str[];
+
/* Facelet attribute status */
/*
@@ -142,6 +161,20 @@ extern const char * facelet_attr_status_str_short[];
/* Facelet attribute */
+#ifdef WITH_POLICY
+#define foreach_facelet_attr \
+ _(netdevice_type_t, netdevice_type) \
+ _(netdevice_t, netdevice) \
+ _(int, family) \
+ _(ip_address_t, local_addr) \
+ _(u16, local_port) \
+ _(ip_address_t, remote_addr) \
+ _(u16, remote_port) \
+ _(face_state_t, admin_state) \
+ _(face_state_t, state) \
+ _(u32, priority) \
+ _(facemgr_face_type_t, face_type)
+#else
#define foreach_facelet_attr \
_(netdevice_type_t, netdevice_type) \
_(netdevice_t, netdevice) \
@@ -153,6 +186,7 @@ extern const char * facelet_attr_status_str_short[];
_(face_state_t, admin_state) \
_(face_state_t, state) \
_(facemgr_face_type_t, face_type)
+#endif /* WITH_POLICY */
#define foreach_facelet_event \
_(UNDEFINED) \
@@ -160,13 +194,6 @@ extern const char * facelet_attr_status_str_short[];
_(CREATE) \
_(UPDATE) \
_(DELETE) \
- _(SET_PARAMS) \
- _(SET_UP) \
- _(SET_DOWN) \
- _(SET_TAGS) \
- _(CLEAR_TAGS) \
- _(ADD_TAG) \
- _(REMOVE_TAG) \
_(N)
#define MAXSZ_EVENT__ 10
@@ -234,8 +261,9 @@ int facelet_merge(facelet_t * facelet, const facelet_t * facelet_to_merge);
facelet_status_t facelet_get_status(const facelet_t * facelet);
void facelet_set_status(facelet_t * facelet, facelet_status_t status);
-void facelet_set_status_error(facelet_t * facelet, bool value);
-bool facelet_get_status_error(const facelet_t * facelet);
+void facelet_set_error(facelet_t * facelet, facelet_error_reason_t reason);
+void facelet_unset_error(facelet_t * facelet);
+bool facelet_get_error(const facelet_t * facelet);
void facelet_set_bj_done(facelet_t * facelet);
void facelet_unset_bj_done(facelet_t * facelet);