Implementation

The Name Server is implemented as a task that waits for requests (messages) and operates with the Name Server database in its main function. The requests contain a key/info corresponding to the name (already registered or to be registered) in the Name Server database and an operation type.

A simple hash table is the data structure used for the database. The chaining technique is used to avoid collisions. In other words, in the chaining approach, the hash table is an array of pointers to the head of linked lists, i.e., each index has its own linked list. The hash table contains 59 indexes, which can speed up the operations up to 59 times compared to a simple linked list’s linear time. Hash table memory organization can be seen in Name Server hash table.

Name Server entry consists of two parts — header and stored information. The header consists of three variables, each having 4 bytes (12 B needed for the header). The entry can store up to 8 bytes of user data. Entry variables are:

  • link - pointer to next element

  • name - Name Server ID (key to the database)

  • info_length - length of the data stored in the database

  • name_info - data stored in the database

Name Server API

Name Server uses message-based API that consists of these functions:

PxError_t PxNameQuery(PxNameId_t name, PxSize_t buffer_length, void  *buffer, PxSize_t *info_length);
PxError_t PxNameRegister(PxNameId_t name, PxSize_t info_length, void const *info);
PxError_t PxNameReRegister(PxNameId_t name, PxSize_t info_length, void const *info);

Name Server receives requests (messages) from the Name Server API functions, does the hash table lookup to find a place for a new or already existing entry, processes the request and sends the message back (releases it) with the operation results.