Lacewing.h | Lacewing.h | |||
---|---|---|---|---|
/* | /* vim: set et ts=4 sw=4 ft=cpp: | |||
* Copyright (c) 2011 James McLaughlin. All rights reserved. | * | |||
* Copyright (C) 2011 James McLaughlin. All rights reserved. | ||||
* | * | |||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | * modification, are permitted provided that the following conditions | |||
* are met: | * are met: | |||
* | * | |||
* 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | * notice, this list of conditions and the following disclaimer. | |||
* | * | |||
* 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in the | * notice, this list of conditions and the following disclaimer in the | |||
skipping to change at line 46 | skipping to change at line 47 | |||
#include <stdarg.h> | #include <stdarg.h> | |||
#ifndef _WIN32 | #ifndef _WIN32 | |||
#include <inttypes.h> | #include <inttypes.h> | |||
#define lw_i64 int64_t | #define lw_i64 int64_t | |||
#define lw_iptr intptr_t | #define lw_iptr intptr_t | |||
#define lw_i32 int32_t | #define lw_i32 int32_t | |||
#define lw_i16 int16_t | #define lw_i16 int16_t | |||
#define lw_i8 int8_t | ||||
#ifndef LacewingHandler | #ifndef LacewingHandler | |||
#define LacewingHandler | #define LacewingHandler | |||
#endif | #endif | |||
#ifndef LacewingFunction | #ifndef LacewingFunction | |||
#define LacewingFunction | #define LacewingFunction | |||
#endif | #endif | |||
#else | #else | |||
#ifdef _WIN64 | #ifdef _WIN64 | |||
#define lw_iptr __int64 | #define lw_iptr __int64 | |||
#else | #else | |||
#define lw_iptr __int32 | #define lw_iptr __int32 | |||
#endif | #endif | |||
#define lw_i64 __int64 | #define lw_i64 __int64 | |||
#define lw_i32 __int32 | #define lw_i32 __int32 | |||
#define lw_i16 __int16 | #define lw_i16 __int16 | |||
#define lw_i8 __int8 | ||||
#define LacewingHandler __cdecl | #define LacewingHandler __cdecl | |||
#endif | #endif | |||
#define lw_bool lw_iptr | ||||
#ifndef LacewingFunction | #ifndef LacewingFunction | |||
#define LacewingFunction __declspec(dllimport) | #define LacewingFunction __declspec(dllimport) | |||
#ifndef Lacewing_NoAutoLink | #ifndef Lacewing_NoAutoLink | |||
#pragma comment(lib, "Lacewing.lib") | #pragma comment(lib, "Lacewing.lib") | |||
#endif | #endif | |||
#endif | #endif | |||
typedef lw_i8 lw_bool; | ||||
const lw_bool lw_true = (lw_bool) 1; | ||||
const lw_bool lw_false = (lw_bool) 0; | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" | extern "C" | |||
{ | { | |||
#endif /* __cplusplus */ | #endif /* __cplusplus */ | |||
#define LacewingFlat(c) \ | #define LacewingFlat(c) \ | |||
typedef struct { void * reserved; void * tag; } c; | typedef struct { void * reserved; void * tag; } c; | |||
LacewingFunction const char* lw_version (); | LacewingFunction const char* lw_version (); | |||
LacewingFunction lw_bool lw_start_thread (void * functio | ||||
n, void * param); | ||||
LacewingFunction void lw_set_current_thread_name (const char * n | ||||
ame); | ||||
LacewingFunction void lw_pause (long milliseco | ||||
nds); | ||||
LacewingFunction void lw_yield (); | ||||
LacewingFunction lw_i64 lw_current_thread_id (); | LacewingFunction lw_i64 lw_current_thread_id (); | |||
LacewingFunction lw_i64 lw_file_last_modified (const char * f ilename); | LacewingFunction lw_i64 lw_file_last_modified (const char * f ilename); | |||
LacewingFunction lw_bool lw_file_exists (const char * f ilename); | LacewingFunction lw_bool lw_file_exists (const char * f ilename); | |||
LacewingFunction lw_i64 lw_file_size (const char * f ilename); | LacewingFunction lw_i64 lw_file_size (const char * f ilename); | |||
LacewingFunction lw_bool lw_path_exists (const char * f ilename); | LacewingFunction lw_bool lw_path_exists (const char * f ilename); | |||
LacewingFunction void lw_int64_to_string (lw_i64, char * ); | LacewingFunction void lw_int64_to_string (lw_i64, char * ); | |||
LacewingFunction void lw_temp_path (char * buffer, | LacewingFunction void lw_temp_path (char * buffer) | |||
long length); | ; | |||
LacewingFunction void lw_new_temp_file (char * buffer, | LacewingFunction void lw_new_temp_file (char * buffer) | |||
long length); | ; | |||
LacewingFunction long lw_count_processors (); | ||||
LacewingFunction const char* lw_guess_mime_type (const char * f ilename); | LacewingFunction const char* lw_guess_mime_type (const char * f ilename); | |||
LacewingFunction void lw_md5 (char * output, const char * input, long length); | LacewingFunction void lw_md5 (char * output, const char * input, long length); | |||
LacewingFunction void lw_md5_hex (char * output, const char * input, long length); | LacewingFunction void lw_md5_hex (char * output, const char * input, long length); | |||
LacewingFunction void lw_sha1 (char * output, const char * input, long length); | LacewingFunction void lw_sha1 (char * output, const char * input, long length); | |||
LacewingFunction void lw_sha1_hex (char * output, const char * input, long length); | LacewingFunction void lw_sha1_hex (char * output, const char * input, long length); | |||
/* Thread */ | ||||
LacewingFlat (lw_thread); | ||||
LacewingFunction lw_thread* lw_thread_new (const char * name, v | ||||
oid * function); | ||||
LacewingFunction void lw_thread_delete (lw_thread *); | ||||
LacewingFunction void lw_thread_start (lw_thread *, void * | ||||
parameter); | ||||
LacewingFunction lw_bool lw_thread_started (lw_thread *); | ||||
LacewingFunction long lw_thread_join (lw_thread *); | ||||
/* Address */ | /* Address */ | |||
LacewingFlat (lw_addr); | LacewingFlat (lw_addr); | |||
LacewingFunction lw_addr* lw_addr_new (); | LacewingFunction lw_addr* lw_addr_new (); | |||
LacewingFunction lw_addr* lw_addr_new_ip (unsigned int ip, long port); | LacewingFunction lw_addr* lw_addr_new_ip (long ip, long port); | |||
LacewingFunction lw_addr* lw_addr_new_name (const char * hostname , long port, lw_bool blocking); | LacewingFunction lw_addr* lw_addr_new_name (const char * hostname , long port, lw_bool blocking); | |||
LacewingFunction lw_addr* lw_addr_copy (lw_addr *); | LacewingFunction lw_addr* lw_addr_copy (lw_addr *); | |||
LacewingFunction void lw_addr_delete (lw_addr *); | LacewingFunction void lw_addr_delete (lw_addr *); | |||
LacewingFunction long lw_addr_port (lw_addr *); | LacewingFunction long lw_addr_port (lw_addr *); | |||
LacewingFunction void lw_addr_set_port (lw_addr *, long port) ; | LacewingFunction void lw_addr_set_port (lw_addr *, long port) ; | |||
LacewingFunction lw_bool lw_addr_is_ready (lw_addr *); | LacewingFunction lw_bool lw_addr_is_ready (lw_addr *); | |||
LacewingFunction long lw_addr_ip (lw_addr *); | LacewingFunction long lw_addr_ip (lw_addr *); | |||
LacewingFunction unsigned char lw_addr_ip_byte (lw_addr *, long index ); | LacewingFunction unsigned char lw_addr_ip_byte (lw_addr *, long index ); | |||
LacewingFunction const char* lw_addr_tostring (lw_addr *); | LacewingFunction const char* lw_addr_tostring (lw_addr *); | |||
LacewingFunction void* lw_addr_tag (lw_addr *); | ||||
LacewingFunction void lw_addr_set_tag (lw_addr *, void * tag | ||||
); | ||||
/* EventPump */ | /* EventPump */ | |||
LacewingFlat (lw_eventpump); | LacewingFlat (lw_eventpump); | |||
LacewingFunction lw_eventpump* lw_eventpump_new (); | LacewingFunction lw_eventpump* lw_eventpump_new (); | |||
LacewingFunction void lw_eventpump_delete (lw_ev entpump *); | LacewingFunction void lw_eventpump_delete (lw_ev entpump *); | |||
LacewingFunction void lw_eventpump_tick (lw_ev entpump *); | LacewingFunction void lw_eventpump_tick (lw_ev entpump *); | |||
LacewingFunction void lw_eventpump_start_event_loop (lw_ev entpump *); | LacewingFunction void lw_eventpump_start_event_loop (lw_ev entpump *); | |||
LacewingFunction void lw_eventpump_start_multithreading (lw_ev | LacewingFunction void lw_eventpump_start_sleepy_ticking (lw_ev | |||
entpump *); | entpump *, void (LacewingHandler * on_tick_needed) (lw_eventpump *)); | |||
LacewingFunction void lw_eventpump_start_sleepy_ticking (lw_ev | ||||
entpump *, void (LacewingHandler * on_tick_needed) (lw_eventpump)); | ||||
LacewingFunction void lw_eventpump_post_eventloop_exit (lw_ev entpump *); | LacewingFunction void lw_eventpump_post_eventloop_exit (lw_ev entpump *); | |||
LacewingFunction lw_bool lw_eventpump_in_use (lw_ev entpump *); | LacewingFunction lw_bool lw_eventpump_in_use (lw_ev entpump *); | |||
LacewingFunction void lw_eventpump_set_in_use (lw_ev entpump *, lw_bool); | LacewingFunction void lw_eventpump_set_in_use (lw_ev entpump *, lw_bool); | |||
/* Timer */ | /* Timer */ | |||
LacewingFlat (lw_timer); | LacewingFlat (lw_timer); | |||
LacewingFunction lw_timer* lw_timer_new (); | LacewingFunction lw_timer* lw_timer_new (); | |||
LacewingFunction void lw_timer_delete (lw_timer *); | LacewingFunction void lw_timer_delete (lw_timer *); | |||
LacewingFunction void lw_timer_start (lw_timer *, long milliseconds); | LacewingFunction void lw_timer_start (lw_timer *, long milliseconds); | |||
LacewingFunction lw_bool lw_timer_started (lw_timer *); | ||||
LacewingFunction void lw_timer_stop (lw_timer *); | LacewingFunction void lw_timer_stop (lw_timer *); | |||
LacewingFunction void lw_timer_force_tick (lw_timer *); | LacewingFunction void lw_timer_force_tick (lw_timer *); | |||
typedef void (LacewingHandler * lw_timer_handler_tick) (lw_timer *); | typedef void (LacewingHandler * lw_timer_handler_tick) (lw_timer *); | |||
LacewingFunction void lw_timer_ontick (lw_timer *, lw_timer_handler_tick) ; | LacewingFunction void lw_timer_ontick (lw_timer *, lw_timer_handler_tick) ; | |||
/* Sync */ | /* Sync */ | |||
LacewingFlat (lw_sync); | LacewingFlat (lw_sync); | |||
LacewingFlat (lw_sync_lock); | LacewingFlat (lw_sync_lock); | |||
skipping to change at line 235 | skipping to change at line 244 | |||
LacewingFunction lw_client* lw_client_new (lw_eventpu mp *); | LacewingFunction lw_client* lw_client_new (lw_eventpu mp *); | |||
LacewingFunction void lw_client_delete (lw_client *); | LacewingFunction void lw_client_delete (lw_client *); | |||
LacewingFunction void lw_client_connect (lw_client *, const char * host, long port); | LacewingFunction void lw_client_connect (lw_client *, const char * host, long port); | |||
LacewingFunction void lw_client_connect_addr (lw_client *, lw_addr *); | LacewingFunction void lw_client_connect_addr (lw_client *, lw_addr *); | |||
LacewingFunction void lw_client_disconnect (lw_client *); | LacewingFunction void lw_client_disconnect (lw_client *); | |||
LacewingFunction lw_bool lw_client_connected (lw_client *); | LacewingFunction lw_bool lw_client_connected (lw_client *); | |||
LacewingFunction lw_bool lw_client_connecting (lw_client *); | LacewingFunction lw_bool lw_client_connecting (lw_client *); | |||
LacewingFunction lw_addr* lw_client_server_addr (lw_client *); | LacewingFunction lw_addr* lw_client_server_addr (lw_client *); | |||
LacewingFunction void lw_client_send (lw_client *, const char * data, long size); | LacewingFunction void lw_client_send (lw_client *, const char * data, long size); | |||
LacewingFunction void lw_client_send_text (lw_client *, const char * text); | LacewingFunction void lw_client_send_text (lw_client *, const char * text); | |||
LacewingFunction void lw_client_sendf (lw_client *, const char * format, ...); | ||||
LacewingFunction void lw_client_disable_nagling (lw_client *); | LacewingFunction void lw_client_disable_nagling (lw_client *); | |||
LacewingFunction lw_bool lw_client_cheap_buffering (lw_client *); | ||||
LacewingFunction void lw_client_start_buffering (lw_client *); | LacewingFunction void lw_client_start_buffering (lw_client *); | |||
LacewingFunction void lw_client_flush (lw_client *); | LacewingFunction void lw_client_flush (lw_client *); | |||
typedef void (LacewingHandler * lw_client_handler_connect) (lw_client *); | typedef void (LacewingHandler * lw_client_handler_connect) (lw_client *); | |||
LacewingFunction void lw_client_onconnect (lw_client *, lw_client_handler _connect); | LacewingFunction void lw_client_onconnect (lw_client *, lw_client_handler _connect); | |||
typedef void (LacewingHandler * lw_client_handler_disconnect) (lw_client *); | typedef void (LacewingHandler * lw_client_handler_disconnect) (lw_client *); | |||
LacewingFunction void lw_client_ondisconnect (lw_client *, lw_client_hand ler_disconnect); | LacewingFunction void lw_client_ondisconnect (lw_client *, lw_client_hand ler_disconnect); | |||
typedef void (LacewingHandler * lw_client_handler_receive) (lw_client *, char * data, long size); | typedef void (LacewingHandler * lw_client_handler_receive) (lw_client *, char * data, long size); | |||
skipping to change at line 274 | skipping to change at line 285 | |||
LacewingFunction long lw_server_port (lw _server *); | LacewingFunction long lw_server_port (lw _server *); | |||
LacewingFunction lw_bool lw_server_load_cert_file (lw _server *, const char * filename, const char * passphrase); | LacewingFunction lw_bool lw_server_load_cert_file (lw _server *, const char * filename, const char * passphrase); | |||
LacewingFunction lw_bool lw_server_load_sys_cert (lw _server *, const char * store_name, const char * common_name, const char * location); | LacewingFunction lw_bool lw_server_load_sys_cert (lw _server *, const char * store_name, const char * common_name, const char * location); | |||
LacewingFunction lw_bool lw_server_cert_loaded (lw _server *); | LacewingFunction lw_bool lw_server_cert_loaded (lw _server *); | |||
LacewingFunction lw_i64 lw_server_bytes_sent (lw _server *); | LacewingFunction lw_i64 lw_server_bytes_sent (lw _server *); | |||
LacewingFunction lw_i64 lw_server_bytes_received (lw _server *); | LacewingFunction lw_i64 lw_server_bytes_received (lw _server *); | |||
LacewingFunction void lw_server_disable_nagling (lw _server *); | LacewingFunction void lw_server_disable_nagling (lw _server *); | |||
LacewingFunction lw_addr* lw_server_client_address (lw _server_client *); | LacewingFunction lw_addr* lw_server_client_address (lw _server_client *); | |||
LacewingFunction void lw_server_client_send (lw _server_client *, const char * data, long size); | LacewingFunction void lw_server_client_send (lw _server_client *, const char * data, long size); | |||
LacewingFunction void lw_server_client_send_writable (lw _server_client *, char * data, long size); | LacewingFunction void lw_server_client_send_writable (lw _server_client *, char * data, long size); | |||
LacewingFunction void lw_server_client_send_text (lw | ||||
_server_client *, const char * text); | ||||
LacewingFunction void lw_server_client_sendf (lw | ||||
_server_client *, const char * format, ...); | ||||
LacewingFunction lw_bool lw_server_client_cheap_buffering (lw | ||||
_server_client *); | ||||
LacewingFunction void lw_server_client_start_buffering (lw _server_client *); | LacewingFunction void lw_server_client_start_buffering (lw _server_client *); | |||
LacewingFunction void lw_server_client_flush (lw _server_client *); | LacewingFunction void lw_server_client_flush (lw _server_client *); | |||
LacewingFunction void lw_server_client_disconnect (lw _server_client *); | LacewingFunction void lw_server_client_disconnect (lw _server_client *); | |||
LacewingFunction lw_server_client* lw_server_client_next (lw _server_client *); | LacewingFunction lw_server_client* lw_server_client_next (lw _server_client *); | |||
typedef void (LacewingHandler * lw_server_handler_connect) (lw_server *, lw_server_client *); | typedef void (LacewingHandler * lw_server_handler_connect) (lw_server *, lw_server_client *); | |||
LacewingFunction void lw_server_onconnect (lw_server *, lw_server_handler _connect); | LacewingFunction void lw_server_onconnect (lw_server *, lw_server_handler _connect); | |||
typedef void (LacewingHandler * lw_server_handler_disconnect) (lw_server *, lw_server_client *); | typedef void (LacewingHandler * lw_server_handler_disconnect) (lw_server *, lw_server_client *); | |||
LacewingFunction void lw_server_ondisconnect (lw_server *, lw_server_hand ler_disconnect); | LacewingFunction void lw_server_ondisconnect (lw_server *, lw_server_hand ler_disconnect); | |||
skipping to change at line 300 | skipping to change at line 314 | |||
/* UDP */ | /* UDP */ | |||
LacewingFlat (lw_udp); | LacewingFlat (lw_udp); | |||
LacewingFunction lw_udp* lw_udp_new (lw_eventpu mp *); | LacewingFunction lw_udp* lw_udp_new (lw_eventpu mp *); | |||
LacewingFunction void lw_udp_delete (lw_udp *); | LacewingFunction void lw_udp_delete (lw_udp *); | |||
LacewingFunction void lw_udp_host (lw_udp *, long port); | LacewingFunction void lw_udp_host (lw_udp *, long port); | |||
LacewingFunction void lw_udp_host_filter (lw_udp *, lw_filter *); | LacewingFunction void lw_udp_host_filter (lw_udp *, lw_filter *); | |||
LacewingFunction void lw_udp_host_addr (lw_udp *, lw_addr *); | LacewingFunction void lw_udp_host_addr (lw_udp *, lw_addr *); | |||
LacewingFunction lw_bool lw_udp_hosting (lw_udp *); | ||||
LacewingFunction void lw_udp_unhost (lw_udp *); | LacewingFunction void lw_udp_unhost (lw_udp *); | |||
LacewingFunction long lw_udp_port (lw_udp *); | LacewingFunction long lw_udp_port (lw_udp *); | |||
LacewingFunction lw_i64 lw_udp_bytes_sent (lw_udp *); | LacewingFunction lw_i64 lw_udp_bytes_sent (lw_udp *); | |||
LacewingFunction lw_i64 lw_udp_bytes_received (lw_udp *); | LacewingFunction lw_i64 lw_udp_bytes_received (lw_udp *); | |||
LacewingFunction void lw_udp_send (lw_udp *, lw_addr *, const char * data, long size); | LacewingFunction void lw_udp_send (lw_udp *, lw_addr *, const char * data, long size); | |||
typedef void (LacewingHandler * lw_udp_handler_receive) (lw_udp *, char * data, long size); | typedef void (LacewingHandler * lw_udp_handler_receive) (lw_udp *, lw_add r *, char * data, long size); | |||
LacewingFunction void lw_udp_onreceive (lw_udp *, lw_udp_handler_receive) ; | LacewingFunction void lw_udp_onreceive (lw_udp *, lw_udp_handler_receive) ; | |||
typedef void (LacewingHandler * lw_udp_handler_error) (lw_udp *, lw_error *); | typedef void (LacewingHandler * lw_udp_handler_error) (lw_udp *, lw_error *); | |||
LacewingFunction void lw_udp_onerror (lw_udp *, lw_udp_handler_error); | LacewingFunction void lw_udp_onerror (lw_udp *, lw_udp_handler_error); | |||
/* Webserver */ | /* Webserver */ | |||
LacewingFlat (lw_ws); | LacewingFlat (lw_ws); | |||
LacewingFlat (lw_ws_req); | LacewingFlat (lw_ws_req); | |||
LacewingFlat (lw_ws_upload); | LacewingFlat (lw_ws_upload); | |||
skipping to change at line 337 | skipping to change at line 352 | |||
LacewingFunction lw_bool lw_ws_hosting_secure (lw_ws *); | LacewingFunction lw_bool lw_ws_hosting_secure (lw_ws *); | |||
LacewingFunction long lw_ws_port (lw_ws *); | LacewingFunction long lw_ws_port (lw_ws *); | |||
LacewingFunction long lw_ws_port_secure (lw_ws *); | LacewingFunction long lw_ws_port_secure (lw_ws *); | |||
LacewingFunction lw_bool lw_ws_load_cert_file (lw_ws *, c onst char * filename, const char * passphrase); | LacewingFunction lw_bool lw_ws_load_cert_file (lw_ws *, c onst char * filename, const char * passphrase); | |||
LacewingFunction lw_bool lw_ws_load_sys_cert (lw_ws *, c onst char * store_name, const char * common_name, const char * location); | LacewingFunction lw_bool lw_ws_load_sys_cert (lw_ws *, c onst char * store_name, const char * common_name, const char * location); | |||
LacewingFunction lw_bool lw_ws_cert_loaded (lw_ws *); | LacewingFunction lw_bool lw_ws_cert_loaded (lw_ws *); | |||
LacewingFunction lw_i64 lw_ws_bytes_sent (lw_ws *); | LacewingFunction lw_i64 lw_ws_bytes_sent (lw_ws *); | |||
LacewingFunction lw_i64 lw_ws_bytes_received (lw_ws *); | LacewingFunction lw_i64 lw_ws_bytes_received (lw_ws *); | |||
LacewingFunction void lw_ws_close_session (lw_ws *, c onst char * id); | LacewingFunction void lw_ws_close_session (lw_ws *, c onst char * id); | |||
LacewingFunction void lw_ws_enable_manual_finish (lw_ws *); | LacewingFunction void lw_ws_enable_manual_finish (lw_ws *); | |||
LacewingFunction long lw_ws_idle_timeout (lw_ws *); | ||||
LacewingFunction void lw_ws_set_idle_timeout (lw_ws *, l | ||||
ong seconds); | ||||
LacewingFunction lw_addr* lw_ws_req_addr (lw_ws_req *); | LacewingFunction lw_addr* lw_ws_req_addr (lw_ws_req *); | |||
LacewingFunction lw_bool lw_ws_req_secure (lw_ws_req *); | LacewingFunction lw_bool lw_ws_req_secure (lw_ws_req *); | |||
LacewingFunction const char* lw_ws_req_url (lw_ws_req *); | LacewingFunction const char* lw_ws_req_url (lw_ws_req *); | |||
LacewingFunction const char* lw_ws_req_hostname (lw_ws_req *); | LacewingFunction const char* lw_ws_req_hostname (lw_ws_req *); | |||
LacewingFunction void lw_ws_req_disconnect (lw_ws_req *); | LacewingFunction void lw_ws_req_disconnect (lw_ws_req *); | |||
LacewingFunction void lw_ws_req_set_redirect (lw_ws_req *, const char * url); | LacewingFunction void lw_ws_req_set_redirect (lw_ws_req *, const char * url); | |||
LacewingFunction void lw_ws_req_set_response_type (lw_ws_req *, long status_code, const char * message); | LacewingFunction void lw_ws_req_set_status (lw_ws_req *, long code, const char * message); | |||
LacewingFunction void lw_ws_req_set_mime_type (lw_ws_req *, const char * mime_type); | LacewingFunction void lw_ws_req_set_mime_type (lw_ws_req *, const char * mime_type); | |||
LacewingFunction void lw_ws_req_set_mime_type_ex (lw_ws_req *, const char * mime_type, const char * charset); | ||||
LacewingFunction void lw_ws_req_guess_mime_type (lw_ws_req *, const char * filename); | LacewingFunction void lw_ws_req_guess_mime_type (lw_ws_req *, const char * filename); | |||
LacewingFunction void lw_ws_req_set_charset (lw_ws_req *, const char * charset); | ||||
LacewingFunction void lw_ws_req_send_text (lw_ws_req *, const char * data); | LacewingFunction void lw_ws_req_send_text (lw_ws_req *, const char * data); | |||
LacewingFunction void lw_ws_req_send_text_const (lw_ws_req *, const char * data); | LacewingFunction void lw_ws_req_send_text_const (lw_ws_req *, const char * data); | |||
LacewingFunction void lw_ws_req_send (lw_ws_req *, const char * data, long size); | LacewingFunction void lw_ws_req_send (lw_ws_req *, const char * data, long size); | |||
LacewingFunction void lw_ws_req_send_const (lw_ws_req *, const char * data, long size); | LacewingFunction void lw_ws_req_send_const (lw_ws_req *, const char * data, long size); | |||
LacewingFunction void lw_ws_req_sendfile (lw_ws_req *, const char * filename); | LacewingFunction void lw_ws_req_sendfile (lw_ws_req *, const char * filename); | |||
LacewingFunction void lw_ws_req_sendfile_ex (lw_ws_req *, const char * filename, lw_i64 offset, lw_i64 size); | ||||
LacewingFunction void lw_ws_req_sendf (lw_ws_req *, const char * format, ...); | LacewingFunction void lw_ws_req_sendf (lw_ws_req *, const char * format, ...); | |||
LacewingFunction void lw_ws_req_reset (lw_ws_req *); | LacewingFunction void lw_ws_req_reset (lw_ws_req *); | |||
LacewingFunction void lw_ws_req_finish (lw_ws_req *); | LacewingFunction void lw_ws_req_finish (lw_ws_req *); | |||
LacewingFunction lw_i64 lw_ws_req_last_modified (lw_ws_req *); | LacewingFunction lw_i64 lw_ws_req_last_modified (lw_ws_req *); | |||
LacewingFunction void lw_ws_req_set_last_modified (lw_ws_req *, lw_i64); | LacewingFunction void lw_ws_req_set_last_modified (lw_ws_req *, lw_i64); | |||
LacewingFunction void lw_ws_req_set_unmodified (lw_ws_req *); | LacewingFunction void lw_ws_req_set_unmodified (lw_ws_req *); | |||
LacewingFunction void lw_ws_req_set_header (lw_ws_req *, const char * name, const char * value); | LacewingFunction void lw_ws_req_set_header (lw_ws_req *, const char * name, const char * value); | |||
LacewingFunction const char* lw_ws_req_header (lw_ws_req *, const char * name); | LacewingFunction const char* lw_ws_req_header (lw_ws_req *, const char * name); | |||
LacewingFunction void lw_ws_req_set_cookie (lw_ws_req *, const char * name, const char * value); | LacewingFunction void lw_ws_req_set_cookie (lw_ws_req *, const char * name, const char * value); | |||
LacewingFunction const char* lw_ws_req_cookie (lw_ws_req *, const char * name); | LacewingFunction const char* lw_ws_req_cookie (lw_ws_req *, const char * name); | |||
LacewingFunction const char* lw_ws_req_session_id (lw_ws_req *); | LacewingFunction const char* lw_ws_req_session_id (lw_ws_req *); | |||
LacewingFunction void lw_ws_req_session_write (lw_ws_req *, const char * name, const char * value); | LacewingFunction void lw_ws_req_session_write (lw_ws_req *, const char * name, const char * value); | |||
LacewingFunction const char* lw_ws_req_session_read (lw_ws_req *, const char * name); | LacewingFunction const char* lw_ws_req_session_read (lw_ws_req *, const char * name); | |||
LacewingFunction void lw_ws_req_session_close (lw_ws_req *); | LacewingFunction void lw_ws_req_session_close (lw_ws_req *); | |||
LacewingFunction const char* lw_ws_req_GET (lw_ws_req *, const char * name); | LacewingFunction const char* lw_ws_req_GET (lw_ws_req *, const char * name); | |||
LacewingFunction const char* lw_ws_req_POST (lw_ws_req *, const char * name); | LacewingFunction const char* lw_ws_req_POST (lw_ws_req *, const char * name); | |||
LacewingFunction void lw_ws_req_disable_cache (lw_ws_req *); | LacewingFunction void lw_ws_req_disable_cache (lw_ws_req *); | |||
LacewingFunction long lw_ws_req_idle_timeout (lw_ws_req | ||||
*); | ||||
LacewingFunction void lw_ws_req_set_idle_timeout (lw_ws_req | ||||
*, long seconds); | ||||
/*LacewingFunction void lw_ws_req_enable_dl_resuming (lw_ws_req *); | /*LacewingFunction void lw_ws_req_enable_dl_resuming (lw_ws_req *); | |||
LacewingFunction lw_i64 lw_ws_req_reqrange_begin (lw_ws_req *); | LacewingFunction lw_i64 lw_ws_req_reqrange_begin (lw_ws_req *); | |||
LacewingFunction lw_i64 lw_ws_req_reqrange_end (lw_ws_req *); | LacewingFunction lw_i64 lw_ws_req_reqrange_end (lw_ws_req *); | |||
LacewingFunction void lw_ws_req_set_outgoing_range (lw_ws_req *, lw_i64 begin, lw_i64 end);*/ | LacewingFunction void lw_ws_req_set_outgoing_range (lw_ws_req *, lw_i64 begin, lw_i64 end);*/ | |||
LacewingFunction const char* lw_ws_upload_form_el_name (lw_ws_uplo ad *); | LacewingFunction const char* lw_ws_upload_form_el_name (lw_ws_uplo ad *); | |||
LacewingFunction const char* lw_ws_upload_filename (lw_ws_uplo ad *); | LacewingFunction const char* lw_ws_upload_filename (lw_ws_uplo ad *); | |||
LacewingFunction const char* lw_ws_upload_header (lw_ws_uplo ad *, const char * name); | LacewingFunction const char* lw_ws_upload_header (lw_ws_uplo ad *, const char * name); | |||
LacewingFunction void lw_ws_upload_set_autosave (lw_ws_uplo ad *); | LacewingFunction void lw_ws_upload_set_autosave (lw_ws_uplo ad *); | |||
LacewingFunction const char* lw_ws_upload_autosave_fname (lw_ws_uplo ad *); | LacewingFunction const char* lw_ws_upload_autosave_fname (lw_ws_uplo ad *); | |||
skipping to change at line 434 | skipping to change at line 454 | |||
} \ | } \ | |||
inline C & operator << (char * V) \ | inline C & operator << (char * V) \ | |||
{ F (V, -1); \ | { F (V, -1); \ | |||
return *this; \ | return *this; \ | |||
} \ | } \ | |||
namespace Lacewing | namespace Lacewing | |||
{ | { | |||
LacewingFunction const char* Version (); | LacewingFunction const char* Version (); | |||
LacewingFunction bool StartThread (void * Function, vo | ||||
id * Parameter = 0); | ||||
LacewingFunction void SetCurrentThreadName (const char * Name); | ||||
LacewingFunction void Pause (int Milliseconds); | ||||
LacewingFunction void Yield (); | ||||
LacewingFunction lw_i64 CurrentThreadID (); | LacewingFunction lw_i64 CurrentThreadID (); | |||
LacewingFunction lw_i64 LastModified (const char * Filena me); | LacewingFunction lw_i64 LastModified (const char * Filena me); | |||
LacewingFunction bool FileExists (const char * Filena me); | LacewingFunction bool FileExists (const char * Filena me); | |||
LacewingFunction lw_i64 FileSize (const char * Filena me); | LacewingFunction lw_i64 FileSize (const char * Filena me); | |||
LacewingFunction bool PathExists (const char * Filena me); | LacewingFunction bool PathExists (const char * Filena me); | |||
LacewingFunction void Int64ToString (lw_i64, char *); | LacewingFunction void Int64ToString (lw_i64, char *); | |||
LacewingFunction void TempPath (char * Buffer, int | LacewingFunction void TempPath (char * Buffer); | |||
Length); | LacewingFunction void NewTempFile (char * Buffer); | |||
LacewingFunction void NewTempFile (char * Buffer, int | ||||
Length); | ||||
LacewingFunction int CountProcessors (); | ||||
LacewingFunction const char* GuessMimeType (const char * Filena me); | LacewingFunction const char* GuessMimeType (const char * Filena me); | |||
LacewingFunction void MD5 (char * Output, cons t char * Input, int Length = -1); | LacewingFunction void MD5 (char * Output, cons t char * Input, int Length = -1); | |||
LacewingFunction void MD5_Hex (char * Output, cons t char * Input, int Length = -1); | LacewingFunction void MD5_Hex (char * Output, cons t char * Input, int Length = -1); | |||
LacewingFunction void SHA1 (char * Output, cons t char * Input, int Length = -1); | LacewingFunction void SHA1 (char * Output, cons t char * Input, int Length = -1); | |||
LacewingFunction void SHA1_Hex (char * Output, cons t char * Input, int Length = -1); | LacewingFunction void SHA1_Hex (char * Output, cons t char * Input, int Length = -1); | |||
struct Error | struct Error | |||
{ | { | |||
void * InternalTag, * Tag; | void * InternalTag, * Tag; | |||
skipping to change at line 553 | skipping to change at line 568 | |||
LacewingFunction void Post (void * Function, void * Parameter); | LacewingFunction void Post (void * Function, void * Parameter); | |||
LacewingFunction void PostEventLoopExit (); | LacewingFunction void PostEventLoopExit (); | |||
LacewingFunction bool InUse (); | LacewingFunction bool InUse (); | |||
LacewingFunction void InUse (bool); | LacewingFunction void InUse (bool); | |||
}; | }; | |||
typedef EventPump Pump; | typedef EventPump Pump; | |||
#endif | #endif | |||
struct Thread | ||||
{ | ||||
void * InternalTag, * Tag; | ||||
LacewingFunction Thread (const char * Name, void * Function); | ||||
LacewingFunction ~ Thread (); | ||||
LacewingFunction void Start (void * Parameter); | ||||
LacewingFunction bool Started (); | ||||
LacewingFunction int Join (); | ||||
}; | ||||
struct Timer | struct Timer | |||
{ | { | |||
void * InternalTag, * Tag; | void * InternalTag, * Tag; | |||
LacewingFunction Timer (Pump &); | LacewingFunction Timer (Pump &); | |||
LacewingFunction ~Timer (); | LacewingFunction ~Timer (); | |||
LacewingFunction void Start (int Milliseconds); | LacewingFunction void Start (int Milliseconds); | |||
LacewingFunction void Stop (); | LacewingFunction void Stop (); | |||
LacewingFunction bool Started (); | ||||
LacewingFunction void ForceTick (); | LacewingFunction void ForceTick (); | |||
typedef void (LacewingHandler * HandlerTick) (Lacewing::Timer &Timer); | typedef void (LacewingHandler * HandlerTick) (Lacewing::Timer &Timer); | |||
LacewingFunction void onTick (HandlerTick); | LacewingFunction void onTick (HandlerTick); | |||
}; | }; | |||
struct Sync | struct Sync | |||
{ | { | |||
void * InternalTag, * Tag; | void * InternalTag, * Tag; | |||
skipping to change at line 716 | skipping to change at line 745 | |||
LacewingFunction bool Connected(); | LacewingFunction bool Connected(); | |||
LacewingFunction bool Connecting(); | LacewingFunction bool Connecting(); | |||
LacewingFunction Lacewing::Address &ServerAddress(); | LacewingFunction Lacewing::Address &ServerAddress(); | |||
LacewingFunction void Send (const char * Data, int Size = -1); | LacewingFunction void Send (const char * Data, int Size = -1); | |||
LacewingStream (Client, Send); | LacewingStream (Client, Send); | |||
LacewingFunction void DisableNagling(); | LacewingFunction void DisableNagling(); | |||
LacewingFunction bool CheapBuffering (); | ||||
LacewingFunction void StartBuffering(); | LacewingFunction void StartBuffering(); | |||
LacewingFunction void Flush(); | LacewingFunction void Flush(); | |||
typedef void (LacewingHandler * HandlerConnect) (Lacewing::Clie nt &Client); | typedef void (LacewingHandler * HandlerConnect) (Lacewing::Clie nt &Client); | |||
typedef void (LacewingHandler * HandlerDisconnect) (Lacewing::Clie nt &Client); | typedef void (LacewingHandler * HandlerDisconnect) (Lacewing::Clie nt &Client); | |||
typedef void (LacewingHandler * HandlerReceive) (Lacewing::Clie nt &Client, char * Data, int Size); | typedef void (LacewingHandler * HandlerReceive) (Lacewing::Clie nt &Client, char * Data, int Size); | |||
typedef void (LacewingHandler * HandlerError) (Lacewing::Clie nt &Client, Lacewing::Error &); | typedef void (LacewingHandler * HandlerError) (Lacewing::Clie nt &Client, Lacewing::Error &); | |||
LacewingFunction void onConnect (HandlerConnect); | LacewingFunction void onConnect (HandlerConnect); | |||
LacewingFunction void onDisconnect (HandlerDisconnect); | LacewingFunction void onDisconnect (HandlerDisconnect); | |||
skipping to change at line 760 | skipping to change at line 791 | |||
LacewingFunction void DisableNagling (); | LacewingFunction void DisableNagling (); | |||
struct Client | struct Client | |||
{ | { | |||
void * InternalTag, * Tag; | void * InternalTag, * Tag; | |||
LacewingFunction Lacewing::Address &GetAddress(); | LacewingFunction Lacewing::Address &GetAddress(); | |||
LacewingFunction void Send (const char * Data, int Size = -1); | LacewingFunction void Send (const char * Data, int Size = -1); | |||
LacewingFunction void SendFile (const char * Filename, lw_i64 Offset = 0, lw_i64 Size = 0); | LacewingFunction void SendFile (const char * Filename, lw_i64 Offset = 0, lw_i64 Size = -1); | |||
LacewingFunction void SendWritable (char * Data, int Size = -1); | LacewingFunction void SendWritable (char * Data, int Size = -1); | |||
LacewingFunction void StartBuffering(); | LacewingFunction bool CheapBuffering (); | |||
LacewingFunction void Flush(); | LacewingFunction void StartBuffering (); | |||
LacewingFunction void Flush (); | ||||
LacewingStream (Client, Send); | LacewingStream (Client, Send); | |||
LacewingFunction void Disconnect(); | LacewingFunction void Disconnect(); | |||
LacewingFunction Client * Next (); | LacewingFunction Client * Next (); | |||
}; | }; | |||
LacewingFunction int ClientCount(); | LacewingFunction int ClientCount(); | |||
LacewingFunction Client * FirstClient (); | LacewingFunction Client * FirstClient (); | |||
skipping to change at line 798 | skipping to change at line 830 | |||
{ | { | |||
void * InternalTag, * Tag; | void * InternalTag, * Tag; | |||
LacewingFunction UDP (Pump &); | LacewingFunction UDP (Pump &); | |||
LacewingFunction ~UDP (); | LacewingFunction ~UDP (); | |||
LacewingFunction void Host (int Port); | LacewingFunction void Host (int Port); | |||
LacewingFunction void Host (Lacewing::Filter &Filter); | LacewingFunction void Host (Lacewing::Filter &Filter); | |||
LacewingFunction void Host (Address &); /* Use Port() afterwards to get the port number */ | LacewingFunction void Host (Address &); /* Use Port() afterwards to get the port number */ | |||
LacewingFunction void Unhost(); | LacewingFunction bool Hosting (); | |||
LacewingFunction void Unhost (); | ||||
LacewingFunction int Port(); | LacewingFunction int Port (); | |||
LacewingFunction lw_i64 BytesSent(); | LacewingFunction lw_i64 BytesSent(); | |||
LacewingFunction lw_i64 BytesReceived(); | LacewingFunction lw_i64 BytesReceived(); | |||
LacewingFunction void Send(Lacewing::Address &Address, const char * Dat a, int Size = -1); | LacewingFunction void Send(Lacewing::Address &Address, const char * Dat a, int Size = -1); | |||
typedef void (LacewingHandler * HandlerReceive) (Lacewing::UDP &UDP, Lacewing::Address &From, char * Data, int Size); | typedef void (LacewingHandler * HandlerReceive) (Lacewing::UDP &UDP, Lacewing::Address &From, char * Data, int Size); | |||
typedef void (LacewingHandler * HandlerError) (Lacewing::UDP &UDP, Lacewing::Error &); | typedef void (LacewingHandler * HandlerError) (Lacewing::UDP &UDP, Lacewing::Error &); | |||
LacewingFunction void onReceive(HandlerReceive); | LacewingFunction void onReceive(HandlerReceive); | |||
skipping to change at line 845 | skipping to change at line 878 | |||
LacewingFunction bool LoadCertificateFile (const char * Filename, con st char * Passphrase = ""); | LacewingFunction bool LoadCertificateFile (const char * Filename, con st char * Passphrase = ""); | |||
LacewingFunction bool LoadSystemCertificate (const char * StoreName, co nst char * CommonName, const char * Location = "CurrentUser"); | LacewingFunction bool LoadSystemCertificate (const char * StoreName, co nst char * CommonName, const char * Location = "CurrentUser"); | |||
LacewingFunction bool CertificateLoaded (); | LacewingFunction bool CertificateLoaded (); | |||
LacewingFunction lw_i64 BytesSent(); | LacewingFunction lw_i64 BytesSent(); | |||
LacewingFunction lw_i64 BytesReceived(); | LacewingFunction lw_i64 BytesReceived(); | |||
LacewingFunction void EnableManualRequestFinish (); | LacewingFunction void EnableManualRequestFinish (); | |||
LacewingFunction int IdleTimeout (); | ||||
LacewingFunction void IdleTimeout (int Seconds); | ||||
struct Request | struct Request | |||
{ | { | |||
void * InternalTag, * Tag; | void * InternalTag, * Tag; | |||
LacewingFunction Lacewing::Address &GetAddress(); | LacewingFunction Lacewing::Address &GetAddress(); | |||
LacewingFunction bool Secure(); | LacewingFunction bool Secure (); | |||
LacewingFunction const char * URL(); | LacewingFunction const char * URL(); | |||
LacewingFunction const char * Hostname(); | LacewingFunction const char * Hostname(); | |||
LacewingFunction void Disconnect(); | LacewingFunction void Disconnect(); | |||
LacewingFunction void SetRedirect(const char * URL); | LacewingFunction void SetRedirect (const char * URL); | |||
LacewingFunction void SetResponseType(int StatusCode, const char * | LacewingFunction void Status (int Code, const char * Message); | |||
Message); | ||||
LacewingFunction void SetMimeType(const char * MimeType); | LacewingFunction void SetMimeType(const char * MimeType, const char * Charset = "UTF-8"); | |||
LacewingFunction void GuessMimeType(const char * Filename); | LacewingFunction void GuessMimeType(const char * Filename); | |||
LacewingFunction void SetCharset(const char * Charset); | ||||
LacewingFunction void Send (const char * Data, int Size = -1); | LacewingFunction void Send (const char * Data, int Size = -1); | |||
LacewingFunction bool SendFile (const char * Filename); | LacewingFunction void SendFile (const char * Filename, lw_i64 Offset = 0, lw_i64 Size = -1); | |||
LacewingFunction void SendConstant (const char * Data, int Size = -1); | LacewingFunction void SendConstant (const char * Data, int Size = -1); | |||
LacewingStream(Request, Send); | LacewingStream(Request, Send); | |||
LacewingFunction void Reset(); | LacewingFunction void Reset (); | |||
LacewingFunction void Finish(const char * Data = 0, int Size = -1); | LacewingFunction void Finish (); | |||
LacewingFunction int IdleTimeout (); | ||||
LacewingFunction void IdleTimeout (int Seconds); | ||||
LacewingFunction lw_i64 LastModified (); | LacewingFunction lw_i64 LastModified (); | |||
LacewingFunction void LastModified (lw_i64 Time); | LacewingFunction void LastModified (lw_i64 Time); | |||
LacewingFunction void SetUnmodified (); | LacewingFunction void SetUnmodified (); | |||
LacewingFunction const char * Header (const char * Name); | LacewingFunction const char * Header (const char * Name); | |||
LacewingFunction void Header (const char * Name, const char * Value); | LacewingFunction void Header (const char * Name, const char * Value); | |||
LacewingFunction const char * Cookie (const char * Name); | LacewingFunction const char * Cookie (const char * Name); | |||
LacewingFunction void Cookie (const char * Name, const char * Value); | LacewingFunction void Cookie (const char * Name, const char * Value); | |||
skipping to change at line 918 | skipping to change at line 956 | |||
LacewingFunction const char * Filename(); | LacewingFunction const char * Filename(); | |||
LacewingFunction const char * Header(const char * Name); | LacewingFunction const char * Header(const char * Name); | |||
LacewingFunction void SetAutoSave(); | LacewingFunction void SetAutoSave(); | |||
LacewingFunction const char * GetAutoSaveFilename(); | LacewingFunction const char * GetAutoSaveFilename(); | |||
}; | }; | |||
typedef void (LacewingHandler * HandlerGet) (Lacewin g::Webserver &Webserver, Lacewing::Webserver::Request &Request); | typedef void (LacewingHandler * HandlerGet) (Lacewin g::Webserver &Webserver, Lacewing::Webserver::Request &Request); | |||
typedef void (LacewingHandler * HandlerPost) (Lacewin g::Webserver &Webserver, Lacewing::Webserver::Request &Request); | typedef void (LacewingHandler * HandlerPost) (Lacewin g::Webserver &Webserver, Lacewing::Webserver::Request &Request); | |||
typedef void (LacewingHandler * HandlerHead) (Lacewin g::Webserver &Webserver, Lacewing::Webserver::Request &Request); | typedef void (LacewingHandler * HandlerHead) (Lacewin g::Webserver &Webserver, Lacewing::Webserver::Request &Request); | |||
typedef void (LacewingHandler * HandlerError) (Lacewin | ||||
g::Webserver &Webserver, Lacewing::Error &); | ||||
typedef void (LacewingHandler * HandlerConnect) (Lacewin | ||||
g::Webserver &Webserver, Lacewing::Webserver::Request &Request); | ||||
typedef void (LacewingHandler * HandlerDisconnect) (Lacewin g::Webserver &Webserver, Lacewing::Webserver::Request &Request); | typedef void (LacewingHandler * HandlerDisconnect) (Lacewin g::Webserver &Webserver, Lacewing::Webserver::Request &Request); | |||
typedef void (LacewingHandler * HandlerError) (Lacewin g::Webserver &Webserver, Lacewing::Error &); | ||||
typedef void (LacewingHandler * HandlerUploadStart) (Lacewin g::Webserver &Webserver, Lacewing::Webserver::Request &Request, | typedef void (LacewingHandler * HandlerUploadStart) (Lacewin g::Webserver &Webserver, Lacewing::Webserver::Request &Request, | |||
Lacewin g::Webserver::Upload &Upload); | Lacewin g::Webserver::Upload &Upload); | |||
typedef void (LacewingHandler * HandlerUploadChunk) (Lacewin g::Webserver &Webserver, Lacewing::Webserver::Request &Request, | typedef void (LacewingHandler * HandlerUploadChunk) (Lacewin g::Webserver &Webserver, Lacewing::Webserver::Request &Request, | |||
Lacewin g::Webserver::Upload &Upload, const char * Data, int Size); | Lacewin g::Webserver::Upload &Upload, const char * Data, int Size); | |||
typedef void (LacewingHandler * HandlerUploadDone) (Lacewin g::Webserver &Webserver, Lacewing::Webserver::Request &Request, | typedef void (LacewingHandler * HandlerUploadDone) (Lacewin g::Webserver &Webserver, Lacewing::Webserver::Request &Request, | |||
Lacewin g::Webserver::Upload &Upload); | Lacewin g::Webserver::Upload &Upload); | |||
typedef void (LacewingHandler * HandlerUploadPost) (Lacewin g::Webserver &Webserver, Lacewing::Webserver::Request &Request, | typedef void (LacewingHandler * HandlerUploadPost) (Lacewin g::Webserver &Webserver, Lacewing::Webserver::Request &Request, | |||
Lacewin g::Webserver::Upload * Uploads[], int UploadCount); | Lacewin g::Webserver::Upload * Uploads[], int UploadCount); | |||
LacewingFunction void onGet (HandlerGet); | LacewingFunction void onGet (HandlerGet); | |||
LacewingFunction void onUploadStart (HandlerUploadStart); | LacewingFunction void onUploadStart (HandlerUploadStart); | |||
LacewingFunction void onUploadChunk (HandlerUploadChunk); | LacewingFunction void onUploadChunk (HandlerUploadChunk); | |||
LacewingFunction void onUploadDone (HandlerUploadDone); | LacewingFunction void onUploadDone (HandlerUploadDone); | |||
LacewingFunction void onUploadPost (HandlerUploadPost); | LacewingFunction void onUploadPost (HandlerUploadPost); | |||
LacewingFunction void onPost (HandlerPost); | LacewingFunction void onPost (HandlerPost); | |||
LacewingFunction void onHead (HandlerHead); | LacewingFunction void onHead (HandlerHead); | |||
LacewingFunction void onDisconnect (HandlerDisconnect); | ||||
LacewingFunction void onError (HandlerError); | LacewingFunction void onError (HandlerError); | |||
LacewingFunction void onConnect (HandlerConnect); | ||||
LacewingFunction void onDisconnect (HandlerConnect); | ||||
}; | }; | |||
struct RelayClient | struct RelayClient | |||
{ | { | |||
public: | public: | |||
void * InternalTag, * Tag; | void * InternalTag, * Tag; | |||
LacewingFunction RelayClient (Pump &); | LacewingFunction RelayClient (Pump &); | |||
LacewingFunction ~RelayClient (); | LacewingFunction ~RelayClient (); | |||
skipping to change at line 967 | skipping to change at line 1003 | |||
LacewingFunction bool Connecting (); | LacewingFunction bool Connecting (); | |||
LacewingFunction bool Connected (); | LacewingFunction bool Connected (); | |||
LacewingFunction void Disconnect (); | LacewingFunction void Disconnect (); | |||
LacewingFunction Lacewing::Address &ServerAddress(); | LacewingFunction Lacewing::Address &ServerAddress(); | |||
LacewingFunction int ID (); | LacewingFunction int ID (); | |||
LacewingFunction void Name (const char * Name); | LacewingFunction void Name (const char * Name); | |||
LacewingFunction const char * Name (); | LacewingFunction const char * Name (); | |||
LacewingFunction const char * WelcomeMessage (); | ||||
LacewingFunction void ListChannels(); | LacewingFunction void ListChannels(); | |||
struct ChannelListing | struct ChannelListing | |||
{ | { | |||
void * InternalTag, * Tag; | void * InternalTag, * Tag; | |||
short PeerCount; | short PeerCount; | |||
const char * Name; | const char * Name; | |||
LacewingFunction ChannelListing * Next (); | LacewingFunction ChannelListing * Next (); | |||
skipping to change at line 1023 | skipping to change at line 1061 | |||
}; | }; | |||
LacewingFunction int PeerCount(); | LacewingFunction int PeerCount(); | |||
LacewingFunction Peer * FirstPeer (); | LacewingFunction Peer * FirstPeer (); | |||
LacewingFunction void Leave(); | LacewingFunction void Leave(); | |||
LacewingFunction Channel * Next (); | LacewingFunction Channel * Next (); | |||
}; | }; | |||
LacewingFunction Channel * FindChannel(const char * Name); | ||||
LacewingFunction Channel * FindChannel(unsigned int ID); | ||||
LacewingFunction int ChannelCount(); | LacewingFunction int ChannelCount(); | |||
LacewingFunction Channel * FirstChannel (); | LacewingFunction Channel * FirstChannel (); | |||
typedef void (LacewingHandler * HandlerConnect) (Lacew ing::RelayClient &Client, const char * WelcomeMessage); | typedef void (LacewingHandler * HandlerConnect) (Lacew ing::RelayClient &Client); | |||
typedef void (LacewingHandler * HandlerConnectionDenied) (Lacew ing::RelayClient &Client, const char * DenyReason); | typedef void (LacewingHandler * HandlerConnectionDenied) (Lacew ing::RelayClient &Client, const char * DenyReason); | |||
typedef void (LacewingHandler * HandlerDisconnect) (Lacew ing::RelayClient &Client); | typedef void (LacewingHandler * HandlerDisconnect) (Lacew ing::RelayClient &Client); | |||
typedef void (LacewingHandler * HandlerServerMessage) | typedef void (LacewingHandler * HandlerServerMessage) | |||
(Lacewing::RelayClient &Client, bool Blasted, int Subchannel, c har * Data, int Size, int Variant); | (Lacewing::RelayClient &Client, bool Blasted, int Subchannel, c har * Data, int Size, int Variant); | |||
typedef void (LacewingHandler * HandlerChannelMessage) | typedef void (LacewingHandler * HandlerChannelMessage) | |||
(Lacewing::RelayClient &Client, Lacewing::RelayClient::Channel &Cha nnel, Lacewing::RelayClient::Channel::Peer &Peer, | (Lacewing::RelayClient &Client, Lacewing::RelayClient::Channel &Cha nnel, Lacewing::RelayClient::Channel::Peer &Peer, | |||
bool Blasted, int Subchannel, char * Data, int Size, int Varian t); | bool Blasted, int Subchannel, char * Data, int Size, int Varian t); | |||
typedef void (LacewingHandler * HandlerPeerMessage) | typedef void (LacewingHandler * HandlerPeerMessage) | |||
(Lacewing::RelayClient &Client, Lacewing::RelayClient::Channel &Cha nnel, Lacewing::RelayClient::Channel::Peer &Peer, | (Lacewing::RelayClient &Client, Lacewing::RelayClient::Channel &Cha nnel, Lacewing::RelayClient::Channel::Peer &Peer, | |||
bool Blasted, int Subchannel, char * Data, int Size, int Varian t); | bool Blasted, int Subchannel, char * Data, int Size, int Varian t); | |||
typedef void (LacewingHandler * HandlerServerChannelMessage) | ||||
(Lacewing::RelayClient &Client, Lacewing::RelayClient::Channel &Cha | ||||
nnel, bool Blasted, | ||||
int Subchannel, char * Data, int Size, int Variant); | ||||
typedef void (LacewingHandler * HandlerError) (Lacew ing::RelayClient &Client, Lacewing::Error &); | typedef void (LacewingHandler * HandlerError) (Lacew ing::RelayClient &Client, Lacewing::Error &); | |||
typedef void (LacewingHandler * HandlerJoin) (Lacew ing::RelayClient &Client, Lacewing::RelayClient::Channel &Target); | typedef void (LacewingHandler * HandlerJoin) (Lacew ing::RelayClient &Client, Lacewing::RelayClient::Channel &Target); | |||
typedef void (LacewingHandler * HandlerJoinDenied) (Lacew ing::RelayClient &Client, const char * ChannelName, const char * DenyReason ); | typedef void (LacewingHandler * HandlerJoinDenied) (Lacew ing::RelayClient &Client, const char * ChannelName, const char * DenyReason ); | |||
typedef void (LacewingHandler * HandlerLeave) (Lacew ing::RelayClient &Client, Lacewing::RelayClient::Channel &Target); | typedef void (LacewingHandler * HandlerLeave) (Lacew ing::RelayClient &Client, Lacewing::RelayClient::Channel &Target); | |||
typedef void (LacewingHandler * HandlerLeaveDenied) (Lacew ing::RelayClient &Client, Lacewing::RelayClient::Channel &Target,const char * DenyReason); | typedef void (LacewingHandler * HandlerLeaveDenied) (Lacew ing::RelayClient &Client, Lacewing::RelayClient::Channel &Target,const char * DenyReason); | |||
typedef void (LacewingHandler * HandlerNameSet) (Lacew ing::RelayClient &Client); | typedef void (LacewingHandler * HandlerNameSet) (Lacew ing::RelayClient &Client); | |||
typedef void (LacewingHandler * HandlerNameChanged) (Lacew ing::RelayClient &Client, const char * OldName); | typedef void (LacewingHandler * HandlerNameChanged) (Lacew ing::RelayClient &Client, const char * OldName); | |||
typedef void (LacewingHandler * HandlerNameDenied) (Lacew ing::RelayClient &Client, const char * Name, const char * DenyReason); | typedef void (LacewingHandler * HandlerNameDenied) (Lacew ing::RelayClient &Client, const char * Name, const char * DenyReason); | |||
typedef void (LacewingHandler * HandlerPeerConnect) (Lacew ing::RelayClient &Client, Lacewing::RelayClient::Channel &Channel,Lacewing: :RelayClient::Channel::Peer &Peer); | typedef void (LacewingHandler * HandlerPeerConnect) (Lacew ing::RelayClient &Client, Lacewing::RelayClient::Channel &Channel,Lacewing: :RelayClient::Channel::Peer &Peer); | |||
typedef void (LacewingHandler * HandlerPeerDisconnect) (Lacew ing::RelayClient &Client, Lacewing::RelayClient::Channel &Channel,Lacewing: :RelayClient::Channel::Peer &Peer); | typedef void (LacewingHandler * HandlerPeerDisconnect) (Lacew ing::RelayClient &Client, Lacewing::RelayClient::Channel &Channel,Lacewing: :RelayClient::Channel::Peer &Peer); | |||
typedef void (LacewingHandler * HandlerPeerChangeName) (Lacew ing::RelayClient &Client, Lacewing::RelayClient::Channel &Channel,Lacewing: :RelayClient::Channel::Peer &Peer,const char * OldName); | typedef void (LacewingHandler * HandlerPeerChangeName) (Lacew ing::RelayClient &Client, Lacewing::RelayClient::Channel &Channel,Lacewing: :RelayClient::Channel::Peer &Peer,const char * OldName); | |||
typedef void (LacewingHandler * HandlerChannelListReceived) (Lacew ing::RelayClient &Client); | typedef void (LacewingHandler * HandlerChannelListReceived) (Lacew ing::RelayClient &Client); | |||
LacewingFunction void onConnect (HandlerConnect); | LacewingFunction void onConnect (HandlerConnect); | |||
LacewingFunction void onConnectionDenied (HandlerConnectionDenied); | LacewingFunction void onConnectionDenied (HandlerConnectionDenied) | |||
LacewingFunction void onDisconnect (HandlerDisconnect); | ; | |||
LacewingFunction void onServerMessage (HandlerServerMessage); | LacewingFunction void onDisconnect (HandlerDisconnect); | |||
LacewingFunction void onChannelMessage (HandlerChannelMessage); | LacewingFunction void onServerMessage (HandlerServerMessage); | |||
LacewingFunction void onPeerMessage (HandlerPeerMessage); | LacewingFunction void onChannelMessage (HandlerChannelMessage); | |||
LacewingFunction void onError (HandlerError); | LacewingFunction void onPeerMessage (HandlerPeerMessage); | |||
LacewingFunction void onJoin (HandlerJoin); | LacewingFunction void onServerChannelMessage (HandlerServerChannelMess | |||
LacewingFunction void onJoinDenied (HandlerJoinDenied); | age); | |||
LacewingFunction void onLeave (HandlerLeave); | LacewingFunction void onError (HandlerError); | |||
LacewingFunction void onLeaveDenied (HandlerLeaveDenied); | LacewingFunction void onJoin (HandlerJoin); | |||
LacewingFunction void onNameSet (HandlerNameSet); | LacewingFunction void onJoinDenied (HandlerJoinDenied); | |||
LacewingFunction void onNameChanged (HandlerNameChanged); | LacewingFunction void onLeave (HandlerLeave); | |||
LacewingFunction void onNameDenied (HandlerNameDenied); | LacewingFunction void onLeaveDenied (HandlerLeaveDenied); | |||
LacewingFunction void onPeerConnect (HandlerPeerConnect); | LacewingFunction void onNameSet (HandlerNameSet); | |||
LacewingFunction void onPeerDisconnect (HandlerPeerDisconnect); | LacewingFunction void onNameChanged (HandlerNameChanged); | |||
LacewingFunction void onPeerChangeName (HandlerPeerChangeName); | LacewingFunction void onNameDenied (HandlerNameDenied); | |||
LacewingFunction void onChannelListReceived (HandlerChannelListRecei | LacewingFunction void onPeerConnect (HandlerPeerConnect); | |||
ved); | LacewingFunction void onPeerDisconnect (HandlerPeerDisconnect); | |||
LacewingFunction void onPeerChangeName (HandlerPeerChangeName); | ||||
LacewingFunction void onChannelListReceived (HandlerChannelListReceiv | ||||
ed); | ||||
private: | private: | |||
Lacewing::Client Socket; | Lacewing::Client Socket; | |||
Lacewing::UDP UDP; | Lacewing::UDP UDP; | |||
}; | }; | |||
struct RelayServer | struct RelayServer | |||
{ | { | |||
void * InternalTag, * Tag; | void * InternalTag, * Tag; | |||
Lacewing::Server Socket; | Lacewing::Server Socket; | |||
Lacewing::UDP UDP; | Lacewing::UDP UDP; | |||
LacewingFunction RelayServer(Pump &); | LacewingFunction RelayServer(Pump &); | |||
skipping to change at line 1116 | skipping to change at line 1155 | |||
{ | { | |||
void * InternalTag, * Tag; | void * InternalTag, * Tag; | |||
LacewingFunction int ID(); | LacewingFunction int ID(); | |||
LacewingFunction Client * ChannelMaster(); | LacewingFunction Client * ChannelMaster(); | |||
LacewingFunction const char * Name (); | LacewingFunction const char * Name (); | |||
LacewingFunction void Name (const char *); | LacewingFunction void Name (const char *); | |||
LacewingFunction int ClientCount(); | LacewingFunction bool Hidden(); | |||
LacewingFunction bool AutoCloseEnabled(); | ||||
LacewingFunction void Close(); | ||||
LacewingFunction void * ClientLoop(void * ID = 0); | LacewingFunction void Send (int Subchannel, const char * Data, int | |||
LacewingFunction Client &ClientLoopIndex(void * ID); | Size = -1, int Variant = 0); | |||
LacewingFunction void EndClientLoop(void * ID); | LacewingFunction void Blast (int Subchannel, const char * Data, int | |||
Size = -1, int Variant = 0); | ||||
/* for(void * ID = Channel.ClientLoop(); ID; ID = Channel.ClientLo | LacewingFunction int ClientCount (); | |||
op(ID)) | ||||
{ | ||||
Lacewing::RelayServer::Client &Client = Channel.ClientLoopI | ||||
ndex(ID); | ||||
// If leaving the client loop before the end | struct ClientIterator | |||
Channel.EndClientLoop(ID); | { | |||
} | void * InternalTag; | |||
*/ | ||||
LacewingFunction bool Hidden(); | LacewingFunction ClientIterator (Channel &); | |||
LacewingFunction bool AutoCloseEnabled(); | LacewingFunction Client * Next (); | |||
LacewingFunction void Close(); | }; | |||
LacewingFunction Channel * Next (); | LacewingFunction Channel * Next (); | |||
}; | }; | |||
LacewingFunction int ChannelCount(); | LacewingFunction int ChannelCount(); | |||
LacewingFunction Channel * FirstChannel (); | LacewingFunction Channel * FirstChannel (); | |||
struct Client | struct Client | |||
{ | { | |||
void * InternalTag, * Tag; | void * InternalTag, * Tag; | |||
skipping to change at line 1159 | skipping to change at line 1196 | |||
LacewingFunction void Disconnect(); | LacewingFunction void Disconnect(); | |||
LacewingFunction void Send(int Subchannel, const char * Data, int S ize = -1, int Variant = 0); | LacewingFunction void Send(int Subchannel, const char * Data, int S ize = -1, int Variant = 0); | |||
LacewingFunction void Blast(int Subchannel, const char * Data, int Size = -1, int Variant = 0); | LacewingFunction void Blast(int Subchannel, const char * Data, int Size = -1, int Variant = 0); | |||
LacewingFunction const char * Name (); | LacewingFunction const char * Name (); | |||
LacewingFunction void Name (const char *); | LacewingFunction void Name (const char *); | |||
LacewingFunction int ChannelCount(); | LacewingFunction int ChannelCount(); | |||
Client * Next (); | struct ChannelIterator | |||
{ | ||||
void * InternalTag; | ||||
LacewingFunction ChannelIterator (Client &); | ||||
LacewingFunction Channel * Next (); | ||||
}; | ||||
LacewingFunction Client * Next (); | ||||
}; | }; | |||
LacewingFunction int ClientCount (); | LacewingFunction int ClientCount (); | |||
LacewingFunction Client * FirstClient (); | LacewingFunction Client * FirstClient (); | |||
typedef bool (LacewingHandler * HandlerConnect) (Lacewing::RelaySer ver &Server, Lacewing::RelayServer::Client &Client); | typedef bool (LacewingHandler * HandlerConnect) (Lacewing::RelaySer ver &Server, Lacewing::RelayServer::Client &Client); | |||
typedef void (LacewingHandler * HandlerDisconnect) (Lacewing::RelaySer ver &Server, Lacewing::RelayServer::Client &Client); | typedef void (LacewingHandler * HandlerDisconnect) (Lacewing::RelaySer ver &Server, Lacewing::RelayServer::Client &Client); | |||
typedef void (LacewingHandler * HandlerError) (Lacewing::RelaySer ver &Server, Lacewing::Error &); | typedef void (LacewingHandler * HandlerError) (Lacewing::RelaySer ver &Server, Lacewing::Error &); | |||
typedef void (LacewingHandler * HandlerServerMessage) | typedef void (LacewingHandler * HandlerServerMessage) | |||
(Lacewing::RelayServer &Server, Lacewing::RelayServer::Client &Clie nt, bool Blasted, int Subchannel, | (Lacewing::RelayServer &Server, Lacewing::RelayServer::Client &Clie nt, bool Blasted, int Subchannel, | |||
char * Data, int Size, int Variant); | char * Data, int Size, int Variant); | |||
typedef bool (LacewingHandler * HandlerChannelMessage) | typedef bool (LacewingHandler * HandlerChannelMessage) | |||
(Lacewing::RelayServer &Server, Lacewing::RelayServer::Client &Clie nt, Lacewing::RelayServer::Channel &Channel, | (Lacewing::RelayServer &Server, Lacewing::RelayServer::Client &Clie nt, Lacewing::RelayServer::Channel &Channel, | |||
bool Blasted, int Subchannel, char * Data, int Size, int Varian t); | bool Blasted, int Subchannel, char * Data, int Size, int Varian t); | |||
typedef bool (LacewingHandler * HandlerPeerMessage) | typedef bool (LacewingHandler * HandlerPeerMessage) | |||
(Lacewing::RelayServer &Server, Lacewing::RelayServer::Client &Clie nt, Lacewing::RelayServer::Channel &Channel, | (Lacewing::RelayServer &Server, Lacewing::RelayServer::Client &Clie nt, Lacewing::RelayServer::Channel &Channel, | |||
Lacewing::RelayServer::Client &TargetClient,bool Blasted, | Lacewing::RelayServer::Client &TargetClient,bool Blasted, | |||
int Subchannel,char * Packet, int Size, int Variant); | int Subchannel, char * Packet, int Size, int Variant); | |||
typedef bool (LacewingHandler * HandlerJoinChannel) | typedef bool (LacewingHandler * HandlerJoinChannel) | |||
(Lacewing::RelayServer &Server, Lacewing::RelayServer::Client &Clie nt, Lacewing::RelayServer::Channel &Channel); | (Lacewing::RelayServer &Server, Lacewing::RelayServer::Client &Clie nt, Lacewing::RelayServer::Channel &Channel); | |||
typedef bool (LacewingHandler * HandlerLeaveChannel) | typedef bool (LacewingHandler * HandlerLeaveChannel) | |||
(Lacewing::RelayServer &Server, Lacewing::RelayServer::Client &Clie nt, Lacewing::RelayServer::Channel &Channel); | (Lacewing::RelayServer &Server, Lacewing::RelayServer::Client &Clie nt, Lacewing::RelayServer::Channel &Channel); | |||
typedef bool (LacewingHandler * HandlerSetName) | typedef bool (LacewingHandler * HandlerSetName) | |||
(Lacewing::RelayServer &Server, Lacewing::RelayServer::Client &Clie nt, const char * Name); | (Lacewing::RelayServer &Server, Lacewing::RelayServer::Client &Clie nt, const char * Name); | |||
LacewingFunction void onConnect (HandlerConnect); | LacewingFunction void onConnect (HandlerConnect); | |||
LacewingFunction void onDisconnect(HandlerDisconnect); | LacewingFunction void onDisconnect (HandlerDisconnect); | |||
LacewingFunction void onError (HandlerError); | LacewingFunction void onError (HandlerError); | |||
LacewingFunction void onServerMessage (HandlerServerMessage); | LacewingFunction void onServerMessage (HandlerServerMessage); | |||
LacewingFunction void onChannelMessage (HandlerChannelMessage); | LacewingFunction void onChannelMessage (HandlerChannelMessage); | |||
LacewingFunction void onPeerMessage (HandlerPeerMessage); | LacewingFunction void onPeerMessage (HandlerPeerMessage); | |||
LacewingFunction void onJoinChannel (HandlerJoinChannel); | LacewingFunction void onJoinChannel (HandlerJoinChannel); | |||
LacewingFunction void onLeaveChannel (HandlerLeaveChannel); | LacewingFunction void onLeaveChannel (HandlerLeaveChannel); | |||
LacewingFunction void onSetName (HandlerSetName); | LacewingFunction void onSetName (HandlerSetName); | |||
}; | }; | |||
struct FlashPlayerPolicy | struct FlashPolicy | |||
{ | { | |||
void * InternalTag, * Tag; | void * InternalTag, * Tag; | |||
Server Socket; | LacewingFunction FlashPolicy (Pump &); | |||
LacewingFunction ~FlashPolicy (); | ||||
LacewingFunction FlashPlayerPolicy(Pump &); | ||||
LacewingFunction ~FlashPlayerPolicy(); | ||||
LacewingFunction void Host(const char * Filename, int Port = 843); | LacewingFunction void Host (const char * Filename, int Port = 843); | |||
LacewingFunction void Host(const char * Filename, Lacewing::Filter &Fil | LacewingFunction void Host (const char * Filename, Lacewing::Filter &Fi | |||
ter); | lter); | |||
LacewingFunction void Unhost(); | LacewingFunction void Unhost (); | |||
LacewingFunction bool Hosting(); | LacewingFunction bool Hosting (); | |||
typedef void (LacewingHandler * HandlerError) (Lacewing::FlashP | typedef void (LacewingHandler * HandlerError) | |||
layerPolicy &FlashPlayerPolicy, Lacewing::Error &); | (Lacewing::FlashPolicy &FlashPolicy, Lacewing::Error &); | |||
LacewingFunction void onError (HandlerError); | LacewingFunction void onError (HandlerError); | |||
}; | }; | |||
} | } | |||
#endif /* __cplusplus */ | #endif /* __cplusplus */ | |||
#endif /* LacewingIncluded */ | #endif /* LacewingIncluded */ | |||
End of changes. 65 change blocks. | ||||
123 lines changed or deleted | 166 lines changed or added | |||