mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 05:02:10 +00:00
hack to fix udp sockets
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3377 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
SWITCH_DECLARE(char *) switch_priority_name(switch_priority_t priority)
|
||||
{
|
||||
switch(priority) { /*lol*/
|
||||
@@ -50,6 +51,40 @@ SWITCH_DECLARE(char *) switch_priority_name(switch_priority_t priority)
|
||||
|
||||
static char RFC2833_CHARS[] = "0123456789*#ABCDF";
|
||||
|
||||
|
||||
|
||||
SWITCH_DECLARE(char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t *in)
|
||||
{
|
||||
uint8_t x, *i;
|
||||
char *p = buf;
|
||||
|
||||
|
||||
i = (uint8_t *) &in->sa.sin.sin_addr;
|
||||
|
||||
memset(buf, 0, len);
|
||||
for(x =0; x < 4; x++) {
|
||||
sprintf(p, "%u%s", i[x], x == 3 ? "" : ".");
|
||||
p = buf + strlen(buf);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(apr_status_t) switch_socket_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock,
|
||||
apr_int32_t flags, char *buf,
|
||||
apr_size_t *len)
|
||||
{
|
||||
apr_status_t r;
|
||||
|
||||
if ((r = apr_socket_recvfrom(from, sock, flags, buf, len)) == APR_SUCCESS) {
|
||||
from->port = ntohs(from->sa.sin.sin_port);
|
||||
//from->ipaddr_ptr = &(from->sa.sin.sin_addr);
|
||||
//from->ipaddr_ptr = inet_ntoa(from->sa.sin.sin_addr);
|
||||
}
|
||||
|
||||
return r;
|
||||
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(char) switch_rfc2833_to_char(int event)
|
||||
{
|
||||
if (event > -1 && event < (int32_t) sizeof(RFC2833_CHARS)) {
|
||||
|
||||
Reference in New Issue
Block a user