|
Teonet library
0.4.7
|
#include <stdint.h>#include <pbl.h>#include "teonet_l0_client.h"Go to the source code of this file.
Data Structures | |
| struct | teoSScrClass |
| File: subscribe.h Author: Kirill Scherba kirill@scherba.ru More... | |
| struct | teoSScrListData |
| teoSScr class list or CMD_SUBSCRIBE_ANSWER data More... | |
Typedefs | |
| typedef struct teoSScrClass | teoSScrClass |
| File: subscribe.h Author: Kirill Scherba kirill@scherba.ru More... | |
| typedef struct teoSScrListData | teoSScrListData |
| teoSScr class list or CMD_SUBSCRIBE_ANSWER data More... | |
Functions | |
| teoSScrClass * | teoSScrInit (void *ke) |
| Initialize teoSScr module. More... | |
| void | teoSScrDestroy (teoSScrClass *sscr) |
| Destroy teoSScr module. More... | |
| void | teoSScrSubscription (teoSScrClass *sscr, char *peer_name, uint16_t ev, ksnet_arp_data *arp) |
| Remote peer subscribed to event at this host. More... | |
| int | teoSScrUnSubscription (teoSScrClass *sscr, char *peer_name, uint16_t ev) |
| Remote peer unsubscribed from event at this host. More... | |
| int | teoSScrUnSubscriptionAll (teoSScrClass *sscr, char *peer_name) |
| Unsubscribe peer_name from all events. More... | |
| const char * | teoSScrSubscriptionList (teoSScrClass *sscr) |
| Show peers subscribed to this host. More... | |
| void | teoSScrSubscribe (teoSScrClass *sscr, char *peer_name, uint16_t ev) |
| Send command to subscribe this host to event at remote peer. More... | |
| void | teoSScrUnSubscribe (teoSScrClass *sscr, char *peer_name, uint16_t ev) |
| Send command to unsubscribe this host from event at remote peer. More... | |
| void | teoSScrSend (teoSScrClass *sscr, uint16_t ev, void *data, size_t data_length, uint8_t cmd) |
| Send event and it data to all subscribers. More... | |
| int | teoSScrNumberOfSubscribers (teoSScrClass *sscr) |
| Calculate number of subscriptions. More... | |
| int | teoSScrNumberOfEventSubscribers (teoSScrClass *sscr, uint16_t event) |
| Calculate number of subscribers to particular event. More... | |
| typedef struct teoSScrClass teoSScrClass |
File: subscribe.h Author: Kirill Scherba kirill@scherba.ru
Created on December 28, 2015, 1:31 PM teoSScr Class structure definition
| typedef struct teoSScrListData teoSScrListData |
teoSScr class list or CMD_SUBSCRIBE_ANSWER data
| void teoSScrDestroy | ( | teoSScrClass * | sscr | ) |
Destroy teoSScr module.
| sscr | Pointer to ksnCQueClass |
References free(), and teoSScrClass::map.
Referenced by ksnCommandDestroy(), test_6_1(), and test_6_2().
| teoSScrClass* teoSScrInit | ( | void * | ke | ) |
Initialize teoSScr module.
| ke | Pointer to ksnetEvMgrClass |
References teoSScrClass::ke, ke, malloc(), and teoSScrClass::map.
Referenced by ksnCommandInit(), test_6_1(), and test_6_2().
| int teoSScrNumberOfEventSubscribers | ( | teoSScrClass * | sscr, |
| uint16_t | event | ||
| ) |
Calculate number of subscribers to particular event.
| sscr |
References teoSScrClass::map.
| int teoSScrNumberOfSubscribers | ( | teoSScrClass * | sscr | ) |
Calculate number of subscriptions.
| sscr |
| void teoSScrSend | ( | teoSScrClass * | sscr, |
| uint16_t | ev, | ||
| void * | data, | ||
| size_t | data_length, | ||
| uint8_t | cmd | ||
| ) |
Send event and it data to all subscribers.
| sscr | Pointer to teoSScrClass |
| ev | Event |
| data | Event data |
| data_length | Event data length |
| cmd | Command, used for EV_K_RECEIVED event to show received command |
References teoSScrListData::addr, CMD_SUBSCRIBE_ANSWER, teoSScrListData::data, DEBUG, free(), teoSScrClass::ke, ksn_printf, ksnCoreSendCmdto(), ksnLNullSendToL0(), teoSScrListData::l0_f, malloc(), teoSScrClass::map, MODULE, and teoSScrListData::port.
Referenced by _send_subscribe_event_connected(), _send_subscribe_event_disconnected(), _send_subscribe_event_newvisit(), cmd_disconnected_cb(), event_cb(), event_cb_server(), teo::Teonet::sendToSscr(), and teoSScrSendA().
| void teoSScrSubscribe | ( | teoSScrClass * | sscr, |
| char * | peer_name, | ||
| uint16_t | ev | ||
| ) |
Send command to subscribe this host to event at remote peer.
| sscr | Pointer to teoSScrClass |
| peer_name | Remote host name |
| ev | Event |
References CMD_SUBSCRIBE, teoSScrClass::ke, and ksnCoreSendCmdto().
Referenced by event_cb_client(), teo::Teonet::subscribe(), and teoSScrSubscribeA().
| void teoSScrSubscription | ( | teoSScrClass * | sscr, |
| char * | peer_name, | ||
| uint16_t | ev, | ||
| ksnet_arp_data * | arp_data | ||
| ) |
Remote peer subscribed to event at this host.
Remote peer 'peer_name' has subscribed to the event 'ev' at this host
| sscr | Pointer to teoSScrClass |
| peer_name | Remote peer name |
| ev | Event |
| arp_data | Pointer to arp data if peer_name is L0 client, or NULL if it's a peer |
References add_data_to_list, DEBUG, teoSScrClass::ke, ksn_printf, teoSScrClass::map, MODULE, teoSScrNumberOfSubscribers(), and teoSScrSubscriptionList().
Referenced by cmd_subscribe_cb(), and test_6_2().
| const char* teoSScrSubscriptionList | ( | teoSScrClass * | sscr | ) |
Show peers subscribed to this host.
| sscr |
References teoSScrListData::addr, teoSScrListData::cmd, teoSScrListData::data, teoSScrListData::ev, teoSScrListData::l0_f, teoSScrClass::map, and teoSScrListData::port.
Referenced by hotkeys_cb(), and teoSScrSubscription().
| void teoSScrUnSubscribe | ( | teoSScrClass * | sscr, |
| char * | peer_name, | ||
| uint16_t | ev | ||
| ) |
Send command to unsubscribe this host from event at remote peer.
| sscr | Pointer to teoSScrClass |
| peer_name | Remote host name |
| ev | Event |
References CMD_UNSUBSCRIBE, teoSScrClass::ke, and ksnCoreSendCmdto().
| int teoSScrUnSubscription | ( | teoSScrClass * | sscr, |
| char * | peer_name, | ||
| uint16_t | ev | ||
| ) |
Remote peer unsubscribed from event at this host.
| sscr | Pointer to teoSScrClass |
| peer_name | Remote peer name |
| ev | Event |
References teoSScrListData::data, DEBUG, teoSScrListData::ev, teoSScrClass::ke, ksn_printf, teoSScrClass::map, MODULE, and teoSScrNumberOfSubscribers().
Referenced by cmd_subscribe_cb(), event_cb_server(), teoSScrUnSubscriptionAll(), and test_6_2().
| int teoSScrUnSubscriptionAll | ( | teoSScrClass * | sscr, |
| char * | peer_name | ||
| ) |
Unsubscribe peer_name from all events.
| sscr | |
| peer_name |
References teoSScrClass::map, and teoSScrUnSubscription().
Referenced by test_6_2().