#include <ArServerBase.h>
Inheritance diagram for ArServerBase:

Start this server by calling open(), and then running the loop with run() or runAsync(), (or loopOnce() if it is absolutely neccesary to use your own loop; see the implementation of run()). You can then pass this object to the various "ArServerInfo", "ArServerHandler", and ArServerMode classes.
Data request callbacks are added to an ArServerBase object by calling addData().
This class takes care of locking in its own function calls so you don't need to worry about locking and unlocking the class before you do things.
The counterpart of this class for clients is ArClientBase.
You can require user names and passwords for making connections to the server, so each user has a set of permissions for different command groups. To do this, load configuration from a userInfo file with loadUserInfo(). You can log the user info (and what commands users have) with logUserInfo(). You can log the command groups with logCommandGroups() or logCommandGroupsToFile(). For a description of the file see ArServerUserInfo. There is also an example in ArNetworking/examples/serverDemo.userInfo.
In addition to the user and password requirement you can set a server "key" (a special string of text) required (in addition to user and password) to access the server with setServerKey(), though this is ONLY used if user and password information is requied (so that older clients can connect if there's no user and password information required).
The way that the passwords are transmitted across the network is this: Upon connection the server sends a randomly generated (for that connection) string of text to the client which we'll call the passwordKey. The client then combines the serverKey (a string which must be known to connect to the server at all), the password, and the passwordKey (that string that is generated uniquely for each connection) and comes up with an md5 of that string and sends that md5 value across the line. The server then compares the md5 from the client with the md5 generated with the correct information on the server... if they match the password is good, otherwise it rejects the connection. This is NOT perfect security but should be much better then plaintext. If you care about perfect security then use an ssh tunnel with something like PUTTY from the machine the client is on to the machine the server is on with an openssh server set up (this'll likely even work in windows with cygwin) and set up a firewall on the machine the server is on that disallows port the server port connection from outside and only allows ssh from outside (and get a book or three and read those).
This class now handles identifiers for the ArServerClients... all server bases will let a client set a self identifier string, and a here goal... those may be used by any server. Messages can be sent to just server clients that match that message (so that its easier to send messages to people who sent commands).
Master servers (the main connection server base on the central server) can also give each connection an id number (with identGetConnectionID). Things that then connect to the other server bases on a master server (slave servers) should then set their ConnectionID (with identSetConnectionID) so that things can relate the different connections together.
drawingsExample.cpp, drawingsExampleWithRobot.cpp, popupExample.cpp, serverDemo.cpp, and simpleServerExample.cpp.
Public Member Functions | |
| void | addClientRemovedCallback (ArFunctor1< ArServerClient * > *functor) |
| Add a callback to be invoked when a client has been removed (but before it is deleted). | |
| void | addCycleCallback (ArFunctor *functor) |
| Add a callback to be called at every cycle. | |
| bool | addData (const char *name, const char *description, ArFunctor2< ArServerClient *, ArNetPacket * > *functor, const char *argumentDescription, const char *returnDescription, const char *commandGroup=NULL, const char *dataFlags=NULL) |
| Adds a callback to be called when requests for some data are recieved. | |
| bool | addDataAdvanced (const char *name, const char *description, ArFunctor2< ArServerClient *, ArNetPacket * > *functor, const char *argumentDescription, const char *returnDescription, const char *commandGroup=NULL, const char *dataFlags=NULL, unsigned int commandNumber=0, ArFunctor2< long, unsigned int > *requestChangedFunctor=NULL, ArFunctor2< ArServerClient *, ArNetPacket * > *requestOnceFunctor=NULL) |
| Adds a callback for requests in a more advanced manner, for internal use. | |
| bool | addIdleSingleShotCallback (ArFunctor *functor) |
| Adds an idle callback to be called once next time the robot is idle. | |
| bool | allowingIdlePackets (void) |
| Gets if we're allowing idle packets. | |
| ArServerBase (bool addAriaExitCB=true, const char *serverName="", bool addBackupTimeoutToConfig=true, const char *backupTimeoutName="RobotToClientTimeoutInMins", const char *backupTimeoutDesc="The amount of time the central server can go without sending a packet to the robot successfully (when there are packets to send). A number less than 0 means this won't happen. The time is in minutes but takes doubles (ie .5) (5 seconds is used if the value is positive, but less than that amount)", bool masterServer=false, bool slaveServer=false, bool logPasswordFailureVerbosely=false, bool allowSlowPackets=true, bool allowIdlePackets=true) | |
| Constructor. | |
| bool | broadcastPacketTcp (ArNetPacket *packet, const char *name) |
| Broadcasts packets to any client wanting this data. | |
| bool | broadcastPacketTcpByCommand (ArNetPacket *packet, unsigned int command) |
| Broadcasts packets to any client wanting this data. | |
| bool | broadcastPacketTcpByCommandWithExclusion (ArNetPacket *packet, unsigned int command, ArServerClient *excludeClient, bool match=false, ArServerClientIdentifier identifier=ArServerClientIdentifier(), bool matchConnectionID=false) |
| Broadcasts packets to any client wanting this data. | |
| bool | broadcastPacketTcpToMatching (ArNetPacket *packet, const char *name, ArServerClientIdentifier identifier, bool matchConnectionID=false) |
| Broadcasts packets to any client wanting this data that matches the ID. | |
| bool | broadcastPacketTcpWithExclusion (ArNetPacket *packet, const char *name, ArServerClient *excludeClient, bool match=false, ArServerClientIdentifier identifier=ArServerClientIdentifier(), bool matchConnectionID=false) |
| Broadcasts packets to any client wanting this data. | |
| bool | broadcastPacketUdp (ArNetPacket *packet, const char *name) |
| Broadcasts packets to any client wanting this data. | |
| bool | broadcastPacketUdpByCommand (ArNetPacket *packet, unsigned int command) |
| Broadcasts packets to any client wanting this data. | |
| bool | broadcastPacketUdpByCommandWithExclusion (ArNetPacket *packet, unsigned int command, ArServerClient *excludeClient, bool match=false, ArServerClientIdentifier identifier=ArServerClientIdentifier(), bool matchConnectionID=false) |
| Broadcasts packets to any client wanting this data. | |
| bool | broadcastPacketUdpToMatching (ArNetPacket *packet, const char *name, ArServerClientIdentifier identifier, bool matchConnectionID) |
| Broadcasts packets to any client wanting this data that matches. | |
| bool | broadcastPacketUdpWithExclusion (ArNetPacket *packet, const char *name, ArServerClient *excludeClient, bool match=false, ArServerClientIdentifier identifier=ArServerClientIdentifier(), bool matchConnectionID=false) |
| Broadcasts packets to any client wanting this data. | |
| void | close (void) |
| Closes the server. | |
| void | closeConnectionID (ArTypes::UByte4 idNum) |
| Closes connection with a given connection ID. | |
| bool | dataHasFlag (const char *name, const char *dataFlag) |
| Returns if a command has a data flag. | |
| bool | dataHasFlagByCommand (unsigned int command, const char *dataFlag) |
| Returns if a command has a data flag by command number. | |
| unsigned int | findCommandFromName (const char *command) |
| Gets the number of a command. | |
| bool | getDebugLogging (void) |
| Gets if this is using debug logging. | |
| long | getFrequency (unsigned int command, bool internalCall=false) |
| Gets the frequncy a command is requested (mostly internal). | |
| int | getMostClients (void) |
| Gets the most clients we've had connected. | |
| int | getNumClients (void) |
| Gets the number of clients connected. | |
| const char * | getOpenOnIP (void) |
| Gets the IP we're opening on (or NULL if there's none). | |
| unsigned int | getTcpPort (void) |
| Gets the tcp port we're using. | |
| unsigned int | getUdpPort (void) |
| Gets the udp port we're using. | |
| const ArServerUserInfo * | getUserInfo (void) const |
| Gets the user info we're using (mostly internal for switching). | |
| bool | hasIdleCallbacks (void) |
| Internal, Sees if we have any idle callbacks we are waiting to process. | |
| bool | hasIdlePackets (void) |
| Internal, Sees if we have any idle packets we are waiting to process. | |
| bool | hasSlowPackets (void) |
| Internal, Sees if we have any slow packets we are waiting to process. | |
| bool | idleProcessingPending (void) |
| Sees if we have any idle processing pending (idle packets or callbacks). | |
| bool | loadUserInfo (const char *fileName, const char *baseDirectory="") |
| Loads up a set of usernames/passwords/permissions from a file. | |
| void | logCommandGroups (void) |
| Logs the groups and commands in those groups. | |
| void | logCommandGroupsToFile (const char *fileName) |
| Logs the groups and commands in those groups to a file. | |
| void | logConnections (const char *prefix="") |
| Logs the connections. | |
| void | logGroupDescriptions (void) |
| Logs the command group names and descriptions. | |
| void | logGroupDescriptionsToFile (const char *fileName) |
| Logs the command group names and descriptions to a file. | |
| void | logTracking (bool terse=true) |
| Logs the tracking on each client (how many packets and bytes were sent). | |
| void | logUserInfo (void) |
| Logs the users and their groups. | |
| void | loopOnce (void) |
| Runs the server loop once. | |
| ArServerClient * | makeNewServerClientFromSocket (ArSocket *socket, bool doNotReject) |
| Makes a new serverclient from this socket (for switching, needs no password since this was an outgoing connection to a trusted server). | |
| bool | open (unsigned int port, const char *openOnIP=NULL, bool tcpOnly=false) |
| Opens the server to accept new client connections. | |
| void | processPacket (ArNetPacket *packet, struct sockaddr_in *sin) |
| Processes udp packets. | |
| void | rejectSinceUsingCentralServer (const char *centralServerIPString) |
| Tells the server to reject connectings because we're usinga central server. | |
| void | remClientRemovedCallback (ArFunctor1< ArServerClient * > *functor) |
| Remove the callback invoked when a client has been removed. | |
| void | remCycleCallback (ArFunctor *functor) |
| Remove a callback to be called at every cycle. | |
| void | resetTracking (void) |
| Clears the tracking on all the clients (resets counters). | |
| virtual void | run (void) |
| Runs the server in this thread. | |
| virtual void | runAsync (void) |
| Runs the server in its own thread. | |
| virtual void * | runThread (void *arg) |
| bool | sendUdp (ArNetPacket *packet, struct sockaddr_in *sin) |
| Sends Udp packets. | |
| void | setAdditionalDataFlags (const char *additionalDataFlags) |
| Sets the data flags to add in addition to those passed in. | |
| void | setBackupTimeout (double timeoutInMins) |
| Sets the backup timeout. | |
| void | setDebugLogging (bool debugLogging=false) |
| Sets debug logging. | |
| void | setGroupDescription (const char *GrpName, const char *GrpDesc) |
| Logs the command group names and command group descriptions for those names. | |
| void | setServerKey (const char *serverKey) |
| Sets a 'key' needed to access the server through any account. | |
| void | setUserInfo (const ArServerUserInfo *userInfo) |
| Sets the user info we'll use (mostly internal for switching). | |
| virtual | ~ArServerBase () |
| Destructor. | |
Protected Member Functions | |
| void | acceptTcpSockets (void) |
| accepts new sockets and moves them into the client list | |
| ArServerClient * | finishAcceptingSocket (ArSocket *socket, bool skipPassword=false, bool doNotReject=false) |
| Internal function for server/client switching. | |
| void | identGetConnectionID (ArServerClient *client, ArNetPacket *packet) |
| The command get the ConnectionID of this server client connection. | |
| void | identSetConnectionID (ArServerClient *client, ArNetPacket *packet) |
| The command set the ConnectionID of this server client connection. | |
| void | identSetHereGoal (ArServerClient *client, ArNetPacket *packet) |
| The command set the here goal of this server client connection. | |
| void | identSetSelfIdentifier (ArServerClient *client, ArNetPacket *packet) |
| The command set the self identifier of this server client connection. | |
| void | netIdleProcessingPending (ArServerClient *client, ArNetPacket *packet) |
| callback for our slow idle thread, which is down below. | |
| bool | processFile (void) |
| void | slowIdleCallback (void) |
Protected Attributes | |
| ArSocket | myAcceptingSocket |
| std::string | myAdditionalDataFlags |
| std::list< ArServerClient * > | myAddList |
| ArMutex | myAddListMutex |
| bool | myAllowIdlePackets |
| bool | myAllowSlowPackets |
| ArFunctorC< ArServerBase > | myAriaExitCB |
| double | myBackupTimeout |
| std::list< ArFunctor1< ArServerClient * > * > | myClientRemovedCallbacks |
| std::list< ArServerClient * > | myClients |
| ArMutex | myClientsMutex |
| ArTypes::UByte4 | myConnectionNumber |
| std::list< ArFunctor * > | myCycleCallbacks |
| ArMutex | myCycleCallbacksMutex |
| std::map< unsigned int, ArServerData * > | myDataMap |
| ArMutex | myDataMutex |
| bool | myDebugLogging |
| ArRetFunctor2C< long, ArServerBase, unsigned int, bool > | myGetFrequencyCB |
| std::map< std::string, std::string > | myGroupDescription |
| our mapping of the group names | |
| bool | myHaveIdleCallbacks |
| bool | myHaveIdlePackets |
| bool | myHaveSlowPackets |
| ArFunctor2C< ArServerBase, ArServerClient *, ArNetPacket * > | myIdentGetConnectionIDCB |
| ArFunctor2C< ArServerBase, ArServerClient *, ArNetPacket * > | myIdentSetConnectionIDCB |
| ArFunctor2C< ArServerBase, ArServerClient *, ArNetPacket * > | myIdentSetHereGoalCB |
| ArFunctor2C< ArServerBase, ArServerClient *, ArNetPacket * > | myIdentSetSelfIdentifierCB |
| std::list< ArFunctor * > | myIdleCallbacks |
| ArMutex | myIdleCallbacksMutex |
| ArFunctor2C< ArServerBase, ArServerClient *, ArNetPacket * > | myIdleProcessingPendingCB |
| bool | myLastIdleProcessingPending |
| bool | myLogPasswordFailureVerbosely |
| std::string | myLogPrefix |
| unsigned int | myLoopMSecs |
| int | myMostClients |
| unsigned int | myNextDataNumber |
| int | myNumClients |
| bool | myOpened |
| std::string | myOpenOnIP |
| ArRetFunctorC< bool, ArServerBase > | myProcessFileCB |
| ArMutex | myProcessingSlowIdleMutex |
| ArFunctor2C< ArServerBase, ArNetPacket *, struct sockaddr_in * > | myProcessPacketCB |
| int | myRejecting |
| std::string | myRejectingString |
| std::set< ArServerClient * > | myRemoveSet |
| ArMutex | myRemoveSetMutex |
| ArRetFunctor2C< bool, ArServerBase, ArNetPacket *, struct sockaddr_in * > | mySendUdpCB |
| std::string | myServerKey |
| std::string | myServerName |
| SlowIdleThread * | mySlowIdleThread |
| bool | myTcpOnly |
| unsigned int | myTcpPort |
| ArSocket | myTcpSocket |
| unsigned int | myUdpPort |
| ArNetPacketReceiverUdp | myUdpReceiver |
| ArSocket | myUdpSocket |
| const ArServerUserInfo * | myUserInfo |
| ArLog::LogLevel | myVerboseLogLevel |
Friends | |
| class | ArServerBase::SlowIdleThread |
Classes | |
| class | SlowIdleThread |
| ArServerBase::ArServerBase | ( | bool | addAriaExitCB = true, |
|
| const char * | serverName = "", |
|||
| bool | addBackupTimeoutToConfig = true, |
|||
| const char * | backupTimeoutName = "RobotToClientTimeoutInMins", |
|||
| const char * | backupTimeoutDesc = "The amount of time the central server can go without sending a packet to the robot successfully (when there are packets to send). A number less than 0 means this won't happen. The time is in minutes but takes doubles (ie .5) (5 seconds is used if the value is positive, but less than that amount)", |
|||
| bool | masterServer = false, |
|||
| bool | slaveServer = false, |
|||
| bool | logPasswordFailureVerbosely = false, |
|||
| bool | allowSlowPackets = true, |
|||
| bool | allowIdlePackets = true | |||
| ) |
Constructor.
| addAriaExitCB | whether to add an exit callback to aria or not | |
| serverName | the name for logging | |
| addBackupTimeoutToConfig | whether to add the backup timeout (to clients of this server) as a config option, if this is true it sets a default value for the timeout of 2 minutes, if its false it has no timeout (but you can set one, |
| backupTimeoutName | the name of backup timeout | |
| backupTimeoutName | the description of backup timeout | |
| masterServer | If this is a master server (ie a central manager) | |
| slaveServer | If this is a slave server (ie a central forwarder) | |
| logPasswordFailureVerbosely | Whether we log password failure verbosely or not | |
| allowSlowPackets | Whether we allow slow packets (that go in their own thread) or not... if we don't then they're processed in the main thread like they have always been | |
| allowIdlePackets | Whether we allow idle packets (that go in their own thread and are processed only when the robot is idle) or not... if we don't then they're processed in the main thread like they have always been |
| ArServerBase::~ArServerBase | ( | ) | [virtual] |
Destructor.
| void ArServerBase::acceptTcpSockets | ( | void | ) | [protected] |
accepts new sockets and moves them into the client list
| void ArServerBase::addClientRemovedCallback | ( | ArFunctor1< ArServerClient * > * | functor | ) |
Add a callback to be invoked when a client has been removed (but before it is deleted).
Java Wrapper Library: Use ArFunctor_ServerClient instead of ArFunctor1<ArServerClient*> for functor.
| void ArServerBase::addCycleCallback | ( | ArFunctor * | functor | ) |
Add a callback to be called at every cycle.
| functor | Functor to add. |
| bool ArServerBase::addData | ( | const char * | name, | |
| const char * | description, | |||
| ArFunctor2< ArServerClient *, ArNetPacket * > * | functor, | |||
| const char * | argumentDescription, | |||
| const char * | returnDescription, | |||
| const char * | commandGroup = NULL, |
|||
| const char * | dataFlags = NULL | |||
| ) |
Adds a callback to be called when requests for some data are recieved.
| name | the name of the data | |
| description | the more verbose description of what the data is for | |
| functor | the functor to call when this data is requested | |
| argumentDescription | a description of the arguments expected | |
| returnDescription | a description of what the data returns | |
| commandGroup | the name of the group this command is in | |
| dataFlags | Most people won't need this, its for some advanced server things... this is a list of data flags separated by | characters, the flags are listed in ArClientData docs |
Python Wrapper Library: Pass the name of a function or a lambda expression for
| bool ArServerBase::addDataAdvanced | ( | const char * | name, | |
| const char * | description, | |||
| ArFunctor2< ArServerClient *, ArNetPacket * > * | functor, | |||
| const char * | argumentDescription, | |||
| const char * | returnDescription, | |||
| const char * | commandGroup = NULL, |
|||
| const char * | dataFlags = NULL, |
|||
| unsigned int | advancedCommandNumber = 0, |
|||
| ArFunctor2< long, unsigned int > * | requestChangedFunctor = NULL, |
|||
| ArFunctor2< ArServerClient *, ArNetPacket * > * | requestOnceFunctor = NULL | |||
| ) |
Adds a callback for requests in a more advanced manner, for internal use.
| advancedCommandNumber | 0 for most people... it is the optional number of the command, this is a very advanced option and is made for some server forwarding things so basically no one should use it, 0 means use the auto way... anything else does it manually... the number needs to be the same or higher as the next number available | |
| requestChangedFunctor | functor called with the lowest amount of time requested for this packet, called whenever the requests for the packet change, note that 0 and higher means thats how often it was asked for, -1 means something has requested the data but just when it is called, and -2 means that nothing wants the data | |
| requestOnceFunctor | functor called if this was a request once... with the server and client just like the normal functor, but its only called if its a request once, note that both are called (as long as they aren't NULL of course) |
| bool ArServerBase::addIdleSingleShotCallback | ( | ArFunctor * | functor | ) |
Adds an idle callback to be called once next time the robot is idle.
| bool ArServerBase::allowingIdlePackets | ( | void | ) |
Gets if we're allowing idle packets.
| bool ArServerBase::broadcastPacketTcp | ( | ArNetPacket * | packet, | |
| const char * | name | |||
| ) |
Broadcasts packets to any client wanting this data.
... this no longer excludes things because that doesn't work well with the central server, so use broadcastPacketTcpWithExclusion for that if you really want it...
| packet | the packet to send | |
| name | the type of data to send |
| bool ArServerBase::broadcastPacketTcpByCommand | ( | ArNetPacket * | packet, | |
| unsigned int | command | |||
| ) |
Broadcasts packets to any client wanting this data.
... this no longer excludes things because that doesn't work well with the central server, so use broadcastPacketTcpByCommandWithExclusion for that...
| packet | the packet to send | |
| command | the command number of the data to send |
| bool ArServerBase::broadcastPacketTcpByCommandWithExclusion | ( | ArNetPacket * | packet, | |
| unsigned int | command, | |||
| ArServerClient * | excludeClient, | |||
| bool | match = false, |
|||
| ArServerClientIdentifier | identifier = ArServerClientIdentifier(), |
|||
| bool | matchConnectionID = false | |||
| ) |
Broadcasts packets to any client wanting this data.
| packet | the packet to send | |
| command | the command number of the data to send | |
| excludeClient | don't send data to this client (NULL (the default) just ignores this feature) | |
| match | whether to match the identifier or not | |
| identifier | the identifier to match | |
| matchConnectionID | true to match the connection ID, false to match the other ID |
| bool ArServerBase::broadcastPacketTcpToMatching | ( | ArNetPacket * | packet, | |
| const char * | name, | |||
| ArServerClientIdentifier | identifier, | |||
| bool | matchConnectionID = false | |||
| ) |
Broadcasts packets to any client wanting this data that matches the ID.
...
| packet | the packet to send | |
| name | the type of data to send | |
| identifier | the identifier to match | |
| matchConnectionID | true to match the connection ID, false to match the other ID |
| bool ArServerBase::broadcastPacketTcpWithExclusion | ( | ArNetPacket * | packet, | |
| const char * | name, | |||
| ArServerClient * | excludeClient, | |||
| bool | match = false, |
|||
| ArServerClientIdentifier | identifier = ArServerClientIdentifier(), |
|||
| bool | matchConnectionID = false | |||
| ) |
Broadcasts packets to any client wanting this data.
| packet | the packet to send | |
| name | the type of data to send | |
| excludeClient | don't send data to this client (NULL (the default) just ignores this feature) | |
| match | whether to match the identifier or not | |
| identifier | the identifier to match | |
| matchConnectionID | true to match the connection ID, false to match the other ID |
| bool ArServerBase::broadcastPacketUdp | ( | ArNetPacket * | packet, | |
| const char * | name | |||
| ) |
Broadcasts packets to any client wanting this data.
... this no longer excludes things because that doesn't work well with the central server, so use broadcastPacketUdpWithExclusion for that if you really want to
| packet | the packet to send | |
| name | the type of data to send |
| bool ArServerBase::broadcastPacketUdpByCommand | ( | ArNetPacket * | packet, | |
| unsigned int | command | |||
| ) |
Broadcasts packets to any client wanting this data.
...
(To restrict what clients the command is sent to, use the broadcastPacketUdpByCommandWithExclusion() method.)
| packet | the packet to send | |
| command | the type of data to send |
| bool ArServerBase::broadcastPacketUdpByCommandWithExclusion | ( | ArNetPacket * | packet, | |
| unsigned int | command, | |||
| ArServerClient * | excludeClient, | |||
| bool | match = false, |
|||
| ArServerClientIdentifier | identifier = ArServerClientIdentifier(), |
|||
| bool | matchConnectionID = false | |||
| ) |
Broadcasts packets to any client wanting this data.
| packet | the packet to send | |
| command | the type of data to send | |
| excludeClient | don't send data to this client (NULL (the default) just ignores this feature) | |
| match | whether to match the identifier or not | |
| identifier | the identifier to match | |
| matchConnectionID | true to match the connection ID, false to match the other ID |
| bool ArServerBase::broadcastPacketUdpToMatching | ( | ArNetPacket * | packet, | |
| const char * | name, | |||
| ArServerClientIdentifier | identifier, | |||
| bool | matchConnectionID | |||
| ) |
Broadcasts packets to any client wanting this data that matches.
...
| packet | the packet to send | |
| name | the type of data to send | |
| identifier | the identifier to match | |
| matchConnectionID | true to match the connection ID, false to match the other ID |
| bool ArServerBase::broadcastPacketUdpWithExclusion | ( | ArNetPacket * | packet, | |
| const char * | name, | |||
| ArServerClient * | excludeClient, | |||
| bool | match = false, |
|||
| ArServerClientIdentifier | identifier = ArServerClientIdentifier(), |
|||
| bool | matchConnectionID = false | |||
| ) |
Broadcasts packets to any client wanting this data.
| packet | the packet to send | |
| name | the type of data to send | |
| excludeClient | don't send data to this client (NULL (the default) just ignores this feature) | |
| match | whether to match the identifier or not | |
| identifier | the identifier to match | |
| matchConnectionID | true to match the connection ID, false to match the other ID |
| void ArServerBase::close | ( | void | ) |
Closes the server.
MPL adding this since it looks like its leaked
| void ArServerBase::closeConnectionID | ( | ArTypes::UByte4 | idNum | ) |
Closes connection with a given connection ID.
| bool ArServerBase::dataHasFlag | ( | const char * | name, | |
| const char * | dataFlag | |||
| ) |
Returns if a command has a data flag.
| bool ArServerBase::dataHasFlagByCommand | ( | unsigned int | command, | |
| const char * | dataFlag | |||
| ) |
Returns if a command has a data flag by command number.
| unsigned int ArServerBase::findCommandFromName | ( | const char * | name | ) |
Gets the number of a command.
| name | Name is the name of the command number to be found |
| ArServerClient * ArServerBase::finishAcceptingSocket | ( | ArSocket * | socket, | |
| bool | skipPassword = false, |
|||
| bool | doNotReject = false | |||
| ) | [protected] |
Internal function for server/client switching.
| bool ArServerBase::getDebugLogging | ( | void | ) |
Gets if this is using debug logging.
| long ArServerBase::getFrequency | ( | unsigned int | command, | |
| bool | internalCall = false | |||
| ) |
Gets the frequncy a command is requested (mostly internal).
| command | the command number, you can use findCommandFromName | |
| internalCall | whether its an internal call or not (whether to lock or not) |
| int ArServerBase::getMostClients | ( | void | ) |
Gets the most clients we've had connected.
| int ArServerBase::getNumClients | ( | void | ) |
Gets the number of clients connected.
| const char * ArServerBase::getOpenOnIP | ( | void | ) |
Gets the IP we're opening on (or NULL if there's none).
| unsigned int ArServerBase::getTcpPort | ( | void | ) |
Gets the tcp port we're using.
| unsigned int ArServerBase::getUdpPort | ( | void | ) |
Gets the udp port we're using.
| const ArServerUserInfo * ArServerBase::getUserInfo | ( | void | ) | const |
Gets the user info we're using (mostly internal for switching).
| bool ArServerBase::hasIdleCallbacks | ( | void | ) |
Internal, Sees if we have any idle callbacks we are waiting to process.
| bool ArServerBase::hasIdlePackets | ( | void | ) |
Internal, Sees if we have any idle packets we are waiting to process.
| bool ArServerBase::hasSlowPackets | ( | void | ) |
Internal, Sees if we have any slow packets we are waiting to process.
| void ArServerBase::identGetConnectionID | ( | ArServerClient * | client, | |
| ArNetPacket * | packet | |||
| ) | [protected] |
The command get the ConnectionID of this server client connection.
| void ArServerBase::identSetConnectionID | ( | ArServerClient * | client, | |
| ArNetPacket * | packet | |||
| ) | [protected] |
The command set the ConnectionID of this server client connection.
| void ArServerBase::identSetHereGoal | ( | ArServerClient * | client, | |
| ArNetPacket * | packet | |||
| ) | [protected] |
The command set the here goal of this server client connection.
| void ArServerBase::identSetSelfIdentifier | ( | ArServerClient * | client, | |
| ArNetPacket * | packet | |||
| ) | [protected] |
The command set the self identifier of this server client connection.
| bool ArServerBase::idleProcessingPending | ( | void | ) |
Sees if we have any idle processing pending (idle packets or callbacks).
| bool ArServerBase::loadUserInfo | ( | const char * | fileName, | |
| const char * | baseDirectory = "" | |||
| ) |
Loads up a set of usernames/passwords/permissions from a file.
| void ArServerBase::logCommandGroups | ( | void | ) |
Logs the groups and commands in those groups.
It logs the command names first along with the list of commands in that group. Then it outputs a list of groups. Useful for building the user/pass file.
| void ArServerBase::logCommandGroupsToFile | ( | const char * | fileName | ) |
Logs the groups and commands in those groups to a file.
| void ArServerBase::logConnections | ( | const char * | prefix = "" |
) |
Logs the connections.
| void ArServerBase::logGroupDescriptions | ( | void | ) |
Logs the command group names and descriptions.
| void ArServerBase::logGroupDescriptionsToFile | ( | const char * | fileName | ) |
Logs the command group names and descriptions to a file.
| void ArServerBase::logTracking | ( | bool | terse = true |
) |
Logs the tracking on each client (how many packets and bytes were sent).
| void ArServerBase::logUserInfo | ( | void | ) |
Logs the users and their groups.
| void ArServerBase::loopOnce | ( | void | ) |
Runs the server loop once.
| ArServerClient * ArServerBase::makeNewServerClientFromSocket | ( | ArSocket * | socket, | |
| bool | doNotReject | |||
| ) |
Makes a new serverclient from this socket (for switching, needs no password since this was an outgoing connection to a trusted server).
| void ArServerBase::netIdleProcessingPending | ( | ArServerClient * | client, | |
| ArNetPacket * | packet | |||
| ) | [protected] |
callback for our slow idle thread, which is down below.
.. The command that returns if there is idle processing to do
| bool ArServerBase::open | ( | unsigned int | port, | |
| const char * | openOnIP = NULL, |
|||
| bool | tcpOnly = false | |||
| ) |
Opens the server to accept new client connections.
| port | the port to open the server on | |
| openOnIP | If not null, only listen on the local network interface with this address | |
| tcpOnly | If true, only accept TCP connections. If false, use both TCP and UDP communications with clients. |
| bool ArServerBase::processFile | ( | void | ) | [protected] |
| void ArServerBase::processPacket | ( | ArNetPacket * | packet, | |
| struct sockaddr_in * | sin | |||
| ) |
Processes udp packets.
| void ArServerBase::rejectSinceUsingCentralServer | ( | const char * | centralServerIPString | ) |
Tells the server to reject connectings because we're usinga central server.
| void ArServerBase::remClientRemovedCallback | ( | ArFunctor1< ArServerClient * > * | functor | ) |
Remove the callback invoked when a client has been removed.
Java Wrapper Library: Use ArFunctor_ServerClient instead of ArFunctor1<ArServerClient*> for functor.
| void ArServerBase::remCycleCallback | ( | ArFunctor * | functor | ) |
Remove a callback to be called at every cycle.
| functor | Functor to remove. If it's not currently in the cycle callback list, nothing is done. |
| void ArServerBase::resetTracking | ( | void | ) |
Clears the tracking on all the clients (resets counters).
| void ArServerBase::run | ( | void | ) | [virtual] |
| void ArServerBase::runAsync | ( | void | ) | [virtual] |
| void * ArServerBase::runThread | ( | void * | arg | ) | [virtual] |
Implements ArASyncTask.
| bool ArServerBase::sendUdp | ( | ArNetPacket * | packet, | |
| struct sockaddr_in * | sin | |||
| ) |
Sends Udp packets.
| void ArServerBase::setAdditionalDataFlags | ( | const char * | additionalDataFlags | ) |
Sets the data flags to add in addition to those passed in.
You can do multiple flags by separating them with a | character.
| void ArServerBase::setBackupTimeout | ( | double | timeoutInMins | ) |
Sets the backup timeout.
Less than 0 means this won't happen. If this is positive but less than 5 seconds then 5 seconds is used.
| void ArServerBase::setDebugLogging | ( | bool | debugLogging = false |
) |
Sets debug logging.
| void ArServerBase::setGroupDescription | ( | const char * | cmdGrpName, | |
| const char * | cmdGrpDesc | |||
| ) |
Logs the command group names and command group descriptions for those names.
/// Notes: /// / Revision History: /// WHEN WHO WHAT and/or WHY /// 17-Nov-2005 NJ Created this function. /// / =========================================================================///
| void ArServerBase::setServerKey | ( | const char * | serverKey | ) |
Sets a 'key' needed to access the server through any account.
.. this is NOT used if there is no user and password information.
| void ArServerBase::setUserInfo | ( | const ArServerUserInfo * | userInfo | ) |
Sets the user info we'll use (mostly internal for switching).
| void ArServerBase::slowIdleCallback | ( | void | ) | [protected] |
friend class ArServerBase::SlowIdleThread [friend] |
ArSocket ArServerBase::myAcceptingSocket [protected] |
std::string ArServerBase::myAdditionalDataFlags [protected] |
std::list<ArServerClient *> ArServerBase::myAddList [protected] |
ArMutex ArServerBase::myAddListMutex [protected] |
bool ArServerBase::myAllowIdlePackets [protected] |
bool ArServerBase::myAllowSlowPackets [protected] |
ArFunctorC<ArServerBase> ArServerBase::myAriaExitCB [protected] |
double ArServerBase::myBackupTimeout [protected] |
std::list<ArFunctor1<ArServerClient *> *> ArServerBase::myClientRemovedCallbacks [protected] |
std::list<ArServerClient *> ArServerBase::myClients [protected] |
ArMutex ArServerBase::myClientsMutex [protected] |
ArTypes::UByte4 ArServerBase::myConnectionNumber [protected] |
std::list<ArFunctor*> ArServerBase::myCycleCallbacks [protected] |
ArMutex ArServerBase::myCycleCallbacksMutex [protected] |
std::map<unsigned int, ArServerData *> ArServerBase::myDataMap [protected] |
ArMutex ArServerBase::myDataMutex [protected] |
bool ArServerBase::myDebugLogging [protected] |
ArRetFunctor2C<long, ArServerBase, unsigned int, bool> ArServerBase::myGetFrequencyCB [protected] |
std::map<std::string, std::string> ArServerBase::myGroupDescription [protected] |
our mapping of the group names
bool ArServerBase::myHaveIdleCallbacks [protected] |
bool ArServerBase::myHaveIdlePackets [protected] |
bool ArServerBase::myHaveSlowPackets [protected] |
ArFunctor2C<ArServerBase, ArServerClient *, ArNetPacket *> ArServerBase::myIdentGetConnectionIDCB [protected] |
ArFunctor2C<ArServerBase, ArServerClient *, ArNetPacket *> ArServerBase::myIdentSetConnectionIDCB [protected] |
ArFunctor2C<ArServerBase, ArServerClient *, ArNetPacket *> ArServerBase::myIdentSetHereGoalCB [protected] |
ArFunctor2C<ArServerBase, ArServerClient *, ArNetPacket *> ArServerBase::myIdentSetSelfIdentifierCB [protected] |
std::list<ArFunctor *> ArServerBase::myIdleCallbacks [protected] |
ArMutex ArServerBase::myIdleCallbacksMutex [protected] |
ArFunctor2C<ArServerBase, ArServerClient *, ArNetPacket *> ArServerBase::myIdleProcessingPendingCB [protected] |
bool ArServerBase::myLastIdleProcessingPending [protected] |
bool ArServerBase::myLogPasswordFailureVerbosely [protected] |
std::string ArServerBase::myLogPrefix [protected] |
unsigned int ArServerBase::myLoopMSecs [protected] |
int ArServerBase::myMostClients [protected] |
unsigned int ArServerBase::myNextDataNumber [protected] |
int ArServerBase::myNumClients [protected] |
bool ArServerBase::myOpened [protected] |
std::string ArServerBase::myOpenOnIP [protected] |
ArRetFunctorC<bool, ArServerBase> ArServerBase::myProcessFileCB [protected] |
ArMutex ArServerBase::myProcessingSlowIdleMutex [protected] |
ArFunctor2C<ArServerBase, ArNetPacket *, struct sockaddr_in *> ArServerBase::myProcessPacketCB [protected] |
int ArServerBase::myRejecting [protected] |
std::string ArServerBase::myRejectingString [protected] |
std::set<ArServerClient *> ArServerBase::myRemoveSet [protected] |
ArMutex ArServerBase::myRemoveSetMutex [protected] |
ArRetFunctor2C<bool, ArServerBase, ArNetPacket *, struct sockaddr_in *> ArServerBase::mySendUdpCB [protected] |
std::string ArServerBase::myServerKey [protected] |
std::string ArServerBase::myServerName [protected] |
SlowIdleThread* ArServerBase::mySlowIdleThread [protected] |
bool ArServerBase::myTcpOnly [protected] |
unsigned int ArServerBase::myTcpPort [protected] |
ArSocket ArServerBase::myTcpSocket [protected] |
unsigned int ArServerBase::myUdpPort [protected] |
ArNetPacketReceiverUdp ArServerBase::myUdpReceiver [protected] |
ArSocket ArServerBase::myUdpSocket [protected] |
const ArServerUserInfo* ArServerBase::myUserInfo [protected] |
ArLog::LogLevel ArServerBase::myVerboseLogLevel [protected] |
1.4.7