json_t *jcfgpoll = NULL;
json_t *jcfgsettle = NULL;
json_t *jroutesweep = NULL;
+ json_t *jrouteupdate = NULL;
if ((!trc) || (!jcfg))
return TR_CFG_BAD_PARAMS;
return TR_CFG_NOPARSE;
}
}
+ if (NULL != (jrouteupdate = json_object_get(jint, "route_update_interval"))) {
+ if (json_is_number(jrouteupdate)) {
+ trc->internal->route_update_interval = json_integer_value(jrouteupdate);
+ } else {
+ tr_debug("tr_cfg_parse_internal: Parsing error, route_update_interval is not a number.");
+ return TR_CFG_NOPARSE;
+ }
+ }
if (NULL != (jlog = json_object_get(jint, "logging"))) {
if (NULL != (jlogthres = json_object_get(jlog, "log_threshold"))) {
struct timespec mtime;
};
-struct tr_cfgwatch_data {
+typedef struct tr_cfgwatch_data {
struct timeval poll_interval; /* how often should we check for updates? */
struct timeval settling_time; /* how long should we wait for changes to settle before updating? */
char *config_dir; /* what directory are we watching? */
int change_detected; /* have we detected a change? */
struct timeval last_change_detected; /* when did we last note a changed mtime? */
TR_CFG_MGR *cfg_mgr; /* what trust router config are we updating? */
-};
-typedef struct tr_cfgwatch_data TR_CFGWATCH;
+ void (*update_cb)(TR_CFG *new_cfg, void *cookie); /* callback after config updated */
+ void *update_cookie; /* data for the update_cb() */
+} TR_CFGWATCH;
/* prototypes */
#include <dirent.h>
#include <jansson.h>
#include <syslog.h>
+#include <sys/time.h>
#include <talloc.h>
#include <tr_comm.h>
unsigned int cfg_poll_interval;
unsigned int cfg_settle_count;
unsigned int route_sweep_interval;
+ unsigned int route_update_interval;
} TR_CFG_INTERNAL;
typedef struct tr_cfg {
typedef struct tr_trps_events {
struct tr_socket_event *listen_ev;
struct event *mq_ev;
+ struct event *update_ev;
struct event *sweep_ev;
} TR_TRPS_EVENTS;
TRP_RC tr_trps_event_init(struct event_base *base, TRPS_INSTANCE *trps, TR_CFG_MGR *cfg_mgr,
TR_TRPS_EVENTS *trps_ev);
TRPC_INSTANCE *tr_trpc_initiate(TRPS_INSTANCE *trps, const char *server, unsigned int port);
+void tr_config_changed(TR_CFG *new_cfg, void *cookie);
#endif /* TR_TRP_H */
TR_MQ *mq; /* incoming message queue */
TRP_PTABLE *ptable; /* peer table */
TRP_RTABLE *rtable; /* route table */
+ struct timeval update_interval; /* interval between scheduled updates */
+ struct timeval sweep_interval; /* interval between route table sweeps */
};
TRPS_INSTANCE *trps_new (TALLOC_CTX *mem_ctx);
void trps_free (TRPS_INSTANCE *trps);
-TRP_RC trps_send_msg (TRPS_INSTANCE *trps, void *peer, const char *msg);
+void trps_set_update_interval(TRPS_INSTANCE *trps, unsigned int interval);
+unsigned int trps_get_update_interval(TRPS_INSTANCE *trps);
+void trps_set_sweep_interval(TRPS_INSTANCE *trps, unsigned int interval);
+unsigned int trps_get_sweep_interval(TRPS_INSTANCE *trps);
+TRP_RC trps_send_msg (TRPS_INSTANCE *trps, TR_NAME *peer_gssname, const char *msg);
void trps_add_connection(TRPS_INSTANCE *trps, TRP_CONNECTION *new);
void trps_remove_connection(TRPS_INSTANCE *trps, TRP_CONNECTION *remove);
void trps_add_trpc(TRPS_INSTANCE *trps, TRPC_INSTANCE *trpc);
TR_NAME *trps_get_next_hop(TRPS_INSTANCE *trps, TR_NAME *comm, TR_NAME *realm);
TRP_RC trps_sweep_routes(TRPS_INSTANCE *trps);
TRP_RC trps_add_peer(TRPS_INSTANCE *trps, TRP_PEER *peer);
-TRP_RENTRY **trps_select_updates_for_peer(TALLOC_CTX *memctx, TRPS_INSTANCE *trps, TR_NAME *peer_gssname, size_t *n_update);
+TRP_PEER *trps_get_peer(TRPS_INSTANCE *trps, TR_NAME *gssname);
+TRP_RC trps_scheduled_update(TRPS_INSTANCE *trps);
#endif /* TRP_INTERNAL_H */
TRP_PEER *head; /* head of a peer table list */
} TRP_PTABLE;
+/* iterator for the peer table */
+typedef TRP_PEER *TRP_PTABLE_ITER;
+
TRP_PTABLE *trp_ptable_new(TALLOC_CTX *memctx);
void trp_ptable_free(TRP_PTABLE *ptbl);
TRP_RC trp_ptable_add(TRP_PTABLE *ptbl, TRP_PEER *newpeer);
TRP_RC trp_ptable_remove(TRP_PTABLE *ptbl, TRP_PEER *peer);
+TRP_PEER *trp_ptable_find(TRP_PTABLE *ptbl, TR_NAME *gssname);
char *trp_ptable_to_str(TALLOC_CTX *memctx, TRP_PTABLE *ptbl, const char *sep, const char *lineterm);
+TRP_PTABLE_ITER *trp_ptable_iter_new(TALLOC_CTX *mem_ctx);
+TRP_PEER *trp_ptable_iter_first(TRP_PTABLE_ITER *iter, TRP_PTABLE *ptbl);
+TRP_PEER *trp_ptable_iter_next(TRP_PTABLE_ITER *iter);
+void trp_ptable_iter_free(TRP_PTABLE_ITER *iter);
+
TRP_PEER *trp_peer_new(TALLOC_CTX *memctx);
void trp_peer_free(TRP_PEER *peer);
char *trp_peer_get_server(TRP_PEER *peer);
void trp_upd_free(TRP_UPD *update);
TR_EXPORT TRP_INFOREC *trp_upd_get_inforec(TRP_UPD *upd);
void trp_upd_set_inforec(TRP_UPD *upd, TRP_INFOREC *rec);
+void trp_upd_add_inforec(TRP_UPD *upd, TRP_INFOREC *rec);
TR_EXPORT TR_NAME *trp_upd_get_peer(TRP_UPD *upd);
void trp_upd_set_peer(TRP_UPD *upd, TR_NAME *peer);
TR_EXPORT TRP_INFOREC *trp_inforec_new(TALLOC_CTX *mem_ctx, TRP_INFOREC_TYPE type);
}
timersub(&now, &cfg_status->last_change_detected, &diff);
if (!timercmp(&diff, &cfg_status->settling_time, <)) {
- tr_notice("Configuration file change settled, updating configuration.");
+ tr_notice("Configuration file change settled, attempting to update configuration.");
if (0 != tr_read_and_apply_config(cfg_status))
tr_warning("Configuration file update failed. Using previous configuration.");
- else
+ else {
+ if (cfg_status->update_cb!=NULL)
+ cfg_status->update_cb(cfg_status->cfg_mgr->active, cfg_status->update_cookie);
tr_notice("Configuration updated successfully.");
+ }
cfg_status->change_detected=0;
}
}
tr_crit("Error reading configuration, exiting.");
return 1;
}
+ tr->cfgwatch->update_cb=tr_config_changed; /* handle configuration changes */
+ tr->cfgwatch->update_cookie=(void *)tr;
/***** initialize the trust path query server instance *****/
if (NULL == (tr->tids = tids_create (tr))) {
#include <tr_trp.h>
#include <tr_debug.h>
-/* hold a trps instance and a config manager */
+/* data for event callbacks */
struct tr_trps_event_cookie {
TRPS_INSTANCE *trps;
TR_CFG_MGR *cfg_mgr;
+ struct event *ev;
};
/* callback to schedule event to process messages */
}
}
+static void tr_trps_update(int listener, short event, void *arg)
+{
+ struct tr_trps_event_cookie *cookie=talloc_get_type_abort(arg, struct tr_trps_event_cookie);
+ TRPS_INSTANCE *trps=cookie->trps;
+ struct event *ev=cookie->ev;
+
+ tr_debug("tr_trps_update: sending scheduled route updates.");
+ trps_scheduled_update(trps);
+ event_add(ev, &(trps->update_interval));
+}
+
static void tr_trps_sweep(int listener, short event, void *arg)
{
- TRPS_INSTANCE *trps=talloc_get_type_abort(arg, TRPS_INSTANCE);
+ struct tr_trps_event_cookie *cookie=talloc_get_type_abort(arg, struct tr_trps_event_cookie);
+ TRPS_INSTANCE *trps=cookie->trps;
+ struct event *ev=cookie->ev;
+
tr_debug("tr_trps_sweep: sweeping routes");
trps_sweep_routes(trps);
+ /* schedule the event to run again */
+ event_add(ev, &(trps->sweep_interval));
}
static int tr_trps_events_destructor(void *obj)
if (ev!=NULL) {
ev->listen_ev=talloc(ev, struct tr_socket_event);
ev->mq_ev=NULL;
+ ev->update_ev=NULL;
ev->sweep_ev=NULL;
if (ev->listen_ev==NULL) {
talloc_free(ev);
{
TALLOC_CTX *tmp_ctx=talloc_new(NULL);
struct tr_socket_event *listen_ev=NULL;
- struct tr_trps_event_cookie *cookie;
- struct timeval two_secs={2, 0};
+ struct tr_trps_event_cookie *trps_cookie=NULL;
+ struct tr_trps_event_cookie *update_cookie=NULL;
+ struct tr_trps_event_cookie *sweep_cookie=NULL;
TRP_RC retval=TRP_ERROR;
if (trps_ev == NULL) {
/* Create the cookie for callbacks. It is part of the trps context, so it will
* be cleaned up when trps is freed by talloc_free. */
- cookie=talloc(tmp_ctx, struct tr_trps_event_cookie);
- if (cookie == NULL) {
- tr_debug("tr_trps_event_init: Unable to allocate cookie.");
+ trps_cookie=talloc(tmp_ctx, struct tr_trps_event_cookie);
+ if (trps_cookie == NULL) {
+ tr_debug("tr_trps_event_init: Unable to allocate trps_cookie.");
retval=TRP_NOMEM;
goto cleanup;
}
- cookie->trps=trps;
- cookie->cfg_mgr=cfg_mgr;
- talloc_steal(trps, cookie);
+ trps_cookie->trps=trps;
+ trps_cookie->cfg_mgr=cfg_mgr;
+ talloc_steal(trps, trps_cookie);
/* get a trps listener */
listen_ev->sock_fd=trps_get_listener(trps,
tr_trps_gss_handler,
cfg_mgr->active->internal->hostname,
cfg_mgr->active->internal->trps_port,
- (void *)cookie);
+ (void *)trps_cookie);
if (listen_ev->sock_fd < 0) {
tr_crit("Error opening TRP server socket.");
retval=TRP_ERROR;
goto cleanup;
}
+ trps_cookie->ev=listen_ev->ev; /* in case it needs to frob the event */
/* and its event */
listen_ev->ev=event_new(base,
(void *)trps);
tr_mq_set_notify_cb(trps->mq, tr_trps_mq_cb, trps_ev->mq_ev);
+ /* now set up the route update timer event */
+ update_cookie=talloc(tmp_ctx, struct tr_trps_event_cookie);
+ if (update_cookie == NULL) {
+ tr_debug("tr_trps_event_init: Unable to allocate update_cookie.");
+ retval=TRP_NOMEM;
+ goto cleanup;
+ }
+ update_cookie->trps=trps;
+ update_cookie->cfg_mgr=cfg_mgr;
+ talloc_steal(trps, update_cookie);
+ trps_ev->update_ev=event_new(base, -1, EV_TIMEOUT, tr_trps_update, (void *)update_cookie);
+ update_cookie->ev=trps_ev->update_ev; /* in case it needs to frob the event */
+ event_add(trps_ev->update_ev, &(trps->update_interval));
+
/* now set up the route table sweep timer event */
- trps_ev->sweep_ev=event_new(base, -1, EV_TIMEOUT|EV_PERSIST, tr_trps_sweep, (void *)trps);
- /* todo: event_add(trps_ev->sweep_ev, &(cfg_mgr->active->internal->route_sweep_interval)); */
- event_add(trps_ev->sweep_ev, &two_secs);
+ sweep_cookie=talloc(tmp_ctx, struct tr_trps_event_cookie);
+ if (sweep_cookie == NULL) {
+ tr_debug("tr_trps_event_init: Unable to allocate sweep_cookie.");
+ retval=TRP_NOMEM;
+ goto cleanup;
+ }
+ sweep_cookie->trps=trps;
+ sweep_cookie->cfg_mgr=cfg_mgr;
+ talloc_steal(trps, sweep_cookie);
+ trps_ev->sweep_ev=event_new(base, -1, EV_TIMEOUT, tr_trps_sweep, (void *)sweep_cookie);
+ sweep_cookie->ev=trps_ev->sweep_ev; /* in case it needs to frob the event */
+ event_add(trps_ev->sweep_ev, &(trps->sweep_interval));
retval=TRP_SUCCESS;
talloc_free(tmp_ctx);
return trpc;
}
+
+/* Called by the config manager after a change to the active configuration.
+ * Updates configuration of objects that do not know about the config manager. */
+void tr_config_changed(TR_CFG *new_cfg, void *cookie)
+{
+ TRPS_INSTANCE *trps=talloc_get_type_abort(cookie, TRPS_INSTANCE);
+ trps_set_update_interval(trps, new_cfg->internal->route_update_interval);
+ trps_set_sweep_interval(trps, new_cfg->internal->route_sweep_interval);
+}
return TRP_ERROR;
}
+TRP_PEER *trp_ptable_find(TRP_PTABLE *ptbl, TR_NAME *gssname)
+{
+ TRP_PEER *cur=ptbl->head;
+ while ((cur!=NULL) && (0 != tr_name_cmp(trp_peer_get_gssname(cur), gssname)))
+ cur=cur->next;
+ return cur;
+}
+
char *trp_peer_to_str(TALLOC_CTX *memctx, TRP_PEER *peer, const char *sep)
{
if (sep==NULL)
talloc_free(tmpctx); /* free detritus */
return result;
}
+
+TRP_PTABLE_ITER *trp_ptable_iter_new(TALLOC_CTX *mem_ctx)
+{
+ TRP_PTABLE_ITER *iter=talloc(mem_ctx, TRP_PTABLE_ITER);
+ *iter=NULL;
+ return iter;
+}
+
+TRP_PEER *trp_ptable_iter_first(TRP_PTABLE_ITER *iter, TRP_PTABLE *ptbl)
+{
+ *iter=ptbl->head;
+ return *iter;
+}
+
+TRP_PEER *trp_ptable_iter_next(TRP_PTABLE_ITER *iter)
+{
+ if ((*iter)->next!=NULL)
+ *iter=(*iter)->next;
+ return *iter;
+}
+
+void trp_ptable_iter_free(TRP_PTABLE_ITER *iter)
+{
+ talloc_free(iter);
+}
+
return NULL;
}
+static TRP_INFOREC *trp_inforec_get_tail(TRP_INFOREC *rec)
+{
+ while (rec!=NULL)
+ rec=trp_inforec_get_next(rec);
+ return rec;
+}
+
void trp_inforec_set_next(TRP_INFOREC *rec, TRP_INFOREC *next_rec)
{
if (rec !=NULL)
upd->records=rec;
}
+void trp_upd_add_inforec(TRP_UPD *upd, TRP_INFOREC *rec)
+{
+ if (upd->records==NULL)
+ upd->records=rec;
+ else
+ trp_inforec_set_next(trp_inforec_get_tail(upd->records), rec);
+ talloc_steal(upd, rec);
+}
+
TR_NAME *trp_upd_get_peer(TRP_UPD *upd)
{
return upd->peer;
#include <talloc.h>
#include <errno.h>
#include <unistd.h>
+#include <sys/time.h>
#include <gsscon.h>
#include <tr_rp.h>
trps->cookie=NULL;
trps->conn=NULL;
trps->trpc=NULL;
+ trps->update_interval=(struct timeval){0,0};
+ trps->sweep_interval=(struct timeval){0,0};
trps->mq=tr_mq_new(trps);
if (trps->mq==NULL) {
tr_mq_append(trps->mq, msg);
}
-#if 0
-static TRP_CONNECTION *trps_find_conn(TRPS_INSTANCE *trps, TR_NAME *peer_gssname)
+unsigned int trps_get_update_interval(TRPS_INSTANCE *trps)
{
- TRP_CONNECTION *cur=NULL;
- for (cur=trps->conn; cur!=NULL; cur=trp_connection_get_next(cur)) {
- if (0==tr_name_cmp(peer_gssname, trp_connection_get_gssname(cur)))
+ return trps->update_interval.tv_sec;
+}
+
+void trps_set_update_interval(TRPS_INSTANCE *trps, unsigned int interval)
+{
+ trps->update_interval.tv_sec=interval;
+ trps->update_interval.tv_usec=0;
+}
+
+unsigned int trps_get_sweep_interval(TRPS_INSTANCE *trps)
+{
+ return trps->sweep_interval.tv_sec;
+}
+
+void trps_set_sweep_interval(TRPS_INSTANCE *trps, unsigned int interval)
+{
+ trps->sweep_interval.tv_sec=interval;
+ trps->sweep_interval.tv_usec=0;
+}
+
+static TRPC_INSTANCE *trps_find_trpc(TRPS_INSTANCE *trps, TR_NAME *peer_gssname)
+{
+ TRPC_INSTANCE *cur=NULL;
+ for (cur=trps->trpc; cur!=NULL; cur=trpc_get_next(cur)) {
+ if (0==tr_name_cmp(peer_gssname,
+ trp_connection_get_gssname(trpc_get_conn(cur)))) {
break;
+ }
}
return cur;
}
-#endif
void trps_add_connection(TRPS_INSTANCE *trps, TRP_CONNECTION *new)
{
trps->trpc=trpc_remove(trps->trpc, remove);
}
-TRP_RC trps_send_msg (TRPS_INSTANCE *trps, void *peer, const char *msg)
+TRP_RC trps_send_msg(TRPS_INSTANCE *trps, TR_NAME *peer_gssname, const char *msg)
{
TALLOC_CTX *tmp_ctx=talloc_new(NULL);
TR_MQ_MSG *mq_msg=NULL;
char *msg_dup=NULL;
TRP_RC rc=TRP_ERROR;
-
- /* Currently ignore peer and just send to an open connection.
- * In reality, need to identify the correct peer and send via that
- * one. */
- if (trps->trpc != NULL) {
- if (trpc_get_status(trps->trpc)!=TRP_CONNECTION_UP)
- tr_debug("trps_send_msg: skipping message sent while TRPC connection not up.");
- else {
- mq_msg=tr_mq_msg_new(tmp_ctx, "trpc_send");
- msg_dup=talloc_strdup(mq_msg, msg); /* get local copy in mq_msg context */
- tr_mq_msg_set_payload(mq_msg, msg_dup, NULL); /* no need for a free() func */
- trpc_mq_append(trps->trpc, mq_msg);
- rc=TRP_SUCCESS;
- }
+ TRPC_INSTANCE *trpc=NULL;
+
+ /* get the connection for this peer */
+ trpc=trps_find_trpc(trps, peer_gssname);
+ if ((trpc==NULL) || (trpc_get_status(trps->trpc)!=TRP_CONNECTION_UP)) {
+ /* We could just let these sit on the queue in the hopes that a connection
+ * is eventually established. However, we'd then have to ensure the queue
+ * didn't keep growing, etc. */
+ tr_warning("trps_send_msg: skipping message queued while TRPC connection not up.");
+ } else {
+ mq_msg=tr_mq_msg_new(tmp_ctx, "trpc_send");
+ msg_dup=talloc_strdup(mq_msg, msg); /* get local copy in mq_msg context */
+ tr_mq_msg_set_payload(mq_msg, msg_dup, NULL); /* no need for a free() func */
+ trpc_mq_append(trpc, mq_msg);
+ rc=TRP_SUCCESS;
}
talloc_free(tmp_ctx);
return rc;
/* returns an array of pointers to updates (*not* an array of updates). Returns number of entries
* via n_update parameter. (The allocated space will generally be larger than required, see note in
* the code.) */
-TRP_RENTRY **trps_select_updates_for_peer(TALLOC_CTX *memctx, TRPS_INSTANCE *trps, TR_NAME *peer_gssname, size_t *n_update)
+static TRP_RENTRY **trps_select_updates_for_peer(TALLOC_CTX *memctx, TRPS_INSTANCE *trps, TR_NAME *peer_gssname, size_t *n_update)
{
size_t n_apc=0;
TR_NAME **apc=trp_rtable_get_apcs(trps->rtable, &n_apc);
return result;
}
+/* convert an rentry into a new trp update info record */
+static TRP_INFOREC *trps_rentry_to_inforec(TALLOC_CTX *mem_ctx, TRPS_INSTANCE *trps, TRP_RENTRY *entry)
+{
+ TRP_INFOREC *rec=trp_inforec_new(mem_ctx, TRP_INFOREC_TYPE_ROUTE);
+ unsigned int linkcost=0;
+
+ if (rec!=NULL) {
+ linkcost=trp_peer_get_linkcost(trps_get_peer(trps,
+ trp_rentry_get_next_hop(entry)));
+
+ /* Note that we leave the next hop empty since the recipient fills that in.
+ * This is where we add the link cost (currently always 1) to the next peer. */
+ if ((trp_inforec_set_comm(rec, trp_rentry_get_apc(entry)) != TRP_SUCCESS)
+ ||(trp_inforec_set_realm(rec, trp_rentry_get_realm(entry)) != TRP_SUCCESS)
+ ||(trp_inforec_set_trust_router(rec, trp_rentry_get_trust_router(entry)) != TRP_SUCCESS)
+ ||(trp_inforec_set_metric(rec, trp_rentry_get_metric(entry)+linkcost) != TRP_SUCCESS)
+ ||(trp_inforec_set_interval(rec, trps_get_update_interval(trps)) != TRP_SUCCESS)) {
+ tr_err("trps_rentry_to_inforec: error creating route update.");
+ talloc_free(rec);
+ rec=NULL;
+ }
+ }
+ return rec;
+}
+
+TRP_RC trps_scheduled_update(TRPS_INSTANCE *trps)
+{
+ TALLOC_CTX *tmp_ctx=talloc_new(NULL);
+ TRP_PTABLE_ITER *iter=trp_ptable_iter_new(tmp_ctx);
+ TRP_PEER *peer=NULL;
+ TR_MSG msg; /* not a pointer! */
+ TRP_UPD *upd=NULL;
+ TRP_RENTRY **update_list=NULL;
+ TRP_INFOREC *rec=NULL;
+ size_t n_updates=0, ii=0;
+ char *encoded=NULL;
+ TRP_RC rc=TRP_ERROR;
+
+ if (iter==NULL) {
+ tr_err("trps_scheduled_update: failed to allocate peer table iterator.");
+ talloc_free(tmp_ctx);
+ return TRP_NOMEM;
+ }
+
+ for (peer=trp_ptable_iter_first(iter, trps->ptable);
+ peer!=NULL;
+ peer=trp_ptable_iter_next(iter))
+ {
+ tr_debug("trps_scheduled_update: preparing scheduled route update for %.*%s",
+ trp_peer_get_gssname(peer)->len, trp_peer_get_gssname(peer)->buf);
+ upd=trp_upd_new(tmp_ctx);
+ /* do not fill in peer, recipient does that */
+ update_list=trps_select_updates_for_peer(tmp_ctx, trps, trp_peer_get_gssname(peer), &n_updates);
+ for (ii=0; ii<n_updates; ii++) {
+ rec=trps_rentry_to_inforec(tmp_ctx, trps, update_list[ii]);
+ if (rec==NULL) {
+ tr_err("trps_scheduled_update: could not create all update records.");
+ rc=TRP_ERROR;
+ goto cleanup;
+ }
+ trp_upd_add_inforec(upd, rec);
+ }
+ talloc_free(update_list);
+ update_list=NULL;
+
+ /* now encode the update message */
+ tr_msg_set_trp_upd(&msg, upd);
+ encoded=tr_msg_encode(&msg);
+ if (encoded==NULL) {
+ tr_err("trps_scheduled_update: error encoding update.");
+ rc=TRP_ERROR;
+ goto cleanup;
+ }
+ tr_debug("trps_scheduled_update: adding message to queue.");
+ if (trps_send_msg(trps, trp_peer_get_gssname(peer), encoded) != TRP_SUCCESS) {
+ tr_err("trps_scheduled_update: error queueing update.");
+ rc=TRP_ERROR;
+ tr_msg_free_encoded(encoded);
+ encoded=NULL;
+ goto cleanup;
+ }
+ tr_debug("trps_scheduled_update: message queued successfully.");
+ tr_msg_free_encoded(encoded);
+ encoded=NULL;
+ trp_upd_free(upd);
+ upd=NULL;
+ }
+
+cleanup:
+ trp_ptable_iter_free(iter);
+ talloc_free(tmp_ctx);
+ return rc;
+}
+
TRP_RC trps_add_peer(TRPS_INSTANCE *trps, TRP_PEER *peer)
{
return trp_ptable_add(trps->ptable, peer);
}
+
+TRP_PEER *trps_get_peer(TRPS_INSTANCE *trps, TR_NAME *gssname)
+{
+ return trp_ptable_find(trps->ptable, gssname);
+}