blob: 2507ed6821bc5f291e7c9f01518bfc17f242a8fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// file : cult/os/net/ipv4/address.cxx
// author : Boris Kolpackov <boris@kolpackov.Net>
// copyright : Copyright (c) 2005-2010 Boris Kolpackov
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <cult/os/net/ipv4/address.hxx>
#include <ostream>
namespace Cult
{
namespace OS
{
namespace Net
{
namespace IPv4
{
std::ostream&
operator<< (std::ostream& os, Address const& addr)
{
char str[INET_ADDRSTRLEN];
if (inet_ntop (AF_INET,
&addr.addr_.sin_addr,
str,
INET_ADDRSTRLEN) == 0)
{
throw Address::Invalid ();
}
return os << str << ":" << addr.port ();
}
}
}
}
}
|