|
simple-socket library 1.2.0
|
Classes | |
| struct | can_filter |
| Structure of id and mask used by filters. More... | |
| struct | can_frame |
| Structure to represent a CAN 2.0 Frame. More... | |
| struct | can_id |
| Represents any possible CAN id or mask. More... | |
| class | CANRawSocket |
| Raw CAN socket class. More... | |
| class | CANSocket |
| CAN socket class. More... | |
| class | InternetSocket |
| Internet socket class. More... | |
| class | SCTPSocket |
| SCTP socket class. More... | |
| class | SimpleSocket |
| A socket representing a basic communication endpoint. More... | |
| class | SocketException |
| Signals a problem with the execution of a socket call. More... | |
| class | SocketHandle |
| A simple class to provide strict ownership of socket handles. More... | |
| class | SocketHandle_Ref |
| class | TCPSocket |
| TCP socket class. More... | |
| class | UDPSocket |
| UDP socket class. More... | |
| class | UnixDatagramSocket |
| Unix datagram socket class. More... | |
| class | UnixSocket |
| Unix domain socket class. More... | |
Functions | |
| std::string | getBroadcastAddress (std::string_view interface) |
| Return the IPv4 broadcast address of the given network interface. | |
| std::string | getDestinationAddress (std::string_view interface) |
| Return the IPv4 destination address of the given network interface. | |
| std::string | getHardwareAddress (std::string_view interface) |
| Return the MAC address of the given network interfaces. | |
| std::string | getInterfaceAddress (std::string_view interface) |
| Return the IPv4 address of the given network interface. | |
| int | getMTU (std::string_view interface) |
| Return the MTU (Maximum Transmission Unit) of the given network interface in bytes. | |
| std::string | getNetmask (std::string_view interface) |
| Return the IPv4 netmask of the given network interface. | |
| std::vector< std::string > | getNetworkInterfaces () |
| Return a list of available network interfaces. | |
| std::string | resolveHostname (const std::string &hostname) |
| uint16_t | resolveService (const std::string &service, const std::string &protocol="tcp") |
| void | setBroadcastAddress (std::string_view interface, std::string_view address) |
| Set the IPv4 broadcast address of the given network interface. | |
| void | setDestinationAddress (std::string_view interface, std::string_view address) |
| Set the IPv4 destination address of the given network interface. | |
| void | setInterfaceAddress (std::string_view interface, std::string_view address) |
| Set the IPv4 address of the given network interface. | |
| void | setMTU (std::string_view interface, int mtu) |
| Set the MTU (Maximum Transmission Unit) of the given network interface in bytes. | |
| void | setNetmask (std::string_view interface, std::string_view address) |
| Set the IPv4 netmask of the given network interface. | |
| std::string NET::resolveHostname | ( | const std::string & | hostname | ) |
Resolve the specified hostname to a standard IPv4 address. If the operating system doesn't know the hostname yet this means a DNS lookup.
| hostname | domain name |
Definition at line 53 of file SocketUtils.cpp.
| uint16_t NET::resolveService | ( | const std::string & | service, |
| const std::string & | protocol = "tcp" ) |
Resolve the specified service for the specified protocol to the corresponding port number in host byte order.
| service | service to resolve (e.g. "http") |
| protocol | protocol of service to resolve. Default is "tcp". To match to any protocol, pass an empty string (""). |
Definition at line 68 of file SocketUtils.cpp.
| std::vector< std::string > NET::getNetworkInterfaces | ( | ) |
Return a list of available network interfaces.
Definition at line 98 of file SocketUtils.cpp.
| std::string NET::getInterfaceAddress | ( | std::string_view | interface | ) |
Return the IPv4 address of the given network interface.
Call may throw if e.g. the interface it not up or not with an IP address.
Definition at line 135 of file SocketUtils.cpp.
| void NET::setInterfaceAddress | ( | std::string_view | interface, |
| std::string_view | address ) |
Set the IPv4 address of the given network interface.
Call may throw if unable to set IP address (e.g. non Ethernet interface, etc.)
Definition at line 147 of file SocketUtils.cpp.
| std::string NET::getBroadcastAddress | ( | std::string_view | interface | ) |
Return the IPv4 broadcast address of the given network interface.
The IOCTL call SIOCGIFBRDADDR is used on the specified interface. This method only works on AF_INET interfaces, it therefore works only on interfaces returned by ifconfig or getNetworkInterfaces().
The call may throw if e.g no BC address is configured or an interface is used that can not have a broadcast address (e.g. bluetooth).
| interface | the interface to query for its broadcast address |
Definition at line 160 of file SocketUtils.cpp.
| void NET::setBroadcastAddress | ( | std::string_view | interface, |
| std::string_view | address ) |
Set the IPv4 broadcast address of the given network interface.
This call my throw if e.g. used on an interface that can not have a BC address e.g. a bluetooth device
| interface | interface name |
| address | IPV4 address to configure the interface to |
Definition at line 172 of file SocketUtils.cpp.
| std::string NET::getNetmask | ( | std::string_view | interface | ) |
Return the IPv4 netmask of the given network interface.
This call may throw if the interface e.g. has no netmask configured (e.g. if interface is down) or can't have one (e.g. bluetooth)
| interface | interface name |
Definition at line 185 of file SocketUtils.cpp.
| void NET::setNetmask | ( | std::string_view | interface, |
| std::string_view | address ) |
Set the IPv4 netmask of the given network interface.
This call may throw if the interface e.g. can not have a broadcast address, is down, etc.
| interface | interface name |
| address | IPV4 address to set the netmask to |
Definition at line 197 of file SocketUtils.cpp.
| std::string NET::getDestinationAddress | ( | std::string_view | interface | ) |
Return the IPv4 destination address of the given network interface.
This call may throw if the interface e.g. has no destination address configured (e.g. if interface is down) or can't have one (e.g. bluetooth)
| interface | interface name |
Definition at line 210 of file SocketUtils.cpp.
| void NET::setDestinationAddress | ( | std::string_view | interface, |
| std::string_view | address ) |
Set the IPv4 destination address of the given network interface.
This call may throw if the interface e.g. can not have a destination address, is down, etc.
| interface | interface name |
| address | IPV4 address to set the netmask to |
Definition at line 222 of file SocketUtils.cpp.
| int NET::getMTU | ( | std::string_view | interface | ) |
Return the MTU (Maximum Transmission Unit) of the given network interface in bytes.
This call may throw.
| interface | interface name |
Definition at line 235 of file SocketUtils.cpp.
| void NET::setMTU | ( | std::string_view | interface, |
| int | mtu ) |
Set the MTU (Maximum Transmission Unit) of the given network interface in bytes.
This call may throw.
| interface | interface name |
| mtu | new mtu in bytes |
Definition at line 247 of file SocketUtils.cpp.
| std::string NET::getHardwareAddress | ( | std::string_view | interface | ) |
Return the MAC address of the given network interfaces.
This call may throw if the interface does not have a MAC address.
| interface | interface name |
Definition at line 259 of file SocketUtils.cpp.