tr_free_name(req->comm);
if (req->orig_coi!=NULL)
tr_free_name(req->orig_coi);
+ if (req->request_id!=NULL)
+ tr_free_name(req->request_id);
return 0;
}
assert(req->json_references);
req->conn = -1;
req->free_conn = 1;
+ req->request_id = NULL;
return req;
}
return(req->orig_coi);
}
-void tid_req_set_rp_orig_coi(TID_REQ *req, TR_NAME *orig_coi)
+void tid_req_set_orig_coi(TID_REQ *req, TR_NAME *orig_coi)
{
req->orig_coi = orig_coi;
}
+void tid_req_set_request_id(TID_REQ *req, TR_NAME *request_id)
+{
+ req->request_id = request_id;
+}
+
+TR_NAME *tid_req_get_request_id(TID_REQ *req)
+{
+ return(req->request_id);
+}
+
TIDC_RESP_FUNC *tid_req_get_resp_func(TID_REQ *req)
{
return(req->resp_func);
req->cookie = cookie;
}
+/* struct is allocated in talloc null context */
TID_REQ *tid_dup_req (TID_REQ *orig_req)
{
TID_REQ *new_req = NULL;
- if (NULL == (new_req = talloc_zero(orig_req, TID_REQ))) {
+ if (NULL == (new_req = talloc_zero(NULL, TID_REQ))) {
tr_crit("tid_dup_req: Can't allocated duplicate request.");
return NULL;
}
tr_crit("tid_dup_req: Can't duplicate request (orig_coi).");
}
}
-
+
+ if (orig_req->request_id) {
+ if (NULL == (new_req->request_id = tr_dup_name(orig_req->request_id))) {
+ tr_crit("tid_dup_req: Can't duplicate request (request_id).");
+ }
+ }
+
return new_req;
}
+/* Adds the JSON object ref to req's list of objects to release when the
+ * req is freed.
+ */
void tid_req_cleanup_json( TID_REQ *req, json_t *ref)
{
(void) json_array_append_new(req->json_references, ref);