mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-15 19:40:06 +00:00
add a host lookup func
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14653 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
fc208bb0b9
commit
ca8dfda04a
@ -165,6 +165,9 @@ SWITCH_DECLARE(switch_status_t) switch_frame_free(switch_frame_t **frame);
|
|||||||
(switch_is_number(expr) && !atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE)
|
(switch_is_number(expr) && !atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE)
|
||||||
|
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_resolve_host(char *host, char *buf, size_t buflen);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief find local ip of the box
|
\brief find local ip of the box
|
||||||
\param buf the buffer to write the ip adress found into
|
\param buf the buffer to write the ip adress found into
|
||||||
|
@ -866,6 +866,25 @@ static int get_netmask(struct sockaddr_in *me, int *mask)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_resolve_host(char *host, char *buf, size_t buflen)
|
||||||
|
{
|
||||||
|
|
||||||
|
struct addrinfo *ai;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
if ((err = getaddrinfo(host, 0, 0, &ai))) {
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
get_addr(buf, buflen, ai->ai_addr, sizeof(*ai->ai_addr));
|
||||||
|
|
||||||
|
freeaddrinfo(ai);
|
||||||
|
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *mask, int family)
|
SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *mask, int family)
|
||||||
{
|
{
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user