This Chapter specifies the API of the software library supporting this Technical Specification.
MPAI-AIF specifies the following API:
- Store API called by a Controller.
- Controller API called by a User Agent.
- Controller API called by an AIM.
- Controller API called by other Controllers.
The API is written in a C-like fashion. However, the specification should be meant as a definition for a general programming language.
Note that namespaces for modules, ports and communication channels (strings belonging to which are indicated in the next sections with names such as module_name, port_name, and channel_name, respectively) are all independent.
We assume that the implementation defines several types, as follows:
|the type of messages being passed through communication ports and channels
|the type of parsed message datatypes (a.k.a. “the high-level protocol”)
|the type of return code defined in 7.2.2.
The actual types are opaque, and their exact definition is left to the Implementer. The only meaningful way to operate on library types with defined results is by using library functions.
On the other hand, the type of AIM Implementations, module_t, is always defined as:
|typedef error_t *(module_t)()
across all implementations, in order to ensure cross-compatibility.
Types such as void, size_t, char, int, float are regular C types.
Valid return codes:
Valid error codes:
|A generic error code
|Memory allocation error
|The operation requested of a module cannot be executed since the module has not been found
|The AIW cannot be initialied
|The AIW cannot be properly terminated
|A new AIM cannot be created
|A new AIM Port cannot be created
|A new Channel between AIMs could not be created.
|A generic message writing error
|A message writing operation failed because there are too many pending messages waiting to be delivered
|One or both ports of a connection has (or have) been removed
|A generic message reading error
|The requested operation failed
A new Channel between Controllers could not be created.