summaryrefslogtreecommitdiff
path: root/src/trg-client.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/trg-client.h')
-rw-r--r--src/trg-client.h30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/trg-client.h b/src/trg-client.h
index a35b9cb..d6aa679 100644
--- a/src/trg-client.h
+++ b/src/trg-client.h
@@ -52,11 +52,25 @@
#define HTTP_OK 200
#define HTTP_CONFLICT 409
+#define FAIL_JSON_DECODE -2
+#define FAIL_RESPONSE_UNSUCCESSFUL -3
+#define DISPATCH_POOL_SIZE 3
+
+
typedef struct {
int status;
- char *data;
+ char *raw;
int size;
-} trg_http_response;
+ JsonObject *obj;
+ gpointer cb_data;
+} trg_response;
+
+typedef struct
+{
+ JsonNode *node;
+ GSourceFunc callback;
+ gpointer cb_data;
+} trg_request;
G_BEGIN_DECLS
@@ -98,14 +112,20 @@ typedef struct {
*/
int serial;
CURL *curl;
- trg_http_response *response;
} trg_tls;
/* stuff that used to be in http.h */
-void http_response_free(trg_http_response *response);
-trg_http_response *trg_http_perform(TrgClient * client, gchar * req);
+void trg_response_free(trg_response *response);
+int trg_http_perform(TrgClient * client, gchar * reqstr, trg_response *reqrsp);
/* end http.h*/
+/* stuff that used to be in dispatch.c */
+trg_response *dispatch(TrgClient * client, JsonNode * req);
+gboolean dispatch_async(TrgClient * client, JsonNode * req,
+ GSourceFunc callback,
+ gpointer data);
+/* end dispatch.c*/
+
GType trg_client_get_type (void);
TrgClient* trg_client_new (void);