Add working Hello World example
This commit is contained in:
+10
-1
@@ -12,13 +12,22 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define AISL_CONFIG_DEFAULT \
|
||||
{ \
|
||||
.server_spool_size = 1 \
|
||||
, .client_spool_size = 32 \
|
||||
, .ssl_spool_size = 1 \
|
||||
, .initial_buffer_size = 16536 \
|
||||
, .client_accept_limit = 1024 \
|
||||
, .client_silence_timeout = 30 \
|
||||
} \
|
||||
|
||||
|
||||
struct aisl_config
|
||||
{
|
||||
uint32_t server_spool_size;
|
||||
uint32_t client_spool_size;
|
||||
uint32_t ssl_spool_size;
|
||||
uint32_t callback_spool_size;
|
||||
uint32_t initial_buffer_size;
|
||||
uint32_t client_accept_limit;
|
||||
uint32_t client_silence_timeout;
|
||||
|
||||
+3
-42
@@ -76,52 +76,13 @@ aisl_set_ssl( aisl_t instance,
|
||||
* - #aisl_stream_t;
|
||||
*
|
||||
* @param instance a pointer to #aisl_t instance.
|
||||
* @param source a pointer to an event source.
|
||||
* @param event a code of event.
|
||||
* @param callback a pointer to function that will be triggered on event.
|
||||
* @return #aisl_status_t code.
|
||||
*/
|
||||
aisl_status_t
|
||||
aisl_set_callback( aisl_t instance,
|
||||
void * source,
|
||||
aisl_event_t event,
|
||||
aisl_callback_t callback );
|
||||
|
||||
|
||||
/**
|
||||
* @brief Raises event from source.
|
||||
* @param instance a pointer to #aisl_t instance.
|
||||
* @param source a pointer to an event source.
|
||||
* @param event a code of event.
|
||||
* @param ... a list of arguments specific for event.
|
||||
* @return true if event was handled by at least one callback, false otherwise.
|
||||
*/
|
||||
bool
|
||||
aisl_raise( aisl_t instance, void * source, aisl_event_t event, ... );
|
||||
|
||||
|
||||
/**
|
||||
* @brief Raises event from source.
|
||||
* @param instance a pointer to #aisl_t instance.
|
||||
* @param source a pointer to an event source.
|
||||
* @param event a code of event.
|
||||
* @param args a list of arguments specific for event.
|
||||
* @return true if event was handled by at least one callback, false otherwise.
|
||||
*/
|
||||
bool
|
||||
aisl_raise_vl( aisl_t instance,
|
||||
void * source,
|
||||
aisl_event_t event,
|
||||
va_list args );
|
||||
|
||||
|
||||
/**
|
||||
* @brief Unsets callbacks for specified source.
|
||||
* @param instance a pointer to #aisl_t instance.
|
||||
* @param source a pointer to an event source.
|
||||
*/
|
||||
void
|
||||
aisl_unset_callbacks_for( aisl_t instance, void * source );
|
||||
aisl_set_callback( aisl_t instance,
|
||||
aisl_event_t event,
|
||||
aisl_callback_t callback );
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+9
-24
@@ -68,23 +68,22 @@ aisl_status_to_string(aisl_status_t status);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AISL_HTTP_1_0
|
||||
, AISL_HTTP_1_1
|
||||
, AISL_HTTP_2_0
|
||||
AISL_HTTP_0_9 = 0x0009
|
||||
, AISL_HTTP_1_0 = 0x0100
|
||||
, AISL_HTTP_1_1 = 0x0101
|
||||
, AISL_HTTP_2_0 = 0x0200
|
||||
|
||||
} aisl_http_version_t;
|
||||
|
||||
#ifndef WITHOUT_STRINGIFIERS
|
||||
|
||||
const char *
|
||||
aisl_http_version_to_string( aisl_http_version_t version );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AISL_HTTP_GET
|
||||
AISL_HTTP_METHOD_UNKNOWN
|
||||
, AISL_HTTP_GET
|
||||
, AISL_HTTP_PUT
|
||||
, AISL_HTTP_POST
|
||||
, AISL_HTTP_HEAD
|
||||
@@ -97,13 +96,10 @@ typedef enum
|
||||
|
||||
} aisl_http_method_t;
|
||||
|
||||
#ifndef WITHOUT_STRINGIFIERS
|
||||
|
||||
const char *
|
||||
aisl_http_method_to_string( aisl_http_method_t method );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -160,14 +156,6 @@ const char *
|
||||
aisl_http_response_to_string( aisl_http_response_t code );
|
||||
|
||||
|
||||
#ifndef WITHOUT_STRINGIFIERS
|
||||
|
||||
const char *
|
||||
aisl_http_secure_to_string( bool is_secure );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Built-in Events IDs */
|
||||
|
||||
enum
|
||||
@@ -187,8 +175,6 @@ enum
|
||||
, AISL_EVENT_STREAM_CLOSE = 350
|
||||
, AISL_EVENT_STREAM_ERROR = 390
|
||||
|
||||
, AISL_EVENTS_CUSTOM = 1000
|
||||
|
||||
};
|
||||
|
||||
#ifndef WITHOUT_STRINGIFIERS
|
||||
@@ -231,7 +217,9 @@ typedef bool
|
||||
const char * val );
|
||||
|
||||
typedef bool
|
||||
(*aisl_on_stream_input_t)( aisl_stream_t stream, char * data, int32_t len );
|
||||
(*aisl_on_stream_input_t)( aisl_stream_t stream,
|
||||
const char * data,
|
||||
int32_t len );
|
||||
|
||||
typedef bool
|
||||
(*aisl_on_stream_request_t)( aisl_stream_t stream );
|
||||
@@ -245,7 +233,4 @@ typedef bool
|
||||
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