Changeset 1584 for pjproject/trunk
- Timestamp:
- Nov 17, 2007 10:27:34 AM (17 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/aconfigure
r1502 r1584 5695 5695 cat >>confdefs.h <<\_ACEOF 5696 5696 #define PJ_HAS_NETINET_IP_H 1 5697 _ACEOF 5698 5699 fi 5700 5701 5702 if test "${ac_cv_header_net_if_h+set}" = set; then 5703 echo "$as_me:$LINENO: checking for net/if.h" >&5 5704 echo $ECHO_N "checking for net/if.h... $ECHO_C" >&6 5705 if test "${ac_cv_header_net_if_h+set}" = set; then 5706 echo $ECHO_N "(cached) $ECHO_C" >&6 5707 fi 5708 echo "$as_me:$LINENO: result: $ac_cv_header_net_if_h" >&5 5709 echo "${ECHO_T}$ac_cv_header_net_if_h" >&6 5710 else 5711 # Is the header compilable? 5712 echo "$as_me:$LINENO: checking net/if.h usability" >&5 5713 echo $ECHO_N "checking net/if.h usability... $ECHO_C" >&6 5714 cat >conftest.$ac_ext <<_ACEOF 5715 /* confdefs.h. */ 5716 _ACEOF 5717 cat confdefs.h >>conftest.$ac_ext 5718 cat >>conftest.$ac_ext <<_ACEOF 5719 /* end confdefs.h. */ 5720 $ac_includes_default 5721 #include <net/if.h> 5722 _ACEOF 5723 rm -f conftest.$ac_objext 5724 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 5725 (eval $ac_compile) 2>conftest.er1 5726 ac_status=$? 5727 grep -v '^ *+' conftest.er1 >conftest.err 5728 rm -f conftest.er1 5729 cat conftest.err >&5 5730 echo "$as_me:$LINENO: \$? = $ac_status" >&5 5731 (exit $ac_status); } && 5732 { ac_try='test -z "$ac_c_werror_flag" 5733 || test ! -s conftest.err' 5734 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 5735 (eval $ac_try) 2>&5 5736 ac_status=$? 5737 echo "$as_me:$LINENO: \$? = $ac_status" >&5 5738 (exit $ac_status); }; } && 5739 { ac_try='test -s conftest.$ac_objext' 5740 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 5741 (eval $ac_try) 2>&5 5742 ac_status=$? 5743 echo "$as_me:$LINENO: \$? = $ac_status" >&5 5744 (exit $ac_status); }; }; then 5745 ac_header_compiler=yes 5746 else 5747 echo "$as_me: failed program was:" >&5 5748 sed 's/^/| /' conftest.$ac_ext >&5 5749 5750 ac_header_compiler=no 5751 fi 5752 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext 5753 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 5754 echo "${ECHO_T}$ac_header_compiler" >&6 5755 5756 # Is the header present? 5757 echo "$as_me:$LINENO: checking net/if.h presence" >&5 5758 echo $ECHO_N "checking net/if.h presence... $ECHO_C" >&6 5759 cat >conftest.$ac_ext <<_ACEOF 5760 /* confdefs.h. */ 5761 _ACEOF 5762 cat confdefs.h >>conftest.$ac_ext 5763 cat >>conftest.$ac_ext <<_ACEOF 5764 /* end confdefs.h. */ 5765 #include <net/if.h> 5766 _ACEOF 5767 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 5768 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 5769 ac_status=$? 5770 grep -v '^ *+' conftest.er1 >conftest.err 5771 rm -f conftest.er1 5772 cat conftest.err >&5 5773 echo "$as_me:$LINENO: \$? = $ac_status" >&5 5774 (exit $ac_status); } >/dev/null; then 5775 if test -s conftest.err; then 5776 ac_cpp_err=$ac_c_preproc_warn_flag 5777 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag 5778 else 5779 ac_cpp_err= 5780 fi 5781 else 5782 ac_cpp_err=yes 5783 fi 5784 if test -z "$ac_cpp_err"; then 5785 ac_header_preproc=yes 5786 else 5787 echo "$as_me: failed program was:" >&5 5788 sed 's/^/| /' conftest.$ac_ext >&5 5789 5790 ac_header_preproc=no 5791 fi 5792 rm -f conftest.err conftest.$ac_ext 5793 echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 5794 echo "${ECHO_T}$ac_header_preproc" >&6 5795 5796 # So? What about this header? 5797 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in 5798 yes:no: ) 5799 { echo "$as_me:$LINENO: WARNING: net/if.h: accepted by the compiler, rejected by the preprocessor!" >&5 5800 echo "$as_me: WARNING: net/if.h: accepted by the compiler, rejected by the preprocessor!" >&2;} 5801 { echo "$as_me:$LINENO: WARNING: net/if.h: proceeding with the compiler's result" >&5 5802 echo "$as_me: WARNING: net/if.h: proceeding with the compiler's result" >&2;} 5803 ac_header_preproc=yes 5804 ;; 5805 no:yes:* ) 5806 { echo "$as_me:$LINENO: WARNING: net/if.h: present but cannot be compiled" >&5 5807 echo "$as_me: WARNING: net/if.h: present but cannot be compiled" >&2;} 5808 { echo "$as_me:$LINENO: WARNING: net/if.h: check for missing prerequisite headers?" >&5 5809 echo "$as_me: WARNING: net/if.h: check for missing prerequisite headers?" >&2;} 5810 { echo "$as_me:$LINENO: WARNING: net/if.h: see the Autoconf documentation" >&5 5811 echo "$as_me: WARNING: net/if.h: see the Autoconf documentation" >&2;} 5812 { echo "$as_me:$LINENO: WARNING: net/if.h: section \"Present But Cannot Be Compiled\"" >&5 5813 echo "$as_me: WARNING: net/if.h: section \"Present But Cannot Be Compiled\"" >&2;} 5814 { echo "$as_me:$LINENO: WARNING: net/if.h: proceeding with the preprocessor's result" >&5 5815 echo "$as_me: WARNING: net/if.h: proceeding with the preprocessor's result" >&2;} 5816 { echo "$as_me:$LINENO: WARNING: net/if.h: in the future, the compiler will take precedence" >&5 5817 echo "$as_me: WARNING: net/if.h: in the future, the compiler will take precedence" >&2;} 5818 ( 5819 cat <<\_ASBOX 5820 ## ------------------------------------ ## 5821 ## Report this to the pjproject lists. ## 5822 ## ------------------------------------ ## 5823 _ASBOX 5824 ) | 5825 sed "s/^/$as_me: WARNING: /" >&2 5826 ;; 5827 esac 5828 echo "$as_me:$LINENO: checking for net/if.h" >&5 5829 echo $ECHO_N "checking for net/if.h... $ECHO_C" >&6 5830 if test "${ac_cv_header_net_if_h+set}" = set; then 5831 echo $ECHO_N "(cached) $ECHO_C" >&6 5832 else 5833 ac_cv_header_net_if_h=$ac_header_preproc 5834 fi 5835 echo "$as_me:$LINENO: result: $ac_cv_header_net_if_h" >&5 5836 echo "${ECHO_T}$ac_cv_header_net_if_h" >&6 5837 5838 fi 5839 if test $ac_cv_header_net_if_h = yes; then 5840 cat >>confdefs.h <<\_ACEOF 5841 #define PJ_HAS_NET_IF_H 1 5697 5842 _ACEOF 5698 5843 -
pjproject/trunk/aconfigure.ac
r1502 r1584 144 144 AC_CHECK_HEADER(netinet/in.h,[AC_DEFINE(PJ_HAS_NETINET_IN_H,1)]) 145 145 AC_CHECK_HEADER(netinet/ip.h,[AC_DEFINE(PJ_HAS_NETINET_IP_H,1)]) 146 AC_CHECK_HEADER(net/if.h,[AC_DEFINE(PJ_HAS_NET_IF_H,1)]) 146 147 AC_CHECK_HEADER(setjmp.h,[AC_DEFINE(PJ_HAS_SETJMP_H,1)]) 147 148 AC_CHECK_HEADER(stdarg.h,[AC_DEFINE(PJ_HAS_STDARG_H,1)]) -
pjproject/trunk/pjlib/include/pj/compat/os_auto.h.in
r920 r1584 52 52 #undef PJ_HAS_NETINET_IN_H 53 53 #undef PJ_HAS_NETINET_IP_H 54 #undef PJ_HAS_NET_IF_H 54 55 #undef PJ_HAS_SETJMP_H 55 56 #undef PJ_HAS_STDARG_H -
pjproject/trunk/pjlib/include/pj/compat/socket.h
r1235 r1584 56 56 /* To pull in IPTOS_* constants */ 57 57 # include <netinet/ip.h> 58 #endif 59 60 #if defined(PJ_HAS_NET_IF_H) && PJ_HAS_NET_IF_H != 0 61 /* For interface enumeration in ip_helper */ 62 # include <net/if.h> 58 63 #endif 59 64 -
pjproject/trunk/pjlib/src/pj/ip_helper_generic.c
r1104 r1584 22 22 #include <pj/errno.h> 23 23 #include <pj/string.h> 24 #include <pj/compat/socket.h> 24 25 25 /* 26 * Enumerate the local IP interface currently active in the host. 27 */ 28 PJ_DEF(pj_status_t) pj_enum_ip_interface(unsigned *p_cnt, 29 pj_in_addr ifs[]) 26 static pj_status_t dummy_enum_ip_interface(unsigned *p_cnt, 27 pj_in_addr ifs[]) 30 28 { 31 29 pj_status_t status; … … 42 40 *p_cnt = 1; 43 41 return PJ_SUCCESS; 42 } 43 44 #ifdef SIOCGIFCONF 45 static pj_status_t sock_enum_ip_interface(unsigned *p_cnt, 46 pj_in_addr ifs[]) 47 { 48 pj_sock_t sock; 49 char buf[512]; 50 struct ifconf ifc; 51 struct ifreq *ifr; 52 int i, count; 53 pj_status_t status; 54 55 status = pj_sock_socket(PJ_AF_INET, PJ_SOCK_DGRAM, 0, &sock); 56 if (status != PJ_SUCCESS) 57 return status; 58 59 /* Query available interfaces */ 60 ifc.ifc_len = sizeof(buf); 61 ifc.ifc_buf = buf; 62 63 if (ioctl(sock, SIOCGIFCONF, &ifc) < 0) { 64 int oserr = pj_get_netos_error(); 65 pj_sock_close(sock); 66 return PJ_RETURN_OS_ERROR(oserr); 67 } 68 69 /* Done with socket */ 70 pj_sock_close(sock); 71 72 /* Interface interfaces */ 73 ifr = (struct ifreq*) ifc.ifc_req; 74 count = ifc.ifc_len / sizeof(struct ifreq); 75 if (count > *p_cnt) 76 count = *p_cnt; 77 else 78 *p_cnt = count; 79 for (i=0; i<count; ++i) { 80 struct ifreq *itf = &ifr[i]; 81 ifs[i].s_addr = ((struct sockaddr_in *)&itf->ifr_addr)->sin_addr.s_addr; 82 } 83 84 return PJ_SUCCESS; 85 } 86 #endif /* SIOCGIFCONF */ 87 88 /* 89 * Enumerate the local IP interface currently active in the host. 90 */ 91 PJ_DEF(pj_status_t) pj_enum_ip_interface(unsigned *p_cnt, 92 pj_in_addr ifs[]) 93 { 94 #ifdef SIOCGIFCONF 95 if (sock_enum_ip_interface(p_cnt, ifs) == PJ_SUCCESS) 96 return PJ_SUCCESS; 97 #endif 98 return dummy_enum_ip_interface(p_cnt, ifs); 44 99 } 45 100
Note: See TracChangeset
for help on using the changeset viewer.