#include <tr_debug.h>
#include <trust_router/trp.h>
#include <trust_router/tid.h>
+#include <tr_util.h>
/* Note: be careful mixing talloc with glib. */
entry->comm=NULL;
entry->realm=NULL;
entry->trust_router=NULL;
- entry->trp_port=TRP_PORT;
- entry->tid_port=TID_PORT;
+ entry->trust_router_port=TRP_PORT;
+ entry->next_hop_port=TID_PORT;
entry->peer=NULL;
entry->next_hop=NULL;
entry->selected=0;
return entry->metric;
}
-/* TODO: set the hostname and port for the next hop. Currently assume default TID port. --jlr */
void trp_route_set_next_hop(TRP_ROUTE *entry, TR_NAME *next_hop)
{
if (entry->next_hop!=NULL)
return entry->expiry;
}
+/**
+ * Get the expiration according to the realtime clock
+ *
+ * @param entry
+ * @param result space to store the result
+ * @return pointer to the result, or null on error
+ */
+struct timespec *trp_route_get_expiry_realtime(TRP_ROUTE *entry, struct timespec *result)
+{
+ return tr_clock_convert(TRP_CLOCK, entry->expiry, CLOCK_REALTIME, result);
+}
+
void trp_route_set_local(TRP_ROUTE *entry, int local)
{
entry->local=local;
{
return entry->triggered;
}
+
+void trp_route_set_trust_router_port(TRP_ROUTE *entry, int port)
+{
+ if (entry)
+ entry->trust_router_port = port;
+}
+
+/**
+ * Get the port to use for TRP connections to the trust router
+ *
+ * @param entry
+ * @return port, or -1 if entry is null
+ */
+int trp_route_get_trust_router_port(TRP_ROUTE *entry)
+{
+ if (entry)
+ return entry->trust_router_port;
+
+ return -1;
+}
+
+void trp_route_set_next_hop_port(TRP_ROUTE *entry, int port)
+{
+ if (entry)
+ entry->next_hop_port = port;
+}
+
+/**
+ * Get the port to use for TID connections to the next hop
+ *
+ * @param entry
+ * @return port, or -1 if entry is null
+ */
+int trp_route_get_next_hop_port(TRP_ROUTE *entry)
+{
+ if (entry)
+ return entry->next_hop_port;
+
+ return -1;
+}