Barrelfish
Functions
pubsub.c File Reference

Publish/Subscribe client API implementation. More...

Functions

errval_t oct_subscribe (subscription_handler_fn function, const void *state, subscription_t *id, const char *query,...)
 Subscribe for a given type of message. More...
 
errval_t oct_unsubscribe (subscription_t id)
 Unsubscribes a subscription. More...
 
errval_t oct_publish (const char *record,...)
 Publishes a record. More...
 

Detailed Description

Publish/Subscribe client API implementation.

The individual handler functions are stored in a function table on the client side. The API provides convenience functions for subscribe/ unsubscribe and publish.

Function Documentation

errval_t oct_publish ( const char *  record,
  ... 
)

Publishes a record.

Parameters
recordThe record to publish.
...Additional arguments to format the record using vsprintf.
Return values
SYS_ERR_OK
OCT_ERR_PARSER_FAIL
OCT_ERR_ENGINE_FAIL
errval_t oct_subscribe ( subscription_handler_fn  function,
const void *  state,
subscription_t *  id,
const char *  query,
  ... 
)

Subscribe for a given type of message.

Parameters
[in]functionHandler function in case a matching record is published.
[in]stateState passed on to handler function.
[out]idId of the subscription. In case of the value is undefined.
queryWhat type of records you want to subscribe.
...Additional arguments to format the record using vsprintf.
Return values
SYS_ERR_OK
OCT_ERR_MAX_SUBSCRIPTIONS
OCT_ERR_PARSER_FAIL
OCT_ERR_ENGINE_FAIL
errval_t oct_unsubscribe ( subscription_t  id)

Unsubscribes a subscription.

Parameters
idId of the subscription (as provided by oct_subscribe).
Return values
SYS_ERR_OK
OCT_ERR_PARSER_FAIL
OCT_ERR_ENGINE_FAIL