aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/libhicnctrl/src/modules/hicn_light
diff options
context:
space:
mode:
Diffstat (limited to 'ctrl/libhicnctrl/src/modules/hicn_light')
-rw-r--r--ctrl/libhicnctrl/src/modules/hicn_light/connection.c5
-rw-r--r--ctrl/libhicnctrl/src/modules/hicn_light/listener.c5
-rw-r--r--ctrl/libhicnctrl/src/modules/hicn_light/route.c4
-rw-r--r--ctrl/libhicnctrl/src/modules/hicn_light/stats.c9
-rw-r--r--ctrl/libhicnctrl/src/modules/hicn_light/strategy.c107
-rw-r--r--ctrl/libhicnctrl/src/modules/hicn_light/subscription.c5
6 files changed, 48 insertions, 87 deletions
diff --git a/ctrl/libhicnctrl/src/modules/hicn_light/connection.c b/ctrl/libhicnctrl/src/modules/hicn_light/connection.c
index c7d06415e..83f7a2e27 100644
--- a/ctrl/libhicnctrl/src/modules/hicn_light/connection.c
+++ b/ctrl/libhicnctrl/src/modules/hicn_light/connection.c
@@ -495,4 +495,9 @@ int hicnlight_connection_serialize_list(const hc_object_t *object,
return sizeof(msg_header_t); // Do not use msg_connection_list_t
}
+int hicnlight_connection_serialize_set(const hc_object_t *object,
+ uint8_t *packet) {
+ return -1;
+}
+
DECLARE_MODULE_OBJECT_OPS(hicnlight, connection);
diff --git a/ctrl/libhicnctrl/src/modules/hicn_light/listener.c b/ctrl/libhicnctrl/src/modules/hicn_light/listener.c
index 68d4b8fcd..46fded2ca 100644
--- a/ctrl/libhicnctrl/src/modules/hicn_light/listener.c
+++ b/ctrl/libhicnctrl/src/modules/hicn_light/listener.c
@@ -173,4 +173,9 @@ int hicnlight_listener_serialize_list(const hc_object_t *object,
return sizeof(msg_header_t); // Do not use msg_listener_list_t
}
+int hicnlight_listener_serialize_set(const hc_object_t *object,
+ uint8_t *packet) {
+ return -1;
+}
+
DECLARE_MODULE_OBJECT_OPS(hicnlight, listener);
diff --git a/ctrl/libhicnctrl/src/modules/hicn_light/route.c b/ctrl/libhicnctrl/src/modules/hicn_light/route.c
index 22cf6fbc5..38510704c 100644
--- a/ctrl/libhicnctrl/src/modules/hicn_light/route.c
+++ b/ctrl/libhicnctrl/src/modules/hicn_light/route.c
@@ -170,4 +170,8 @@ int hicnlight_route_serialize_list(const hc_object_t *object, uint8_t *packet) {
return sizeof(msg_header_t); // Do not use msg_route_list_t
}
+int hicnlight_route_serialize_set(const hc_object_t *object, uint8_t *packet) {
+ return -1;
+}
+
DECLARE_MODULE_OBJECT_OPS(hicnlight, route);
diff --git a/ctrl/libhicnctrl/src/modules/hicn_light/stats.c b/ctrl/libhicnctrl/src/modules/hicn_light/stats.c
index 81c506770..a60190a13 100644
--- a/ctrl/libhicnctrl/src/modules/hicn_light/stats.c
+++ b/ctrl/libhicnctrl/src/modules/hicn_light/stats.c
@@ -60,6 +60,10 @@ int hicnlight_stats_serialize_list(const hc_object_t *object, uint8_t *packet) {
return sizeof(msg_header_t); // Do not use msg_stats_list_t
}
+int hicnlight_stats_serialize_set(const hc_object_t *object, uint8_t *packet) {
+ return -1;
+}
+
DECLARE_MODULE_OBJECT_OPS(hicnlight, stats);
/* PER-FACE STATS */
@@ -101,4 +105,9 @@ int hicnlight_face_stats_serialize_list(const hc_object_t *object,
return sizeof(msg_header_t); // Do not use msg_stats_list_t
}
+int hicnlight_face_stats_serialize_set(const hc_object_t *object,
+ uint8_t *packet) {
+ return -1;
+}
+
DECLARE_MODULE_OBJECT_OPS(hicnlight, face_stats);
diff --git a/ctrl/libhicnctrl/src/modules/hicn_light/strategy.c b/ctrl/libhicnctrl/src/modules/hicn_light/strategy.c
index 35e241f3e..16ce2d047 100644
--- a/ctrl/libhicnctrl/src/modules/hicn_light/strategy.c
+++ b/ctrl/libhicnctrl/src/modules/hicn_light/strategy.c
@@ -28,62 +28,28 @@ int hicnlight_strategy_serialize_list(const hc_object_t *object,
assert(!object);
return -1;
}
-#if 0
-// per prefix
-static hc_result_t *_strategy_set_serialize(hc_sock_t *socket,
- hc_strategy_t *strategy) {
- return -1;
- hc_result_t *res = malloc(sizeof(*res));
- char strategy_s[MAXSZ_HC_STRATEGY];
- strncpy(strategy->name, strategy_str(strategy->type),
- MAXSZ_STRATEGY_NAME - 1);
-
- int rc = hc_strategy_snprintf(strategy_s, MAXSZ_HC_STRATEGY, strategy);
- if (rc >= MAXSZ_HC_STRATEGY)
- WARN("[hicnlight_strategy_create] Unexpected truncation of strategy string");
- DEBUG("[hicnlight_strategy_create] strategy=%s", strategy_s);
-
- if (!IS_VALID_FAMILY(strategy->family) ||
- !IS_VALID_STRATEGY_TYPE(strategy->type)) {
- res->success = false;
- return res;
- }
-
- msg_strategy_set_t msg = {.header =
- {
- .message_type = REQUEST_LIGHT,
- .command_id = COMMAND_TYPE_STRATEGY_SET,
- .length = 1,
- .seq_num = 0,
- },
- .payload = {
- .address = strategy->address,
- .family = strategy->family,
- .len = strategy->len,
- .type = strategy->type,
- }};
-
- hc_command_params_t params = {
- .cmd = ACTION_SET,
- .cmd_id = COMMAND_TYPE_STRATEGY_SET,
- .size_in = sizeof(cmd_strategy_set_t),
- .size_out = 0,
- .parse = NULL,
- };
- *res = (hc_result_t){
- .msg =
- (hc_msg_t){
- .header = msg.header,
- .payload.strategy_set = msg.payload,
- },
- .params = params,
- .async = false,
- .success = true,
- };
- return res;
+int hicnlight_strategy_serialize_set(const hc_object_t *object,
+ uint8_t *packet) {
+ const hc_strategy_t *strategy = &object->strategy;
+
+ msg_strategy_set_t *msg = (msg_strategy_set_t *)packet;
+ *msg = (msg_strategy_set_t){.header =
+ {
+ .message_type = REQUEST_LIGHT,
+ .command_id = COMMAND_TYPE_STRATEGY_SET,
+ .length = 1,
+ .seq_num = 0,
+ },
+ .payload = {
+ .address = strategy->address,
+ .family = strategy->family,
+ .len = strategy->len,
+ .type = strategy->type,
+ }};
+
+ return sizeof(msg_strategy_set_t);
}
-#endif
#if 0
static hc_result_t *_strategy_add_local_prefix_serialize(
@@ -143,39 +109,6 @@ static hc_result_t *_strategy_add_local_prefix_serialize(
};
return res;
}
-#endif
-
-#if 0
-static int hicnlight_strategy_set(hc_sock_t *socket, hc_strategy_t *strategy) {
- hc_result_t *result = _strategy_set_serialize(socket, strategy);
-
- int ret = INPUT_ERROR;
- if (result->success) {
- ret = hicnlight_execute_command(socket, (hc_msg_t *)&result->msg,
- sizeof(result->msg), &result->params, NULL,
- result->async);
- }
-
- hc_result_free(result);
- return ret;
- return -1; // XXX added
-}
-
-static int hicnlight_strategy_add_local_prefix(hc_sock_t *socket,
- hc_strategy_t *strategy) {
- hc_result_t *result = _strategy_add_local_prefix_serialize(socket, strategy);
-
- int ret = INPUT_ERROR;
- if (result->success) {
- ret = hicnlight_execute_command(socket, (hc_msg_t *)&result->msg,
- sizeof(result->msg), &result->params, NULL,
- result->async);
- }
-
- hc_result_free(result);
- return ret;
- return -1; // XXX added
-}
/* How to retrieve that from the forwarder ? */
static const char *strategies[] = {
diff --git a/ctrl/libhicnctrl/src/modules/hicn_light/subscription.c b/ctrl/libhicnctrl/src/modules/hicn_light/subscription.c
index d00055e89..e2de09bf5 100644
--- a/ctrl/libhicnctrl/src/modules/hicn_light/subscription.c
+++ b/ctrl/libhicnctrl/src/modules/hicn_light/subscription.c
@@ -63,4 +63,9 @@ int hicnlight_subscription_serialize_list(const hc_object_t *object,
return -1;
}
+int hicnlight_subscription_serialize_set(const hc_object_t *object,
+ uint8_t *packet) {
+ return -1;
+}
+
DECLARE_MODULE_OBJECT_OPS(hicnlight, subscription);