diff options
author | Enrico Loparco (eloparco) <eloparco@cisco.com> | 2021-06-14 13:37:37 +0200 |
---|---|---|
committer | Enrico Loparco (eloparco) <eloparco@cisco.com> | 2021-06-24 09:25:40 +0200 |
commit | 4c5b811c7d105aafb847f9006fd1e5235206e5cd (patch) | |
tree | c185256c1cb0c0fc23b5c32b042a531201adcbce /hicn-light/src/hicn/io/tcp.c | |
parent | 1c37763975af0a6c89a9089aa606155227e67d41 (diff) |
[HICN-707] Add function for IP addr to string conversion
Signed-off-by: Enrico Loparco (eloparco) <eloparco@cisco.com>
Change-Id: Ie9226963a6459661918678a3b1723bf87a2b15ab
Diffstat (limited to 'hicn-light/src/hicn/io/tcp.c')
-rw-r--r-- | hicn-light/src/hicn/io/tcp.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/hicn-light/src/hicn/io/tcp.c b/hicn-light/src/hicn/io/tcp.c index 7c9d19729..1e36f78ea 100644 --- a/hicn-light/src/hicn/io/tcp.c +++ b/hicn-light/src/hicn/io/tcp.c @@ -143,12 +143,14 @@ connection_tcp_accept(connection_t * connection, forwarder_t *forwarder, int fd, .closed = false, }; - // XXX this new connection needs to be registered - //char *str = pair_ToString(udp->pair); + char addr_str[INET6_ADDRSTRLEN]; + if (local) + address_to_string(&(pair->local), addr_str); + else + address_to_string(&(pair->remote), addr_str); INFO("%s connection %p created for address %s (local=%s)", - face_type_str(connection->type), connection, "N/A", + face_type_str(connection->type), connection, addr_str, connection_is_local(connection) ? "true" : "false"); - //free(str); return 0; } @@ -232,10 +234,12 @@ connection_tcp_initialize(connection_t * connection) return -1; } - //char *pair_str = address_pair_ToString(pair); - INFO("%s connection %p connect for address pair %s", - face_type_str(connection->type), connection, "N/A"); - //free(pair_str); + char local_addr_str[INET6_ADDRSTRLEN]; + address_to_string(&(connection->pair.local), local_addr_str); + char remote_addr_str[INET6_ADDRSTRLEN]; + address_to_string(&(connection->pair.remote), remote_addr_str); + INFO("%s connection %p connect for address pair %s - %s", + face_type_str(connection->type), connection,local_addr_str, remote_addr_str); return 0; } |