TR request and response message handlers.
[trust_router.git] / include / tr_msg.h
index 7d8a5fa..bfd0da7 100644 (file)
 #ifndef TR_MSG_H
 #define TR_MSG_H
 
-#include <tpq.h>
-#include <tidr.h>
 #include <jansson.h>
+#include <trust_router/tr_versioning.h>
+#include <trust_router/tid.h>
 
 enum msg_type {
-  TR_UNKNOWN,
-  TPQ_REQUEST,
-  TPQ_RESPONSE,
-  TIDR_REQUEST,
-  TIDR_RESPONSE
+  TR_UNKNOWN = 0,
+  TID_REQUEST,
+  TID_RESPONSE
 };
 
 /* Union of TR message types to hold message of any type. */
 typedef struct tr_msg {
   enum msg_type msg_type;
   union {
-    TPQ_REQ *tpq_req;
-    TPQ_RESP *tpq_resp;
-    TIDR_REQ *tidr_req;
-    TIDR_RESP *tidr_resp;
+    TID_REQ *tid_req;
+    TID_RESP *tid_resp;
   };
 } TR_MSG;
 
 char *tr_msg_encode(TR_MSG *msg);
-TR_MSG *tr_msg_decode(char *jmsg);
+TR_MSG *tr_msg_decode(char *jmsg, size_t len);
 void tr_msg_free_encoded(char *jmsg);
 void tr_msg_free_decoded(TR_MSG *msg);