Function List
From PX Documentation
Contents |
Client Functions
Events/EventQueue
| Function | Description | Arguments |
| void NDEventLoop | Processes incoming/outgoing events | void |
| const char* NDGetEventName | Retrieves event name based on given event type | int eventType int channelID |
| int NDInstallEventType | Creates event type | int typeID NDEventCallback execCallback NDValidationCallback validateCallback char* name int flags int channelID |
Objects
| Function | Description | Arguments |
| int NDInstallObjectType | Creates new object type | int objectType int objectSize const char *typeName NDObjectCallback createObjectCB NDValidationCallback createObjectValidationCB NDObjectCallback deleteObjectCB NDValidationCallback deleteObjectValidationCB NDObjectCallback updateObjectCB NDValidationCallback updateObjectValidationCB int channelID |
| int NDRegisterField | Registers a field of an object, and informs system how, if at all, the field will be updated with callback | int objectType int fieldID int fieldType int size int offset int flags NDOFieldChangedCallback callback char* fieldName int channelID |
Per-Zone Object Model Functions
| Function | Description | Arguments |
| int NDCreateObject | Creates new object with type type assigned to channelID | int type, void* obj, int ownerID, int groupID, int flags, NDZoneRef zoneRef |
| int NDDeleteObject | Deletes given object on given channel | NDObjectID objectID |
| int NDBeginObjectUpdate | Necessary for ND to optimize the transmission of multiple updated fields over the network | NDZoneRef zoneRef |
| int NDEndObjectUpdate | Necessary for ND to optimize the transmission of multiple updated fields over the network | NDZoneRef zoneRef |
| int NDUpdateObjectField | Informs system which field of object is being updated | NDObjectID objectID, int fieldID |
Object Manager
| Function | Description | Arguments |
| int NDOGetNumObjects | Determines number of objects within the zoneRef | NDZoneRef zoneRef |
| int NDOObjectExists | Checks whether given object exists | NDObjectID objID |
| NDObjectID NDOGetNextObjectID | Retrieves next object in list within given zone | const NDObjectID lastID = NDObjectIDDefault NDZoneRef zoneRef = NDDefaultZone |
| void* NDOGetByID | Retreives objects by id from channel | NDObjectID id int* type |
| void* NDOGetByType | Gets object by type | int objectType int local int instanceNum NDZoneRef zoneRef |
| void* NDOGetByTypeID | Retrieves objects by id from channel, but only if the object has the proper type | int type NDObjectID id |
| void* NDOSearchByID | Retrieves object and ZoneRef for given object ID | const NDObjectID objID int* type NDZoneRef* zoneRef |
| const char* NDOGetTypeName | Returns name of an object type | int type NDZoneRef zoneRef |
| int NDObjectIDEqual | Checks whether given NDObjects are equal | const NDObjectID a const NDObjectID b |
EventData Accessors
| Function | Description | Arguments |
| void* NDEventDataGetUserEvent | Retrieves user event data from given event | NDEventData eventData |
| int NDEventDataGetChannelID | Retrieves channel ID data from given event | NDEventData eventData |
| int NDEventDataGetConnID | Retrieves connection ID data from given event | NDEventData eventData |
| int NDEventDataGetFlags | Retrieves flags for specified ND event | NDEventData eventData |
| int NDEventDataGetEventType | Retrieves event type data from given event | NDEventData eventData |
| int NDEventDataGetTime | Retrieves time data from given event | NDEventData eventData |
| int NDEventDataGetOriginID | Retrieves origin ID data from given event | NDEventData eventData |
| NDZoneRef NDEventDataGetSourceZone | Retrieves source zone for specified Event | NDEventData eventData |
| NDZoneRef NDEventDataGetZone | Updates a field for a given object | NDEventData eventData |
| NDEventData NDEventDataGetObjectID | Returns ID for a given object | NDEventData eventData |
| int NDEventDataGetFieldID | Returns field ID for a given object | NDEventData eventData |
| void* NDEventDataGetFieldData | Returns field data for a given object | NDEventData eventData |
| int NDEventDataSetFieldData | Updates a field for a given object | NDEventData eventData, void* newData |
| int NDEventDataIsInterpolated | Returns whether data for a specific event is interpolated | NDEventData eventData |
Validation Callback Accessors
| Function | Description | Arguments |
| int NDEventDataSetAllIDsValid | Validates all IDs for given event | NDEventData eventData |
| int NDEventDataSetAllIDsInvalid | Invalidates all IDs for given event | NDEventData eventData |
| int NDEventDataSetIDValid | Validates a single ID for the given event | NDEventData eventData int ownerID |
| int NDEventDataSetIDInvalid | Invalidates a single ID for the given event | NDEventData eventData int ownerID |
| int NDEventDataGetNextValidID | Used as an interator, returns the next valid ID in the list of valid IDs for the given event | NDEventData eventData |
| int NDEventDataGetNextValidIDReset | Used to reset the iterator over the list of valid IDs to the beginning | NDEventData eventData |
ObjectData Accessors
| Function | Description | Arguments |
| int NDEventDataGetObjectType | Returns object type for a given object | NDEventData eventData |
| void* NDEventDataGetObject | Retrieves object involved in specified Event | NDEventData eventData |
Server Functions
Zones
| Function | Description | Arguments |
| NDZoneRef NDGetDefaultZone | Gets a reference to the current default zone | int channelID |
| int NDGetZoneIDByLocalRef | Retrieves Zone ID for specified zoneRef | NDZoneRef zoneRef |
| int NDConnGetZoneID | Retrieves Zone ID for specified connID | int connID |
| NDZoneRef NDGetZoneLocalRefById | Retrieves zoneRef for specified Zone ID | int zoneID |
| int NDConnectUserToZone | Connects new user to given zone | int newZoneID int ownerID NDObjectID objID int flags = NDEventTransferToZoneFlags::defaults |
| int NDOTransferToZone | Transfers given object to specified new zone | int newZoneID const NDObjectID objID |
Tracker
| Function | Description | Arguments |
| int NDTInitTrackerServer | Creates Tracker server on specified port, creating connections for ND clients and servers | int port NDAuthorizationCallback authCB = NULL NDZoneCreationCallback zoneCB = NULL |
| int NDTGetTrackerChannel | Retrieves the Tracker's channel | void |
| int NDTShutdownTracker | Shuts down the tracker | void |
Database
| Function | Description | Arguments |
| int NDDBGetFieldData | Retrieves specified data field from NDQueryRef q | NDQueryRef q int row int col void **data int *dataSize |
| Void NDDBGetUserData | Retreives data associated with this database as stored by user | NDDBRef db |
| Void NDDBSetUserData | Sets data associated with this database | NDDBRef db, void* data |
| int NDDBInstallModule | Installs database modules, used when installing non-ODBC custom database | NDDatabaseCallback readHandler NDDatabaseCallback writeHandler NDDatabaseCallback openHandler NDDatabaseCallback closeHandler |
| void NDDBStoreQuery | Sends query to database, used with UPDATE functions | void *queryString NDDBRef db const NDObjectID objectId = NDObjectIDDefault int zoneId = -1 |
| NDQueryRef NDDBLoadQuery | Sends query to database, used with SELECT functions | void *queryString NDDBRef db const NDObjectID objectId = NDObjectIDDefault int zoneId = -1 |
| NDDBRef NDDBOpen | Opens database connection using installed database callback function, used when creating non-ODBC custom database modules | void *query |
| void NDDBClose | Closes database connection using installed database callback function, used when creating non-ODBC custom database modules | NDDBRef db, void *query |
| Void NDDBFreeQuery | Frees memory from NDQueryRef q | NDQueryRef q |
| int NDDBReportResult | Appends additional records to query results | NDQueryRef q void *resultPtr int resultSize int resultIndex int resultType = 0 |
SimData Accessors
| Function | Description | Arguments |
| int NDSimDataGetChannelID | Retrieves channel ID for simulation specified data | NDSimData simData |
| long NDSimDataGetUniverseTime | Retrieves Universe time for specified simulation data packet | NDSimData simData |
| long NDSimDataGetLastSimTime | Retrieves last simulation time for specified simulation data packet | NDSimData simData |
| int NDInstallSimulationCallback | Installs callback function for simulations | NDSimulationCallback callback int channelID = -1 |
Core Networking Functions
| Function | Description | Arguments |
| int NDSendEvent | Sends specified event to channel - used for networking game events | void* usrEvent int type int size int ownerID int channelID |
Conn
| Function | Description | Arguments |
| int NDConnIsStarted | Retrieves state of passed connection – returning TRUE if connection is started | int connID |
| int NDConnIsClosed | Retrieves state of passed connection – returning TRUE if connection is closed | int connID |
| NDRole::Type NDConnGetLocalRole | Retrieves role for the local side of the specified connection | int connID |
| NDRole::Type NDConnGetRemoteRole | Retrieves role for the remote side of the specified connection | int connID |
| int NDConnGetRemoteOwnerID | Retrieves connection remote ID for passed connection | int connID |
| int NDConnGetFlags | Retrieves all set flags for passed connection | int connID |
| int NDConnClose | Closes the specified connection | int connID |
| int NDConnExists | Determines whether the specified connection exists | int connID |
| int NDConnGetLocalOwnerID | Retrieves local owner ID | int connID |
| void NDConnSetLocalOwnerID | Sets local owner ID | int connID int ownerID |
| int NDConnSetTimeout | Sets how long a connection can be idle before termination | int connID long t |
| void* NDConnGetUserData | Retreives data associated with this connection as stored by user | int connID |
| void NDConnSetUserData | Sets data associated with this connection | int connID void* data |
| const sockaddr_in* NDConnGetRemoteAddr | Gets remote address for connection | int connID |
| int NDCreateClientConn | Creates Client connection in channelID, mapping to server IP, server Port and passing key and server Owner ID | char* serverIP int serverPort int flags char* userName char* passwd int channelID |
| int NDCreateServerConn | Creates Server connection in channelID, opening listening port, and searching for client IP, client Port and passing key and server Owner ID | int listenPort int flags NDAuthorizationCallback authCB char* trackerIP int trackerPort char* userName char* passwd int channelID |
| int NDSetCullingData | Sets the culling distance for the specified object | NDObjectID ourObjID float cullingDistance int channelID |
Channel: Connections
| Function | Description | Arguments |
| void NDCloseAllConns | Closes all activity on channelID | int channelID |
| int NDGetNumConns | Counts number of connections for channelID | int channelID |
| int NDGetNumClients | Retrieves number of clients assigned to channelID | int channelID |
| int NDGetNumServers | Retrieves number of servers assigned to channelID | int channelID |
| int NDGetConnByOwnerID | Retrieves connections in channelID by owner ID | int ownerIDRemote int channelID |
| int NDGetClientConnByOwnerID | Retrieves client connections in channelID by owner ID | int ownerIDRemote int channelID |
| int NDGetServerConnByOwnerID | Retrieves server connections in channelID by owner ID | int ownerIDRemote int channelID |
| int NDSetConnectTimeout | Sets the global connect timeout in ms | int t |
Channel
| Function | Description | Arguments |
| const char *NDChannelGetDescription | Retrieves channel description by channelID | int channelID |
| void NDChannelSetDescription | Sets string character description for channelID | char *desc int channelID |
| int NDChannelGetOwnerID | Retrieves owner ID for channelID | int channelID |
| void NDChannelSetOwnerID | Sets owner ID for channelID | int id int channelID |
| void NDChannelSetRole | Sets role for channelID | NDRole::Type role int channelID |
| NDRole::Type NDChannelGetRole | Retrieves role by channelID | int channelID |
| int NDChannelExists | Checks whether channel exists | int channelID |
| int NDChannelGetAddr | Retrieves socket address for channelID in user-defined event data | sockaddr_in *a int channelID |
| int NDCreateChannel | Creates new Channel | NDRole::Type role int port int flags char *desc |
| int NDGetChannelByConnID | Retreives all channels for specified connection ID | int connID |
| int NDGetDefaultChannel | Retrieves current default channel ID | void |
| int NDSetDefaultChannel | Sets default channel to new channel ID | int channelID |
Sessions
| Function | Description | Arguments |
| void NDStartSession | Starts session assigned to channelID | int channelID |
| void NDEndSession | Ends session | int channelID |
| long NDGetUniverseTime | Retrieves universe time for specified channel | int channelID |
Utility Functions
Debug
| Function | Description | Arguments |
| void NDDefaultDebugCallback | Default debug behavior | char* msg |
| void NDSetDebugCallback | Allows to overwrite debug function calls | NDDebugCallback cb |
| void NDSetDebugLevel | Sets debug level | int level |
| int NDGetDebugLevel | Gets current debug level | void |
| void NDSetNetDebug | Sets net debug level | int b |
| int NDGetNetDebug | Gets net debug level | void |
| void NDSetKeepAliveDebug | Specifies whether keepAlive events should be displayed in the debug console | int b |
Miscellaneous Utility Functions
| Function | Description | Arguments |
| long NDTime | Returns the number of seconds since the epoch (1/1/1970) | void |
| long NDTimeMS | Returns the number of milliseconds since ND was intialized. WARNING: Not interchangeable with NDGetUniverseTime. | void |
| void NDSleepMS | Sleeps NetDog for ms number of milliseconds | long ms |
| int NDRandom | Returns a random number between 0 and max-1 | int max |
| int NDSeedRandom | Seeds the random number generator. Requires high-entropy data as input. Len specifies length of data. | const char* data int len |
| int NDInstallSignalHandler | Installs a signal handler in an ND-friendly way. Currently, only SIGINT is supported. | int signal NDSignalHandler handler |
| int NDShutdown | Cleanly shuts down ND, closing connections and freeing memory. | void |
- Note - depending on license, not all functions will be available, please contact support@netdognetworks.com if you have any questions.
