[asterisk-commits] tzafrir: branch tzafrir/monitor-rtp r217528 - /team/tzafrir/monitor-rtp/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 9 17:17:55 CDT 2009


Author: tzafrir
Date: Wed Sep  9 17:17:53 2009
New Revision: 217528

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=217528
Log:
Use the Asterisk Way to get_ipaddr.

Modified:
    team/tzafrir/monitor-rtp/res/res_monitor.c

Modified: team/tzafrir/monitor-rtp/res/res_monitor.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tzafrir/monitor-rtp/res/res_monitor.c?view=diff&rev=217528&r1=217527&r2=217528
==============================================================================
--- team/tzafrir/monitor-rtp/res/res_monitor.c (original)
+++ team/tzafrir/monitor-rtp/res/res_monitor.c Wed Sep  9 17:17:53 2009
@@ -44,6 +44,7 @@
 #include "asterisk/utils.h"
 #include "asterisk/config.h"
 #include "asterisk/options.h"
+#include "asterisk/acl.h"
 
 /*** DOCUMENTATION
 	<application name="Monitor" language="en_US">
@@ -288,24 +289,13 @@
 	return 0;
 }
 
-static int get_ipaddr(const char *str, struct in_addr *addr)
-{
-	struct ast_hostent he;
-
-	if (!ast_gethostbyname(str, &he)) {
-		ast_log(LOG_NOTICE, "Failed to resolve hostname '%s'\n", str);
-		return 0;
-	}
-	memcpy(&(addr->s_addr), he.hp.h_addr, sizeof(addr->s_addr));
-	return 1;
-}
-
 static int udp_stream(const char *server, in_port_t port, struct sockaddr_in *saddr)
 {
 	int sock;
 
-	if (!get_ipaddr(server, &(saddr->sin_addr)))
+	if (!ast_get_ip(saddr, server)) {
 		return -EINVAL;
+	}
 	ast_log(LOG_NOTICE, "%s: %s:%d\n", __FUNCTION__, server, port);
 	saddr->sin_family = AF_INET;
 	saddr->sin_port = htons(port);
@@ -418,7 +408,7 @@
 		}
 	}
 #endif /* ifdef RTP_MONITOR_DEBUG */
-	if (!get_ipaddr(reporting_host, &(my_addr.sin_addr))) {
+	if (!ast_get_ip(&(my_addr), reporting_host)) {
 		ast_log(LOG_WARNING, "Bad reporting_host: '%s'\n", reporting_host);
 		return -1;
 	}




More information about the asterisk-commits mailing list