UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
netadapter_if.hpp
Go to the documentation of this file.
1#ifndef UPnPsdk_NETADAPTER_IF_HPP
2#define UPnPsdk_NETADAPTER_IF_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-03-16
16#include <UPnPsdk/sockaddr.hpp>
17#include <memory>
18
19
20namespace UPnPsdk {
21
44class UPnPsdk_API INetadapter {
45 public:
46 // Constructor
48
49 // Destructor
50 virtual ~INetadapter();
51
57 virtual void get_first() = 0;
58
64 virtual bool get_next() = 0;
65
75 virtual unsigned int index() const = 0;
76
84 virtual std::string name() const = 0;
85
86 // // I code IP Version-Independent, so this method is not provided.
87 // sa_family_t in_family() const;
88
90 virtual void sockaddr(
94 SSockaddr& a_saddr) const = 0;
95
101 virtual void socknetmask(
105 SSockaddr& a_snetmask) const = 0;
106
111 virtual unsigned int bitmask() const = 0;
112
115 virtual void reset() noexcept = 0;
116};
117
120using PNetadapter_platform = std::shared_ptr<INetadapter>;
121
122} // namespace UPnPsdk
123
124#endif // UPnPsdk_NETADAPTER_IF_HPP
Manage information from different platforms about network adapters.
virtual void reset() noexcept=0
Reset pointer and point to the first entry of the local network adapter list if available.
virtual void socknetmask(SSockaddr &a_snetmask) const =0
Get socket address netmask from current selected list entry.
virtual unsigned int index() const =0
Get index number from current selected list entry.
virtual std::string name() const =0
Get network adapter name from current selected list entry.
virtual void get_first()=0
Load a list of network adapters from the operating system and select its first entry.
virtual unsigned int bitmask() const =0
Get prefix length from the ip address of the current selected local network adapter.
virtual bool get_next()=0
Select next entry from the network adapter list that was initial loaded with get_first().
virtual void sockaddr(SSockaddr &a_saddr) const =0
Get socket address from current selected list entry.
Reengineered Object Oriented UPnP+ program code.
std::shared_ptr< INetadapter > PNetadapter_platform
Smart pointer to hold the injected pointer to the netadapter object for the current used platform.
Declaration of the Sockaddr class and some free helper functions.
Trivial ::sockaddr structures enhanced with methods.
Definition sockaddr.hpp:94