diff options
author | Jordan Augé <jordan.auge+fdio@cisco.com> | 2019-11-17 00:07:12 +0100 |
---|---|---|
committer | Jordan Augé <jordan.auge+fdio@cisco.com> | 2019-11-17 11:03:31 +0100 |
commit | 2ada8954ecd3601d115a22696c4c3ab90858cec3 (patch) | |
tree | 6db983388333e8776eecaf9c07c5b7bd6f2f10be /hicn-light/src/hicn/io/udpConnection.c | |
parent | 2dcc25795fab0100ce33852f08d77a5fd90d8f14 (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/src/hicn/io/udpConnection.c')
-rw-r--r-- | hicn-light/src/hicn/io/udpConnection.c | 31 |
1 files changed, 31 insertions, 0 deletions
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"); |