Stun Server  Compliant with the latest RFCs including 5389, 5769, and 5780
discover the local host's own external IP address
CStunSocket Class Reference

#include <stunsocket.h>

Collaboration diagram for CStunSocket:

Public Member Functions

 CStunSocket ()
 
 ~CStunSocket ()
 
void Close ()
 
bool IsValid ()
 
HRESULT Attach (int sock)
 
int Detach ()
 
int GetSocketHandle () const
 
const CSocketAddressGetLocalAddress () const
 
const CSocketAddressGetRemoteAddress () 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
 

Detailed Description

Definition at line 22 of file stunsocket.h.

Constructor & Destructor Documentation

CStunSocket::CStunSocket ( const CStunSocket )
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.

Member Function Documentation

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.

HRESULT CStunSocket::EnablePktInfo_IPV4 ( bool  fEnable)
private

Definition at line 145 of file stunsocket.cpp.

HRESULT CStunSocket::EnablePktInfo_IPV6 ( bool  fEnable)
private

Definition at line 162 of file stunsocket.cpp.

HRESULT CStunSocket::EnablePktInfoImpl ( int  level,
int  option1,
int  option2,
bool  fEnable 
)
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.

HRESULT CStunSocket::InitCommon ( int  socktype,
const CSocketAddress addrlocal,
SocketRole  role,
bool  fSetReuseFlag 
)
private

Definition at line 276 of file stunsocket.cpp.

bool CStunSocket::IsValid ( )

Definition at line 51 of file stunsocket.cpp.

void CStunSocket::operator= ( const CStunSocket )
inlineprivate

Definition at line 31 of file stunsocket.h.

void CStunSocket::Reset ( )
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.

HRESULT CStunSocket::SetV6Only ( int  sock)
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.

Member Data Documentation

CSocketAddress CStunSocket::_addrlocal
private

Definition at line 26 of file stunsocket.h.

CSocketAddress CStunSocket::_addrremote
private

Definition at line 27 of file stunsocket.h.

SocketRole CStunSocket::_role
private

Definition at line 28 of file stunsocket.h.

int CStunSocket::_sock
private

Definition at line 25 of file stunsocket.h.


The documentation for this class was generated from the following files: