+#include <tpq.h>
+static json_t *tr_msg_encode_dh(DH *dh)
+{
+ json_t *jdh = NULL;
+ json_t *jbn = NULL;
+
+ if ((!dh) || (!dh->p) || (!dh->g) || (!dh->pub_key))
+ return NULL;
+
+ jdh = json_object();
+
+ jbn = json_string(BN_bn2hex(dh->p));
+ json_object_set_new(jdh, "dh_p", jbn);
+
+ jbn = json_string(BN_bn2hex(dh->g));
+ json_object_set_new(jdh, "dh_g", jbn);
+
+ jbn = json_string(BN_bn2hex(dh->pub_key));
+ json_object_set_new(jdh, "dh_pub_key", jbn);
+
+ return jdh;
+}
+
+static DH *tr_msg_decode_dh(json_t *jdh)
+{
+ DH *dh = NULL;
+
+ return dh;
+}
+
+json_t *tr_msg_encode_tpqreq(TPQ_REQ *req)
+{
+ json_t *jreq = NULL;
+ json_t *jstr = NULL;
+
+ if ((!req) || (!req->rp_realm) || (!req->realm) || !(req->coi))
+ return NULL;
+
+ jreq = json_object();
+
+ jstr = json_string(req->rp_realm->buf);
+ json_object_set_new(jreq, "rp_realm", jstr);
+
+ jstr = json_string(req->realm->buf);
+ json_object_set_new(jreq, "target_realm", jstr);
+
+ jstr = json_string(req->coi->buf);
+ json_object_set_new(jreq, "community", jstr);
+
+ json_object_set_new(jreq, "dh_info", tr_msg_encode_dh(req->tpqc_dh));
+
+ return jreq;
+}
+
+TPQ_REQ *tr_msg_decode_tpqreq(json_t *jreq)
+{
+ TPQ_REQ *req = NULL;
+
+ return req;
+}
+
+json_t *tr_msg_encode_tpqresp(TPQ_RESP *resp)
+{
+ json_t *jresp = NULL;
+
+ return jresp;
+}
+
+
+TPQ_RESP *tr_msg_decode_tpqresp(json_t *jresp)
+{
+ TPQ_RESP *resp = NULL;
+
+ return resp;
+}
+
+json_t *tr_msg_encode_tidrreq(TIDR_REQ *req)
+{
+ json_t *jreq = NULL;
+
+ return jreq;
+
+}
+
+TIDR_REQ *tr_msg_decode_tidrreq(json_t *jreq)
+{
+ TIDR_REQ *req = NULL;
+
+ return req;
+}
+
+json_t *tr_msg_encode_tidrresp(TIDR_RESP *resp)
+{
+ json_t *jresp = NULL;
+
+ return jresp;
+}
+
+TIDR_RESP *tr_msg_decode_tidrresp(json_t *jresp)
+{
+ TIDR_RESP *resp = NULL;
+
+ return resp;
+}