reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
GenericIPAddress.cxx
Go to the documentation of this file.
1
2#include "rutil/DnsUtil.hxx"
4
5using namespace resip;
6
8resip::operator<<(EncodeStream& ostrm, const GenericIPAddress& addr)
9{
10 ostrm << "[ " ;
11
12#ifdef USE_IPV6
13 if (addr.address.sa_family == AF_INET6)
14 {
15 ostrm << "V6 " << DnsUtil::inet_ntop(addr.v6Address.sin6_addr) << " port=" << ntohs(addr.v6Address.sin6_port);
16 }
17 else
18#endif
19 if (addr.address.sa_family == AF_INET)
20 {
21 ostrm << "V4 " << DnsUtil::inet_ntop(addr.v4Address.sin_addr) << ":" << ntohs(addr.v4Address.sin_port);
22 }
23 else
24 {
25 resip_assert(0);
26 }
27
28 ostrm << " ]";
29
30 return ostrm;
31}
32
33/* ====================================================================
34*
35* Copyright 2016 Daniel Pocock https://danielpocock.com
36*
37* Redistribution and use in source and binary forms, with or without
38* modification, are permitted provided that the following conditions
39* are met:
40*
41* 1. Redistributions of source code must retain the above copyright
42* notice, this list of conditions and the following disclaimer.
43*
44* 2. Redistributions in binary form must reproduce the above copyright
45* notice, this list of conditions and the following disclaimer in
46* the documentation and/or other materials provided with the
47* distribution.
48*
49* 3. Neither the name of the author(s) nor the names of any contributors
50* may be used to endorse or promote products derived from this software
51* without specific prior written permission.
52*
53* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
54* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
55* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
56* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
57* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
59* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
60* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
61* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63* SUCH DAMAGE.
64*
65* ====================================================================
66*
67*
68*/
69
#define resip_assert(x)
This file needs to work for both C and C++ code.
static Data inet_ntop(const struct in_addr &addr)
Converts from the network format to presentation format.
Definition DnsUtil.cxx:240
dcm! – add UnusedChecking(_enum) below;
EncodeStream & operator<<(EncodeStream &strm, const BaseException &e)
#define EncodeStream
Represents an IP-address and port (V4 or V6).