2022-09-05 13:40:50 +00:00
|
|
|
|
/*
|
|
|
|
|
* address.hpp
|
|
|
|
|
*
|
|
|
|
|
* Created on: 5 сент. 2022 г.
|
|
|
|
|
* Author: alexander
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
#include <string.h>
|
2022-09-07 12:43:34 +00:00
|
|
|
|
#include <string>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <netdb.h>
|
2022-09-05 13:40:50 +00:00
|
|
|
|
|
|
|
|
|
namespace zh {
|
|
|
|
|
|
|
|
|
|
class Address
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
struct sockaddr_in _addr;
|
2022-09-07 12:43:34 +00:00
|
|
|
|
std::unique_ptr<const struct hostent *> _host;
|
2022-09-05 13:40:50 +00:00
|
|
|
|
unsigned int _len;
|
|
|
|
|
public:
|
|
|
|
|
Address();
|
|
|
|
|
Address(const Address &address);
|
|
|
|
|
Address(const unsigned short int family, const unsigned int addr, const unsigned short int port);
|
2022-09-07 12:43:34 +00:00
|
|
|
|
Address(const unsigned short int family, const std::string &addr, const unsigned short int port);
|
2022-09-05 13:40:50 +00:00
|
|
|
|
unsigned int& size();
|
|
|
|
|
struct sockaddr_in& operator*();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|