talloc_free(resp);
}
+/**
+ * Allocate a new copy of a TID_RESP
+ *
+ * @param mem_ctx
+ * @param resp
+ * @return
+ */
TID_RESP *tid_resp_dup(TALLOC_CTX *mem_ctx, TID_RESP *resp)
{
TID_RESP *newresp=NULL;
newresp=tid_resp_new(mem_ctx);
if (NULL!=newresp) {
- newresp->result=resp->result;
- newresp->err_msg=tr_dup_name(resp->err_msg);
- newresp->rp_realm=tr_dup_name(resp->rp_realm);
- newresp->realm=tr_dup_name(resp->realm);
- newresp->comm=tr_dup_name(resp->comm);
- newresp->orig_coi=tr_dup_name(resp->orig_coi);
- newresp->servers=tid_srvr_blk_dup(newresp, resp->servers);
- tid_resp_set_cons(newresp, resp->cons);
- tid_resp_set_error_path(newresp, resp->error_path);
+ tid_resp_cpy(newresp, resp);
}
return newresp;
}
+/**
+ * Copy contents of one TID_RESP to an existing TID_RESP
+ *
+ * @param dst
+ * @param src
+ * @return TID_SUCCESS on success, error code on error
+ */
+TID_RC tid_resp_cpy(TID_RESP *dst, TID_RESP *src)
+{
+ tid_resp_set_result(dst, tid_resp_get_result(src));
+ tid_resp_set_err_msg(dst,
+ tr_dup_name(tid_resp_get_err_msg(src)));
+ tid_resp_set_rp_realm(dst,
+ tr_dup_name(tid_resp_get_rp_realm(src)));
+ tid_resp_set_realm(dst,
+ tr_dup_name(tid_resp_get_realm(src)));
+ tid_resp_set_comm(dst,
+ tr_dup_name(tid_resp_get_comm(src)));
+ tid_resp_set_cons(dst, src->cons);
+ tid_resp_set_orig_coi(dst,
+ tr_dup_name(tid_resp_get_orig_coi(src)));
+ dst->servers = tid_srvr_blk_dup(dst, src->servers);
+ tid_resp_set_error_path(dst, src->error_path);
+
+ return TID_SUCCESS;
+}
+
TR_EXPORT int tid_resp_get_result(TID_RESP *resp)
{
return(resp->result);
if (srvr->aaa_server_dh!=NULL)
tr_destroy_dh_params(srvr->aaa_server_dh);
if (srvr->path!=NULL)
- json_decref(srvr->path);
+ json_decref((json_t *)(srvr->path));
return 0;
}
return head;
}
-TR_EXPORT void tid_srvr_blk_set_path(TID_SRVR_BLK *block, json_t *path)
+TR_EXPORT void tid_srvr_blk_set_path(TID_SRVR_BLK *block, TID_PATH *path)
{
if (block->path!=NULL)
- json_decref(block->path);
+ json_decref((json_t *)(block->path));
block->path=path;
if (block->path!=NULL)
- json_incref(block->path);
+ json_incref((json_t *)(block->path));
}
-TR_EXPORT const json_t *tid_srvr_get_path( const TID_SRVR_BLK *block)
+TR_EXPORT const TID_PATH *tid_srvr_get_path( const TID_SRVR_BLK *block)
{
if (!block)
return NULL;
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;
json_incref(resp->error_path);
}
-TR_EXPORT json_t *tid_resp_get_error_path(const TID_RESP *resp)
+TR_EXPORT const TID_PATH *tid_resp_get_error_path(const TID_RESP *resp)
{
if (!resp)
return NULL;
- return resp->error_path;
+ return (const TID_PATH *)(resp->error_path);
}
-TR_EXPORT json_t *tid_resp_get_a_path(const TID_RESP *const_resp)
+TR_EXPORT const TID_PATH *tid_resp_get_a_path(const TID_RESP *const_resp)
{
size_t index;
TID_SRVR_BLK *server;
if (!resp)
return NULL;
-
if (resp->error_path)
- return resp->error_path;
+ return (const TID_PATH *)(resp->error_path);
tid_resp_servers_foreach( resp, server, index) {
if (server->path)
return server->path;