Stun Server
Compliant with the latest RFCs including 5389, 5769, and 5780
discover the local host's own external IP address
|
#include <stunsocket.h>
Public Member Functions | |
CStunSocket () | |
~CStunSocket () | |
void | Close () |
bool | IsValid () |
HRESULT | Attach (int sock) |
int | Detach () |
int | GetSocketHandle () const |
const CSocketAddress & | GetLocalAddress () const |
const CSocketAddress & | GetRemoteAddress () const |
SocketRole | GetRole () const |
void | SetRole (SocketRole role) |
HRESULT | EnablePktInfoOption (bool fEnable) |
HRESULT | SetNonBlocking (bool fEnable) |
void | UpdateAddresses () |
HRESULT | UDPInit (const CSocketAddress &local, SocketRole role) |
HRESULT | TCPInit (const CSocketAddress &local, SocketRole role, bool fSetReuseFlag) |
Private Member Functions | |
CStunSocket (const CStunSocket &) | |
void | operator= (const CStunSocket &) |
HRESULT | InitCommon (int socktype, const CSocketAddress &addrlocal, SocketRole role, bool fSetReuseFlag) |
void | Reset () |
HRESULT | EnablePktInfoImpl (int level, int option1, int option2, bool fEnable) |
HRESULT | EnablePktInfo_IPV4 (bool fEnable) |
HRESULT | EnablePktInfo_IPV6 (bool fEnable) |
HRESULT | SetV6Only (int sock) |
Private Attributes | |
int | _sock |
CSocketAddress | _addrlocal |
CSocketAddress | _addrremote |
SocketRole | _role |
Definition at line 22 of file stunsocket.h.
|
inlineprivate |
Definition at line 30 of file stunsocket.h.
CStunSocket::CStunSocket | ( | ) |
Definition at line 21 of file stunsocket.cpp.
CStunSocket::~CStunSocket | ( | ) |
Definition at line 28 of file stunsocket.cpp.
HRESULT CStunSocket::Attach | ( | int | sock | ) |
Definition at line 56 of file stunsocket.cpp.
void CStunSocket::Close | ( | ) |
Definition at line 41 of file stunsocket.cpp.
int CStunSocket::Detach | ( | ) |
Definition at line 75 of file stunsocket.cpp.
|
private |
Definition at line 145 of file stunsocket.cpp.
|
private |
Definition at line 162 of file stunsocket.cpp.
|
private |
Definition at line 119 of file stunsocket.cpp.
HRESULT CStunSocket::EnablePktInfoOption | ( | bool | fEnable | ) |
Definition at line 179 of file stunsocket.cpp.
const CSocketAddress & CStunSocket::GetLocalAddress | ( | ) | const |
Definition at line 87 of file stunsocket.cpp.
const CSocketAddress & CStunSocket::GetRemoteAddress | ( | ) | const |
Definition at line 92 of file stunsocket.cpp.
SocketRole CStunSocket::GetRole | ( | ) | const |
Definition at line 98 of file stunsocket.cpp.
int CStunSocket::GetSocketHandle | ( | ) | const |
Definition at line 82 of file stunsocket.cpp.
|
private |
Definition at line 276 of file stunsocket.cpp.
bool CStunSocket::IsValid | ( | ) |
Definition at line 51 of file stunsocket.cpp.
|
inlineprivate |
Definition at line 31 of file stunsocket.h.
|
private |
Definition at line 33 of file stunsocket.cpp.
HRESULT CStunSocket::SetNonBlocking | ( | bool | fEnable | ) |
Definition at line 217 of file stunsocket.cpp.
void CStunSocket::SetRole | ( | SocketRole | role | ) |
Definition at line 104 of file stunsocket.cpp.
|
private |
Definition at line 196 of file stunsocket.cpp.
HRESULT CStunSocket::TCPInit | ( | const CSocketAddress & | local, |
SocketRole | role, | ||
bool | fSetReuseFlag | ||
) |
Definition at line 327 of file stunsocket.cpp.
HRESULT CStunSocket::UDPInit | ( | const CSocketAddress & | local, |
SocketRole | role | ||
) |
Definition at line 322 of file stunsocket.cpp.
void CStunSocket::UpdateAddresses | ( | ) |
Definition at line 245 of file stunsocket.cpp.
|
private |
Definition at line 26 of file stunsocket.h.
|
private |
Definition at line 27 of file stunsocket.h.
|
private |
Definition at line 28 of file stunsocket.h.
|
private |
Definition at line 25 of file stunsocket.h.