Refactoring pending
This commit is contained in:
+2
-11
@@ -13,14 +13,8 @@
|
||||
/* AISL configuration structure */
|
||||
#include <aisl/config.h>
|
||||
|
||||
/* AISL status codes and utilities */
|
||||
#include <aisl/status.h>
|
||||
|
||||
/* AISL callbacks definitions */
|
||||
#include <aisl/callback.h>
|
||||
|
||||
/* AISL events enumeration and utilities*/
|
||||
#include <aisl/event.h>
|
||||
/* AISL types and stringifiers */
|
||||
#include <aisl/types.h>
|
||||
|
||||
/* AISL instancing, initialization and processing */
|
||||
#include <aisl/instance.h>
|
||||
@@ -34,7 +28,4 @@
|
||||
/* HTTP(s) streaming */
|
||||
#include <aisl/stream.h>
|
||||
|
||||
/* HTTP constants and utilities */
|
||||
#include <aisl/http.h>
|
||||
|
||||
#endif /* !AISL_H */
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* <aisl/callback.h>
|
||||
*
|
||||
* Copyright (c) 2017 by Löwenware Ltd.
|
||||
*
|
||||
* Project homepage: https://lowenware.com/aisl/
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AISL_CALLBACK_H_E99458C9_CCAA_4CAC_97F8_41E8869EE26F
|
||||
#define AISL_CALLBACK_H_E99458C9_CCAA_4CAC_97F8_41E8869EE26F
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdarg.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <aisl/server.h>
|
||||
#include <aisl/client.h>
|
||||
#include <aisl/stream.h>
|
||||
#include <aisl/http.h>
|
||||
|
||||
#define AISL_CALLBACK(x) ((aisl_callback_t) x)
|
||||
|
||||
|
||||
/* void-type callback */
|
||||
typedef void
|
||||
(* aisl_callback_t) (void);
|
||||
|
||||
|
||||
/* real type callbacks */
|
||||
|
||||
typedef bool
|
||||
(*aisl_server_open_t)( aisl_server_t server, int flags );
|
||||
|
||||
typedef bool
|
||||
(*aisl_server_error_t)( aisl_server_t server, int flags, const char * details );
|
||||
|
||||
typedef bool
|
||||
(*aisl_client_connect_t)( aisl_server_t server, aisl_client_t client );
|
||||
|
||||
typedef bool
|
||||
(*aisl_client_disconnect_t)( aisl_server_t server, aisl_client_t client );
|
||||
|
||||
typedef bool
|
||||
(*aisl_client_timeout_t)( aisl_server_t server, aisl_client_t client );
|
||||
|
||||
typedef bool
|
||||
(*aisl_stream_open_t)( aisl_stream_t stream,
|
||||
aisl_http_method_t method,
|
||||
const char * path,
|
||||
const char * query );
|
||||
|
||||
typedef bool
|
||||
(*aisl_stream_header_t)( aisl_stream_t stream,
|
||||
const char * key,
|
||||
const char * val );
|
||||
|
||||
typedef bool
|
||||
(*aisl_stream_input_t)( aisl_stream_t stream, char * data, int len );
|
||||
|
||||
typedef bool
|
||||
(*aisl_stream_request_t)( aisl_stream_t stream );
|
||||
|
||||
typedef bool
|
||||
(*aisl_stream_output_t)( aisl_stream_t stream, uint32_t buffer_space );
|
||||
|
||||
typedef bool
|
||||
(*aisl_stream_close_t)( aisl_stream_t stream );
|
||||
|
||||
typedef bool
|
||||
(*aisl_stream_error_t)( aisl_stream_t stream, const char * details );
|
||||
|
||||
typedef bool
|
||||
(*aisl_custom_event_t)( void * source, va_list vl );
|
||||
|
||||
#endif /* !AISL_CALLBACK_H */
|
||||
@@ -10,6 +10,6 @@
|
||||
#ifndef AISL_CLIENT_H_A6C37DCF_2183_4F22_A5A0_668311757A08
|
||||
#define AISL_CLIENT_H_A6C37DCF_2183_4F22_A5A0_668311757A08
|
||||
|
||||
typedef struct aisl_client * aisl_client_t;
|
||||
#include <aisl/types.h>
|
||||
|
||||
#endif /* !AISL_CLIENT_H */
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* <aisl/event.h>
|
||||
*
|
||||
* Copyright (c) 2017 by Löwenware Ltd.
|
||||
*
|
||||
* Project homepage: https://lowenware.com/aisl/
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AISL_EVENT_H_E99458C9_CCAA_4CAC_97F8_41E8869EE26F
|
||||
#define AISL_EVENT_H_E99458C9_CCAA_4CAC_97F8_41E8869EE26F
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
enum
|
||||
{
|
||||
AISL_SERVER_OPEN = 100
|
||||
, AISL_SERVER_ERROR = 190
|
||||
|
||||
, AISL_CLIENT_CONNECT = 200
|
||||
, AISL_CLIENT_DISCONNECT = 210
|
||||
, AISL_CLIENT_TIMEOUT = 220
|
||||
|
||||
, AISL_STREAM_OPEN = 300
|
||||
, AISL_STREAM_HEADER = 310
|
||||
, AISL_STREAM_INPUT = 320
|
||||
, AISL_STREAM_REQUEST = 330
|
||||
, AISL_STREAM_OUTPUT = 340
|
||||
, AISL_STREAM_CLOSE = 350
|
||||
, AISL_STREAM_ERROR = 390
|
||||
|
||||
, AISL_EVENTS_CUSTOM = 1000
|
||||
|
||||
};
|
||||
|
||||
typedef uint32_t aisl_event_t;
|
||||
|
||||
|
||||
const char *
|
||||
aisl_event_get_text( aisl_event_t event );
|
||||
|
||||
#endif /* !AISL_EVENT_H */
|
||||
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* aisl/http.h
|
||||
*
|
||||
* Copyright (c) 2017 by Löwenware Ltd.
|
||||
*
|
||||
* Project homepage: https://lowenware.com/aisl/
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AISL_HTTP_H_2BB40A17_5EB3_438B_8A98_EB3C68BA3A45
|
||||
#define AISL_HTTP_H_2BB40A17_5EB3_438B_8A98_EB3C68BA3A45
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AISL_HTTP_1_0
|
||||
, AISL_HTTP_1_1
|
||||
, AISL_HTTP_2_0
|
||||
|
||||
} aisl_http_version_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AISL_HTTP_GET
|
||||
, AISL_HTTP_PUT
|
||||
, AISL_HTTP_POST
|
||||
, AISL_HTTP_HEAD
|
||||
, AISL_HTTP_TRACE
|
||||
, AISL_HTTP_DELETE
|
||||
, AISL_HTTP_OPTIONS
|
||||
, AISL_HTTP_CONNECT
|
||||
|
||||
, AISL_HTTP_PRI
|
||||
|
||||
} aisl_http_method_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AISL_HTTP_CONTINUE = 100
|
||||
, AISL_HTTP_SWITCHING_PROTOCOLS
|
||||
|
||||
, AISL_HTTP_OK = 200
|
||||
, AISL_HTTP_CREATED
|
||||
, AISL_HTTP_ACCEPTED
|
||||
, AISL_HTTP_NON_AUTHORITATIVE_INFORMATION
|
||||
, AISL_HTTP_NO_CONTENT
|
||||
, AISL_HTTP_RESET_CONTENT
|
||||
, AISL_HTTP_PARTIAL_CONTENT
|
||||
|
||||
, AISL_HTTP_MULTIPLE_CHOICES = 300
|
||||
, AISL_HTTP_MOVED_PERMANENTLY
|
||||
, AISL_HTTP_FOUND
|
||||
, AISL_HTTP_SEE_OTHER
|
||||
, AISL_HTTP_NOT_MODIFIED
|
||||
, AISL_HTTP_USE_PROXY
|
||||
, AISL_HTTP_UNUSED
|
||||
, AISL_HTTP_TEMPORARY_REDIRECT
|
||||
|
||||
, AISL_HTTP_BAD_REQUEST = 400
|
||||
, AISL_HTTP_UNAUTHORIZED
|
||||
, AISL_HTTP_PAYMENT_REQUIRED
|
||||
, AISL_HTTP_FORBIDDEN
|
||||
, AISL_HTTP_NOT_FOUND
|
||||
, AISL_HTTP_METHOD_NOT_ALLOWED
|
||||
, AISL_HTTP_NOT_ACCEPTABLE
|
||||
, AISL_HTTP_PROXY_AUTHENTICATION_REQUIRED
|
||||
, AISL_HTTP_REQUEST_TIMEOUT
|
||||
, AISL_HTTP_CONFLICT
|
||||
, AISL_HTTP_GONE
|
||||
, AISL_HTTP_LENGTH_REQUIRED
|
||||
, AISL_HTTP_PRECONDITION_FAILED
|
||||
, AISL_HTTP_REQUEST_ENTITY_TOO_LARGE
|
||||
, AISL_HTTP_REQUEST_URI_TOO_LONG
|
||||
, AISL_HTTP_UNSUPPORTED_MEDIA_TYPE
|
||||
, AISL_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE
|
||||
, AISL_HTTP_EXPECTATION_FAILED
|
||||
|
||||
, AISL_HTTP_INTERNAL_SERVER_ERROR = 500
|
||||
, AISL_HTTP_NOT_IMPLEMENTED
|
||||
, AISL_HTTP_BAD_GATEWAY
|
||||
, AISL_HTTP_SERVICE_UNAVAILABLE
|
||||
, AISL_HTTP_GATEWAY_TIMEOUT
|
||||
, AISL_HTTP_VERSION_NOT_SUPPORTED
|
||||
|
||||
} aisl_http_response_t;
|
||||
|
||||
|
||||
const char *
|
||||
aisl_http_version_to_string( aisl_http_version_t version );
|
||||
|
||||
|
||||
const char *
|
||||
aisl_http_response_to_string( aisl_http_response_t code );
|
||||
|
||||
|
||||
const char *
|
||||
aisl_http_secure_to_string( int is_secure );
|
||||
|
||||
|
||||
const char *
|
||||
aisl_http_method_to_string( aisl_http_method_t method );
|
||||
|
||||
|
||||
#endif /* !AISL_HTTP_H */
|
||||
+32
-25
@@ -7,69 +7,76 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef INSTANCE_H_60576F41_454C_4189_B91A_F40501132230
|
||||
#define INSTANCE_H_60576F41_454C_4189_B91A_F40501132230
|
||||
#ifndef AISL_INSTANCE_H_60576F41_454C_4189_B91A_F40501132230
|
||||
#define AISL_INSTANCE_H_60576F41_454C_4189_B91A_F40501132230
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include <aisl/types.h>
|
||||
#include <aisl/config.h>
|
||||
|
||||
|
||||
typedef struct aisl_instance * aisl_instance_t;
|
||||
|
||||
|
||||
/* Initialization functions */
|
||||
|
||||
aisl_instance_t
|
||||
aisl_new( aisl_config_t * config );
|
||||
aisl_t
|
||||
aisl_new( aisl_config_t config );
|
||||
|
||||
|
||||
void
|
||||
aisl_free( aisl_instance_t instance );
|
||||
aisl_free( aisl_t instance );
|
||||
|
||||
|
||||
aisl_server_t
|
||||
aisl_listen( aisl_instance_t instance,
|
||||
const char * address,
|
||||
uint16_t port );
|
||||
aisl_listen( aisl_t instance, const char * address, uint16_t port );
|
||||
|
||||
|
||||
#ifdef AISL_WITH_SSL
|
||||
|
||||
aisl_status_t
|
||||
aisl_set_ssl( aisl_instance_t instance,
|
||||
aisl_set_ssl( aisl_t instance,
|
||||
const char * hostname,
|
||||
const char * key_file,
|
||||
const char * crt_file );
|
||||
|
||||
#endif
|
||||
|
||||
/* Callbacks and Events functions */
|
||||
|
||||
aisl_status_t
|
||||
aisl_set_callback( aisl_instance_t instance,
|
||||
aisl_set_callback( aisl_t instance,
|
||||
void * source,
|
||||
aisl_event_t e_id,
|
||||
aisl_callback_t cb );
|
||||
aisl_event_t event,
|
||||
aisl_callback_t callback );
|
||||
|
||||
|
||||
aisl_status_t
|
||||
aisl_raise( aisl_t instance, void * source, aisl_event_t event, ... );
|
||||
|
||||
|
||||
aisl_status_t
|
||||
aisl_raise_vl( aisl_t instance,
|
||||
void * source,
|
||||
aisl_event_t event,
|
||||
va_list args );
|
||||
|
||||
|
||||
void
|
||||
aisl_unset_callback_for( aisl_t instance, void * source );
|
||||
|
||||
|
||||
/* Control functions */
|
||||
|
||||
aisl_status_t
|
||||
aisl_run_cycle( aisl_instance_t instance );
|
||||
aisl_run_cycle( aisl_t instance );
|
||||
|
||||
|
||||
const char *
|
||||
aisl_get_error( aisl_instance_t instance );
|
||||
aisl_get_error( aisl_t instance );
|
||||
|
||||
|
||||
aisl_status_t
|
||||
aisl_sleep( aisl_instance_t instance, uint32_t usec );
|
||||
aisl_sleep( aisl_t instance, uint32_t usec );
|
||||
|
||||
|
||||
aisl_status_t
|
||||
aisl_raise( aisl_instance_t instance, aisl_event_t event, ...);
|
||||
|
||||
|
||||
aisl_status_t
|
||||
aisl_raisev( aisl_instance_t instance, aisl_event_t event, va_list args);
|
||||
|
||||
#endif /* !INSTANCE_H */
|
||||
#endif /* !AISL_INSTANCE_H */
|
||||
|
||||
@@ -10,9 +10,8 @@
|
||||
#ifndef AISL_SERVER_H_CC564608_7A05_4B31_9E7E_32750BC60768
|
||||
#define AISL_SERVER_H_CC564608_7A05_4B31_9E7E_32750BC60768
|
||||
|
||||
typedef struct aisl_server * aisl_server_t;
|
||||
|
||||
|
||||
#include <aisl/types.h>
|
||||
#ifdef AISL_WITH_SSL
|
||||
|
||||
aisl_status_t
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* <aisl/status.h>
|
||||
*
|
||||
* Copyright (c) 2017 by Löwenware Ltd.
|
||||
*
|
||||
* Project homepage: https://lowenware.com/aisl/
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AISL_STATUS_H_BF7E4434_A711_4D7C_B3AE_1BA2E1A020EF
|
||||
#define AISL_STATUS_H_BF7E4434_A711_4D7C_B3AE_1BA2E1A020EF
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AISL_EXTCALL_ERROR = -3
|
||||
, AISL_SYSCALL_ERROR = -2
|
||||
, AISL_MALLOC_ERROR = -1
|
||||
|
||||
, AISL_SUCCESS = 0
|
||||
, AISL_IDLE = 1
|
||||
|
||||
} aisl_status_t;
|
||||
|
||||
|
||||
const char *
|
||||
aisl_status_to_string(aisl_status_t status);
|
||||
|
||||
#endif /* !AISL_STATUS_H */
|
||||
@@ -7,10 +7,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef STREAM_H_4D8EB622_3CE0_4F1B_AC1F_B27CCB5C2EDC
|
||||
#define STREAM_H_4D8EB622_3CE0_4F1B_AC1F_B27CCB5C2EDC
|
||||
#ifndef AISL_STREAM_H_4D8EB622_3CE0_4F1B_AC1F_B27CCB5C2EDC
|
||||
#define AISL_STREAM_H_4D8EB622_3CE0_4F1B_AC1F_B27CCB5C2EDC
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include <aisl/types.h>
|
||||
|
||||
typedef struct aisl_stream * aisl_stream_t;
|
||||
|
||||
|
||||
/* Stream helpers */
|
||||
@@ -31,7 +34,7 @@ aisl_http_version_t
|
||||
aisl_get_http_version( aisl_stream_t stream );
|
||||
|
||||
|
||||
aisl_instance_t
|
||||
aisl_t
|
||||
aisl_stream_get_instance( aisl_stream_t s );
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,243 @@
|
||||
/*
|
||||
* <aisl/types.h>
|
||||
*
|
||||
* Copyright (c) 2017-2019 by Löwenware Ltd.
|
||||
*
|
||||
* Project homepage: https://lowenware.com/aisl/
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AISL_TYPES_H_86A9DBA7_C0E6_4CF4_8A64_DAAD4A81031B
|
||||
#define AISL_TYPES_H_86A9DBA7_C0E6_4CF4_8A64_DAAD4A81031B
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/* type casts */
|
||||
#define AISL_CALLBACK(x) ((aisl_callback_t) x)
|
||||
|
||||
|
||||
/* AISL Instance */
|
||||
typedef struct aisl * aisl_t;
|
||||
|
||||
/* Event Identifier */
|
||||
typedef uint32_t aisl_event_t;
|
||||
|
||||
/* HTTP(s) Server */
|
||||
typedef struct aisl_server * aisl_server_t;
|
||||
|
||||
/* HTTP(s) Client */
|
||||
typedef struct aisl_client * aisl_client_t;
|
||||
|
||||
/* Server<->Client Stream */
|
||||
typedef struct aisl_stream * aisl_stream_t;
|
||||
|
||||
/* void type event callback */
|
||||
typedef void
|
||||
(* aisl_callback_t) (void);
|
||||
|
||||
/* status return codes */
|
||||
typedef enum
|
||||
{
|
||||
AISL_EXTCALL_ERROR = -3
|
||||
, AISL_SYSCALL_ERROR = -2
|
||||
, AISL_MALLOC_ERROR = -1
|
||||
|
||||
, AISL_SUCCESS = 0
|
||||
, AISL_IDLE = 1
|
||||
|
||||
} aisl_status_t;
|
||||
|
||||
#ifdef WITH_STRINGIFIERS
|
||||
|
||||
const char *
|
||||
aisl_status_to_string(aisl_status_t status);
|
||||
|
||||
#endif
|
||||
|
||||
/* Generic HTTP Enumerations */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AISL_HTTP_1_0
|
||||
, AISL_HTTP_1_1
|
||||
, AISL_HTTP_2_0
|
||||
|
||||
} aisl_http_version_t;
|
||||
|
||||
#ifdef WITH_STRINGIFIERS
|
||||
|
||||
const char *
|
||||
aisl_http_version_to_string( aisl_http_version_t version );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AISL_HTTP_GET
|
||||
, AISL_HTTP_PUT
|
||||
, AISL_HTTP_POST
|
||||
, AISL_HTTP_HEAD
|
||||
, AISL_HTTP_TRACE
|
||||
, AISL_HTTP_DELETE
|
||||
, AISL_HTTP_OPTIONS
|
||||
, AISL_HTTP_CONNECT
|
||||
|
||||
, AISL_HTTP_PRI
|
||||
|
||||
} aisl_http_method_t;
|
||||
|
||||
#ifdef WITH_STRINGIFIERS
|
||||
|
||||
const char *
|
||||
aisl_http_method_to_string( aisl_http_method_t method );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AISL_HTTP_CONTINUE = 100
|
||||
, AISL_HTTP_SWITCHING_PROTOCOLS
|
||||
|
||||
, AISL_HTTP_OK = 200
|
||||
, AISL_HTTP_CREATED
|
||||
, AISL_HTTP_ACCEPTED
|
||||
, AISL_HTTP_NON_AUTHORITATIVE_INFORMATION
|
||||
, AISL_HTTP_NO_CONTENT
|
||||
, AISL_HTTP_RESET_CONTENT
|
||||
, AISL_HTTP_PARTIAL_CONTENT
|
||||
|
||||
, AISL_HTTP_MULTIPLE_CHOICES = 300
|
||||
, AISL_HTTP_MOVED_PERMANENTLY
|
||||
, AISL_HTTP_FOUND
|
||||
, AISL_HTTP_SEE_OTHER
|
||||
, AISL_HTTP_NOT_MODIFIED
|
||||
, AISL_HTTP_USE_PROXY
|
||||
, AISL_HTTP_UNUSED
|
||||
, AISL_HTTP_TEMPORARY_REDIRECT
|
||||
|
||||
, AISL_HTTP_BAD_REQUEST = 400
|
||||
, AISL_HTTP_UNAUTHORIZED
|
||||
, AISL_HTTP_PAYMENT_REQUIRED
|
||||
, AISL_HTTP_FORBIDDEN
|
||||
, AISL_HTTP_NOT_FOUND
|
||||
, AISL_HTTP_METHOD_NOT_ALLOWED
|
||||
, AISL_HTTP_NOT_ACCEPTABLE
|
||||
, AISL_HTTP_PROXY_AUTHENTICATION_REQUIRED
|
||||
, AISL_HTTP_REQUEST_TIMEOUT
|
||||
, AISL_HTTP_CONFLICT
|
||||
, AISL_HTTP_GONE
|
||||
, AISL_HTTP_LENGTH_REQUIRED
|
||||
, AISL_HTTP_PRECONDITION_FAILED
|
||||
, AISL_HTTP_REQUEST_ENTITY_TOO_LARGE
|
||||
, AISL_HTTP_REQUEST_URI_TOO_LONG
|
||||
, AISL_HTTP_UNSUPPORTED_MEDIA_TYPE
|
||||
, AISL_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE
|
||||
, AISL_HTTP_EXPECTATION_FAILED
|
||||
|
||||
, AISL_HTTP_INTERNAL_SERVER_ERROR = 500
|
||||
, AISL_HTTP_NOT_IMPLEMENTED
|
||||
, AISL_HTTP_BAD_GATEWAY
|
||||
, AISL_HTTP_SERVICE_UNAVAILABLE
|
||||
, AISL_HTTP_GATEWAY_TIMEOUT
|
||||
, AISL_HTTP_VERSION_NOT_SUPPORTED
|
||||
|
||||
} aisl_http_response_t;
|
||||
|
||||
#ifdef WITH_STRINGIFIERS
|
||||
|
||||
const char *
|
||||
aisl_http_response_to_string( aisl_http_response_t code );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WITH_STRINGIFIERS
|
||||
|
||||
const char *
|
||||
aisl_http_secure_to_string( bool is_secure );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Built-in Events IDs */
|
||||
|
||||
enum
|
||||
{
|
||||
AISL_EVENT_SERVER_OPEN = 100
|
||||
, AISL_EVENT_SERVER_ERROR = 190
|
||||
|
||||
, AISL_EVENT_CLIENT_CONNECT = 200
|
||||
, AISL_EVENT_CLIENT_DISCONNECT = 210
|
||||
, AISL_EVENT_CLIENT_TIMEOUT = 220
|
||||
|
||||
, AISL_EVENT_STREAM_OPEN = 300
|
||||
, AISL_EVENT_STREAM_HEADER = 310
|
||||
, AISL_EVENT_STREAM_INPUT = 320
|
||||
, AISL_EVENT_STREAM_REQUEST = 330
|
||||
, AISL_EVENT_STREAM_OUTPUT = 340
|
||||
, AISL_EVENT_STREAM_CLOSE = 350
|
||||
, AISL_EVENT_STREAM_ERROR = 390
|
||||
|
||||
, AISL_EVENTS_CUSTOM = 1000
|
||||
|
||||
};
|
||||
|
||||
#ifdef WITH_STRINGIFIERS
|
||||
|
||||
const char *
|
||||
aisl_event_to_string( aisl_event_t event );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* real type event callbacks */
|
||||
|
||||
typedef bool
|
||||
(*aisl_on_server_open_t)( aisl_server_t server );
|
||||
|
||||
typedef bool
|
||||
(*aisl_on_server_error_t)( aisl_server_t server );
|
||||
|
||||
typedef bool
|
||||
(*aisl_on_client_connect_t)( aisl_client_t client );
|
||||
|
||||
typedef bool
|
||||
(*aisl_on_client_disconnect_t)( aisl_client_t client );
|
||||
|
||||
typedef bool
|
||||
(*aisl_on_client_timeout_t)( aisl_client_t client );
|
||||
|
||||
typedef bool
|
||||
(*aisl_on_stream_open_t)( aisl_stream_t stream,
|
||||
aisl_http_method_t method,
|
||||
const char * path,
|
||||
const char * query );
|
||||
|
||||
typedef bool
|
||||
(*aisl_on_stream_header_t)( aisl_stream_t stream,
|
||||
const char * key,
|
||||
const char * val );
|
||||
|
||||
typedef bool
|
||||
(*aisl_on_stream_input_t)( aisl_stream_t stream, char * data, size_t len );
|
||||
|
||||
typedef bool
|
||||
(*aisl_on_stream_request_t)( aisl_stream_t stream );
|
||||
|
||||
typedef bool
|
||||
(*aisl_on_stream_output_t)( aisl_stream_t stream, size_t buffer_space );
|
||||
|
||||
typedef bool
|
||||
(*aisl_on_stream_close_t)( aisl_stream_t stream );
|
||||
|
||||
typedef bool
|
||||
(*aisl_on_stream_error_t)( aisl_stream_t stream );
|
||||
|
||||
typedef bool
|
||||
(*aisl_on_custom_event_t)( void * source, va_list vl );
|
||||
|
||||
#endif /* !AISL_TYPES_H */
|
||||
Reference in New Issue
Block a user