ArServerSimpleOpener Class Reference

#include <ArServerSimpleOpener.h>

List of all members.


Detailed Description

Set up and open an ArNetworking server.

Some program command line options affect behavior:

Options for ArServerSimpleOpener:
-serverPort <serverPortNumber>
-sp <serverPortNumber>
-serverIP <serverIPToOpenOn>
-sip <serverIPToOpenOn>
-serverTcpOnly
-userInfo <userInfoFileName>
-ui <userInfoFileName>
-logUserInfo
-lui
-logCommandGroups
-lcg
-serverInfoFile <file>

To set the port the server uses use '-serverPort serverPortNumber' or '-sp serverPortNumber'. To set the file to look in for user information use '-userInfo fileName' or "-ui fileName'. To log out the user information use '-logUserInfo' or 'lui'. To log out the command groups use '-logCommandGroups' or '-lcg'. To set the key used for the server (that the client has to know to connect if using user and password) use '-serverInfoFile file'. With a file that has in it 'serverKey serverKey'. You should obviously make sure no one you don't want to know that server key can read your file that it is in.

For more details about all of these options see ArServerBase.

See also:
ArServerBase
Examples:

drawingsExample.cpp, drawingsExampleWithRobot.cpp, popupExample.cpp, serverDemo.cpp, and simpleServerExample.cpp.


Public Member Functions

 ArServerSimpleOpener (ArArgumentParser *parser, const char *prefix="")
 Constructor.
bool checkAndLog (void) const
 Logs the things requested for logging, may check things later.
bool didOpenFail (void)
 Returns true if the open failed because it couldn't open.
int getPort ()
 Get the server's port number.
void logOptions (void) const
 Log the options the simple connector has.
bool open (ArServerBase *server, const char *baseDirectory="", int secondsToTryFor=240)
 Function to open up the server.
bool parseArgs (ArArgumentParser *parser)
 Function to parse the arguments given in an arbitrary parser.
bool parseArgs (void)
 Function to parse the arguments given in the constructor.
bool parseFile (const char *fileName)
 Parses the file for holding the server key.
void setServerTcpOnly (bool serverTcpOnly)
 Sets the tcpOnly flag.
bool wasUserFileBad (void)
 Returns true if the open failed because of a bad user file.
 ~ArServerSimpleOpener ()
 Destructor.

Protected Member Functions

bool fileServerKeyCallback (ArArgumentBuilder *arg)
void logOptionsWithOutPrefix (void) const
void logOptionsWithPrefix (void) const
bool parseArgsWithOutPrefix (ArArgumentParser *parser)
bool parseArgsWithPrefix (ArArgumentParser *parser)
void reset (void)

Protected Attributes

bool myBadUserFile
ArFileParser myFileParser
ArRetFunctor1C< bool, ArServerSimpleOpener,
ArArgumentBuilder * > 
myFileServerKeyCB
bool myLogCommandGroups
ArConstFunctorC< ArServerSimpleOpenermyLogOptionsCB
bool myLogUserInfo
bool myOpenFailed
const char * myOpenOnIP
bool myOwnParser
ArRetFunctorC< bool, ArServerSimpleOpenermyParseArgsCB
ArArgumentParsermyParser
std::string myPrefix
ArServerBasemyServer
std::string myServerKey
int myServerPort
bool myTcpOnly
const char * myUserFile


Constructor & Destructor Documentation

ArServerSimpleOpener::ArServerSimpleOpener ( ArArgumentParser parser,
const char *  prefix = "" 
)

Constructor.

Parameters:
parser the parser to use for information

ArServerSimpleOpener::~ArServerSimpleOpener (  ) 

Destructor.


Member Function Documentation

bool ArServerSimpleOpener::checkAndLog ( void   )  const

Logs the things requested for logging, may check things later.

Examples:
serverDemo.cpp.

bool ArServerSimpleOpener::didOpenFail ( void   )  [inline]

Returns true if the open failed because it couldn't open.

bool ArServerSimpleOpener::fileServerKeyCallback ( ArArgumentBuilder arg  )  [protected]

int ArServerSimpleOpener::getPort (  )  [inline]

Get the server's port number.

Returns:
the server's port number

void ArServerSimpleOpener::logOptions ( void   )  const

Log the options the simple connector has.

void ArServerSimpleOpener::logOptionsWithOutPrefix ( void   )  const [protected]

void ArServerSimpleOpener::logOptionsWithPrefix ( void   )  const [protected]

bool ArServerSimpleOpener::open ( ArServerBase server,
const char *  baseDirectory = "",
int  secondsToTryFor = 240 
)

Function to open up the server.

Parameters:
server the server to operate on
baseDirectory the base directory (solely for loading user information)
secondsToTryFor this is the number of seconds to try opening for, 0 means only try to open once
Examples:
serverDemo.cpp.

bool ArServerSimpleOpener::parseArgs ( ArArgumentParser parser  ) 

Function to parse the arguments given in an arbitrary parser.

bool ArServerSimpleOpener::parseArgs ( void   ) 

Function to parse the arguments given in the constructor.

bool ArServerSimpleOpener::parseArgsWithOutPrefix ( ArArgumentParser parser  )  [protected]

bool ArServerSimpleOpener::parseArgsWithPrefix ( ArArgumentParser parser  )  [protected]

bool ArServerSimpleOpener::parseFile ( const char *  fileName  ) 

Parses the file for holding the server key.

void ArServerSimpleOpener::reset ( void   )  [protected]

void ArServerSimpleOpener::setServerTcpOnly ( bool  serverTcpOnly  )  [inline]

Sets the tcpOnly flag.

bool ArServerSimpleOpener::wasUserFileBad ( void   )  [inline]

Returns true if the open failed because of a bad user file.

Examples:
serverDemo.cpp.


Member Data Documentation

bool ArServerSimpleOpener::myBadUserFile [protected]

ArFileParser ArServerSimpleOpener::myFileParser [protected]

ArRetFunctor1C<bool, ArServerSimpleOpener, ArArgumentBuilder *> ArServerSimpleOpener::myFileServerKeyCB [protected]

bool ArServerSimpleOpener::myLogCommandGroups [protected]

ArConstFunctorC<ArServerSimpleOpener> ArServerSimpleOpener::myLogOptionsCB [protected]

bool ArServerSimpleOpener::myLogUserInfo [protected]

bool ArServerSimpleOpener::myOpenFailed [protected]

const char* ArServerSimpleOpener::myOpenOnIP [protected]

bool ArServerSimpleOpener::myOwnParser [protected]

ArRetFunctorC<bool, ArServerSimpleOpener> ArServerSimpleOpener::myParseArgsCB [protected]

ArArgumentParser* ArServerSimpleOpener::myParser [protected]

std::string ArServerSimpleOpener::myPrefix [protected]

ArServerBase* ArServerSimpleOpener::myServer [protected]

std::string ArServerSimpleOpener::myServerKey [protected]

int ArServerSimpleOpener::myServerPort [protected]

bool ArServerSimpleOpener::myTcpOnly [protected]

const char* ArServerSimpleOpener::myUserFile [protected]


The documentation for this class was generated from the following files:
Generated on Fri Jul 31 12:37:29 2009 for ArNetworking by  doxygen 1.4.7