-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver_api.h
More file actions
27 lines (23 loc) · 966 Bytes
/
server_api.h
File metadata and controls
27 lines (23 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef SERVER_API_H
#define SERVER_API_H
#include "ssl_api.h"
#include <stdint.h>
#include <sys/socket.h>
#define IP_VERSION AF_INET
#define TRANSPORT_PROTOCOL SOCK_STREAM
#define HTTP_SRV_OPT_KEEP_ALIVE 0x01
#define HTTP_SRV_OPT_TE_CHUNKED 0x02
#define TIMEOUT_DEFAULT_SEC 10
typedef int (*start_server_t)(char* address, uint_least16_t port,
char* root_folder, char* default_file,
char* msg_log_file);
int create_socket();
int bind_socket(int sockfd, char* address, uint16_t port);
int listen_connection(int sockfd);
int accept_connection(int sockfd);
int start_http_server(char* address, uint16_t port, char* root_folder,
char* default_file, char* msg_log_file, char* ssl_key, char* ssl_crt);
int start_https_server(char* address, uint16_t port, char* root_folder,
char* default_file, char* msg_log_file);
void set_root_folder(char* root_folder);
#endif