45 lines
715 B
C++
45 lines
715 B
C++
|
/*
|
|||
|
* address.cpp
|
|||
|
*
|
|||
|
* Created on: 5 сент. 2022 г.
|
|||
|
* Author: alexander
|
|||
|
*/
|
|||
|
|
|||
|
#include <address.hpp>
|
|||
|
|
|||
|
namespace zh {
|
|||
|
|
|||
|
Address::Address()
|
|||
|
{
|
|||
|
memset(&_addr, 0, sizeof(_addr));
|
|||
|
_len = sizeof(_addr);
|
|||
|
}
|
|||
|
|
|||
|
Address::Address(const Address &address)
|
|||
|
{
|
|||
|
_addr = address._addr;
|
|||
|
_len = address._len;
|
|||
|
}
|
|||
|
|
|||
|
Address::Address(const unsigned short int family, const unsigned int addr, const unsigned short int port)
|
|||
|
{
|
|||
|
memset(&_addr, 0, sizeof(_addr));
|
|||
|
_len = sizeof(_addr);
|
|||
|
|
|||
|
_addr.sin_family = family;
|
|||
|
_addr.sin_addr.s_addr = htonl(addr);
|
|||
|
_addr.sin_port = htons(port);
|
|||
|
}
|
|||
|
|
|||
|
unsigned int& Address::size()
|
|||
|
{
|
|||
|
return _len;
|
|||
|
}
|
|||
|
|
|||
|
struct sockaddr_in& Address::operator*()
|
|||
|
{
|
|||
|
return _addr;
|
|||
|
}
|
|||
|
|
|||
|
}
|