Add accessor for TID_SRVR_BLK's key_expiration
authorJennifer Richards <jennifer@painless-security.com>
Mon, 17 Jul 2017 17:29:45 +0000 (13:29 -0400)
committerJennifer Richards <jennifer@painless-security.com>
Mon, 17 Jul 2017 17:29:45 +0000 (13:29 -0400)
  * add the accessor
  * bump libtr_tid ABI version

Makefile.am
include/trust_router/tid.h
tid/tid_resp.c

index 2254baf..259faa3 100644 (file)
@@ -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 \
index 0475d4d..8fc4267 100644 (file)
@@ -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;                                            \
index c6ee2e8..e75571b 100644 (file)
@@ -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;