Fixed compilation errors/warnings on Linux with the recent IPv6 commits
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1611 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
parent
d0bd498ec6
commit
7ebdb3e3ba
|
@ -67,7 +67,6 @@
|
|||
# include <tpipv6.h>
|
||||
# endif
|
||||
|
||||
# undef s_addr
|
||||
# define PJ_SOCK_HAS_GETADDRINFO 1
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
|
@ -146,9 +145,10 @@
|
|||
|
||||
|
||||
/*
|
||||
* And undefine this..
|
||||
* And undefine these..
|
||||
*/
|
||||
#undef s_addr
|
||||
#undef s6_addr
|
||||
|
||||
/*
|
||||
* Linux kernel specifics
|
||||
|
|
|
@ -82,7 +82,7 @@ static pj_status_t sock_enum_ip_interface(int af,
|
|||
*p_cnt = count;
|
||||
for (i=0; i<count; ++i) {
|
||||
struct ifreq *itf = &ifr[i];
|
||||
struct sockaddr *ad = itf->ifr_addr;
|
||||
struct sockaddr *ad = &itf->ifr_addr;
|
||||
|
||||
ifs[i].addr.sa_family = ad->sa_family;
|
||||
pj_memcpy(pj_sockaddr_get_addr(&ifs[i]),
|
||||
|
|
|
@ -231,7 +231,7 @@ static int worker_thread(void *unused)
|
|||
|
||||
static int init()
|
||||
{
|
||||
pj_sockaddr_in addr;
|
||||
pj_sockaddr addr;
|
||||
pj_stun_session_cb stun_cb;
|
||||
int len;
|
||||
pj_status_t status;
|
||||
|
@ -282,10 +282,10 @@ static int init()
|
|||
status = pj_sock_socket(pj_AF_INET(), pj_SOCK_DGRAM(), 0, &g.sock);
|
||||
pj_assert(status == PJ_SUCCESS);
|
||||
|
||||
status = pj_sockaddr_in_init(&addr, NULL, 0);
|
||||
status = pj_sockaddr_in_init(&addr.ipv4, NULL, 0);
|
||||
pj_assert(status == PJ_SUCCESS);
|
||||
|
||||
addr.sin_port = pj_htons((pj_uint16_t)LOCAL_PORT);
|
||||
addr.ipv4.sin_port = pj_htons((pj_uint16_t)LOCAL_PORT);
|
||||
status = pj_sock_bind(g.sock, &addr, sizeof(addr));
|
||||
pj_assert(status == PJ_SUCCESS);
|
||||
|
||||
|
@ -293,12 +293,12 @@ static int init()
|
|||
status = pj_sock_getsockname(g.sock, &addr, &len);
|
||||
pj_assert(status == PJ_SUCCESS);
|
||||
|
||||
PJ_LOG(3,(THIS_FILE, "Listening on port %d", (int)pj_ntohs(addr.sin_port)));
|
||||
PJ_LOG(3,(THIS_FILE, "Listening on port %d", (int)pj_ntohs(addr.ipv4.sin_port)));
|
||||
|
||||
len = sizeof(g.peer_addr);
|
||||
status = pj_sock_getsockname(g.peer_sock, &g.peer_addr, &len);
|
||||
if (g.peer_addr.sin_addr.s_addr == 0)
|
||||
pj_gethostip(&g.peer_addr.sin_addr);
|
||||
pj_gethostip(pj_AF_INET(), (pj_sockaddr*)&g.peer_addr.sin_addr);
|
||||
|
||||
PJ_LOG(3,(THIS_FILE, "Peer is on port %d", (int)pj_ntohs(g.peer_addr.sin_port)));
|
||||
|
||||
|
@ -549,7 +549,7 @@ static pj_status_t parse_addr(const char *input,
|
|||
const char *pos;
|
||||
pj_str_t ip;
|
||||
pj_uint16_t port;
|
||||
pj_sockaddr_in tmp_addr;
|
||||
pj_sockaddr tmp_addr;
|
||||
|
||||
pos = pj_ansi_strchr(input, ':');
|
||||
if (pos==NULL) {
|
||||
|
@ -566,12 +566,12 @@ static pj_status_t parse_addr(const char *input,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (pj_sockaddr_in_init(&tmp_addr, &ip, port)!=PJ_SUCCESS) {
|
||||
if (pj_sockaddr_in_init(&tmp_addr.ipv4, &ip, port)!=PJ_SUCCESS) {
|
||||
puts("Invalid address");
|
||||
return -1;
|
||||
}
|
||||
|
||||
pj_memcpy(addr, &tmp_addr, sizeof(tmp_addr));
|
||||
pj_memcpy(addr, &tmp_addr, sizeof(pj_sockaddr_in));
|
||||
|
||||
return PJ_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -769,7 +769,7 @@ static pj_status_t client_create_relay(struct turn_client *client)
|
|||
}
|
||||
|
||||
if (client->alloc_addr.sin_addr.s_addr == 0) {
|
||||
status = pj_gethostip(&client->alloc_addr.sin_addr);
|
||||
status = pj_gethostip(pj_AF_INET(), (pj_sockaddr*)&client->alloc_addr.sin_addr);
|
||||
if (status != PJ_SUCCESS) {
|
||||
pj_sock_close(client->sock);
|
||||
client->sock = PJ_INVALID_SOCKET;
|
||||
|
|
|
@ -38,6 +38,15 @@
|
|||
|
||||
#if 0
|
||||
# define TRACE_(x) PJ_LOG(5,x)
|
||||
|
||||
static const char *addr_string(const pj_sockaddr_t *addr)
|
||||
{
|
||||
static char str[PJ_INET6_ADDRSTRLEN];
|
||||
pj_inet_ntop(((const pj_sockaddr*)addr)->addr.sa_family,
|
||||
pj_sockaddr_get_addr(addr),
|
||||
str, sizeof(str));
|
||||
return str;
|
||||
}
|
||||
#else
|
||||
# define TRACE_(x)
|
||||
#endif
|
||||
|
@ -178,18 +187,6 @@ struct transport_names_t *get_tpname(pjsip_transport_type_e type)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Tools to get address string.
|
||||
*/
|
||||
static const char *addr_string(const pj_sockaddr_t *addr)
|
||||
{
|
||||
static char str[PJ_INET6_ADDRSTRLEN];
|
||||
pj_inet_ntop(((const pj_sockaddr*)addr)->addr.sa_family,
|
||||
pj_sockaddr_get_addr(addr),
|
||||
str, sizeof(str));
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Register new transport type to PJSIP.
|
||||
|
|
|
@ -991,13 +991,13 @@ PJ_DEF(pj_status_t) pjsip_tls_transport_start( pjsip_endpoint *endpt,
|
|||
* interface address as the transport's address.
|
||||
*/
|
||||
if (listener_addr->sin_addr.s_addr == 0) {
|
||||
pj_in_addr hostip;
|
||||
pj_sockaddr hostip;
|
||||
|
||||
status = pj_gethostip(&hostip);
|
||||
status = pj_gethostip(pj_AF_INET(), &hostip);
|
||||
if (status != PJ_SUCCESS)
|
||||
goto on_error;
|
||||
|
||||
listener_addr->sin_addr = hostip;
|
||||
listener_addr->sin_addr = hostip.ipv4.sin_addr;
|
||||
}
|
||||
|
||||
/* Save the address name */
|
||||
|
|
Loading…
Reference in New Issue