Changeset 1450 for pjproject/trunk/pjlib/src/pj/ip_helper_win32.c
- Timestamp:
- Sep 24, 2007 7:46:41 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/ip_helper_win32.c
r1419 r1450 35 35 #include <pj/string.h> 36 36 37 #ifndef PJ_IP_HELPER_IGNORE_LOOPBACK_IF 38 # define PJ_IP_HELPER_IGNORE_LOOPBACK_IF 1 39 #endif 40 37 41 typedef DWORD (WINAPI *PFN_GetIpAddrTable)(PMIB_IPADDRTABLE pIpAddrTable, 38 42 PULONG pdwSize, … … 41 45 PULONG pdwSize, 42 46 BOOL bOrder); 47 typedef DWORD (WINAPI *PFN_GetIfEntry)(PMIB_IFROW pIfRow); 43 48 44 49 static HANDLE s_hDLL; 45 50 static PFN_GetIpAddrTable s_pfnGetIpAddrTable; 46 51 static PFN_GetIpForwardTable s_pfnGetIpForwardTable; 52 static PFN_GetIfEntry s_pfnGetIfEntry; 47 53 48 54 static void unload_iphlp_module(void) … … 84 90 return ERROR_NOT_SUPPORTED; 85 91 } 92 93 94 #if PJ_IP_HELPER_IGNORE_LOOPBACK_IF 95 static DWORD MyGetIfEntry(MIB_IFROW *pIfRow) 96 { 97 if(NULL == s_pfnGetIfEntry) { 98 s_pfnGetIfEntry = (PFN_GetIfEntry) 99 GetIpHlpApiProc(PJ_T("GetIfEntry")); 100 } 101 102 if(NULL != s_pfnGetIfEntry) { 103 return s_pfnGetIfEntry(pIfRow); 104 } 105 106 return ERROR_NOT_SUPPORTED; 107 } 108 #endif 86 109 87 110 … … 135 158 *p_cnt = 0; 136 159 for (i=0; i<count; ++i) { 160 MIB_IFROW ifRow; 161 137 162 /* Some Windows returns 0.0.0.0! */ 138 163 if (pTab->table[i].dwAddr == 0) 139 164 continue; 165 166 #if PJ_IP_HELPER_IGNORE_LOOPBACK_IF 167 /* Investigate the type of this interface */ 168 pj_bzero(&ifRow, sizeof(ifRow)); 169 ifRow.dwIndex = pTab->table[i].dwIndex; 170 if (MyGetIfEntry(&ifRow) != 0) 171 continue; 172 173 if (ifRow.dwType == MIB_IF_TYPE_LOOPBACK) 174 continue; 175 #endif 176 140 177 ifs[*p_cnt].s_addr = pTab->table[i].dwAddr; 141 178 (*p_cnt)++;
Note: See TracChangeset
for help on using the changeset viewer.