Telemetry Linux - Server Specific APIs

Note

These APIs are currently only used internally in the contstruction of the Linux Telemetry Service.

subscriber_list_item *kprv_subscriber_init(socket_conn conn)

Inits a new subscriber structure.

Return
subscriber_list_item * valid pointer if successful, otherwise NULL
Parameters
  • conn: socket_connection used by subscriber

bool kprv_subscriber_add(subscriber_list_item *sub)

Adds existing subscriber item to global list.

Return
bool true if successful
Parameters
  • sub: subscriber to add to list

void kprv_subscriber_destroy(subscriber_list_item **sub)

Closes and destroys subscriber structure.

Parameters
  • sub: pointer to subscriber pointer to destroy, will be set to NULL

bool kprv_subscriber_add_topic(subscriber_list_item *sub, uint16_t topic_id)

Adds a topic id to a subscribers list of topics.

Return
bool true if successful, false otherwise
Parameters
  • sub: subscriber list item
  • topic_id: topic id to add

bool kprv_subscriber_remove_topic(subscriber_list_item *sub, uint16_t topic_id)

Removes a topic id from a subscribers list of topics.

Return
bool true if successful, false otherwise
Parameters
  • sub: subscriber list item
  • topic_id: topic id to remove

void kprv_subscriber_remove_all_topics(subscriber_list_item *sub)

Removes all topics from a subscriber.

Parameters
  • sub: subscriber to remove all topics from

bool kprv_subscriber_has_topic(const subscriber_list_item *sub, uint16_t topic_id)

Checks if a subscriber is subscribed to a topic.

Return
bool true if topic found, otherwise false
Parameters
  • sub: subscriber_list_item to check for topic
  • topic_id: topic id to check for

void kprv_delete_all_subscribers()

Iterates and removes global list of subscribers.

bool telemetry_process_message(subscriber_list_item *sub, const void *buffer, int buffer_size)

Processes new message from subscriber.

Return
bool true if successful, otherwise false
Parameters
  • sub: subscriber to process message with
  • buffer: buffer to read message from
  • buffer_size: size of buffer

void telemetry_server_cleanup(void)

Performs cleanup of telemetry server stuff.

CSP_DEFINE_TASK(client_handler)

Task for handling communication with client connections.

bool client_rx_work(subscriber_list_item *sub)

Performs work of receiving and processing packets from subscribers.

Return
bool true if successful, otherwise false
Parameters
  • sub: subscriber to process data from

bool kprv_publish_packet(telemetry_packet packet)

Attempts to publish telemetry_packet to subscribers.

Return
bool true if successful, otherwise false
Parameters
  • packet: telemetry_packet to publish