X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=trp%2Ftrp_rtable.c;h=69192416eaad8429835dc657416e347cd592187d;hb=85e340eb4239f520e9ff8b1cf7b1c02fdba410c7;hp=3e4434e165eb39e32592e59a86e9a610754f1349;hpb=aa493148f65b196e380af5c41a16fbe2d50da73f;p=trust_router.git diff --git a/trp/trp_rtable.c b/trp/trp_rtable.c index 3e4434e..6919241 100644 --- a/trp/trp_rtable.c +++ b/trp/trp_rtable.c @@ -8,6 +8,8 @@ #include #include #include +#include +#include /* Note: be careful mixing talloc with glib. */ @@ -34,6 +36,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->peer=NULL; entry->next_hop=NULL; entry->selected=0; @@ -135,6 +139,7 @@ unsigned int trp_route_get_metric(TRP_ROUTE *entry) 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) @@ -610,6 +615,7 @@ static char *timespec_to_str(struct timespec *ts) TRP_ROUTE *trp_rtable_get_selected_entry(TRP_RTABLE *rtbl, TR_NAME *comm, TR_NAME *realm) { size_t n=0; + int ii=0; TRP_ROUTE **entry=trp_rtable_get_realm_entries(rtbl, comm, realm, &n); TRP_ROUTE *selected=NULL; @@ -618,11 +624,13 @@ TRP_ROUTE *trp_rtable_get_selected_entry(TRP_RTABLE *rtbl, TR_NAME *comm, TR_NAM tr_debug("trp_rtable_get_selected_entry: looking through route table entries for realm %.*s.", realm->len, realm->buf); - while(n-- && !trp_route_is_selected(entry[n])) { } - tr_debug("trp_rtable_get_selected_entry: n=%d.", n); - - if (n>=0) - selected=entry[n]; + for(ii=0; ii