diff options
author | michele papalini <micpapal@cisco.com> | 2019-12-10 13:40:16 +0100 |
---|---|---|
committer | michele papalini <micpapal@cisco.com> | 2020-01-21 10:26:25 +0100 |
commit | 43980f3096655df2b2ecec50e700dd6989b0e0d6 (patch) | |
tree | 1a8e23e6fe645d8d1951b84f14e4123f17d4efe9 /hicn-light/src/hicn/io/udpConnection.c | |
parent | de13ed1c3155f699cb1e322dcd4d64a06ae00bb9 (diff) |
[HICN-442] new forwarding strategy
Signed-off-by: michele papalini <micpapal@cisco.com>
Change-Id: I62c03bddedc83e523fc60f4b50d2c69e38b50318
Signed-off-by: Angelo Mantellini <angelo.mantellini@cisco.com>
Signed-off-by: michele papalini <micpapal@cisco.com>
Diffstat (limited to 'hicn-light/src/hicn/io/udpConnection.c')
-rw-r--r-- | hicn-light/src/hicn/io/udpConnection.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/hicn-light/src/hicn/io/udpConnection.c b/hicn-light/src/hicn/io/udpConnection.c index 4e29eba7d..b22b1227f 100644 --- a/hicn-light/src/hicn/io/udpConnection.c +++ b/hicn-light/src/hicn/io/udpConnection.c @@ -79,8 +79,7 @@ static bool _isUp(const IoOperations *ops); static bool _isLocal(const IoOperations *ops); static void _destroy(IoOperations **opsPtr); static list_connections_type _getConnectionType(const IoOperations *ops); -static Ticks _sendProbe(IoOperations *ops, unsigned probeType, - uint8_t *message); +static void _sendProbe(IoOperations *ops, uint8_t *message); 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); @@ -350,10 +349,22 @@ static list_connections_type _getConnectionType(const IoOperations *ops) { return CONN_UDP; } -static Ticks _sendProbe(IoOperations *ops, unsigned probeType, - uint8_t *message) { - //TODO - return 0; +static void _sendProbe(IoOperations *ops, uint8_t *message) { + parcAssertNotNull(ops, "Parameter ops must be non-null"); + parcAssertNotNull(message, "Parameter message must be non-null"); + _UdpState *udpConnState = (_UdpState *)ioOperations_GetClosure(ops); + + if(udpConnState->isLocal) + return; + + ssize_t writeLength = + sendto(udpConnState->udpListenerSocket, message, + messageHandler_GetTotalPacketLength(message), 0, udpConnState->peerAddress, + udpConnState->peerAddressLength); + + if (writeLength < 0) { + return; + } } // ================================================================= |