|
@@ -10,25 +10,25 @@
|
|
|
#ifndef NETWORK_CORE_ADDRESS_H
|
|
|
#define NETWORK_CORE_ADDRESS_H
|
|
|
|
|
|
#include "os_abstraction.h"
|
|
|
#include "config.h"
|
|
|
#include "../../company_type.h"
|
|
|
#include "../../string_func.h"
|
|
|
#include "../../core/smallmap_type.hpp"
|
|
|
|
|
|
|
|
|
class NetworkAddress;
|
|
|
typedef std::vector<NetworkAddress> NetworkAddressList; ///< Type for a list of addresses.
|
|
|
typedef SmallMap<NetworkAddress, SOCKET> SocketList; ///< Type for a mapping between address and socket.
|
|
|
typedef SmallMap<SOCKET, NetworkAddress> SocketList; ///< Type for a mapping between address and socket.
|
|
|
|
|
|
/**
|
|
|
* Wrapper for (un)resolved network addresses; there's no reason to transform
|
|
|
* a numeric IP to a string and then back again to pass it to functions. It
|
|
|
* furthermore allows easier delaying of the hostname lookup.
|
|
|
*/
|
|
|
class NetworkAddress {
|
|
|
private:
|
|
|
std::string hostname; ///< The hostname
|
|
|
int address_length; ///< The length of the resolved address
|
|
|
sockaddr_storage address; ///< The resolved address
|
|
|
bool resolved; ///< Whether the address has been (tried to be) resolved
|