Stun Server  Compliant with the latest RFCs including 5389, 5769, and 5780
discover the local host's own external IP address
main.cpp File Reference
#include "commonincludes.hpp"
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include "stuncore.h"
#include "server.h"
#include "tcpserver.h"
#include "adapters.h"
#include "cmdlineparser.h"
#include <getopt.h>
#include "prettyprint.h"
#include "oshelper.h"
#include "stringhelper.h"
#include "stunserver.txtcode"
#include "stunserver_lite.txtcode"
#include "resolvehostname.h"
Include dependency graph for main.cpp:

Go to the source code of this file.

Classes

struct  StartupArgs
 

Macros

#define PRINTARG(member)   Logging::LogMsg(LL_DEBUG, "%s = %s", #member, args.member.length() ? args.member.c_str() : "<empty>");
 

Functions

void PrintUsage (bool fSummaryUsage)
 
char * strerror_helper (int result, char *msg, int err)
 
char * strerror_helper (char *pszResult, char *, int)
 
void LogHR (uint16_t level, HRESULT hr)
 
void DumpStartupArgs (StartupArgs &args)
 
void DumpConfig (CStunServerConfig &config)
 
HRESULT ResolveAdapterName (bool fPrimary, int family, std::string &strAdapterName, uint16_t port, CSocketAddress *pAddr)
 
HRESULT BuildServerConfigurationFromArgs (StartupArgs &argsIn, CStunServerConfig *pConfigOut)
 
HRESULT ParseCommandLineArgs (int argc, char **argv, int startindex, StartupArgs *pStartupArgs)
 
HRESULT LoadConfigsFromFile (const std::string &filename, std::vector< StartupArgs > &configurations)
 
HRESULT BlockSignal (int sig)
 
void WaitForAppExitSignal ()
 
HRESULT StartUDP (CRefCountedPtr< CStunServer > &spServer, CStunServerConfig &config)
 
HRESULT StartTCP (CRefCountedPtr< CTCPServer > &spTCPServer, CStunServerConfig &config)
 
int main (int argc, char **argv)
 

Macro Definition Documentation

#define PRINTARG (   member)    Logging::LogMsg(LL_DEBUG, "%s = %s", #member, args.member.length() ? args.member.c_str() : "<empty>");

Definition at line 134 of file main.cpp.

Function Documentation

HRESULT BlockSignal ( int  sig)

Definition at line 619 of file main.cpp.

HRESULT BuildServerConfigurationFromArgs ( StartupArgs argsIn,
CStunServerConfig pConfigOut 
)

Definition at line 232 of file main.cpp.

void DumpConfig ( CStunServerConfig config)

Definition at line 157 of file main.cpp.

void DumpStartupArgs ( StartupArgs args)

Definition at line 136 of file main.cpp.

HRESULT LoadConfigsFromFile ( const std::string &  filename,
std::vector< StartupArgs > &  configurations 
)

Definition at line 546 of file main.cpp.

void LogHR ( uint16_t  level,
HRESULT  hr 
)

Definition at line 76 of file main.cpp.

int main ( int  argc,
char **  argv 
)

Definition at line 714 of file main.cpp.

HRESULT ParseCommandLineArgs ( int  argc,
char **  argv,
int  startindex,
StartupArgs pStartupArgs 
)

Definition at line 519 of file main.cpp.

void PrintUsage ( bool  fSummaryUsage)

Definition at line 44 of file main.cpp.

HRESULT ResolveAdapterName ( bool  fPrimary,
int  family,
std::string &  strAdapterName,
uint16_t  port,
CSocketAddress pAddr 
)

Definition at line 203 of file main.cpp.

HRESULT StartTCP ( CRefCountedPtr< CTCPServer > &  spTCPServer,
CStunServerConfig config 
)

Definition at line 690 of file main.cpp.

HRESULT StartUDP ( CRefCountedPtr< CStunServer > &  spServer,
CStunServerConfig config 
)

Definition at line 667 of file main.cpp.

char* strerror_helper ( int  result,
char *  msg,
int  err 
)

Definition at line 61 of file main.cpp.

char* strerror_helper ( char *  pszResult,
char *  ,
int   
)

Definition at line 70 of file main.cpp.

void WaitForAppExitSignal ( )

Definition at line 646 of file main.cpp.