Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
subscribe.h
Go to the documentation of this file.
1 
8 #ifndef SUBSCRIBE_H
9 #define SUBSCRIBE_H
10 
11 #include <stdint.h>
12 #include <pbl.h>
13 
14 #include "teonet_l0_client.h"
15 
19 typedef struct teoSScrClass {
20 
21  void *ke;
22  PblMap *map;
23 
24 } teoSScrClass;
25 
29 typedef struct teoSScrListData {
30 
31  uint16_t ev;
32  uint8_t cmd;
33  uint8_t l0_f;
34  int16_t port;
35  char addr[ARP_TABLE_IP_SIZE];
36  char data[];
37 
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
45 void teoSScrDestroy(teoSScrClass *sscr);
46 void teoSScrSubscription(teoSScrClass *sscr, char *peer_name, uint16_t ev, ksnet_arp_data *arp);
47 int teoSScrUnSubscription(teoSScrClass *sscr, char *peer_name, uint16_t ev);
48 int teoSScrUnSubscriptionAll(teoSScrClass *sscr, char *peer_name);
49 const char *teoSScrSubscriptionList(teoSScrClass *sscr);
50 void teoSScrSubscribe(teoSScrClass *sscr, char *peer_name, uint16_t ev);
51 void teoSScrUnSubscribe(teoSScrClass *sscr, char *peer_name, uint16_t ev);
52 void teoSScrSend(teoSScrClass *sscr, uint16_t ev, void *data, size_t data_length, uint8_t cmd);
54 int teoSScrNumberOfEventSubscribers(teoSScrClass *sscr, uint16_t event);
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif /* SUBSCRIBE_H */
PblMap * map
Pointer to the subscribers map.
Definition: subscribe.h:22
void teoSScrUnSubscribe(teoSScrClass *sscr, char *peer_name, uint16_t ev)
Send command to unsubscribe this host from event at remote peer.
Definition: subscribe.c:451
void teoSScrSubscription(teoSScrClass *sscr, char *peer_name, uint16_t ev, ksnet_arp_data *arp)
Remote peer subscribed to event at this host.
Definition: subscribe.c:239
struct teoSScrListData teoSScrListData
teoSScr class list or CMD_SUBSCRIBE_ANSWER data
const char data[]
Make it with: gcc -o post-callback post-callback.c -lcurl.
Definition: post-callback.c:23
int teoSScrUnSubscription(teoSScrClass *sscr, char *peer_name, uint16_t ev)
Remote peer unsubscribed from event at this host.
Definition: subscribe.c:314
void * ke
Pointer to ksnetEvMgrClass.
Definition: subscribe.h:21
int teoSScrNumberOfSubscribers(teoSScrClass *sscr)
Calculate number of subscriptions.
Definition: subscribe.c:179
teoSScrClass * teoSScrInit(void *ke)
Initialize teoSScr module.
Definition: subscribe.c:37
uint8_t cmd
Command ID (used when send data to subscriber)
Definition: subscribe.h:32
uint8_t l0_f
This is L0 client. The L0 server name added to the beginning of data.
Definition: subscribe.h:33
struct teoSScrClass teoSScrClass
File: subscribe.h Author: Kirill Scherba kirill@scherba.ru
int16_t port
L0 peer port.
Definition: subscribe.h:34
teoSScr class list or CMD_SUBSCRIBE_ANSWER data
Definition: subscribe.h:29
int teoSScrUnSubscriptionAll(teoSScrClass *sscr, char *peer_name)
Unsubscribe peer_name from all events.
Definition: subscribe.c:410
#define ke
void teoSScrSend(teoSScrClass *sscr, uint16_t ev, void *data, size_t data_length, uint8_t cmd)
Send event and it data to all subscribers.
Definition: subscribe.c:58
const char * teoSScrSubscriptionList(teoSScrClass *sscr)
Show peers subscribed to this host.
Definition: subscribe.c:357
void teoSScrSubscribe(teoSScrClass *sscr, char *peer_name, uint16_t ev)
Send command to subscribe this host to event at remote peer.
Definition: subscribe.c:437
int teoSScrNumberOfEventSubscribers(teoSScrClass *sscr, uint16_t event)
Calculate number of subscribers to particular event.
Definition: subscribe.c:205
void teoSScrDestroy(teoSScrClass *sscr)
Destroy teoSScr module.
Definition: subscribe.c:463
char data[]
Remote peer name in list or data in CMD_SUBSCRIBE_ANSWER.
Definition: subscribe.h:36
char addr[ARP_TABLE_IP_SIZE]
L0 peer IP address.
Definition: subscribe.h:35
uint16_t ev
Event (used when send data to subscriber)
Definition: subscribe.h:31
File: subscribe.h Author: Kirill Scherba kirill@scherba.ru
Definition: subscribe.h:19