mirror of
https://github.com/simon987/sist2.git
synced 2025-04-19 10:16:42 +00:00
32 lines
657 B
C
32 lines
657 B
C
#ifndef SIST2_WEB_H
|
|
#define SIST2_WEB_H
|
|
|
|
#include "src/sist.h"
|
|
#include <mongoose.h>
|
|
|
|
typedef struct response {
|
|
char *body;
|
|
size_t size;
|
|
int status_code;
|
|
} response_t;
|
|
|
|
typedef struct {
|
|
response_t *resp;
|
|
int done;
|
|
} http_ev_data_t;
|
|
|
|
typedef struct {
|
|
http_ev_data_t ev_data;
|
|
struct mg_mgr mgr;
|
|
} subreq_ctx_t;
|
|
|
|
response_t *web_get(const char *url, int timeout);
|
|
response_t *web_post(const char * url, const char * data);
|
|
subreq_ctx_t *web_post_async(const char *url, const char *data);
|
|
response_t *web_put(const char *url, const char *data);
|
|
response_t *web_delete(const char *url);
|
|
|
|
void free_response(response_t *resp);
|
|
|
|
#endif
|