#ifndef PARSEE_PARSEE_H #define PARSEE_PARSEE_H #include #include #include #include typedef struct ParseeConfig { char *as_token, *hs_token; /* id here is "Parsee XMPP". */ char *sender_localpart; char *namespace_base; char *listen_as; int port; /* Homeserver port info */ char *homeserver_host; int homeserver_port; } ParseeConfig; typedef struct ParseeData { const ParseeConfig *config; HttpRouter *router; } ParseeData; /* Initialises a Parsee config from scratch, and writes to it * as JSON in the CWD. */ extern void ParseeConfigInit(void); /* Loads a Parsee config from a JSON filepath. */ extern void ParseeConfigLoad(char *); /* Retrieves the Parsee config if loaded. */ extern const ParseeConfig * ParseeConfigGet(void); /* Exports the Parsee config as a YAML document. */ extern void ParseeExportConfigYAML(Stream *); /* Destroys the Parsee configuration */ extern void ParseeConfigFree(void); /* Creates and destroys a data structure, stored on the heap. */ extern ParseeData * ParseeInitData(void); extern void ParseeFreeData(ParseeData *); /* HTTP server handler for Parsee, takes in a config. */ extern void ParseeRequest(HttpServerContext *, void *); extern HttpClientContext * ParseeCreateRequest(ParseeConfig *, HttpRequestMethod, char *); /* Sends headers, and writes the JSON object. */ extern HttpStatus ParseeSetRequestJSON(HttpClientContext *, HashMap *); #endif