Support non-default TRP and TID ports
[trust_router.git] / include / tr_util.h
index 3a3f7bc..d42f875 100644 (file)
 #ifndef TR_UTIL_H
 #define TR_UTIL_H
 
+#include <tr_name_internal.h>
 #include <trust_router/tr_versioning.h>
 
-TR_EXPORT int tr_cmp_timespec(struct timespec *ts1, struct timespec *ts2);
+/* NB, tr_bin_to_hex() is also prototyped in trust_router/tr_dh.h */
+TR_EXPORT void tr_bin_to_hex(const unsigned char * bin, size_t binlen,
+                             char * hex_out, size_t hex_len);
+TR_EXPORT int tr_cmp_timespec(const struct timespec *ts1, const struct timespec *ts2);
+int tr_add_timespec(const struct timespec *ts1, const struct timespec *ts2, struct timespec *sum);
+int tr_sub_timespec(const struct timespec *ts1_copy, const struct timespec *ts2_copy, struct timespec *diff);
+char *timespec_to_str(const struct timespec *ts);
+struct timespec *tr_clock_convert(clockid_t from, const struct timespec *when,
+                                  clockid_t to, struct timespec *dst);
+TR_NAME *tr_parse_hostname(const char *s);
+int tr_parse_port(const char *s);
+int tr_parse_hostname_and_port(const char *s, TR_NAME **hn_dest, int *p_dest);
+TR_NAME *tr_hostname_and_port_to_name(TR_NAME *hn, int port);
 
 #endif /* TR_UTIL_H */