-
-/* Note: be careful mixing talloc with glib. */
-
-static int trp_rentry_destructor(void *obj)
-{
- TRP_RENTRY *entry=talloc_get_type_abort(obj, TRP_RENTRY);
- if (entry->apc!=NULL)
- tr_free_name(entry->apc);
- if (entry->realm!=NULL)
- tr_free_name(entry->realm);
- if (entry->trust_router!=NULL)
- tr_free_name(entry->trust_router);
- if (entry->peer!=NULL)
- tr_free_name(entry->peer);
- if (entry->next_hop!=NULL)
- tr_free_name(entry->next_hop);
- return 0;
-}
-
-TRP_RENTRY *trp_rentry_new(TALLOC_CTX *mem_ctx)
-{
- TRP_RENTRY *entry=talloc(mem_ctx, TRP_RENTRY);
- if (entry!=NULL) {
- entry->apc=NULL;
- entry->realm=NULL;
- entry->trust_router=NULL;
- entry->peer=NULL;
- entry->next_hop=NULL;
- entry->selected=0;
- entry->expiry=talloc(entry, struct timespec);
- if (entry->expiry==NULL) {
- talloc_free(entry);
- return NULL;
- }
- talloc_set_destructor((void *)entry, trp_rentry_destructor);
- }
- return entry;
-}
-
-void trp_rentry_free(TRP_RENTRY *entry)
-{
- if (entry!=NULL)
- talloc_free(entry);
-}
-
-void trp_rentry_set_apc(TRP_RENTRY *entry, TR_NAME *apc)
-{
- entry->apc=apc;
-}
-
-TR_NAME *trp_rentry_get_apc(TRP_RENTRY *entry)
-{
- return entry->apc;
-}
-
-void trp_rentry_set_realm(TRP_RENTRY *entry, TR_NAME *realm)
-{
- entry->realm=realm;
-}
-
-TR_NAME *trp_rentry_get_realm(TRP_RENTRY *entry)
-{
- return entry->realm;
-}
-
-void trp_rentry_set_trust_router(TRP_RENTRY *entry, TR_NAME *tr)
-{
- entry->trust_router=tr;
-}
-
-TR_NAME *trp_rentry_get_trust_router(TRP_RENTRY *entry)
-{
- return entry->trust_router;
-}
-
-void trp_rentry_set_peer(TRP_RENTRY *entry, TR_NAME *peer)
-{
- entry->peer=peer;
-}
-
-TR_NAME *trp_rentry_get_peer(TRP_RENTRY *entry)
-{
- return entry->peer;
-}
-
-void trp_rentry_set_metric(TRP_RENTRY *entry, unsigned int metric)
-{
- entry->metric=metric;
-}
-
-unsigned int trp_rentry_get_metric(TRP_RENTRY *entry)
-{
- return entry->metric;
-}
-
-void trp_rentry_set_next_hop(TRP_RENTRY *entry, TR_NAME *next_hop)
-{
- entry->next_hop=next_hop;
-}
-
-TR_NAME *trp_rentry_get_next_hop(TRP_RENTRY *entry)
-{
- return entry->next_hop;
-}
-
-void trp_rentry_set_selected(TRP_RENTRY *entry, int sel)
-{
- entry->selected=sel;
-}
-
-int trp_rentry_get_selected(TRP_RENTRY *entry)
-{
- return entry->selected;
-}
-
-/* copies incoming value, does not assume responsibility for freeing */
-void trp_rentry_set_expiry(TRP_RENTRY *entry, struct timespec *exp)
-{
- entry->expiry->tv_sec=exp->tv_sec;
- entry->expiry->tv_nsec=exp->tv_nsec;
-}
-
-struct timespec *trp_rentry_get_expiry(TRP_RENTRY *entry)
-{
- return entry->expiry;
-}