From 2110d636759c198eac101d6c4ee28daf38829778 Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Mon, 17 Jul 2017 13:29:45 -0400 Subject: [PATCH] Add accessor for TID_SRVR_BLK's key_expiration * add the accessor * bump libtr_tid ABI version --- Makefile.am | 2 +- include/trust_router/tid.h | 3 ++- tid/tid_resp.c | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2254baf..259faa3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,7 +48,7 @@ trp/trp_upd.c libtr_tid_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden libtr_tid_la_LIBADD = gsscon/libgsscon.la $(GLIB_LIBS) -libtr_tid_la_LDFLAGS = $(AM_LDFLAGS) -version-info 3:0:1 -no-undefined +libtr_tid_la_LDFLAGS = $(AM_LDFLAGS) -version-info 4:0:2 -no-undefined common_t_constraint_SOURCES = common/t_constraint.c \ common/tr_debug.c \ diff --git a/include/trust_router/tid.h b/include/trust_router/tid.h index 0475d4d..8fc4267 100644 --- a/include/trust_router/tid.h +++ b/include/trust_router/tid.h @@ -132,7 +132,8 @@ TR_EXPORT void tid_srvr_get_address(const TID_SRVR_BLK *, TR_EXPORT DH *tid_srvr_get_dh(TID_SRVR_BLK *); TR_EXPORT const TR_NAME *tid_srvr_get_key_name(const TID_SRVR_BLK *); TR_EXPORT const TID_PATH *tid_srvr_get_path(const TID_SRVR_BLK *); - +/* Key expiration time is expressed as time since 1970-01-01 00:00:00 UTC */ +TR_EXPORT int tid_srvr_get_key_expiration(const TID_SRVR_BLK *, struct timeval *tv_out); #define tid_resp_servers_foreach(RESP, SERVER, INDEX) \ for (INDEX=0,SERVER=NULL; \ diff --git a/tid/tid_resp.c b/tid/tid_resp.c index c6ee2e8..e75571b 100644 --- a/tid/tid_resp.c +++ b/tid/tid_resp.c @@ -278,6 +278,17 @@ TR_EXPORT const TID_PATH *tid_srvr_get_path( const TID_SRVR_BLK *block) return block->path; } +TR_EXPORT int tid_srvr_get_key_expiration(const TID_SRVR_BLK *block, struct timeval *tv_out) +{ + if ((block==NULL) || (tv_out==NULL)) + return -1; /* error */ + + tv_out->tv_sec=block->key_expiration.tv_sec; + tv_out->tv_usec=block->key_expiration.tv_usec; + return 0; +} + + TR_EXPORT void tid_resp_set_cons(TID_RESP *resp, TR_CONSTRAINT_SET *cons) { json_t *jc=(json_t *)cons; -- 2.1.4