UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
netadapter_platform.hpp
Go to the documentation of this file.
1#ifndef UPnPsdk_UNIX_NETADAPTER_HPP
2#define UPnPsdk_UNIX_NETADAPTER_HPP
3// Copyright (C) 2024+ GPL 3 and higher by Ingo Höft, <Ingo@Hoeft-online.de>
4// Redistribution only with this Copyright remark. Last modified: 2025-02-24
12#include <ifaddrs.h>
14
15
16namespace UPnPsdk {
17
21class UPnPsdk_API CNetadapter_platform : public INetadapter {
22 public:
23 // Constructor
25
26 // Destructor
27 virtual ~CNetadapter_platform();
28
29 // Methodes
30 void get_first() override;
31 bool get_next() override;
32 unsigned int index() const override;
33 std::string name() const override;
34 void sockaddr(SSockaddr& a_saddr) const override;
35 void socknetmask(SSockaddr& a_snetmask) const override;
36 unsigned int bitmask() const override;
37
38 private:
39 // Pointer to the first network adapter structure. This pointer must not be
40 // modified because it is needed to free the allocated memory space for the
41 // adapter list.
42 ifaddrs* m_ifa_first{nullptr};
43
44 // Pointer to the current network adapter in work.
45 ifaddrs* m_ifa_current{nullptr};
46
47 // Methodes
48 inline bool is_valid_if(const ifaddrs* a_ifa) const noexcept;
49 void free_ifaddrs() noexcept;
50
51 protected:
54 void reset() noexcept override;
55};
56
57} // namespace UPnPsdk
58
59#endif // UPnPsdk_UNIX_NETADAPTER_HPP
Manage information from Unix like platforms about network adapters.
Manage information from different platforms about network adapters.
Reengineered Object Oriented UPnP+ program code.
C++ interface to manage information from different platforms about network adapters.
Trivial ::sockaddr structures enhanced with methods.
Definition sockaddr.hpp:94