[asterisk-commits] russell: trunk r254884 - in /trunk/addons/ooh323c/src: ooSocket.c ooSocket.h

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 25 16:39:07 CDT 2010


Author: russell
Date: Thu Mar 25 16:39:04 2010
New Revision: 254884

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=254884
Log:
Fix a number of other build problems on Mac OS X.

Modified:
    trunk/addons/ooh323c/src/ooSocket.c
    trunk/addons/ooh323c/src/ooSocket.h

Modified: trunk/addons/ooh323c/src/ooSocket.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooSocket.c?view=diff&rev=254884&r1=254883&r2=254884
==============================================================================
--- trunk/addons/ooh323c/src/ooSocket.c (original)
+++ trunk/addons/ooh323c/src/ooSocket.c Thu Mar 25 16:39:04 2010
@@ -13,9 +13,14 @@
  * maintain this copyright notice.
  *
  *****************************************************************************/
-#include <asterisk.h>
-#include <asterisk/lock.h>
-#include <asterisk/network.h>
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/io.h"
+#include "asterisk/lock.h"
+#include "asterisk/utils.h"
+#include "asterisk/network.h"
 
 #include "ooSocket.h"
 #include "ootrace.h"
@@ -474,7 +479,7 @@
 
 int ooSocketPoll(struct pollfd *pfds, int nfds, int timeout)
 {
- return poll(pfds, nfds, timeout);
+ return ast_poll(pfds, nfds, timeout);
 }
 
 int ooPDRead(struct pollfd *pfds, int nfds, int fd)
@@ -498,25 +503,19 @@
 int ooGetLocalIPAddress(char * pIPAddrs)
 {
    int ret;
-   struct hostent phost;
-   struct hostent* reshost;
-   int h_errnop;
-   struct in_addr addr;
+   struct hostent *hp;
+   struct ast_hostent phost;
    char hostname[100];
-   char buf[2048];
 
    if(pIPAddrs == NULL)
       return -1; /* Need to find suitable return value */
    ret = gethostname(hostname, 100);
    if(ret == 0)
    {
-      if (!gethostbyname_r(hostname,
-         &phost, buf, sizeof(buf),
-         &reshost, &h_errnop)) {
-      if(reshost == NULL)
-         return -1; /* Need to define a return value if made part of rtsrc */
-      memcpy(&addr, &phost.h_addr_list[0], sizeof(struct in_addr));
-      strcpy(pIPAddrs, (ast_inet_ntoa(addr) == NULL) ? "127.0.0.1" : ast_inet_ntoa(addr));
+      if (!(hp = ast_gethostbyname(hostname, &phost))) {
+	  		struct in_addr i;
+			memcpy(&i, hp->h_addr, sizeof(i));
+			  strcpy(pIPAddrs, (ast_inet_ntoa(i) == NULL) ? "127.0.0.1" : ast_inet_ntoa(i));
       } else {
          return -1;
       }
@@ -645,7 +644,10 @@
       int flags;
       for (ifName = ifc.ifc_req; (void*)ifName < ifEndList; ifName++) {
          char *pName=NULL;
-         char addr[50], mask[50];
+         char addr[50];
+#ifdef ifr_netmask
+	char mask[50];
+#endif
          
          pIf = (struct OOInterface*)memAlloc(pctxt, sizeof(struct OOInterface));
          pName = (char*)memAlloc(pctxt, strlen(ifName->ifr_name)+1);

Modified: trunk/addons/ooh323c/src/ooSocket.h
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooSocket.h?view=diff&rev=254884&r1=254883&r2=254884
==============================================================================
--- trunk/addons/ooh323c/src/ooSocket.h (original)
+++ trunk/addons/ooh323c/src/ooSocket.h Thu Mar 25 16:39:04 2010
@@ -21,6 +21,8 @@
  */
 #ifndef _OOSOCKET_H_
 #define _OOSOCKET_H_
+
+#include "asterisk/poll-compat.h"
 
 #ifdef _WIN32_WCE
 #include <winsock.h>




More information about the asterisk-commits mailing list