Imported Upstream version 0.9.0
[deb_shairplay.git] / src / lib / httpd.h
1 /**
2 * Copyright (C) 2011-2012 Juho Vähä-Herttua
3 *
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.
8 *
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.
13 */
14
15 #ifndef HTTPD_H
16 #define HTTPD_H
17
18 #include "logger.h"
19 #include "http_request.h"
20 #include "http_response.h"
21
22 typedef struct httpd_s httpd_t;
23
24 struct httpd_callbacks_s {
25 void* opaque;
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);
29 };
30 typedef struct httpd_callbacks_s httpd_callbacks_t;
31
32
33 httpd_t *httpd_init(logger_t *logger, httpd_callbacks_t *callbacks, int max_connections);
34
35 int httpd_is_running(httpd_t *httpd);
36
37 int httpd_start(httpd_t *httpd, unsigned short *port);
38 void httpd_stop(httpd_t *httpd);
39
40 void httpd_destroy(httpd_t *httpd);
41
42
43 #endif