mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-07 13:35:00 +00:00
macros to export symbols
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10910 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
6f2677a53d
commit
63250c91b4
@ -42,7 +42,7 @@
|
|||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="src/include"
|
AdditionalIncludeDirectories="src/include"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
|
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;ESL_EXPORTS"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="3"
|
RuntimeLibrary="3"
|
||||||
@ -120,7 +120,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories="src/include"
|
AdditionalIncludeDirectories="src/include"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;ESL_EXPORTS"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="4"
|
WarningLevel="4"
|
||||||
|
@ -79,7 +79,7 @@ const short _esl_C_toupper_[1 + ESL_CTYPE_NUM_CHARS] = {
|
|||||||
|
|
||||||
const short *_esl_toupper_tab_ = _esl_C_toupper_;
|
const short *_esl_toupper_tab_ = _esl_C_toupper_;
|
||||||
|
|
||||||
int esl_toupper(int c)
|
ESL_DECLARE(int) esl_toupper(int c)
|
||||||
{
|
{
|
||||||
if ((unsigned int)c > 255)
|
if ((unsigned int)c > 255)
|
||||||
return(c);
|
return(c);
|
||||||
@ -126,7 +126,7 @@ const short _esl_C_tolower_[1 + ESL_CTYPE_NUM_CHARS] = {
|
|||||||
|
|
||||||
const short *_esl_tolower_tab_ = _esl_C_tolower_;
|
const short *_esl_tolower_tab_ = _esl_C_tolower_;
|
||||||
|
|
||||||
int esl_tolower(int c)
|
ESL_DECLARE(int) esl_tolower(int c)
|
||||||
{
|
{
|
||||||
if ((unsigned int)c > 255)
|
if ((unsigned int)c > 255)
|
||||||
return(c);
|
return(c);
|
||||||
@ -135,7 +135,7 @@ int esl_tolower(int c)
|
|||||||
return((_esl_tolower_tab_ + 1)[c]);
|
return((_esl_tolower_tab_ + 1)[c]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *esl_stristr(const char *instr, const char *str)
|
ESL_DECLARE(const char *)esl_stristr(const char *instr, const char *str)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
** Rev History: 16/07/97 Greg Thayer Optimized
|
** Rev History: 16/07/97 Greg Thayer Optimized
|
||||||
@ -181,7 +181,7 @@ const char *esl_stristr(const char *instr, const char *str)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int esl_snprintf(char *buffer, size_t count, const char *fmt, ...)
|
ESL_DECLARE(int) esl_snprintf(char *buffer, size_t count, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int ret;
|
int ret;
|
||||||
@ -280,7 +280,7 @@ void esl_global_set_default_logger(int level)
|
|||||||
esl_log_level = level;
|
esl_log_level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t esl_url_encode(const char *url, char *buf, size_t len)
|
ESL_DECLARE(size_t) esl_url_encode(const char *url, char *buf, size_t len)
|
||||||
{
|
{
|
||||||
const char *p;
|
const char *p;
|
||||||
size_t x = 0;
|
size_t x = 0;
|
||||||
@ -317,7 +317,7 @@ size_t esl_url_encode(const char *url, char *buf, size_t len)
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *esl_url_decode(char *s)
|
ESL_DECLARE(char *)esl_url_decode(char *s)
|
||||||
{
|
{
|
||||||
char *o;
|
char *o;
|
||||||
unsigned int tmp;
|
unsigned int tmp;
|
||||||
@ -334,7 +334,7 @@ char *esl_url_decode(char *s)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_attach_handle(esl_handle_t *handle, esl_socket_t socket, struct sockaddr_in addr)
|
ESL_DECLARE(esl_status_t) esl_attach_handle(esl_handle_t *handle, esl_socket_t socket, struct sockaddr_in addr)
|
||||||
{
|
{
|
||||||
handle->sock = socket;
|
handle->sock = socket;
|
||||||
handle->addr = addr;
|
handle->addr = addr;
|
||||||
@ -364,7 +364,7 @@ esl_status_t esl_attach_handle(esl_handle_t *handle, esl_socket_t socket, struct
|
|||||||
return ESL_FAIL;
|
return ESL_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_sendevent(esl_handle_t *handle, esl_event_t *event)
|
ESL_DECLARE(esl_status_t) esl_sendevent(esl_handle_t *handle, esl_event_t *event)
|
||||||
{
|
{
|
||||||
char *txt;
|
char *txt;
|
||||||
|
|
||||||
@ -383,7 +383,7 @@ esl_status_t esl_sendevent(esl_handle_t *handle, esl_event_t *event)
|
|||||||
return ESL_SUCCESS;
|
return ESL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_execute(esl_handle_t *handle, const char *app, const char *arg, const char *uuid)
|
ESL_DECLARE(esl_status_t) esl_execute(esl_handle_t *handle, const char *app, const char *arg, const char *uuid)
|
||||||
{
|
{
|
||||||
char cmd_buf[128] = "sendmsg";
|
char cmd_buf[128] = "sendmsg";
|
||||||
char app_buf[512] = "";
|
char app_buf[512] = "";
|
||||||
@ -418,7 +418,7 @@ static int esl_socket_reuseaddr(esl_socket_t socket)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_listen(const char *host, esl_port_t port, esl_listen_callback_t callback)
|
ESL_DECLARE(esl_status_t) esl_listen(const char *host, esl_port_t port, esl_listen_callback_t callback)
|
||||||
{
|
{
|
||||||
esl_socket_t server_sock = ESL_SOCK_INVALID;
|
esl_socket_t server_sock = ESL_SOCK_INVALID;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
@ -475,7 +475,7 @@ esl_status_t esl_listen(const char *host, esl_port_t port, esl_listen_callback_t
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *password)
|
ESL_DECLARE(esl_status_t) esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *password)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct hostent *result;
|
struct hostent *result;
|
||||||
@ -560,7 +560,7 @@ esl_status_t esl_connect(esl_handle_t *handle, const char *host, esl_port_t port
|
|||||||
return ESL_FAIL;
|
return ESL_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_disconnect(esl_handle_t *handle)
|
ESL_DECLARE(esl_status_t) esl_disconnect(esl_handle_t *handle)
|
||||||
{
|
{
|
||||||
esl_event_safe_destroy(&handle->last_event);
|
esl_event_safe_destroy(&handle->last_event);
|
||||||
esl_event_safe_destroy(&handle->last_sr_event);
|
esl_event_safe_destroy(&handle->last_sr_event);
|
||||||
@ -582,7 +582,7 @@ esl_status_t esl_disconnect(esl_handle_t *handle)
|
|||||||
return ESL_FAIL;
|
return ESL_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_recv_event_timed(esl_handle_t *handle, uint32_t ms, esl_event_t **save_event)
|
ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms, esl_event_t **save_event)
|
||||||
{
|
{
|
||||||
fd_set rfds, efds;
|
fd_set rfds, efds;
|
||||||
struct timeval tv = { 0 };
|
struct timeval tv = { 0 };
|
||||||
@ -631,7 +631,7 @@ esl_status_t esl_recv_event_timed(esl_handle_t *handle, uint32_t ms, esl_event_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esl_status_t esl_recv_event(esl_handle_t *handle, esl_event_t **save_event)
|
ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, esl_event_t **save_event)
|
||||||
{
|
{
|
||||||
char *c;
|
char *c;
|
||||||
esl_ssize_t rrval;
|
esl_ssize_t rrval;
|
||||||
@ -843,7 +843,7 @@ esl_status_t esl_recv_event(esl_handle_t *handle, esl_event_t **save_event)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_send(esl_handle_t *handle, const char *cmd)
|
ESL_DECLARE(esl_status_t) esl_send(esl_handle_t *handle, const char *cmd)
|
||||||
{
|
{
|
||||||
const char *e = cmd + strlen(cmd) -1;
|
const char *e = cmd + strlen(cmd) -1;
|
||||||
|
|
||||||
@ -868,7 +868,7 @@ esl_status_t esl_send(esl_handle_t *handle, const char *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esl_status_t esl_send_recv(esl_handle_t *handle, const char *cmd)
|
ESL_DECLARE(esl_status_t) esl_send_recv(esl_handle_t *handle, const char *cmd)
|
||||||
{
|
{
|
||||||
const char *hval;
|
const char *hval;
|
||||||
esl_status_t status;
|
esl_status_t status;
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include "esl.h"
|
#include "esl.h"
|
||||||
#include "esl_config.h"
|
#include "esl_config.h"
|
||||||
|
|
||||||
int esl_config_open_file(esl_config_t *cfg, const char *file_path)
|
ESL_DECLARE(int) esl_config_open_file(esl_config_t *cfg, const char *file_path)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
const char *path = NULL;
|
const char *path = NULL;
|
||||||
@ -91,7 +91,7 @@ int esl_config_open_file(esl_config_t *cfg, const char *file_path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void esl_config_close_file(esl_config_t *cfg)
|
ESL_DECLARE(void) esl_config_close_file(esl_config_t *cfg)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (cfg->file) {
|
if (cfg->file) {
|
||||||
@ -103,7 +103,7 @@ void esl_config_close_file(esl_config_t *cfg)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int esl_config_next_pair(esl_config_t *cfg, char **var, char **val)
|
ESL_DECLARE(int) esl_config_next_pair(esl_config_t *cfg, char **var, char **val)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char *p, *end;
|
char *p, *end;
|
||||||
@ -209,7 +209,7 @@ int esl_config_next_pair(esl_config_t *cfg, char **var, char **val)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int esl_config_get_cas_bits(char *strvalue, unsigned char *outbits)
|
ESL_DECLARE(int) esl_config_get_cas_bits(char *strvalue, unsigned char *outbits)
|
||||||
{
|
{
|
||||||
char cas_bits[5];
|
char cas_bits[5];
|
||||||
unsigned char bit = 0x8;
|
unsigned char bit = 0x8;
|
||||||
|
@ -121,12 +121,12 @@ static const char *EVENT_NAMES[] = {
|
|||||||
"ALL"
|
"ALL"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *esl_event_name(esl_event_types_t event)
|
ESL_DECLARE(const char *)esl_event_name(esl_event_types_t event)
|
||||||
{
|
{
|
||||||
return EVENT_NAMES[event];
|
return EVENT_NAMES[event];
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_name_event(const char *name, esl_event_types_t *type)
|
ESL_DECLARE(esl_status_t) esl_name_event(const char *name, esl_event_types_t *type)
|
||||||
{
|
{
|
||||||
esl_event_types_t x;
|
esl_event_types_t x;
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ esl_status_t esl_name_event(const char *name, esl_event_types_t *type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esl_status_t esl_event_create_subclass(esl_event_t **event, esl_event_types_t event_id, const char *subclass_name)
|
ESL_DECLARE(esl_status_t) esl_event_create_subclass(esl_event_t **event, esl_event_types_t event_id, const char *subclass_name)
|
||||||
{
|
{
|
||||||
*event = NULL;
|
*event = NULL;
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ esl_status_t esl_event_create_subclass(esl_event_t **event, esl_event_types_t ev
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *esl_priority_name(esl_priority_t priority)
|
ESL_DECLARE(const char *)esl_priority_name(esl_priority_t priority)
|
||||||
{
|
{
|
||||||
switch (priority) { /*lol */
|
switch (priority) { /*lol */
|
||||||
case ESL_PRIORITY_NORMAL:
|
case ESL_PRIORITY_NORMAL:
|
||||||
@ -180,7 +180,7 @@ const char *esl_priority_name(esl_priority_t priority)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_event_set_priority(esl_event_t *event, esl_priority_t priority)
|
ESL_DECLARE(esl_status_t) esl_event_set_priority(esl_event_t *event, esl_priority_t priority)
|
||||||
{
|
{
|
||||||
event->priority = priority;
|
event->priority = priority;
|
||||||
esl_event_add_header_string(event, ESL_STACK_TOP, "priority", esl_priority_name(priority));
|
esl_event_add_header_string(event, ESL_STACK_TOP, "priority", esl_priority_name(priority));
|
||||||
@ -213,7 +213,7 @@ static unsigned int esl_ci_hashfunc_default(const char *char_key, esl_ssize_t *k
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *esl_event_get_header(esl_event_t *event, const char *header_name)
|
ESL_DECLARE(char *)esl_event_get_header(esl_event_t *event, const char *header_name)
|
||||||
{
|
{
|
||||||
esl_event_header_t *hp;
|
esl_event_header_t *hp;
|
||||||
esl_ssize_t hlen = -1;
|
esl_ssize_t hlen = -1;
|
||||||
@ -233,12 +233,12 @@ char *esl_event_get_header(esl_event_t *event, const char *header_name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *esl_event_get_body(esl_event_t *event)
|
ESL_DECLARE(char *)esl_event_get_body(esl_event_t *event)
|
||||||
{
|
{
|
||||||
return (event ? event->body : NULL);
|
return (event ? event->body : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_event_del_header(esl_event_t *event, const char *header_name)
|
ESL_DECLARE(esl_status_t) esl_event_del_header(esl_event_t *event, const char *header_name)
|
||||||
{
|
{
|
||||||
esl_event_header_t *hp, *lp = NULL, *tp;
|
esl_event_header_t *hp, *lp = NULL, *tp;
|
||||||
esl_status_t status = ESL_FAIL;
|
esl_status_t status = ESL_FAIL;
|
||||||
@ -311,6 +311,8 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st
|
|||||||
return ESL_SUCCESS;
|
return ESL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int vasprintf(char **ret, const char *format, va_list ap);
|
||||||
|
|
||||||
static int esl_vasprintf(char **ret, const char *fmt, va_list ap)
|
static int esl_vasprintf(char **ret, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
@ -348,7 +350,7 @@ static int esl_vasprintf(char **ret, const char *fmt, va_list ap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esl_status_t esl_event_add_header(esl_event_t *event, esl_stack_t stack, const char *header_name, const char *fmt, ...)
|
ESL_DECLARE(esl_status_t) esl_event_add_header(esl_event_t *event, esl_stack_t stack, const char *header_name, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char *data;
|
char *data;
|
||||||
@ -365,7 +367,7 @@ esl_status_t esl_event_add_header(esl_event_t *event, esl_stack_t stack, const c
|
|||||||
return esl_event_base_add_header(event, stack, header_name, data);
|
return esl_event_base_add_header(event, stack, header_name, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_event_add_header_string(esl_event_t *event, esl_stack_t stack, const char *header_name, const char *data)
|
ESL_DECLARE(esl_status_t) esl_event_add_header_string(esl_event_t *event, esl_stack_t stack, const char *header_name, const char *data)
|
||||||
{
|
{
|
||||||
if (data) {
|
if (data) {
|
||||||
return esl_event_base_add_header(event, stack, header_name, DUP(data));
|
return esl_event_base_add_header(event, stack, header_name, DUP(data));
|
||||||
@ -373,7 +375,7 @@ esl_status_t esl_event_add_header_string(esl_event_t *event, esl_stack_t stack,
|
|||||||
return ESL_FAIL;
|
return ESL_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_event_add_body(esl_event_t *event, const char *fmt, ...)
|
ESL_DECLARE(esl_status_t) esl_event_add_body(esl_event_t *event, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char *data;
|
char *data;
|
||||||
@ -396,7 +398,7 @@ esl_status_t esl_event_add_body(esl_event_t *event, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void esl_event_destroy(esl_event_t **event)
|
ESL_DECLARE(void) esl_event_destroy(esl_event_t **event)
|
||||||
{
|
{
|
||||||
esl_event_t *ep = *event;
|
esl_event_t *ep = *event;
|
||||||
esl_event_header_t *hp, *this;
|
esl_event_header_t *hp, *this;
|
||||||
@ -420,7 +422,7 @@ void esl_event_destroy(esl_event_t **event)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
esl_status_t esl_event_dup(esl_event_t **event, esl_event_t *todup)
|
ESL_DECLARE(esl_status_t) esl_event_dup(esl_event_t **event, esl_event_t *todup)
|
||||||
{
|
{
|
||||||
esl_event_header_t *header, *hp, *hp2, *last = NULL;
|
esl_event_header_t *header, *hp, *hp2, *last = NULL;
|
||||||
|
|
||||||
@ -463,7 +465,7 @@ esl_status_t esl_event_dup(esl_event_t **event, esl_event_t *todup)
|
|||||||
return ESL_SUCCESS;
|
return ESL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_event_serialize(esl_event_t *event, char **str, esl_bool_t encode)
|
ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, esl_bool_t encode)
|
||||||
{
|
{
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
esl_event_header_t *hp;
|
esl_event_header_t *hp;
|
||||||
|
@ -80,7 +80,7 @@ static void * ESL_THREAD_CALLING_CONVENTION thread_launch(void *args)
|
|||||||
return exit_val;
|
return exit_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_thread_create_detached(esl_thread_function_t func, void *data)
|
ESL_DECLARE(esl_status_t) esl_thread_create_detached(esl_thread_function_t func, void *data)
|
||||||
{
|
{
|
||||||
return esl_thread_create_detached_ex(func, data, thread_default_stacksize);
|
return esl_thread_create_detached_ex(func, data, thread_default_stacksize);
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ esl_status_t esl_thread_create_detached_ex(esl_thread_function_t func, void *dat
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esl_status_t esl_mutex_create(esl_mutex_t **mutex)
|
ESL_DECLARE(esl_status_t) esl_mutex_create(esl_mutex_t **mutex)
|
||||||
{
|
{
|
||||||
esl_status_t status = ESL_FAIL;
|
esl_status_t status = ESL_FAIL;
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
@ -170,7 +170,7 @@ esl_status_t esl_mutex_create(esl_mutex_t **mutex)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_mutex_destroy(esl_mutex_t **mutex)
|
ESL_DECLARE(esl_status_t) esl_mutex_destroy(esl_mutex_t **mutex)
|
||||||
{
|
{
|
||||||
esl_mutex_t *mp = *mutex;
|
esl_mutex_t *mp = *mutex;
|
||||||
*mutex = NULL;
|
*mutex = NULL;
|
||||||
@ -187,7 +187,7 @@ esl_status_t esl_mutex_destroy(esl_mutex_t **mutex)
|
|||||||
return ESL_SUCCESS;
|
return ESL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_mutex_lock(esl_mutex_t *mutex)
|
ESL_DECLARE(esl_status_t) esl_mutex_lock(esl_mutex_t *mutex)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
EnterCriticalSection(&mutex->mutex);
|
EnterCriticalSection(&mutex->mutex);
|
||||||
@ -198,7 +198,7 @@ esl_status_t esl_mutex_lock(esl_mutex_t *mutex)
|
|||||||
return ESL_SUCCESS;
|
return ESL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_mutex_trylock(esl_mutex_t *mutex)
|
ESL_DECLARE(esl_status_t) esl_mutex_trylock(esl_mutex_t *mutex)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (!TryEnterCriticalSection(&mutex->mutex))
|
if (!TryEnterCriticalSection(&mutex->mutex))
|
||||||
@ -210,7 +210,7 @@ esl_status_t esl_mutex_trylock(esl_mutex_t *mutex)
|
|||||||
return ESL_SUCCESS;
|
return ESL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_status_t esl_mutex_unlock(esl_mutex_t *mutex)
|
ESL_DECLARE(esl_status_t) esl_mutex_unlock(esl_mutex_t *mutex)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
LeaveCriticalSection(&mutex->mutex);
|
LeaveCriticalSection(&mutex->mutex);
|
||||||
|
@ -34,10 +34,7 @@
|
|||||||
#ifndef _ESL_H_
|
#ifndef _ESL_H_
|
||||||
#define _ESL_H_
|
#define _ESL_H_
|
||||||
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
int vasprintf(char **ret, const char *format, va_list ap);
|
|
||||||
|
|
||||||
|
|
||||||
#define esl_copy_string(_x, _y, _z) strncpy(_x, _y, _z - 1)
|
#define esl_copy_string(_x, _y, _z) strncpy(_x, _y, _z - 1)
|
||||||
#define esl_set_string(_x, _y) esl_copy_string(_x, _y, sizeof(_x))
|
#define esl_set_string(_x, _y) esl_copy_string(_x, _y, sizeof(_x))
|
||||||
@ -45,7 +42,6 @@ int vasprintf(char **ret, const char *format, va_list ap);
|
|||||||
typedef struct esl_event_header esl_event_header_t;
|
typedef struct esl_event_header esl_event_header_t;
|
||||||
typedef struct esl_event esl_event_t;
|
typedef struct esl_event esl_event_t;
|
||||||
|
|
||||||
|
|
||||||
#define ESL_SEQ_ESC "\033["
|
#define ESL_SEQ_ESC "\033["
|
||||||
/* Ansi Control character suffixes */
|
/* Ansi Control character suffixes */
|
||||||
#define ESL_SEQ_HOME_CHAR 'H'
|
#define ESL_SEQ_HOME_CHAR 'H'
|
||||||
@ -196,7 +192,23 @@ typedef intptr_t esl_ssize_t;
|
|||||||
typedef int esl_filehandle_t;
|
typedef int esl_filehandle_t;
|
||||||
#define ESL_SOCK_INVALID INVALID_SOCKET
|
#define ESL_SOCK_INVALID INVALID_SOCKET
|
||||||
#define strerror_r(num, buf, size) strerror_s(buf, size, num)
|
#define strerror_r(num, buf, size) strerror_s(buf, size, num)
|
||||||
|
#if defined(ESL_DECLARE_STATIC)
|
||||||
|
#define ESL_DECLARE(type) type __stdcall
|
||||||
|
#define ESL_DECLARE_NONSTD(type) type __cdecl
|
||||||
|
#define ESL_DECLARE_DATA
|
||||||
|
#elif defined(ESL_EXPORTS)
|
||||||
|
#define ESL_DECLARE(type) __declspec(dllexport) type __stdcall
|
||||||
|
#define ESL_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
|
||||||
|
#define ESL_DECLARE_DATA __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define ESL_DECLARE(type) __declspec(dllimport) type __stdcall
|
||||||
|
#define ESL_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
|
||||||
|
#define ESL_DECLARE_DATA __declspec(dllimport)
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
|
#define ESL_DECLARE(type) type
|
||||||
|
#define ESL_DECLARE_NONSTD(type) type
|
||||||
|
#define ESL_DECLARE_DATA
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@ -218,7 +230,6 @@ typedef enum {
|
|||||||
ESL_BREAK
|
ESL_BREAK
|
||||||
} esl_status_t;
|
} esl_status_t;
|
||||||
|
|
||||||
|
|
||||||
#include <esl_threadmutex.h>
|
#include <esl_threadmutex.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -279,27 +290,27 @@ void esl_global_set_default_logger(int level);
|
|||||||
#include "esl_threadmutex.h"
|
#include "esl_threadmutex.h"
|
||||||
#include "esl_config.h"
|
#include "esl_config.h"
|
||||||
|
|
||||||
size_t esl_url_encode(const char *url, char *buf, size_t len);
|
ESL_DECLARE(size_t) esl_url_encode(const char *url, char *buf, size_t len);
|
||||||
char *esl_url_decode(char *s);
|
ESL_DECLARE(char *)esl_url_decode(char *s);
|
||||||
const char *esl_stristr(const char *instr, const char *str);
|
ESL_DECLARE(const char *)esl_stristr(const char *instr, const char *str);
|
||||||
int esl_toupper(int c);
|
ESL_DECLARE(int) esl_toupper(int c);
|
||||||
int esl_tolower(int c);
|
ESL_DECLARE(int) esl_tolower(int c);
|
||||||
int esl_snprintf(char *buffer, size_t count, const char *fmt, ...);
|
ESL_DECLARE(int) esl_snprintf(char *buffer, size_t count, const char *fmt, ...);
|
||||||
|
|
||||||
|
|
||||||
typedef void (*esl_listen_callback_t)(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in addr);
|
typedef void (*esl_listen_callback_t)(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in addr);
|
||||||
|
|
||||||
esl_status_t esl_attach_handle(esl_handle_t *handle, esl_socket_t socket, struct sockaddr_in addr);
|
ESL_DECLARE(esl_status_t) esl_attach_handle(esl_handle_t *handle, esl_socket_t socket, struct sockaddr_in addr);
|
||||||
esl_status_t esl_listen(const char *host, esl_port_t port, esl_listen_callback_t callback);
|
ESL_DECLARE(esl_status_t) esl_listen(const char *host, esl_port_t port, esl_listen_callback_t callback);
|
||||||
esl_status_t esl_execute(esl_handle_t *handle, const char *app, const char *arg, const char *uuid);
|
ESL_DECLARE(esl_status_t) esl_execute(esl_handle_t *handle, const char *app, const char *arg, const char *uuid);
|
||||||
esl_status_t esl_sendevent(esl_handle_t *handle, esl_event_t *event);
|
ESL_DECLARE(esl_status_t) esl_sendevent(esl_handle_t *handle, esl_event_t *event);
|
||||||
|
|
||||||
esl_status_t esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *password);
|
ESL_DECLARE(esl_status_t) esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *password);
|
||||||
esl_status_t esl_disconnect(esl_handle_t *handle);
|
ESL_DECLARE(esl_status_t) esl_disconnect(esl_handle_t *handle);
|
||||||
esl_status_t esl_send(esl_handle_t *handle, const char *cmd);
|
ESL_DECLARE(esl_status_t) esl_send(esl_handle_t *handle, const char *cmd);
|
||||||
esl_status_t esl_recv_event(esl_handle_t *handle, esl_event_t **save_event);
|
ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, esl_event_t **save_event);
|
||||||
esl_status_t esl_recv_event_timed(esl_handle_t *handle, uint32_t ms, esl_event_t **save_event);
|
ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms, esl_event_t **save_event);
|
||||||
esl_status_t esl_send_recv(esl_handle_t *handle, const char *cmd);
|
ESL_DECLARE(esl_status_t) esl_send_recv(esl_handle_t *handle, const char *cmd);
|
||||||
#define esl_recv(_h) esl_recv_event(_h, NULL)
|
#define esl_recv(_h) esl_recv_event(_h, NULL)
|
||||||
#define esl_recv_timed(_h, _ms) esl_recv_event_timed(_h, _ms, NULL)
|
#define esl_recv_timed(_h, _ms) esl_recv_event_timed(_h, _ms, NULL)
|
||||||
|
|
||||||
|
@ -100,13 +100,13 @@ struct esl_config {
|
|||||||
\param file_path path to the file
|
\param file_path path to the file
|
||||||
\return 1 (true) on success 0 (false) on failure
|
\return 1 (true) on success 0 (false) on failure
|
||||||
*/
|
*/
|
||||||
int esl_config_open_file(esl_config_t * cfg, const char *file_path);
|
ESL_DECLARE(int) esl_config_open_file(esl_config_t * cfg, const char *file_path);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Close a previously opened configuration file
|
\brief Close a previously opened configuration file
|
||||||
\param cfg (esl_config_t *) config handle to use
|
\param cfg (esl_config_t *) config handle to use
|
||||||
*/
|
*/
|
||||||
void esl_config_close_file(esl_config_t * cfg);
|
ESL_DECLARE(void) esl_config_close_file(esl_config_t * cfg);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Retrieve next name/value pair from configuration file
|
\brief Retrieve next name/value pair from configuration file
|
||||||
@ -114,14 +114,14 @@ void esl_config_close_file(esl_config_t * cfg);
|
|||||||
\param var pointer to aim at the new variable name
|
\param var pointer to aim at the new variable name
|
||||||
\param val pointer to aim at the new value
|
\param val pointer to aim at the new value
|
||||||
*/
|
*/
|
||||||
int esl_config_next_pair(esl_config_t * cfg, char **var, char **val);
|
ESL_DECLARE(int) esl_config_next_pair(esl_config_t * cfg, char **var, char **val);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Retrieve the CAS bits from a configuration string value
|
\brief Retrieve the CAS bits from a configuration string value
|
||||||
\param strvalue pointer to the configuration string value (expected to be in format whatever:xxxx)
|
\param strvalue pointer to the configuration string value (expected to be in format whatever:xxxx)
|
||||||
\param outbits pointer to aim at the CAS bits
|
\param outbits pointer to aim at the CAS bits
|
||||||
*/
|
*/
|
||||||
int esl_config_get_cas_bits(char *strvalue, unsigned char *outbits);
|
ESL_DECLARE(int) esl_config_get_cas_bits(char *strvalue, unsigned char *outbits);
|
||||||
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -159,7 +159,7 @@ struct esl_event {
|
|||||||
\param subclass_name the subclass name for custom event (only valid when event_id is ESL_EVENT_CUSTOM)
|
\param subclass_name the subclass name for custom event (only valid when event_id is ESL_EVENT_CUSTOM)
|
||||||
\return ESL_STATUS_SUCCESS on success
|
\return ESL_STATUS_SUCCESS on success
|
||||||
*/
|
*/
|
||||||
esl_status_t esl_event_create_subclass(esl_event_t **event, esl_event_types_t event_id, const char *subclass_name);
|
ESL_DECLARE(esl_status_t) esl_event_create_subclass(esl_event_t **event, esl_event_types_t event_id, const char *subclass_name);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Set the priority of an event
|
\brief Set the priority of an event
|
||||||
@ -167,7 +167,7 @@ esl_status_t esl_event_create_subclass(esl_event_t **event, esl_event_types_t ev
|
|||||||
\param priority the event priority
|
\param priority the event priority
|
||||||
\return ESL_STATUS_SUCCESS
|
\return ESL_STATUS_SUCCESS
|
||||||
*/
|
*/
|
||||||
esl_status_t esl_event_set_priority(esl_event_t *event, esl_priority_t priority);
|
ESL_DECLARE(esl_status_t) esl_event_set_priority(esl_event_t *event, esl_priority_t priority);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Retrieve a header value from an event
|
\brief Retrieve a header value from an event
|
||||||
@ -175,14 +175,14 @@ esl_status_t esl_event_set_priority(esl_event_t *event, esl_priority_t priority)
|
|||||||
\param header_name the name of the header to read
|
\param header_name the name of the header to read
|
||||||
\return the value of the requested header
|
\return the value of the requested header
|
||||||
*/
|
*/
|
||||||
char *esl_event_get_header(esl_event_t *event, const char *header_name);
|
ESL_DECLARE(char *)esl_event_get_header(esl_event_t *event, const char *header_name);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Retrieve the body value from an event
|
\brief Retrieve the body value from an event
|
||||||
\param event the event to read the body from
|
\param event the event to read the body from
|
||||||
\return the value of the body or NULL
|
\return the value of the body or NULL
|
||||||
*/
|
*/
|
||||||
char *esl_event_get_body(esl_event_t *event);
|
ESL_DECLARE(char *)esl_event_get_body(esl_event_t *event);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Add a header to an event
|
\brief Add a header to an event
|
||||||
@ -192,7 +192,7 @@ char *esl_event_get_body(esl_event_t *event);
|
|||||||
\param fmt the value of the header (varargs see standard sprintf family)
|
\param fmt the value of the header (varargs see standard sprintf family)
|
||||||
\return ESL_STATUS_SUCCESS if the header was added
|
\return ESL_STATUS_SUCCESS if the header was added
|
||||||
*/
|
*/
|
||||||
esl_status_t esl_event_add_header(esl_event_t *event, esl_stack_t stack,
|
ESL_DECLARE(esl_status_t) esl_event_add_header(esl_event_t *event, esl_stack_t stack,
|
||||||
const char *header_name, const char *fmt, ...); //PRINTF_FUNCTION(4, 5);
|
const char *header_name, const char *fmt, ...); //PRINTF_FUNCTION(4, 5);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -203,15 +203,15 @@ esl_status_t esl_event_add_header(esl_event_t *event, esl_stack_t stack,
|
|||||||
\param data the value of the header
|
\param data the value of the header
|
||||||
\return ESL_STATUS_SUCCESS if the header was added
|
\return ESL_STATUS_SUCCESS if the header was added
|
||||||
*/
|
*/
|
||||||
esl_status_t esl_event_add_header_string(esl_event_t *event, esl_stack_t stack, const char *header_name, const char *data);
|
ESL_DECLARE(esl_status_t) esl_event_add_header_string(esl_event_t *event, esl_stack_t stack, const char *header_name, const char *data);
|
||||||
|
|
||||||
esl_status_t esl_event_del_header(esl_event_t *event, const char *header_name);
|
ESL_DECLARE(esl_status_t) esl_event_del_header(esl_event_t *event, const char *header_name);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Destroy an event
|
\brief Destroy an event
|
||||||
\param event pointer to the pointer to event to destroy
|
\param event pointer to the pointer to event to destroy
|
||||||
*/
|
*/
|
||||||
void esl_event_destroy(esl_event_t **event);
|
ESL_DECLARE(void) esl_event_destroy(esl_event_t **event);
|
||||||
#define esl_event_safe_destroy(_event) if (_event) esl_event_destroy(_event)
|
#define esl_event_safe_destroy(_event) if (_event) esl_event_destroy(_event)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -220,14 +220,14 @@ void esl_event_destroy(esl_event_t **event);
|
|||||||
\param todup an event to duplicate
|
\param todup an event to duplicate
|
||||||
\return ESL_STATUS_SUCCESS if the event was duplicated
|
\return ESL_STATUS_SUCCESS if the event was duplicated
|
||||||
*/
|
*/
|
||||||
esl_status_t esl_event_dup(esl_event_t **event, esl_event_t *todup);
|
ESL_DECLARE(esl_status_t) esl_event_dup(esl_event_t **event, esl_event_t *todup);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Render the name of an event id enumeration
|
\brief Render the name of an event id enumeration
|
||||||
\param event the event id to render the name of
|
\param event the event id to render the name of
|
||||||
\return the rendered name
|
\return the rendered name
|
||||||
*/
|
*/
|
||||||
const char *esl_event_name(esl_event_types_t event);
|
ESL_DECLARE(const char *)esl_event_name(esl_event_types_t event);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief return the event id that matches a given event name
|
\brief return the event id that matches a given event name
|
||||||
@ -235,7 +235,7 @@ const char *esl_event_name(esl_event_types_t event);
|
|||||||
\param type the event id to return
|
\param type the event id to return
|
||||||
\return ESL_STATUS_SUCCESS if there was a match
|
\return ESL_STATUS_SUCCESS if there was a match
|
||||||
*/
|
*/
|
||||||
esl_status_t esl_name_event(const char *name, esl_event_types_t *type);
|
ESL_DECLARE(esl_status_t) esl_name_event(const char *name, esl_event_types_t *type);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Render a string representation of an event sutable for printing or network transport
|
\brief Render a string representation of an event sutable for printing or network transport
|
||||||
@ -245,7 +245,7 @@ esl_status_t esl_name_event(const char *name, esl_event_types_t *type);
|
|||||||
\return ESL_STATUS_SUCCESS if the operation was successful
|
\return ESL_STATUS_SUCCESS if the operation was successful
|
||||||
\note you must free the resulting string when you are finished with it
|
\note you must free the resulting string when you are finished with it
|
||||||
*/
|
*/
|
||||||
esl_status_t esl_event_serialize(esl_event_t *event, char **str, esl_bool_t encode);
|
ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, esl_bool_t encode);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Add a body to an event
|
\brief Add a body to an event
|
||||||
@ -254,7 +254,7 @@ esl_status_t esl_event_serialize(esl_event_t *event, char **str, esl_bool_t enco
|
|||||||
\return ESL_STATUS_SUCCESS if the body was added to the event
|
\return ESL_STATUS_SUCCESS if the body was added to the event
|
||||||
\note the body parameter can be shadowed by the esl_event_reserve_subclass_detailed function
|
\note the body parameter can be shadowed by the esl_event_reserve_subclass_detailed function
|
||||||
*/
|
*/
|
||||||
esl_status_t esl_event_add_body(esl_event_t *event, const char *fmt, ...);
|
ESL_DECLARE(esl_status_t) esl_event_add_body(esl_event_t *event, const char *fmt, ...);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Create a new event assuming it will not be custom event and therefore hiding the unused parameters
|
\brief Create a new event assuming it will not be custom event and therefore hiding the unused parameters
|
||||||
@ -264,7 +264,7 @@ esl_status_t esl_event_add_body(esl_event_t *event, const char *fmt, ...);
|
|||||||
*/
|
*/
|
||||||
#define esl_event_create(event, id) esl_event_create_subclass(event, id, ESL_EVENT_SUBCLASS_ANY)
|
#define esl_event_create(event, id) esl_event_create_subclass(event, id, ESL_EVENT_SUBCLASS_ANY)
|
||||||
|
|
||||||
const char *esl_priority_name(esl_priority_t priority);
|
ESL_DECLARE(const char *)esl_priority_name(esl_priority_t priority);
|
||||||
|
|
||||||
///\}
|
///\}
|
||||||
|
|
||||||
|
@ -27,14 +27,14 @@ typedef struct esl_mutex esl_mutex_t;
|
|||||||
typedef struct esl_thread esl_thread_t;
|
typedef struct esl_thread esl_thread_t;
|
||||||
typedef void *(*esl_thread_function_t) (esl_thread_t *, void *);
|
typedef void *(*esl_thread_function_t) (esl_thread_t *, void *);
|
||||||
|
|
||||||
esl_status_t esl_thread_create_detached(esl_thread_function_t func, void *data);
|
ESL_DECLARE(esl_status_t) esl_thread_create_detached(esl_thread_function_t func, void *data);
|
||||||
esl_status_t esl_thread_create_detached_ex(esl_thread_function_t func, void *data, size_t stack_size);
|
esl_status_t esl_thread_create_detached_ex(esl_thread_function_t func, void *data, size_t stack_size);
|
||||||
void esl_thread_override_default_stacksize(size_t size);
|
void esl_thread_override_default_stacksize(size_t size);
|
||||||
esl_status_t esl_mutex_create(esl_mutex_t **mutex);
|
ESL_DECLARE(esl_status_t) esl_mutex_create(esl_mutex_t **mutex);
|
||||||
esl_status_t esl_mutex_destroy(esl_mutex_t **mutex);
|
ESL_DECLARE(esl_status_t) esl_mutex_destroy(esl_mutex_t **mutex);
|
||||||
esl_status_t esl_mutex_lock(esl_mutex_t *mutex);
|
ESL_DECLARE(esl_status_t) esl_mutex_lock(esl_mutex_t *mutex);
|
||||||
esl_status_t esl_mutex_trylock(esl_mutex_t *mutex);
|
ESL_DECLARE(esl_status_t) esl_mutex_trylock(esl_mutex_t *mutex);
|
||||||
esl_status_t esl_mutex_unlock(esl_mutex_t *mutex);
|
ESL_DECLARE(esl_status_t) esl_mutex_unlock(esl_mutex_t *mutex);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user