reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
StunTuple.hxx
Go to the documentation of this file.
1#ifndef STUNTUPLE_HXX
2#define STUNTUPLE_HXX
3
4#include <memory>
5
6#ifndef WIN32
7#include <netinet/in.h>
8#else
9#include <winsock2.h>
10#include <Ws2tcpip.h>
11#endif
12
13#include "rutil/Socket.hxx"
14#include "rutil/compat.hxx"
15
16
17#include <asio/ip/address.hpp>
18
20
21namespace reTurn {
22
24{
25public:
26 typedef enum
27 {
31 TLS
33
34 explicit StunTuple();
35 explicit StunTuple(TransportType transport, const asio::ip::address& address, unsigned int port);
36
37 bool operator==(const StunTuple& rhs) const;
38 bool operator!=(const StunTuple& rhs) const;
39 bool operator<(const StunTuple& rhs) const;
40
41 TransportType getTransportType() const { return mTransport; }
42 void setTransportType(TransportType transport) { mTransport = transport; }
43
44 const asio::ip::address& getAddress() const { return mAddress; }
45 void setAddress(const asio::ip::address& address) { mAddress = address; }
46
47 unsigned int getPort() const { return mPort; }
48 void setPort(unsigned int port) { mPort = port; }
49
50 void toSockaddr(sockaddr* addr) const;
51
52private:
53 TransportType mTransport;
54 asio::ip::address mAddress;
55 unsigned int mPort;
56
57 friend EncodeStream& operator<<(EncodeStream& strm, const StunTuple& tuple);
58};
59
60EncodeStream& operator<<(EncodeStream& strm, const StunTuple& tuple);
61
62}
63
64#endif
65
66
67/* ====================================================================
68
69 Copyright (c) 2007-2008, Plantronics, Inc.
70 All rights reserved.
71
72 Redistribution and use in source and binary forms, with or without
73 modification, are permitted provided that the following conditions are
74 met:
75
76 1. Redistributions of source code must retain the above copyright
77 notice, this list of conditions and the following disclaimer.
78
79 2. Redistributions in binary form must reproduce the above copyright
80 notice, this list of conditions and the following disclaimer in the
81 documentation and/or other materials provided with the distribution.
82
83 3. Neither the name of Plantronics nor the names of its contributors
84 may be used to endorse or promote products derived from this
85 software without specific prior written permission.
86
87 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
88 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
89 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
90 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
91 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
92 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
93 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
94 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
95 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
96 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
97 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
98
99 ==================================================================== */
Handles cross-platform sockets compatibility.
TransportType getTransportType() const
Definition StunTuple.hxx:41
void toSockaddr(sockaddr *addr) const
Definition StunTuple.cxx:64
bool operator==(const StunTuple &rhs) const
Definition StunTuple.cxx:26
const asio::ip::address & getAddress() const
Definition StunTuple.hxx:44
bool operator!=(const StunTuple &rhs) const
Definition StunTuple.cxx:34
unsigned int getPort() const
Definition StunTuple.hxx:47
bool operator<(const StunTuple &rhs) const
Definition StunTuple.cxx:42
friend EncodeStream & operator<<(EncodeStream &strm, const StunTuple &tuple)
Definition StunTuple.cxx:95
void setPort(unsigned int port)
Definition StunTuple.hxx:48
void setAddress(const asio::ip::address &address)
Definition StunTuple.hxx:45
void setTransportType(TransportType transport)
Definition StunTuple.hxx:42
This file is used to handle compatibility fixes/tweaks so reSIProcate can function on multiple platfo...
EncodeStream & operator<<(EncodeStream &strm, const UInt128 &r)
Replaces STL streams for general encoding purposes.
#define EncodeStream
void list()
Definition userAdmin.cxx:66