#ifndef AWS_HTTP_SERVER_H
#define AWS_HTTP_SERVER_H
#include <aws/http/http.h>
struct aws_http_connection;
struct aws_server_bootstrap;
struct aws_socket_options;
struct aws_tls_connection_options;
struct aws_http_server;
struct aws_http_stream;
typedef void(aws_http_server_on_incoming_connection_fn)(
struct aws_http_server *server,
struct aws_http_connection *connection,
int error_code,
void *user_data);
typedef void(aws_http_server_on_destroy_fn)(void *user_data);
struct aws_http_server_options {
size_t self_size;
struct aws_allocator *allocator;
struct aws_server_bootstrap *bootstrap;
struct aws_socket_endpoint *endpoint;
struct aws_socket_options *socket_options;
struct aws_tls_connection_options *tls_options;
size_t initial_window_size;
void *server_user_data;
aws_http_server_on_incoming_connection_fn *on_incoming_connection;
aws_http_server_on_destroy_fn *on_destroy_complete;
bool manual_window_management;
};
#define AWS_HTTP_SERVER_OPTIONS_INIT \
{ .self_size = sizeof(struct aws_http_server_options), .initial_window_size = SIZE_MAX, }
typedef struct aws_http_stream *(
aws_http_on_incoming_request_fn)(struct aws_http_connection *connection, void *user_data);
typedef void(aws_http_on_server_connection_shutdown_fn)(
struct aws_http_connection *connection,
int error_code,
void *connection_user_data);
struct aws_http_server_connection_options {
size_t self_size;
void *connection_user_data;
aws_http_on_incoming_request_fn *on_incoming_request;
aws_http_on_server_connection_shutdown_fn *on_shutdown;
};
#define AWS_HTTP_SERVER_CONNECTION_OPTIONS_INIT \
{ .self_size = sizeof(struct aws_http_server_connection_options), }
AWS_EXTERN_C_BEGIN
AWS_HTTP_API
struct aws_http_server *aws_http_server_new(const struct aws_http_server_options *options);
AWS_HTTP_API
void aws_http_server_release(struct aws_http_server *server);
AWS_HTTP_API
int aws_http_connection_configure_server(
struct aws_http_connection *connection,
const struct aws_http_server_connection_options *options);
AWS_HTTP_API
bool aws_http_connection_is_server(const struct aws_http_connection *connection);
AWS_EXTERN_C_END
#endif