Next: , Up: APIs


12.1 C API

The directory src/c_api contains a C-level API for Pedro clients (not using glib) in the files c_api.c, c_api.h, pedro_token.c and pedro_token.h.

The directory also contains four example programs in two pairs. The program producer.c sends notifications entered by the user. The program consumer.c subscribes based on information entered by the user and displays received notifications.

The programs ping.c and pong.c respectively registers the names ping and pong. The program ping.c repeatedly asks for a term from the user, sends it as a peer-to-peer message to pong and waits for a reply message and displays it. The program pong.c repeatedly waits for a peer-to-peer message, and replies with the same message wrapped in a structured term whose functor is echo.

The file c_api.h contains comments describing the API.srsrc