geekbrains_network_programming/lesson_03/header/address.hpp

34 lines
681 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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