NetDog Communications Channel. More...
Public Member Functions | |
| NDChannel (void *) | |
| Constructor, do not call this directly; use NDCore::createChannel instead. | |
| ~NDChannel () | |
| Destructor, call this to shut down an entire channel. | |
| NDChannelID | getChannelID (void) |
| Returns the channelID associated with this channel. | |
| NDResult | loginToHost (NDCore::SocketType stype, NDSocketAddress *sa, const char *username, const char *password, NDConn **c=NULL, const char *remote_key_file=NULL) |
| Create an authenticated connection to a remote host via UDP or TCP. | |
| NDResult | becomeLoginAcceptor (NDLoginCallback *cback) |
| Allow channel to accept new connections. | |
| NDResult | registerEventType (NDEvent::Type evt_type, const char *evt_name, NDEventCallback *callback) |
| Registers a new event type. | |
| NDEvent * | createEvent (NDEvent::Type evt_type, uint32_t evt_size) |
| Creates a new event object. | |
| NDIdentity | getLocalIdentity (void) |
| Returns the local node's identity record. | |
| NDResult | setLocalIdentity (const NDIdentity &id) |
| Sets the local node's identity record. | |
| NDResult | generateLocalKeys (uint32_t bits) |
| Generates public-private keypairs for use in encryption. | |
| NDResult | saveLocalKeys (const char *pub_file_name, const char *priv_file_name) |
| Saves previously generated public-private keypairs into files. | |
| NDResult | loadLocalKeys (const char *pub_file_name, const char *priv_file_name) |
| Loads public-private keypair from files into this channel. | |
| NDResult | registerRpcHandler (int32_t proc_id, NDRpcHandler *srv) |
| Registers a RPC handler. | |
| NDRpcRequest * | createRpcRequest (NDNodeID srv_node, int32_t proc_id, uint32_t req_size) |
| Creates a new RPC request object. | |
| NDTimeValue | getUniverseTime (void) |
| Gets miliseconds since the start of the virtual universe. | |
| NDResult | setUniverseTime (NDTimeValue t) |
| Sets miliseconds since the start of the virtual universe. | |
| NDResult | registerObjectHandler (NDObjectHandler *ohan) |
| Registers object callback handler. | |
| NDResult | becomeObjectAuthority (NDObjectAuthority *oauth) |
| Promotes this channel to an object authority and registers object authority handler. | |
| NDResult | setObjectUpdatePeriod (NDTimeValue period) |
| Sets automated object update period. | |
| NDResult | sendObjectUpdates (void) |
| Sends object updates. | |
| NDObject * | createObject (NDObjectType otype) |
| Creates a new local object. | |
| NDObject * | getUserObject (void) |
| Gets the object associated with our user, e.g. the object for our own player, etc. | |
| NDObject * | getObjectByID (NDObjectID objid, bool request_from_server=false) |
| Looks up an object by its objectID, fetching the object from the server if necessary (and desired). | |
| NDResult | flushObject (NDObject *obj) |
| Immediately propogates all local modifications to this object over the network. | |
| NDResult | deleteObject (NDObject *obj) |
| Deletes the specified object. | |
| NDResult | getObjectIDList (NDObjectID **obj_list, uint32_t *num_objs) |
| Gets a list of IDs of all objects in this channel. | |
Public Attributes | |
| void * | _ndchannel |
A single NDChannel represents a link to a single NetDog network, and consists of one or more NDConn connections. (Technically, there may not be any connections, e.g. for a server just after startup.)
| NDChannel::NDChannel | ( | void * | ptr | ) |
Constructor, do not call this directly; use NDCore::createChannel instead
| NDChannel::~NDChannel | ( | ) |
Destructor, call this to shut down an entire channel
| NDResult NDChannel::becomeLoginAcceptor | ( | NDLoginCallback * | cback | ) |
This allows the node to accept new connection that require authentication.
| cback | This is a pointer to a NDLoginCallback object. This objects handleLoginCallback() will be called to handle authentication for incomming connections. |
| NDResult NDChannel::becomeObjectAuthority | ( | NDObjectAuthority * | oauth | ) |
| *oauth | NDObjectAuthority callback object |
| NDEvent * NDChannel::createEvent | ( | NDEvent::Type | evt_type, | |
| uint32_t | evt_size | |||
| ) |
| NDObject * NDChannel::createObject | ( | NDObjectType | otype | ) |
Creates a new local object. The object is "empty" until attributes (fields) have been written into it. The object is local (visible only to this client (or server)) until publish() has been called on it.
| otype | the object type for this object |
| NDRpcRequest * NDChannel::createRpcRequest | ( | NDNodeID | srv_node, | |
| int32_t | proc_id, | |||
| uint32_t | req_size | |||
| ) |
When performing an RPC request, you must...
| srv_node | ||
| proc_id | ||
| req_size |
| NDResult NDChannel::deleteObject | ( | NDObject * | obj | ) |
Deletes the specified object locally and from the server and all clients
| obj | a pointer to the object to be deleted |
| NDResult NDChannel::flushObject | ( | NDObject * | obj | ) |
Immediately propogates all local modifications to this object over the network, i.e. to the server and all clients.
| obj | a pointer to the object to be flushed |
| NDResult NDChannel::generateLocalKeys | ( | uint32_t | bits | ) |
Generates public-private keypairs for use in encryption
| bits | random data used to seed the generation of keys |
| NDChannelID NDChannel::getChannelID | ( | void | ) |
Returns the channelID associated with this channel
| NDIdentity NDChannel::getLocalIdentity | ( | void | ) |
Returns the local identity record. This contains information about the identity, roles, authorization of the local node.
| NDObject * NDChannel::getObjectByID | ( | NDObjectID | objid, | |
| bool | request_from_server = false | |||
| ) |
Looks up an object by its objectID, fetching the object from the server if necessary (and desired)
| objid | the objectID of the object to look up | |
| request_from_server | specifies whether the object should be retrieved from the server if it is not present locally |
| NDResult NDChannel::getObjectIDList | ( | NDObjectID ** | obj_list, | |
| uint32_t * | num_objs | |||
| ) |
Gets a list of IDs of all objects in this channel
| obj_list | pointer to an array of object IDs into which the list should be written | |
| num_objs | pointer into which to write the size of the list (i.e. the total number of objects) |
| NDTimeValue NDChannel::getUniverseTime | ( | void | ) |
| NDObject * NDChannel::getUserObject | ( | void | ) |
Gets the object associated with our user, e.g. the object for our own player, etc.
| NDResult NDChannel::loadLocalKeys | ( | const char * | pub_file_name, | |
| const char * | priv_file_name | |||
| ) |
Loads public-private keypair from files into this channel
| pub_file_name | file name from which to load the public key | |
| priv_file_name | file name from which to load the private key |
| NDResult NDChannel::loginToHost | ( | NDCore::SocketType | stype, | |
| NDSocketAddress * | sa, | |||
| const char * | username, | |||
| const char * | password, | |||
| NDConn ** | c = NULL, |
|||
| const char * | remote_key_file = NULL | |||
| ) |
This node assumes a client role, and connects/authenticates with the remote host, Authentication, and authorization trust of the remote host is assumed. Remote host can be authenticated using it public key.
| stype | Connect via UDP or TCP. Acceptable values are NDCore::UDP or NDCore::TCP | |
| sa | Address of remote host | |
| username | Plain text username for authentication | |
| password | Plain text password for authentication | |
| c | Pointer into which the newly created conn pointer will be stored (NULL may be passed if the conn pointer is not needed) | |
| remote_key_file | File containing remote hosts public key, NULL if no encryption is required |
| NDResult NDChannel::registerEventType | ( | NDEvent::Type | evt_type, | |
| const char * | evt_name, | |||
| NDEventCallback * | callback | |||
| ) |
Registers a new event type. An event type ID, event name and event handler callback object are required.
| evt_type | ||
| evt_name | ||
| callback |
| NDResult NDChannel::registerObjectHandler | ( | NDObjectHandler * | ohan | ) |
| *ohan | NDObjectHandler callback object |
| NDResult NDChannel::registerRpcHandler | ( | int32_t | proc_id, | |
| NDRpcHandler * | srv | |||
| ) |
Registers an RPC handler. It registers the procedure ID, and uses the NDRpcHandler callback object to process any RPC requests to this node.
| proc_id | The procedure ID | |
| *srv | The callback object |
| NDResult NDChannel::saveLocalKeys | ( | const char * | pub_file_name, | |
| const char * | priv_file_name | |||
| ) |
Saves previously generated public-private keypairs into files
| pub_file_name | file name for the public key | |
| priv_file_name | file name for the private key |
| NDResult NDChannel::sendObjectUpdates | ( | void | ) |
Initiates sending of all updates object information, use if you have set the Object Update Period to zero.
| NDResult NDChannel::setLocalIdentity | ( | const NDIdentity & | id | ) |
Sets the local node's identity record.
| id | the identity record value to be set for this channel |
| NDResult NDChannel::setObjectUpdatePeriod | ( | NDTimeValue | period | ) |
| period | Number of miliseconds between sending object update messages. A value of zero (default) disables automated updates. |
| NDResult NDChannel::setUniverseTime | ( | NDTimeValue | t | ) |
| t | time in miliseconds |
1.6.1