Stun Server  Compliant with the latest RFCs including 5389, 5769, and 5780
discover the local host's own external IP address
adapters.cpp File Reference
#include "commonincludes.hpp"
#include "socketaddress.h"
Include dependency graph for adapters.cpp:

Go to the source code of this file.

Functions

void GetDefaultAdapters (int family, ifaddrs *pList, ifaddrs **ppAddrPrimary, ifaddrs **ppAddrAlternate)
 
bool HasAtLeastTwoAdapters (int family)
 
HRESULT GetBestAddressForSocketBind (bool fPrimary, int family, uint16_t port, CSocketAddress *pSocketAddr)
 
HRESULT GetSocketAddressForAdapter (int family, const char *pszAdapterName, uint16_t port, CSocketAddress *pSocketAddr)
 

Function Documentation

HRESULT GetBestAddressForSocketBind ( bool  fPrimary,
int  family,
uint16_t  port,
CSocketAddress pSocketAddr 
)

Suggests a default adapter for a given stun server socket

Parameters
fPrimary- true if the returned adapter is to be used for the primary socket in a stun server. Typically passing "true" means "return the first adapter enumerated", otherwise return the second adapter enumerated"
family- Either AF_INET or AF_INET6
pSocketAddr- OUT param. On success, contains the address to bind to
Returns
S_OK on success. Error code otherwise.

Definition at line 83 of file adapters.cpp.

void GetDefaultAdapters ( int  family,
ifaddrs *  pList,
ifaddrs **  ppAddrPrimary,
ifaddrs **  ppAddrAlternate 
)

Definition at line 24 of file adapters.cpp.

HRESULT GetSocketAddressForAdapter ( int  family,
const char *  pszAdapterName,
uint16_t  port,
CSocketAddress pSocketAddr 
)

Definition at line 111 of file adapters.cpp.

bool HasAtLeastTwoAdapters ( int  family)

Returns true if there are two or more host interfaces(adapters) for the specified family of IP addresses that are both "up" and not loopback adapters

Parameters
familyeither AF_INET or AF_INET6

Definition at line 54 of file adapters.cpp.