| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 |
| 11 | #ifndef RTC_BASE_IFADDRS_CONVERTER_H_ |
| 12 | #define RTC_BASE_IFADDRS_CONVERTER_H_ |
| 13 |
| 14 | #if defined(WEBRTC_ANDROID) |
| 15 | #include "rtc_base/ifaddrs_android.h" |
| 16 | #else |
| 17 | #include <ifaddrs.h> |
| 18 | #endif // WEBRTC_ANDROID |
| 19 |
| 20 | #include "rtc_base/ip_address.h" |
| 21 |
| 22 | namespace rtc { |
| 23 |
| 24 | // This class converts native interface addresses to our internal IPAddress |
| 25 | // class. Subclasses should override ConvertNativeToIPAttributes to implement |
| 26 | // the different ways of retrieving IPv6 attributes for various POSIX platforms. |
| 27 | class IfAddrsConverter { |
| 28 | public: |
| 29 | IfAddrsConverter(); |
| 30 | virtual ~IfAddrsConverter(); |
| 31 | virtual bool ConvertIfAddrsToIPAddress(const struct ifaddrs* interface, |
| 32 | InterfaceAddress* ipaddress, |
| 33 | IPAddress* mask); |
| 34 |
| 35 | protected: |
| 36 | virtual bool ConvertNativeAttributesToIPAttributes( |
| 37 | const struct ifaddrs* interface, |
| 38 | int* ip_attributes); |
| 39 | }; |
| 40 |
| 41 | IfAddrsConverter* CreateIfAddrsConverter(); |
| 42 |
| 43 | } // namespace rtc |
| 44 |
| 45 | #endif // RTC_BASE_IFADDRS_CONVERTER_H_ |
| 46 |