Node descriptors

Node descriptors refer to nodes (machines) in a QNet network much the same way that file descriptors refer to a particular file.

They're dynamically created when needed, last as long as needed, and while in use refer to a particular file. But if two different nodes are referring to the same third node, they may end up with different node descriptors, just as when two different processes open() the same file, they may end up with different file descriptors. A node may even have two different node descriptors to the same remote node, if those references to the remote node have different Quality of Service information.

The <sys/netmgr.h> header defines the ND_LOCAL_NODE macro as zero. You can use it any time that you're dealing with node descriptors to make it obvious that you're talking about the local node.

If you want to see if two node descriptors from the same node refer to the same machine, you can't just arithmetically compare the descriptors for equality; use the ND_NODE_CMP() macro instead:

This is similar to the way that strcmp() and memcmp() work. It's done this way in case you want to do any sorting that's based on node descriptors.

The <sys/netmgr.h> header file also defines the following networking functions:

netmgr_strtond()
Convert a string into a node descriptor.
netmgr_ndtostr()
Convert a node descriptor into a string.
netmgr_remote_nd()
Get a node descriptor that's relative to a remote node.

For more information, see the C Library Reference.