aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-light
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2019-11-17 00:07:12 +0100
committerJordan Augé <jordan.auge+fdio@cisco.com>2019-11-17 11:03:31 +0100
commit2ada8954ecd3601d115a22696c4c3ab90858cec3 (patch)
tree6db983388333e8776eecaf9c07c5b7bd6f2f10be /hicn-light
parent2dcc25795fab0100ce33852f08d77a5fd90d8f14 (diff)
[HICN-379] Add face priority support in face manager
Change-Id: If4f75d44fc66414a4a70135de7827f5082b97112 Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'hicn-light')
-rw-r--r--hicn-light/src/hicn/command_line/controller/hicnLightControl_main.c1
-rw-r--r--hicn-light/src/hicn/config/configuration.c36
-rw-r--r--hicn-light/src/hicn/config/controlListConnections.c5
-rw-r--r--hicn-light/src/hicn/core/connection.c20
-rw-r--r--hicn-light/src/hicn/core/connection.h7
-rw-r--r--hicn-light/src/hicn/core/mapme.c1
-rw-r--r--hicn-light/src/hicn/io/hicnConnection.c31
-rw-r--r--hicn-light/src/hicn/io/ioOperations.c10
-rw-r--r--hicn-light/src/hicn/io/ioOperations.h23
-rw-r--r--hicn-light/src/hicn/io/streamConnection.c31
-rw-r--r--hicn-light/src/hicn/io/udpConnection.c31
-rw-r--r--hicn-light/src/hicn/processor/fibEntry.c27
-rw-r--r--hicn-light/src/hicn/utils/commands.h13
13 files changed, 229 insertions, 7 deletions
diff --git a/hicn-light/src/hicn/command_line/controller/hicnLightControl_main.c b/hicn-light/src/hicn/command_line/controller/hicnLightControl_main.c
index ab0e0e6d8..1f5d33e24 100644
--- a/hicn-light/src/hicn/command_line/controller/hicnLightControl_main.c
+++ b/hicn-light/src/hicn/command_line/controller/hicnLightControl_main.c
@@ -82,6 +82,7 @@ static int payloadLengthController[LAST_COMMAND_VALUE] = {
sizeof(list_policies_command),
sizeof(remove_policy_command),
sizeof(update_connection_command),
+ sizeof(connection_set_priority_command),
#endif
};
diff --git a/hicn-light/src/hicn/config/configuration.c b/hicn-light/src/hicn/config/configuration.c
index 01192569f..f135dcc5a 100644
--- a/hicn-light/src/hicn/config/configuration.c
+++ b/hicn-light/src/hicn/config/configuration.c
@@ -420,6 +420,7 @@ struct iovec *configuration_ProcessCreateTunnel(Configuration *config,
Connection *conn = connection_Create(ops);
#ifdef WITH_POLICY
connection_SetTags(conn, control->tags);
+ connection_SetPriority(conn, control->priority);
#endif /* WITH_POLICY */
connection_SetAdminState(conn, control->admin_state);
@@ -443,6 +444,7 @@ struct iovec *configuration_ProcessCreateTunnel(Configuration *config,
} else {
#ifdef WITH_POLICY
connection_SetTags(conn, control->tags);
+ connection_SetPriority(conn, control->priority);
connection_SetAdminState(conn, control->admin_state);
#ifdef WITH_MAPME
@@ -704,6 +706,7 @@ struct iovec *configuration_ProcessConnectionList(Configuration *config,
listConnectionsCommand->connectionData.admin_state = connection_GetAdminState(original);
#ifdef WITH_POLICY
+ listConnectionsCommand->priority = connection_GetPriority(original);
listConnectionsCommand->connectionData.tags = connection_GetTags(original);
#endif /* WITH_POLICY */
@@ -1162,7 +1165,7 @@ struct iovec *configuration_ConnectionSetAdminState(Configuration *config,
connection_SetAdminState(conn, control->admin_state);
#ifdef WITH_MAPME
- /* Hook: new connection created through the control protocol */
+ /* Hook: connection event */
forwarder_onConnectionEvent(config->forwarder, conn,
control->admin_state == CONNECTION_STATE_UP
? CONNECTION_EVENT_SET_UP
@@ -1173,6 +1176,27 @@ struct iovec *configuration_ConnectionSetAdminState(Configuration *config,
}
#ifdef WITH_POLICY
+
+struct iovec *configuration_ConnectionSetPriority(Configuration *config,
+ struct iovec *request) {
+ header_control_message *header = request[0].iov_base;
+ connection_set_priority_command *control = request[1].iov_base;
+
+ Connection * conn = getConnectionBySymbolicOrId(config, control->symbolicOrConnid);
+ if (!conn)
+ return utils_CreateNack(header, control, sizeof(connection_set_priority_command));
+
+ connection_SetPriority(conn, control->priority);
+
+#ifdef WITH_MAPME
+ /* Hook: connection event */
+ forwarder_onConnectionEvent(config->forwarder, conn,
+ CONNECTION_EVENT_PRIORITY_CHANGED);
+#endif /* WITH_MAPME */
+
+ return utils_CreateAck(header, control, sizeof(connection_set_priority_command));
+}
+
struct iovec *configuration_ProcessPolicyAdd(Configuration *config,
struct iovec *request) {
header_control_message *header = request[0].iov_base;
@@ -1256,12 +1280,14 @@ struct iovec *configuration_UpdateConnection(Configuration *config,
Connection * conn = getConnectionBySymbolicOrId(config, control->symbolicOrConnid);
if (!conn)
- return utils_CreateNack(header, control, sizeof(connection_set_admin_state_command));
+ return utils_CreateNack(header, control, sizeof(update_connection_command));
connection_SetTags(conn, control->tags);
connection_SetAdminState(conn, control->admin_state);
+ if (control->priority > 0)
+ connection_SetPriority(conn, control->priority);
- return utils_CreateAck(header, control, sizeof(remove_policy_command));
+ return utils_CreateAck(header, control, sizeof(update_connection_command));
}
#endif /* WITH_POLICY */
@@ -1372,6 +1398,10 @@ struct iovec *configuration_DispatchCommand(Configuration *config,
case UPDATE_CONNECTION:
response = configuration_UpdateConnection(config, control);
break;
+
+ case CONNECTION_SET_PRIORITY:
+ response = configuration_ConnectionSetPriority(config, control);
+ break;
#endif /* WITH_POLICY */
default:
diff --git a/hicn-light/src/hicn/config/controlListConnections.c b/hicn-light/src/hicn/config/controlListConnections.c
index 0e8e2c30b..0613ac4f9 100644
--- a/hicn-light/src/hicn/config/controlListConnections.c
+++ b/hicn-light/src/hicn/config/controlListConnections.c
@@ -114,7 +114,7 @@ static CommandReturn _controlListConnections_Execute(CommandParser *parser,
}
#ifdef WITH_POLICY
- printf("%5s %10s %12s %6s %40s %40s %5s %s\n", "id", "name", "admin_state", "state", "source", "destination", "type", "flags");
+ printf("%5s %10s %12s %6s %40s %40s %5s %s %s\n", "id", "name", "admin_state", "state", "source", "destination", "type", "priority", "flags");
#else
printf("%5s %10s %12s %6s %40s %40s %5s\n", "id", "name", "admin_state", "state", "source", "destination", "type");
#endif /* WITH_POLICY */
@@ -147,11 +147,12 @@ foreach_policy_tag
*s = '\0';
parcBufferComposer_Format(
- composer, "%5d %10s %12s %6s %40s %40s %5s [%s]", listConnectionsCommand->connid, listConnectionsCommand->connectionName,
+ composer, "%5d %10s %12s %6s %40s %40s %5s [%d] [%s]", listConnectionsCommand->connid, listConnectionsCommand->connectionName,
stateString[listConnectionsCommand->admin_state],
stateString[listConnectionsCommand->state], sourceString,
destinationString,
connTypeString[listConnectionsCommand->connectionData.connectionType],
+ listConnectionsCommand->connectionData.priority,
flags_str);
#else
diff --git a/hicn-light/src/hicn/core/connection.c b/hicn-light/src/hicn/core/connection.c
index 6295d08df..8ec38f75f 100644
--- a/hicn-light/src/hicn/core/connection.c
+++ b/hicn-light/src/hicn/core/connection.c
@@ -332,6 +332,26 @@ void connection_SetAdminState(Connection *conn, connection_state_t admin_state)
ioOperations_SetAdminState(conn->ops, admin_state);
}
+#ifdef WITH_POLICY
+uint32_t connection_GetPriority(const Connection *conn)
+{
+ parcAssertNotNull(conn, "Parameter conn must be non-null");
+ if (!conn->ops)
+ return CONNECTION_STATE_UNDEFINED;
+ return ioOperations_GetPriority(conn->ops);
+}
+
+void connection_SetPriority(Connection *conn, uint32_t priority)
+{
+ parcAssertNotNull(conn, "Parameter conn must be non-null");
+ if (!conn->ops)
+ return;
+ if ((priority != CONNECTION_STATE_UP) && (priority != CONNECTION_STATE_DOWN))
+ return;
+ ioOperations_SetPriority(conn->ops, priority);
+}
+#endif /* WITH_POLICY */
+
const char * connection_GetInterfaceName(const Connection * conn)
{
parcAssertNotNull(conn, "Parameter conn must be non-null");
diff --git a/hicn-light/src/hicn/core/connection.h b/hicn-light/src/hicn/core/connection.h
index b7b5e3c91..3b647dd7a 100644
--- a/hicn-light/src/hicn/core/connection.h
+++ b/hicn-light/src/hicn/core/connection.h
@@ -36,6 +36,7 @@ typedef enum {
CONNECTION_EVENT_UPDATE,
CONNECTION_EVENT_SET_UP,
CONNECTION_EVENT_SET_DOWN,
+ CONNECTION_EVENT_PRIORITY_CHANGED,
} connection_event_t;
#endif /* WITH_MAPME */
@@ -183,6 +184,12 @@ connection_state_t connection_GetAdminState(const Connection *conn);
void connection_SetAdminState(Connection *conn, connection_state_t admin_state);
+#ifdef WITH_POLICY
+uint32_t connection_GetPriority(const Connection *conn);
+
+void connection_SetPriority(Connection *conn, uint32_t priority);
+#endif /* WITH_POLICY */
+
const char * connection_GetInterfaceName(const Connection * conn);
#ifdef WITH_POLICY
diff --git a/hicn-light/src/hicn/core/mapme.c b/hicn-light/src/hicn/core/mapme.c
index 94ada3afa..0eba02e49 100644
--- a/hicn-light/src/hicn/core/mapme.c
+++ b/hicn-light/src/hicn/core/mapme.c
@@ -488,6 +488,7 @@ void mapme_onConnectionEvent(const MapMe *mapme, const Connection *conn_added, c
case CONNECTION_EVENT_DELETE:
case CONNECTION_EVENT_SET_DOWN:
case CONNECTION_EVENT_UPDATE:
+ case CONNECTION_EVENT_PRIORITY_CHANGED:
break;
}
}
diff --git a/hicn-light/src/hicn/io/hicnConnection.c b/hicn-light/src/hicn/io/hicnConnection.c
index d56231c38..e35454438 100644
--- a/hicn-light/src/hicn/io/hicnConnection.c
+++ b/hicn-light/src/hicn/io/hicnConnection.c
@@ -78,6 +78,9 @@ typedef struct hicn_state {
* but it is currently not reachable from within the implementation. */
connection_state_t state;
connection_state_t admin_state;
+#ifdef WITH_POLICY
+ uint32_t priority;
+#endif /* WITH_POLICY */
} _HicnState;
// Prototypes
@@ -97,6 +100,10 @@ static connection_state_t _getState(const IoOperations *ops);
static void _setState(IoOperations *ops, connection_state_t state);
static connection_state_t _getAdminState(const IoOperations *ops);
static void _setAdminState(IoOperations *ops, connection_state_t admin_state);
+#ifdef WITH_POLICY
+static uint32_t _getPriority(const IoOperations *ops);
+static void _setPriority(IoOperations *ops, uint32_t priority);
+#endif /* WITH_POLICY */
static const char * _getInterfaceName(const IoOperations *ops);
/*
@@ -129,6 +136,10 @@ static IoOperations _template = {
.setState = &_setState,
.getAdminState = &_getAdminState,
.setAdminState = &_setAdminState,
+#ifdef WITH_POLICY
+ .getPriority = &_getPriority,
+ .setPriority = &_setPriority,
+#endif /* WITH_POLICY */
.getInterfaceName = &_getInterfaceName,
};
@@ -168,6 +179,10 @@ IoOperations *hicnConnection_Create(Forwarder *forwarder, const char * interface
_setConnectionState(hicnConnState, true);
+#ifdef WITH_POLICY
+ hicnConnState->priority = 0;
+#endif /* WITH_POLICY */
+
if (logger_IsLoggable(hicnConnState->logger, LoggerFacility_IO,
PARCLogLevel_Info)) {
char *str = addressPair_ToString(hicnConnState->addressPair);
@@ -592,6 +607,22 @@ static void _setAdminState(IoOperations *ops, connection_state_t admin_state) {
hicnConnState->admin_state = admin_state;
}
+#ifdef WITH_POLICY
+static uint32_t _getPriority(const IoOperations *ops) {
+ parcAssertNotNull(ops, "Parameter must be non-null");
+ const _HicnState *hicnConnState =
+ (const _HicnState *)ioOperations_GetClosure(ops);
+ return hicnConnState->priority;
+}
+
+static void _setPriority(IoOperations *ops, uint32_t priority) {
+ parcAssertNotNull(ops, "Parameter must be non-null");
+ _HicnState *hicnConnState =
+ (_HicnState *)ioOperations_GetClosure(ops);
+ hicnConnState->priority = priority;
+}
+#endif /* WITH_POLICY
+*/
static const char * _getInterfaceName(const IoOperations *ops)
{
parcAssertNotNull(ops, "Parameter must be non-null");
diff --git a/hicn-light/src/hicn/io/ioOperations.c b/hicn-light/src/hicn/io/ioOperations.c
index b2d346ed8..336e9f12e 100644
--- a/hicn-light/src/hicn/io/ioOperations.c
+++ b/hicn-light/src/hicn/io/ioOperations.c
@@ -86,6 +86,16 @@ void ioOperations_SetAdminState(IoOperations *ops, connection_state_t admin_stat
ops->setAdminState(ops, admin_state);
}
+#ifdef WITH_POLICY
+uint32_t ioOperations_GetPriority(const IoOperations *ops) {
+ return ops->getPriority(ops);
+}
+
+void ioOperations_SetPriority(IoOperations *ops, uint32_t priority) {
+ ops->setPriority(ops, priority);
+}
+#endif /* WITH_POLICY */
+
const char * ioOperations_GetInterfaceName(const IoOperations *ops) {
return ops->getInterfaceName(ops);
}
diff --git a/hicn-light/src/hicn/io/ioOperations.h b/hicn-light/src/hicn/io/ioOperations.h
index c8a107199..ee8720e77 100644
--- a/hicn-light/src/hicn/io/ioOperations.h
+++ b/hicn-light/src/hicn/io/ioOperations.h
@@ -89,6 +89,10 @@ struct io_ops {
void (*setState)(IoOperations *ops, connection_state_t state);
connection_state_t (*getAdminState)(const IoOperations *ops);
void (*setAdminState)(IoOperations *ops, connection_state_t admin_state);
+#ifdef WITH_POLICY
+ uint32_t (*getPriority)(const IoOperations *ops);
+ void (*setPriority)(IoOperations *ops, uint32_t priority);
+#endif /* WITH_POLICY */
const char * (*getInterfaceName)(const IoOperations *ops);
};
@@ -416,6 +420,25 @@ connection_state_t ioOperations_GetAdminState(const IoOperations *ops);
*/
void ioOperations_SetAdminState(IoOperations *ops, connection_state_t admin_state);
+#ifdef WITH_POLICY
+/**
+ * Returns the priority of the connection
+ *
+ * @param [in] ops The connection implementation.
+ *
+ * @return Connection state (uint32_t).
+ */
+uint32_t ioOperations_GetPriority(const IoOperations *ops);
+
+/**
+ * Sets the priority of the connection
+ *
+ * @param [in] ops The connection implementation.
+ * @param [in] state New state to set (uint32_t).
+ */
+void ioOperations_SetPriority(IoOperations *ops, uint32_t priority);
+#endif /* WITH_POLICY */
+
/**
* Sets the interface name associated to the connection.
*
diff --git a/hicn-light/src/hicn/io/streamConnection.c b/hicn-light/src/hicn/io/streamConnection.c
index 4e2f9c37e..27ec45d48 100644
--- a/hicn-light/src/hicn/io/streamConnection.c
+++ b/hicn-light/src/hicn/io/streamConnection.c
@@ -66,6 +66,9 @@ typedef struct stream_state {
* but it is currently not reachable from within the implementation. */
connection_state_t state;
connection_state_t admin_state;
+#ifdef WITH_POLICY
+ uint32_t priority;
+#endif /* WITH_POLICY */
} _StreamState;
// Prototypes
@@ -91,6 +94,10 @@ static connection_state_t _streamConnection_getState(const IoOperations *ops);
static void _streamConnection_setState(IoOperations *ops, connection_state_t state);
static connection_state_t _streamConnection_getAdminState(const IoOperations *ops);
static void _streamConnection_setAdminState(IoOperations *ops, connection_state_t admin_state);
+#ifdef WITH_POLICY
+static uint32_t _streamConnection_getPriority(const IoOperations *ops);
+static void _streamConnection_setPriority(IoOperations *ops, uint32_t priority);
+#endif /* WITH_POLICY */
static const char * _streamConnection_getInterfaceName(const IoOperations *ops);
/*
@@ -123,6 +130,10 @@ static IoOperations _template = {
.setState = &_streamConnection_setState,
.getAdminState = &_streamConnection_getAdminState,
.setAdminState = &_streamConnection_setAdminState,
+#ifdef WITH_POLICY
+ .getPriority = &_streamConnection_getPriority,
+ .setPriority = &_streamConnection_setPriority,
+#endif /* WITH_POLICY */
.getInterfaceName = &_streamConnection_getInterfaceName,
};
@@ -147,6 +158,10 @@ IoOperations *streamConnection_AcceptConnection(Forwarder *forwarder, int fd,
stream->addressPair = pair;
stream->isClosed = false;
+#ifdef WITH_POLICY
+ stream->priority = 0;
+#endif /* WITH_POLICY */
+
// allocate a connection
IoOperations *io_ops = parcMemory_AllocateAndClear(sizeof(IoOperations));
parcAssertNotNull(io_ops, "parcMemory_AllocateAndClear(%zu) returned NULL",
@@ -736,6 +751,22 @@ static void _streamConnection_setAdminState(IoOperations *ops, connection_state_
stream->admin_state = admin_state;
}
+#ifdef WITH_POLICY
+static uint32_t _streamConnection_getPriority(const IoOperations *ops) {
+ parcAssertNotNull(ops, "Parameter must be non-null");
+ const _StreamState *stream =
+ (const _StreamState *)ioOperations_GetClosure(ops);
+ return stream->priority;
+}
+
+static void _streamConnection_setPriority(IoOperations *ops, uint32_t priority) {
+ parcAssertNotNull(ops, "Parameter must be non-null");
+ _StreamState *stream =
+ (_StreamState *)ioOperations_GetClosure(ops);
+ stream->priority = priority;
+}
+#endif /* WITH_POLICY */
+
static const char * _streamConnection_getInterfaceName(const IoOperations *ops)
{
parcAssertNotNull(ops, "Parameter must be non-null");
diff --git a/hicn-light/src/hicn/io/udpConnection.c b/hicn-light/src/hicn/io/udpConnection.c
index 9ad70403f..4e29eba7d 100644
--- a/hicn-light/src/hicn/io/udpConnection.c
+++ b/hicn-light/src/hicn/io/udpConnection.c
@@ -63,6 +63,9 @@ typedef struct udp_state {
* but it is currently not reachable from within the implementation. */
connection_state_t state;
connection_state_t admin_state;
+#ifdef WITH_POLICY
+ uint32_t priority;
+#endif /* WITH_POLICY */
} _UdpState;
// Prototypes
@@ -82,6 +85,10 @@ static connection_state_t _getState(const IoOperations *ops);
static void _setState(IoOperations *ops, connection_state_t state);
static connection_state_t _getAdminState(const IoOperations *ops);
static void _setAdminState(IoOperations *ops, connection_state_t admin_state);
+#ifdef WITH_POLICY
+static uint32_t _getPriority(const IoOperations *ops);
+static void _setPriority(IoOperations *ops, uint32_t priority);
+#endif /* WITH_POLICY */
static const char * _getInterfaceName(const IoOperations *ops);
/*
@@ -114,6 +121,10 @@ static IoOperations _template = {
.setState = &_setState,
.getAdminState = &_getAdminState,
.setAdminState = &_setAdminState,
+#ifdef WITH_POLICY
+ .getPriority = &_getPriority,
+ .setPriority = &_setPriority,
+#endif /* WITH_POLICY */
.getInterfaceName = &_getInterfaceName,
};
@@ -151,6 +162,10 @@ IoOperations *udpConnection_Create(Forwarder *forwarder, const char * interfaceN
_setConnectionState(udpConnState, true);
+#ifdef WITH_POLICY
+ udpConnState->priority = 0;
+#endif /* WITH_POLICY */
+
if (logger_IsLoggable(udpConnState->logger, LoggerFacility_IO,
PARCLogLevel_Info)) {
char *str = addressPair_ToString(udpConnState->addressPair);
@@ -443,6 +458,22 @@ static void _setAdminState(IoOperations *ops, connection_state_t admin_state) {
udpConnState->admin_state = admin_state;
}
+#ifdef WITH_POLICY
+static uint32_t _getPriority(const IoOperations *ops) {
+ parcAssertNotNull(ops, "Parameter must be non-null");
+ const _UdpState *udpConnState =
+ (const _UdpState *)ioOperations_GetClosure(ops);
+ return udpConnState->priority;
+}
+
+static void _setPriority(IoOperations *ops, uint32_t priority) {
+ parcAssertNotNull(ops, "Parameter must be non-null");
+ _UdpState *udpConnState =
+ (_UdpState *)ioOperations_GetClosure(ops);
+ udpConnState->priority = priority;
+}
+#endif /* WITH_POLICY */
+
static const char * _getInterfaceName(const IoOperations *ops)
{
parcAssertNotNull(ops, "Parameter must be non-null");
diff --git a/hicn-light/src/hicn/processor/fibEntry.c b/hicn-light/src/hicn/processor/fibEntry.c
index 1aaa3ace9..084be7b17 100644
--- a/hicn-light/src/hicn/processor/fibEntry.c
+++ b/hicn-light/src/hicn/processor/fibEntry.c
@@ -576,16 +576,39 @@ const NumberSet *fibEntry_GetNexthopsFromForwardingStrategy(
if (numberSet_Length(available_nexthops) == 0) {
out = numberSet_Create();
} else {
+
+ /* Priority */
+ NumberSet * priority_nexthops = numberSet_Create();
+
+ uint32_t max_priority = 0;
+ for (size_t k = 0; k < numberSet_Length(priority_nexthops); k++) {
+ unsigned conn_id = numberSet_GetItem(priority_nexthops, k);
+ const Connection * conn = connectionTable_FindById(table, conn_id);
+ uint32_t priority = connection_GetPriority(conn);
+ if (priority < max_priority) {
+ continue;
+ } else if (priority == max_priority) {
+ numberSet_Add(priority_nexthops, conn_id);
+ } else { /* priority > max_priority */
+ numberSet_Release(&priority_nexthops);
+ priority_nexthops = numberSet_Create();
+ numberSet_Add(priority_nexthops, conn_id);
+ max_priority = priority;
+ }
+ }
+
/* Multipath */
if ((policy.tags[POLICY_TAG_MULTIPATH].state != POLICY_STATE_PROHIBIT) &&
(policy.tags[POLICY_TAG_MULTIPATH].state != POLICY_STATE_AVOID)) {
- out = fibEntry->fwdStrategy->lookupNexthop(fibEntry->fwdStrategy, available_nexthops,
+ out = fibEntry->fwdStrategy->lookupNexthop(fibEntry->fwdStrategy, priority_nexthops,
interestMessage);
} else {
- unsigned nexthop = numberSet_GetItem(available_nexthops, 0);
+ unsigned nexthop = numberSet_GetItem(priority_nexthops, 0);
out = numberSet_Create();
numberSet_Add(out, nexthop);
}
+
+ numberSet_Release(&priority_nexthops);
}
numberSet_Release(&available_nexthops);
diff --git a/hicn-light/src/hicn/utils/commands.h b/hicn-light/src/hicn/utils/commands.h
index a5bc15e8a..520559ccf 100644
--- a/hicn-light/src/hicn/utils/commands.h
+++ b/hicn-light/src/hicn/utils/commands.h
@@ -75,6 +75,7 @@ typedef enum {
LIST_POLICIES,
REMOVE_POLICY,
UPDATE_CONNECTION,
+ CONNECTION_SET_PRIORITY,
#endif /* WITH_POLICY */
LAST_COMMAND_VALUE
} command_id;
@@ -138,6 +139,7 @@ typedef struct {
uint8_t connectionType;
uint8_t admin_state;
#ifdef WITH_POLICY
+ uint32_t priority;
policy_tags_t tags;
#endif /* WITH_POLICY */
} add_connection_command;
@@ -166,6 +168,9 @@ typedef struct {
uint32_t connid;
uint8_t state;
uint8_t admin_state;
+#ifdef WITH_POLICY
+ uint32_t priority;
+#endif /* WITH_POLICY */
char interfaceName[SYMBOLIC_NAME_LEN];
char connectionName[SYMBOLIC_NAME_LEN];
} list_connections_command;
@@ -335,9 +340,15 @@ typedef struct {
typedef struct {
char symbolicOrConnid[SYMBOLIC_NAME_LEN];
uint8_t admin_state;
+ uint32_t priority;
policy_tags_t tags;
} update_connection_command;
+typedef struct {
+ char symbolicOrConnid[SYMBOLIC_NAME_LEN];
+ uint32_t priority;
+} connection_set_priority_command;
+
#endif /* WITH_POLICY */
//===== size of commands ======
@@ -394,6 +405,8 @@ static inline int payloadLengthDaemon(command_id id) {
return sizeof(remove_policy_command);
case UPDATE_CONNECTION:
return sizeof(update_connection_command);
+ case CONNECTION_SET_PRIORITY:
+ return sizeof(connection_set_priority_command);
#endif /* WITH_POLICY */
case LAST_COMMAND_VALUE:
return 0;