X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Finclude%2Fgnunet_tun_lib.h;h=7bef0a6bebad64f4e15254013f493b1446cf5737;hb=360d7afad50d1af425a20e89419d2063a6a0e220;hp=9b98ab13b8de2a45d7d0b42a3948826af95dcacc;hpb=219e64fe613c47eab4c143791128c2b453be3bf8;p=oweals%2Fgnunet.git diff --git a/src/include/gnunet_tun_lib.h b/src/include/gnunet_tun_lib.h index 9b98ab13b..7bef0a6be 100644 --- a/src/include/gnunet_tun_lib.h +++ b/src/include/gnunet_tun_lib.h @@ -910,12 +910,41 @@ GNUNET_TUN_ipv4policy2regex (const char *policy); * the network. * * @param service_name a string - * @param hc corresponding hash + * @param[out] hc corresponding hash */ void GNUNET_TUN_service_name_to_hash (const char *service_name, struct GNUNET_HashCode *hc); + +/** + * Check if two sockaddrs are equal. + * + * @param sa one address + * @param sb another address + * @param include_port also check ports + * @return #GNUNET_YES if they are equal + */ +int +GNUNET_TUN_sockaddr_cmp (const struct sockaddr *sa, + const struct sockaddr *sb, + int include_port); + + +/** + * Compute the CADET port given a service descriptor + * (returned from #GNUNET_TUN_service_name_to_hash) and + * a TCP/UDP port @a ip_port. + * + * @param desc service shared secret + * @param ip_port TCP/UDP port, use 0 for ICMP + * @param[out] cadet_port CADET port to use + */ +void +GNUNET_TUN_compute_service_cadet_port (const struct GNUNET_HashCode *desc, + uint16_t ip_port, + struct GNUNET_HashCode *cadet_port); + #endif /** @} */ /* end of group */