diff options
Diffstat (limited to 'src/tun/regex.c')
-rw-r--r-- | src/tun/regex.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tun/regex.c b/src/tun/regex.c index f1ebb85f4..d48fe1da8 100644 --- a/src/tun/regex.c +++ b/src/tun/regex.c | |||
@@ -810,4 +810,27 @@ GNUNET_TUN_service_name_to_hash (const char *service_name, | |||
810 | } | 810 | } |
811 | 811 | ||
812 | 812 | ||
813 | /** | ||
814 | * Compute the CADET port given a service descriptor | ||
815 | * (returned from #GNUNET_TUN_service_name_to_hash) and | ||
816 | * a TCP/UDP port @a ip_port. | ||
817 | * | ||
818 | * @param desc service shared secret | ||
819 | * @param ip_port TCP/UDP port, use 0 for ICMP | ||
820 | * @param[out] cadet_port CADET port to use | ||
821 | */ | ||
822 | void | ||
823 | GNUNET_TUN_compute_service_cadet_port (const struct GNUNET_HashCode *desc, | ||
824 | uint16_t ip_port, | ||
825 | struct GNUNET_HashCode *cadet_port) | ||
826 | { | ||
827 | uint16_t be_port = htons (ip_port); | ||
828 | |||
829 | *cadet_port = *desc; | ||
830 | GNUNET_memcpy (cadet_port, | ||
831 | &be_port, | ||
832 | sizeof (uint16_t)); | ||
833 | } | ||
834 | |||
835 | |||
813 | /* end of regex.c */ | 836 | /* end of regex.c */ |