2017-01-01 23:03:06 +00:00
|
|
|
#ifndef WEBSERVER_H
|
|
|
|
#define WEBSERVER_H
|
|
|
|
|
2017-01-02 21:31:05 +00:00
|
|
|
#include "ws_types.h"
|
|
|
|
#include "ws_modes.h"
|
2017-01-02 21:48:49 +00:00
|
|
|
#include "ws_utils.h"
|
|
|
|
|
2017-01-01 23:03:06 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#define BUFFER_SIZE 1024
|
|
|
|
#define WS_HTTP_VERSION "HTTP/1.1"
|
|
|
|
#define WS_VERSION "0.1"
|
2017-01-02 21:48:49 +00:00
|
|
|
#define WS_NAME "Serwer"
|
2017-01-01 23:03:06 +00:00
|
|
|
|
2017-01-02 22:37:57 +00:00
|
|
|
#define LOG_TESTING 11
|
|
|
|
#define LOG_DEBUG 10
|
|
|
|
#define LOG_VERBOSE 5
|
|
|
|
#define LOG_WARN 2
|
|
|
|
#define LOG_MESSAGE 1
|
|
|
|
#define LOG_ERROR 0
|
|
|
|
|
2017-01-01 23:03:06 +00:00
|
|
|
headers_t ws_headers_create(void);
|
2017-01-11 12:08:13 +00:00
|
|
|
int ws_headers_add(headers_t*, const char*, const char*);
|
|
|
|
int ws_headers_convert(headers_t*, char*);
|
2017-01-01 23:03:06 +00:00
|
|
|
void ws_headers_free(headers_t*);
|
|
|
|
|
2017-01-11 12:08:13 +00:00
|
|
|
int ws_handle_add(webserver_t*, handle_t);
|
2017-01-03 00:01:24 +00:00
|
|
|
handler_t* ws_handler_find(webserver_t*, const char*, const char*);
|
2017-01-01 23:03:06 +00:00
|
|
|
|
2017-01-02 22:37:57 +00:00
|
|
|
size_t ws_send(int, int, headers_t, int);
|
2017-01-01 23:03:06 +00:00
|
|
|
void ws_simple_status(int, int);
|
|
|
|
|
2017-01-02 21:31:05 +00:00
|
|
|
webserver_t ws_create(const char*, const char*, const char*, FILE*, srvoptions_t);
|
|
|
|
int ws_listen(webserver_t*);
|
2017-01-01 23:03:06 +00:00
|
|
|
int ws_run(webserver_t*);
|
|
|
|
|
2017-01-02 21:31:05 +00:00
|
|
|
void ws_log(webserver_t*, loglevel_t, const char*, ...);
|
|
|
|
|
2017-01-01 23:03:06 +00:00
|
|
|
#endif
|