2 * Copyright (C) 2011-2012 Juho Vähä-Herttua
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
19 #include "http_request.h"
20 #include "http_response.h"
22 typedef struct httpd_s httpd_t
;
24 struct httpd_callbacks_s
{
26 void* (*conn_init
)(void *opaque
, unsigned char *local
, int locallen
, unsigned char *remote
, int remotelen
);
27 void (*conn_request
)(void *ptr
, http_request_t
*request
, http_response_t
**response
);
28 void (*conn_destroy
)(void *ptr
);
30 typedef struct httpd_callbacks_s httpd_callbacks_t
;
33 httpd_t
*httpd_init(logger_t
*logger
, httpd_callbacks_t
*callbacks
, int max_connections
);
35 int httpd_is_running(httpd_t
*httpd
);
37 int httpd_start(httpd_t
*httpd
, unsigned short *port
);
38 void httpd_stop(httpd_t
*httpd
);
40 void httpd_destroy(httpd_t
*httpd
);