Support non-default TRP and TID ports
[trust_router.git] / trp / trp_route.c
index 6178d97..19d7e22 100644 (file)
@@ -73,8 +73,8 @@ TRP_ROUTE *trp_route_new(TALLOC_CTX *mem_ctx)
     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;
@@ -262,3 +262,43 @@ int trp_route_is_triggered(TRP_ROUTE *entry)
 {
   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;
+}