reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
WinCompat.hxx
Go to the documentation of this file.
1#if !defined(resip_WinCompat_hxx)
2#define resip_WinCompat_hxx
3
4#if defined(WIN32)
5#include <Iphlpapi.h>
6#include <list>
7
9#include "rutil/Mutex.hxx"
11
12namespace resip
13{
14
19class WinCompat
20{
21 public:
22 enum Version
23 {
24 NotWindows,
25 // Legacy (Win9x - no longer supported, retained for compatibility)
26 Windows95,
27 Windows98,
28 Windows98SE,
29 WindowsME,
30 // NT family
31 WindowsNT,
32 Windows2000,
33 WindowsXP,
34 Windows2003Server,
35 WindowsVista,
36 WindowsServer2008,
37 Windows7,
38 WindowsServer2008R2,
39 Windows8,
40 WindowsServer2012,
41 Windows81,
42 WindowsServer2012R2,
43 Windows10,
44 WindowsServer2016,
45 WindowsServer2019,
46 WindowsServer2022,
47 Windows11,
48 WindowsUnknown
49 };
50
51 static Version getVersion();
52
53 class Exception final : public BaseException
54 {
55 public:
56 Exception(const Data& msg, const Data& file, int line);
57 const char* name() const noexcept override { return "TransportException"; }
58 };
59
60 static GenericIPAddress determineSourceInterface(const GenericIPAddress& destination);
61 static std::list<std::pair<Data,Data> > getInterfaces(const Data& matching);
62 static void destroyInstance();
63
64 static bool windowsEventLog(WORD type, WORD numStrings, LPCTSTR* strings);
65
66 private:
67 static WinCompat* instance();
68 static WinCompat* mInstance;
69
70 static GenericIPAddress determineSourceInterfaceWithIPv6(const GenericIPAddress& destination);
71 static GenericIPAddress determineSourceInterfaceWithoutIPv6(const GenericIPAddress& destination);
72 typedef DWORD (WINAPI * GetBestInterfaceExProc)(const sockaddr *, DWORD *);
73 typedef DWORD (WINAPI * GetAdaptersAddressesProc)(ULONG, DWORD, VOID *, IP_ADAPTER_ADDRESSES *, ULONG *);
74 typedef DWORD (WINAPI * GetAdaptersInfoProc)(PIP_ADAPTER_INFO, PULONG);
75 typedef DWORD (WINAPI * GetBestRouteProc)(DWORD dwDestAddr, DWORD dwSourceAddr, PMIB_IPFORWARDROW pBestRoute);
76 typedef DWORD (WINAPI * GetIpAddrTableProc)(PMIB_IPADDRTABLE pIpAddrTable, PULONG pdwSize, BOOL bOrder);
77
78 WinCompat();
79 ~WinCompat();
80
81 GetBestInterfaceExProc getBestInterfaceEx;
82 GetAdaptersAddressesProc getAdaptersAddresses;
83 GetAdaptersInfoProc getAdaptersInfo;
84 GetBestRouteProc getBestRoute;
85 GetIpAddrTableProc getIpAddrTable;
86 bool loadLibraryWithIPv4Failed;
87 bool loadLibraryWithIPv6Failed;
88 HMODULE hLib;
89};
90
91}
92
93#endif // WIN32
94#endif
dcm! – add UnusedChecking(_enum) below;
void list()
Definition userAdmin.cxx:66