aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/libhicnctrl/includes
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2019-11-07 16:42:01 +0100
committerJordan Augé <jordan.auge+fdio@cisco.com>2019-11-08 01:36:45 +0100
commit1bf749aa3e4b0ccc40057b2587af5211926a1431 (patch)
tree1e59105d64e7dc13f4f1cd4ae8437bb8bb932292 /ctrl/libhicnctrl/includes
parenta30d495f6e91f3bed0420bf76c19315fe0de8801 (diff)
[HICN-385] fix route removal in hicnctrl, code uniformization in hicn-light control api
Change-Id: Id097368dcde993775f206623195cc5aa57b4fe12 Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'ctrl/libhicnctrl/includes')
-rw-r--r--ctrl/libhicnctrl/includes/hicn/ctrl/api.h4
-rw-r--r--[-rwxr-xr-x]ctrl/libhicnctrl/includes/hicn/ctrl/commands.h79
2 files changed, 39 insertions, 44 deletions
diff --git a/ctrl/libhicnctrl/includes/hicn/ctrl/api.h b/ctrl/libhicnctrl/includes/hicn/ctrl/api.h
index 62cf98927..7b57a6323 100644
--- a/ctrl/libhicnctrl/includes/hicn/ctrl/api.h
+++ b/ctrl/libhicnctrl/includes/hicn/ctrl/api.h
@@ -69,6 +69,7 @@
#include <stdint.h>
#include <hicn/util/ip_address.h>
+#include <hicn/ctrl/commands.h>
#include "face.h"
#define HICN_DEFAULT_PORT 9695
@@ -380,8 +381,7 @@ int hc_sock_reset(hc_sock_t * s);
#define NULLTERM 1
#endif
-#define SYMBOLIC_NAME_LEN 16 /* NULL-terminated right ? */
-#define INTERFACE_LEN 16
+#define INTERFACE_LEN IFNAMSIZ
#define MAXSZ_HC_NAME_ SYMBOLIC_NAME_LEN
#define MAXSZ_HC_NAME MAXSZ_HC_NAME_ + NULLTERM
diff --git a/ctrl/libhicnctrl/includes/hicn/ctrl/commands.h b/ctrl/libhicnctrl/includes/hicn/ctrl/commands.h
index e69c93932..a5bc15e8a 100755..100644
--- a/ctrl/libhicnctrl/includes/hicn/ctrl/commands.h
+++ b/ctrl/libhicnctrl/includes/hicn/ctrl/commands.h
@@ -31,18 +31,16 @@
#include <stdint.h>
#include <stdlib.h>
+#include <hicn/util/ip_address.h>
#ifdef WITH_POLICY
#include <hicn/policy.h>
#endif /* WITH_POLICY */
+#define SYMBOLIC_NAME_LEN 16
+
typedef struct in6_addr ipv6_addr_t;
typedef uint32_t ipv4_addr_t;
-union commandAddr {
- ipv4_addr_t ipv4;
- ipv6_addr_t ipv6;
-};
-
typedef enum {
REQUEST_LIGHT = 0xc0, // this is a command
RESPONSE_LIGHT,
@@ -115,9 +113,9 @@ typedef struct {
typedef enum { ETHER_MODE, IP_MODE, HICN_MODE } listener_mode;
typedef struct {
- char symbolic[16];
- char interfaceName[16];
- union commandAddr address;
+ char symbolic[SYMBOLIC_NAME_LEN];
+ char interfaceName[SYMBOLIC_NAME_LEN];
+ ip_address_t address;
uint16_t port;
// uint16_t etherType;
uint8_t addressType;
@@ -125,15 +123,15 @@ typedef struct {
uint8_t connectionType;
} add_listener_command;
-// SIZE=40
+// SIZE=56
//========== [01] ADD CONNECTION ==========
typedef struct {
- char symbolic[16];
- //char interfaceName[16];
- union commandAddr remoteIp;
- union commandAddr localIp;
+ char symbolic[SYMBOLIC_NAME_LEN];
+ //char interfaceName[SYMBOLIC_NAME_LEN];
+ ip_address_t remoteIp;
+ ip_address_t localIp;
uint16_t remotePort;
uint16_t localPort;
uint8_t ipType;
@@ -168,17 +166,17 @@ typedef struct {
uint32_t connid;
uint8_t state;
uint8_t admin_state;
- char interfaceName[16];
- char connectionName[16];
+ char interfaceName[SYMBOLIC_NAME_LEN];
+ char connectionName[SYMBOLIC_NAME_LEN];
} list_connections_command;
-// SIZE=64
+// SIZE=80
//========== [03] ADD ROUTE ==========
typedef struct {
- char symbolicOrConnid[16];
- union commandAddr address;
+ char symbolicOrConnid[SYMBOLIC_NAME_LEN];
+ ip_address_t address;
uint16_t cost;
uint8_t addressType;
uint8_t len;
@@ -189,7 +187,7 @@ typedef struct {
//========== [04] LIST ROUTE ==========
typedef struct {
- union commandAddr address;
+ ip_address_t address;
uint32_t connid;
uint16_t cost;
uint8_t addressType;
@@ -199,30 +197,29 @@ typedef struct {
// SIZE=24
//========== [05] REMOVE CONNECTION ==========
-
typedef struct {
- char symbolicOrConnid[16];
+ char symbolicOrConnid[SYMBOLIC_NAME_LEN];
} remove_connection_command;
//========== [06] REMOVE LISTENER ==========
typedef struct {
- char symbolicOrListenerid[16];
+ char symbolicOrListenerid[SYMBOLIC_NAME_LEN];
} remove_listener_command;
// SIZE=16
-//========== [06] REMOVE ROUTE ==========
+//========== [07] REMOVE ROUTE ==========
typedef struct {
- char symbolicOrConnid[16];
- union commandAddr address;
+ char symbolicOrConnid[SYMBOLIC_NAME_LEN];
+ ip_address_t address;
uint8_t addressType;
uint8_t len;
} remove_route_command;
// SIZE=36
-//========== [07] CACHE STORE ==========
+//========== [08] CACHE STORE ==========
typedef struct {
uint8_t activate;
@@ -230,7 +227,7 @@ typedef struct {
// SIZE=1
-//========== [08] CACHE SERVE ==========
+//========== [09] CACHE SERVE ==========
typedef struct {
uint8_t activate;
@@ -238,20 +235,18 @@ typedef struct {
// SIZE=1
-//========== [09] SET STRATEGY ==========
+//========== [10] SET STRATEGY ==========
typedef enum {
SET_STRATEGY_LOADBALANCER,
SET_STRATEGY_RANDOM,
SET_STRATEGY_RANDOM_PER_DASH_SEGMENT,
SET_STRATEGY_LOADBALANCER_WITH_DELAY,
- SET_STRATEGY_LOADBALANCER_BY_RATE,
- SET_STRATEGY_LOADBALANCER_BEST_ROUTE,
LAST_STRATEGY_VALUE
} strategy_type;
typedef struct {
- union commandAddr address;
+ ip_address_t address;
uint8_t strategyType;
uint8_t addressType;
uint8_t len;
@@ -262,7 +257,7 @@ typedef struct {
//========== [11] SET WLDR ==========
typedef struct {
- char symbolicOrConnid[16];
+ char symbolicOrConnid[SYMBOLIC_NAME_LEN];
uint8_t activate;
} set_wldr_command;
@@ -271,8 +266,8 @@ typedef struct {
//========== [12] ADD PUNTING ==========
typedef struct {
- char symbolicOrConnid[16];
- union commandAddr address;
+ char symbolicOrConnid[SYMBOLIC_NAME_LEN];
+ ip_address_t address;
uint8_t addressType;
uint8_t len;
} add_punting_command;
@@ -282,9 +277,9 @@ typedef struct {
//========== [13] LIST LISTENER ==========
typedef struct {
- union commandAddr address;
- char listenerName[16];
- char interfaceName[16];
+ ip_address_t address;
+ char listenerName[SYMBOLIC_NAME_LEN];
+ char interfaceName[SYMBOLIC_NAME_LEN];
uint32_t connid;
uint16_t port;
uint8_t addressType;
@@ -310,7 +305,7 @@ typedef struct {
// SIZE=1
typedef struct {
- char symbolicOrConnid[16];
+ char symbolicOrConnid[SYMBOLIC_NAME_LEN];
uint8_t admin_state;
uint8_t pad8[3];
} connection_set_admin_state_command;
@@ -318,27 +313,27 @@ typedef struct {
#ifdef WITH_POLICY
typedef struct {
- union commandAddr address;
+ ip_address_t address;
uint8_t addressType;
uint8_t len;
policy_t policy;
} add_policy_command;
typedef struct {
- union commandAddr address;
+ ip_address_t address;
uint8_t addressType;
uint8_t len;
policy_t policy;
} list_policies_command;
typedef struct {
- union commandAddr address;
+ ip_address_t address;
uint8_t addressType;
uint8_t len;
} remove_policy_command;
typedef struct {
- char symbolicOrConnid[16];
+ char symbolicOrConnid[SYMBOLIC_NAME_LEN];
uint8_t admin_state;
policy_tags_t tags;
} update_connection_command;