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:
Michael Jerris committed 2008-12-22 17:59:14 +00:00
1 parent 6f2677a53d
commit 63250c91b4
9 files changed
+100 -87

No files matched your search

+32 -21
View File
@@ -34,10 +34,7 @@
#ifndef _ESL_H_
#define _ESL_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_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 esl_event_t;
#define ESL_SEQ_ESC "\033["
/* Ansi Control character suffixes */
#define ESL_SEQ_HOME_CHAR 'H'
@@ -196,7 +192,23 @@ typedef intptr_t esl_ssize_t;
typedef int esl_filehandle_t;
#define ESL_SOCK_INVALID INVALID_SOCKET
#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
#define ESL_DECLARE(type) type
#define ESL_DECLARE_NONSTD(type) type
#define ESL_DECLARE_DATA
#include <stdint.h>
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -218,7 +230,6 @@ typedef enum {
ESL_BREAK
} esl_status_t;
#include <esl_threadmutex.h>
typedef struct {
@@ -279,27 +290,27 @@ void esl_global_set_default_logger(int level);
#include "esl_threadmutex.h"
#include "esl_config.h"
size_t esl_url_encode(const char *url, char *buf, size_t len);
char *esl_url_decode(char *s);
const char *esl_stristr(const char *instr, const char *str);
int esl_toupper(int c);
int esl_tolower(int c);
int esl_snprintf(char *buffer, size_t count, const char *fmt, ...);
ESL_DECLARE(size_t) esl_url_encode(const char *url, char *buf, size_t len);
ESL_DECLARE(char *)esl_url_decode(char *s);
ESL_DECLARE(const char *)esl_stristr(const char *instr, const char *str);
ESL_DECLARE(int) esl_toupper(int c);
ESL_DECLARE(int) esl_tolower(int c);
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);
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_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_attach_handle(esl_handle_t *handle, esl_socket_t socket, struct sockaddr_in addr);
ESL_DECLARE(esl_status_t) esl_listen(const char *host, esl_port_t port, esl_listen_callback_t callback);
ESL_DECLARE(esl_status_t) esl_execute(esl_handle_t *handle, const char *app, const char *arg, const char *uuid);
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_status_t esl_disconnect(esl_handle_t *handle);
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_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_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *password);
ESL_DECLARE(esl_status_t) esl_disconnect(esl_handle_t *handle);
ESL_DECLARE(esl_status_t) esl_send(esl_handle_t *handle, const char *cmd);
ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, 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_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_timed(_h, _ms) esl_recv_event_timed(_h, _ms, NULL)
+4 -4
View File
@@ -100,13 +100,13 @@ struct esl_config {
\param file_path path to the file
\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
\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
@@ -114,14 +114,14 @@ void esl_config_close_file(esl_config_t * cfg);
\param var pointer to aim at the new variable name
\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
\param strvalue pointer to the configuration string value (expected to be in format whatever:xxxx)
\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);
/** @} */
+14 -14
View File
@@ -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)
\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
@@ -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
\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
@@ -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
\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
\param event the event to read the body from
\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
@@ -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)
\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);
/*!
@@ -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
\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
\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)
/*!
@@ -220,14 +220,14 @@ void esl_event_destroy(esl_event_t **event);
\param todup an event to duplicate
\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
\param event the event id to render the name of
\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
@@ -235,7 +235,7 @@ const char *esl_event_name(esl_event_types_t event);
\param type the event id to return
\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
@@ -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
\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
@@ -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
\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
@@ -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)
const char *esl_priority_name(esl_priority_t priority);
ESL_DECLARE(const char *)esl_priority_name(esl_priority_t priority);
///\}
+6 -6
View File
@@ -27,14 +27,14 @@ typedef struct esl_mutex esl_mutex_t;
typedef struct esl_thread esl_thread_t;
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);
void esl_thread_override_default_stacksize(size_t size);
esl_status_t esl_mutex_create(esl_mutex_t **mutex);
esl_status_t esl_mutex_destroy(esl_mutex_t **mutex);
esl_status_t esl_mutex_lock(esl_mutex_t *mutex);
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_create(esl_mutex_t **mutex);
ESL_DECLARE(esl_status_t) esl_mutex_destroy(esl_mutex_t **mutex);
ESL_DECLARE(esl_status_t) esl_mutex_lock(esl_mutex_t *mutex);
ESL_DECLARE(esl_status_t) esl_mutex_trylock(esl_mutex_t *mutex);
ESL_DECLARE(esl_status_t) esl_mutex_unlock(esl_mutex_t *mutex);
#endif