Function List

From PX Documentation

Jump to: navigation, search

Contents

Client Functions

Events/EventQueue

Function Description Arguments
void NDEventLoop Processes incoming/outgoing eventsvoid
const char* NDGetEventNameRetrieves event name based on given event typeint eventType
int channelID
int NDInstallEventTypeCreates event typeint typeID
NDEventCallback execCallback
NDValidationCallback validateCallback
char* name
int flags
int channelID

Objects

Function Description Arguments
int NDInstallObjectTypeCreates new object typeint objectType
int objectSize
const char *typeName
NDObjectCallback createObjectCB
NDValidationCallback createObjectValidationCB
NDObjectCallback deleteObjectCB
NDValidationCallback deleteObjectValidationCB
NDObjectCallback updateObjectCB
NDValidationCallback updateObjectValidationCB
int channelID
int NDRegisterFieldRegisters a field of an object, and informs system how, if at all, the field will be updated with callbackint 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 NDCreateObjectCreates new object with type type assigned to channelIDint type,
void* obj,
int ownerID,
int groupID,
int flags,
NDZoneRef zoneRef
int NDDeleteObjectDeletes given object on given channelNDObjectID objectID
int NDBeginObjectUpdateNecessary for ND to optimize the transmission of multiple updated fields over the networkNDZoneRef zoneRef
int NDEndObjectUpdateNecessary for ND to optimize the transmission of multiple updated fields over the networkNDZoneRef zoneRef
int NDUpdateObjectFieldInforms system which field of object is being updatedNDObjectID objectID,
int fieldID

Object Manager

Function Description Arguments
int NDOGetNumObjectsDetermines number of objects within the zoneRef NDZoneRef zoneRef
int NDOObjectExists Checks whether given object existsNDObjectID objID
NDObjectID NDOGetNextObjectID Retrieves next object in list within given zoneconst NDObjectID lastID = NDObjectIDDefault
NDZoneRef zoneRef = NDDefaultZone
void* NDOGetByIDRetreives objects by id from channelNDObjectID id
int* type
void* NDOGetByTypeGets object by typeint objectType
int local
int instanceNum
NDZoneRef zoneRef
void* NDOGetByTypeIDRetrieves objects by id from channel, but only if the object has the proper typeint type
NDObjectID id
void* NDOSearchByID Retrieves object and ZoneRef for given object IDconst NDObjectID objID
int* type
NDZoneRef* zoneRef
const char* NDOGetTypeNameReturns name of an object typeint type
NDZoneRef zoneRef
int NDObjectIDEqual Checks whether given NDObjects are equalconst NDObjectID a
const NDObjectID b

EventData Accessors

Function Description Arguments
void* NDEventDataGetUserEventRetrieves user event data from given eventNDEventData eventData
int NDEventDataGetChannelIDRetrieves channel ID data from given eventNDEventData eventData
int NDEventDataGetConnIDRetrieves connection ID data from given eventNDEventData eventData
int NDEventDataGetFlags Retrieves flags for specified ND eventNDEventData eventData
int NDEventDataGetEventTypeRetrieves event type data from given eventNDEventData eventData
int NDEventDataGetTimeRetrieves time data from given eventNDEventData eventData
int NDEventDataGetOriginIDRetrieves origin ID data from given eventNDEventData eventData
NDZoneRef NDEventDataGetSourceZone Retrieves source zone for specified EventNDEventData eventData
NDZoneRef NDEventDataGetZoneUpdates a field for a given objectNDEventData eventData
NDEventData NDEventDataGetObjectIDReturns ID for a given objectNDEventData eventData
int NDEventDataGetFieldIDReturns field ID for a given objectNDEventData eventData
void* NDEventDataGetFieldDataReturns field data for a given objectNDEventData eventData
int NDEventDataSetFieldDataUpdates a field for a given objectNDEventData eventData, void* newData
int NDEventDataIsInterpolated Returns whether data for a specific event is interpolatedNDEventData eventData

Validation Callback Accessors

Function Description Arguments
int NDEventDataSetAllIDsValidValidates all IDs for given eventNDEventData eventData
int NDEventDataSetAllIDsInvalidInvalidates all IDs for given eventNDEventData eventData
int NDEventDataSetIDValidValidates a single ID for the given eventNDEventData eventData
int ownerID
int NDEventDataSetIDInvalidInvalidates a single ID for the given eventNDEventData eventData
int ownerID
int NDEventDataGetNextValidIDUsed as an interator, returns the next valid ID in the list of valid IDs for the given eventNDEventData eventData
int NDEventDataGetNextValidIDResetUsed to reset the iterator over the list of valid IDs to the beginningNDEventData eventData

ObjectData Accessors

Function Description Arguments
int NDEventDataGetObjectTypeReturns object type for a given objectNDEventData eventData
void* NDEventDataGetObject Retrieves object involved in specified EventNDEventData eventData


Server Functions

Zones

Function Description Arguments
NDZoneRef NDGetDefaultZoneGets a reference to the current default zoneint channelID
int NDGetZoneIDByLocalRef Retrieves Zone ID for specified zoneRefNDZoneRef zoneRef
int NDConnGetZoneID Retrieves Zone ID for specified connIDint connID
NDZoneRef NDGetZoneLocalRefById Retrieves zoneRef for specified Zone IDint zoneID
int NDConnectUserToZone Connects new user to given zoneint newZoneID
int ownerID
NDObjectID objID
int flags = NDEventTransferToZoneFlags::defaults
int NDOTransferToZone Transfers given object to specified new zoneint newZoneID
const NDObjectID objID


Tracker

Function Description Arguments
int NDTInitTrackerServer Creates Tracker server on specified port, creating connections for ND clients and serversint port
NDAuthorizationCallback authCB = NULL
NDZoneCreationCallback zoneCB = NULL
int NDTGetTrackerChannel Retrieves the Tracker's channelvoid
int NDTShutdownTracker Shuts down the trackervoid

Database

Function Description Arguments
int NDDBGetFieldData Retrieves specified data field from NDQueryRef qNDQueryRef q
int row
int col
void **data
int *dataSize
Void NDDBGetUserData Retreives data associated with this database as stored by userNDDBRef db
Void NDDBSetUserData Sets data associated with this databaseNDDBRef db, void* data
int NDDBInstallModule Installs database modules, used when installing non-ODBC custom databaseNDDatabaseCallback readHandler
NDDatabaseCallback writeHandler
NDDatabaseCallback openHandler
NDDatabaseCallback closeHandler
void NDDBStoreQuery Sends query to database, used with UPDATE functionsvoid *queryString
NDDBRef db
const NDObjectID objectId = NDObjectIDDefault
int zoneId = -1
NDQueryRef NDDBLoadQuery Sends query to database, used with SELECT functionsvoid *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 modulesvoid *query
void NDDBClose Closes database connection using installed database callback function, used when creating non-ODBC custom database modulesNDDBRef db, void *query
Void NDDBFreeQuery Frees memory from NDQueryRef qNDQueryRef q
int NDDBReportResult Appends additional records to query resultsNDQueryRef q
void *resultPtr
int resultSize
int resultIndex
int resultType = 0

SimData Accessors

Function Description Arguments
int NDSimDataGetChannelIDRetrieves channel ID for simulation specified dataNDSimData simData
long NDSimDataGetUniverseTimeRetrieves Universe time for specified simulation data packetNDSimData simData
long NDSimDataGetLastSimTimeRetrieves last simulation time for specified simulation data packetNDSimData simData
int NDInstallSimulationCallbackInstalls callback function for simulationsNDSimulationCallback callback
int channelID = -1


Core Networking Functions

Function Description Arguments
int NDSendEventSends specified event to channel - used for networking game eventsvoid* usrEvent
int type
int size
int ownerID
int channelID

Conn

Function Description Arguments
int NDConnIsStartedRetrieves state of passed connection – returning TRUE if connection is startedint connID
int NDConnIsClosedRetrieves state of passed connection – returning TRUE if connection is closedint connID
NDRole::Type NDConnGetLocalRoleRetrieves role for the local side of the specified connectionint connID
NDRole::Type NDConnGetRemoteRoleRetrieves role for the remote side of the specified connectionint connID
int NDConnGetRemoteOwnerIDRetrieves connection remote ID for passed connectionint connID
int NDConnGetFlagsRetrieves all set flags for passed connectionint connID
int NDConnCloseCloses the specified connectionint connID
int NDConnExistsDetermines whether the specified connection existsint connID
int NDConnGetLocalOwnerIDRetrieves local owner IDint connID
void NDConnSetLocalOwnerIDSets local owner IDint connID
int ownerID
int NDConnSetTimeoutSets how long a connection can be idle before terminationint connID
long t
void* NDConnGetUserDataRetreives data associated with this connection as stored by userint connID
void NDConnSetUserDataSets data associated with this connectionint connID
void* data
const sockaddr_in* NDConnGetRemoteAddrGets remote address for connectionint connID
int NDCreateClientConnCreates 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 NDCreateServerConnCreates 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 NDSetCullingDataSets the culling distance for the specified objectNDObjectID ourObjID
float cullingDistance
int channelID

Channel: Connections

Function Description Arguments
void NDCloseAllConnsCloses all activity on channelIDint channelID
int NDGetNumConnsCounts number of connections for channelIDint channelID
int NDGetNumClientsRetrieves number of clients assigned to channelIDint channelID
int NDGetNumServersRetrieves number of servers assigned to channelIDint channelID
int NDGetConnByOwnerIDRetrieves connections in channelID by owner IDint ownerIDRemote
int channelID
int NDGetClientConnByOwnerIDRetrieves client connections in channelID by owner IDint ownerIDRemote
int channelID
int NDGetServerConnByOwnerIDRetrieves server connections in channelID by owner IDint ownerIDRemote
int channelID
int NDSetConnectTimeoutSets the global connect timeout in msint t

Channel

Function Description Arguments
const char *NDChannelGetDescriptionRetrieves channel description by channelIDint channelID
void NDChannelSetDescriptionSets string character description for channelIDchar *desc
int channelID
int NDChannelGetOwnerIDRetrieves owner ID for channelIDint channelID
void NDChannelSetOwnerIDSets owner ID for channelIDint id
int channelID
void NDChannelSetRoleSets role for channelIDNDRole::Type role
int channelID
NDRole::Type NDChannelGetRoleRetrieves role by channelIDint channelID
int NDChannelExistsChecks whether channel existsint channelID
int NDChannelGetAddrRetrieves socket address for channelID in user-defined event datasockaddr_in *a
int channelID
int NDCreateChannelCreates new ChannelNDRole::Type role
int port
int flags
char *desc
int NDGetChannelByConnIDRetreives all channels for specified connection IDint connID
int NDGetDefaultChannelRetrieves current default channel IDvoid
int NDSetDefaultChannelSets default channel to new channel IDint channelID

Sessions

Function Description Arguments
void NDStartSessionStarts session assigned to channelIDint channelID
void NDEndSessionEnds sessionint channelID
long NDGetUniverseTimeRetrieves universe time for specified channelint channelID

Utility Functions

Debug

Function Description Arguments
void NDDefaultDebugCallbackDefault debug behaviorchar* msg
void NDSetDebugCallbackAllows to overwrite debug function callsNDDebugCallback cb
void NDSetDebugLevelSets debug levelint level
int NDGetDebugLevelGets current debug levelvoid
void NDSetNetDebugSets net debug levelint b
int NDGetNetDebugGets net debug levelvoid
void NDSetKeepAliveDebugSpecifies whether keepAlive events should be displayed in the debug consoleint b

Miscellaneous Utility Functions

Function Description Arguments
long NDTimeReturns the number of seconds since the epoch (1/1/1970)void
long NDTimeMSReturns the number of milliseconds since ND was intialized. WARNING: Not interchangeable with NDGetUniverseTime.void
void NDSleepMSSleeps NetDog for ms number of millisecondslong ms
int NDRandomReturns a random number between 0 and max-1int max
int NDSeedRandomSeeds the random number generator. Requires high-entropy data as input. Len specifies length of data.const char* data
int len
int NDInstallSignalHandlerInstalls a signal handler in an ND-friendly way. Currently, only SIGINT is supported.int signal
NDSignalHandler handler
int NDShutdownCleanly 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.
Personal tools