mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-15 22:08:33 +00:00
add wrapper code to fully encapsulate apr, apr-utils, pcre, and sqlite. fully use switch_ namespace in modules, create our own format and type defines. follow up commit for unix autotools coming soon after this. PLEASE NOTE: you will NEED to do a make megaclean and run configure again after this update (and the following commit) or it will not build.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4494 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
2d78da120a
commit
42e78242a3
46 files changed
+4026
-2066
No files matched your search
@@ -65,7 +65,7 @@ enum switch_mod_cdr_sql_types_t { CDR_INTEGER,CDR_STRING,CDR_DECIMAL,CDR_DOUBLE,
|
||||
#define STDCALL
|
||||
#endif
|
||||
|
||||
typedef apr_status_t (STDCALL *modcdr_time_convert_t)(apr_time_exp_t*,apr_time_t);
|
||||
typedef switch_status_t (STDCALL *modcdr_time_convert_t)(switch_time_exp_t*,switch_time_t);
|
||||
|
||||
class BaseCDR {
|
||||
public:
|
||||
|
||||
@@ -67,7 +67,7 @@ CsvCDR::CsvCDR(switch_mod_cdr_newchannel_t *newchannel) : BaseCDR(newchannel)
|
||||
convert_time(&tempcallend, callenddate);
|
||||
|
||||
// Format the times
|
||||
apr_size_t retsizecsd, retsizecad, retsizectd, retsizeced; //csd == callstartdate, cad == callanswerdate, ced == callenddate, ceff == callenddate_forfile
|
||||
switch_size_t retsizecsd, retsizecad, retsizectd, retsizeced; //csd == callstartdate, cad == callanswerdate, ced == callenddate, ceff == callenddate_forfile
|
||||
char format[] = "%Y-%m-%d %H:%M:%S";
|
||||
switch_strftime(formattedcallstartdate,&retsizecsd,sizeof(formattedcallstartdate),format,&tempcallstart);
|
||||
switch_strftime(formattedcallanswerdate,&retsizecad,sizeof(formattedcallanswerdate),format,&tempcallanswer);
|
||||
@@ -213,7 +213,7 @@ void CsvCDR::open_file()
|
||||
|
||||
switch_time_exp_lt(&now_converted,now);
|
||||
|
||||
apr_size_t retsize;
|
||||
switch_size_t retsize;
|
||||
char format[] = "%Y-%m-%d-%H-%M-%S";
|
||||
char formatteddate[100];
|
||||
memset(formatteddate,0,100);
|
||||
|
||||
@@ -65,10 +65,10 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_bindings, globals.bindings)
|
||||
char *next, *cur;
|
||||
uint32_t count = 0;
|
||||
uint8_t custom = 0;
|
||||
apr_ssize_t hlen = APR_HASH_KEY_STRING;
|
||||
switch_ssize_t hlen = SWITCH_HASH_KEY_STRING;
|
||||
|
||||
gethostname(globals.hostname, sizeof(globals.hostname));
|
||||
globals.host_hash = apr_hashfunc_default(globals.hostname, &hlen);
|
||||
globals.host_hash = switch_hashfunc_default(globals.hostname, &hlen);
|
||||
globals.key_count = 0;
|
||||
|
||||
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
|
||||
@@ -256,7 +256,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
|
||||
{
|
||||
int x = 0;
|
||||
|
||||
switch_socket_shutdown(globals.udp_socket, APR_SHUTDOWN_READWRITE);
|
||||
switch_socket_shutdown(globals.udp_socket, SWITCH_SHUTDOWN_READWRITE);
|
||||
globals.running = -1;
|
||||
while(x < 100000 && globals.running) {
|
||||
x++;
|
||||
|
||||
@@ -194,7 +194,7 @@ static void socket_function(switch_core_session_t *session, char *data)
|
||||
return;
|
||||
}
|
||||
|
||||
if (switch_socket_create(&new_sock, AF_INET, SOCK_STREAM, APR_PROTO_TCP, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_socket_create(&new_sock, AF_INET, SOCK_STREAM, SWITCH_PROTO_TCP, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error!\n");
|
||||
return;
|
||||
}
|
||||
@@ -271,7 +271,7 @@ static switch_loadable_module_interface_t event_socket_module_interface = {
|
||||
static void close_socket(switch_socket_t **sock) {
|
||||
switch_mutex_lock(listen_list.sock_mutex);
|
||||
if (*sock) {
|
||||
apr_socket_shutdown(*sock, APR_SHUTDOWN_READWRITE);
|
||||
switch_socket_shutdown(*sock, SWITCH_SHUTDOWN_READWRITE);
|
||||
switch_socket_close(*sock);
|
||||
*sock = NULL;
|
||||
}
|
||||
@@ -449,7 +449,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
|
||||
|
||||
|
||||
if (data) {
|
||||
snprintf(buf, sizeof(buf), "Content-Type: log/data\nContent-Length: %"APR_SSIZE_T_FMT"\n\n", strlen(data));
|
||||
snprintf(buf, sizeof(buf), "Content-Type: log/data\nContent-Length: %"SWITCH_SSIZE_T_FMT"\n\n", strlen(data));
|
||||
len = strlen(buf);
|
||||
switch_socket_send(listener->sock, buf, &len);
|
||||
len = strlen(data);
|
||||
@@ -486,7 +486,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
|
||||
|
||||
len = strlen(listener->ebuf);
|
||||
|
||||
snprintf(hbuf, sizeof(hbuf), "Content-Length: %"APR_SSIZE_T_FMT"\n"
|
||||
snprintf(hbuf, sizeof(hbuf), "Content-Length: %"SWITCH_SSIZE_T_FMT"\n"
|
||||
"Content-Type: text/event-%s\n"
|
||||
"\n", len, etype);
|
||||
|
||||
@@ -558,7 +558,7 @@ static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t *thread, void *obj)
|
||||
switch_size_t rlen, blen;
|
||||
char buf[1024] = "";
|
||||
rlen = strlen(reply);
|
||||
snprintf(buf, sizeof(buf), "Content-Type: api/response\nContent-Length: %"APR_SSIZE_T_FMT"\n\n", rlen);
|
||||
snprintf(buf, sizeof(buf), "Content-Type: api/response\nContent-Length: %"SWITCH_SSIZE_T_FMT"\n\n", rlen);
|
||||
blen = strlen(buf);
|
||||
switch_socket_send(acs->listener->sock, buf, &blen);
|
||||
switch_socket_send(acs->listener->sock, reply, &rlen);
|
||||
@@ -1006,7 +1006,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open\n");
|
||||
|
||||
switch_socket_opt_set(listener->sock, APR_SO_NONBLOCK, TRUE);
|
||||
switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, TRUE);
|
||||
switch_set_flag_locked(listener, LFLAG_RUNNING);
|
||||
add_listener(listener);
|
||||
|
||||
@@ -1210,9 +1210,9 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
|
||||
|
||||
|
||||
for(;;) {
|
||||
rv = switch_sockaddr_info_get(&sa, prefs.ip, APR_INET, prefs.port, 0, pool);
|
||||
rv = switch_sockaddr_info_get(&sa, prefs.ip, SWITCH_INET, prefs.port, 0, pool);
|
||||
if (rv) goto fail;
|
||||
rv = switch_socket_create(&listen_list.sock, sa->family, SOCK_STREAM, APR_PROTO_TCP, pool);
|
||||
rv = switch_socket_create(&listen_list.sock, switch_sockaddr_get_family(sa), SOCK_STREAM, SWITCH_PROTO_TCP, pool);
|
||||
if (rv) goto sock_fail;
|
||||
rv = switch_socket_opt_set(listen_list.sock, SWITCH_SO_REUSEADDR, 1);
|
||||
if (rv) goto sock_fail;
|
||||
|
||||
Reference in new issue
Block a user