The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
hblistener.h
Go to the documentation of this file.
1 
26 #ifndef _HBLISTENER_H
27 #define _HBLISTENER_H
28 #include <projectcommon.h>
29 #include <netaddr.h>
30 #include <netgsource.h>
31 #include <listener.h>
32 typedef struct _HbListener HbListener;
33 
34 typedef enum {
38 
41 
44 struct _HbListener {
46  guint64 (*get_deadtime)(HbListener*);
47  void (*set_deadtime)(HbListener*, guint64);
48  guint64 (*get_warntime)(HbListener*);
49  void (*set_warntime)(HbListener*, guint64);
50  void (*set_heartbeat_callback)(HbListener*, void (*)(HbListener* who));
51  void (*set_deadtime_callback)(HbListener*, void (*)(HbListener* who));
52  void (*set_warntime_callback)(HbListener*, void (*)(HbListener* who, guint64 howlate));
53  void (*set_comealive_callback)(HbListener*, void (*)(HbListener* who, guint64 howlate));
56  void (*_warntime_callback)(HbListener* who, guint64 howlate);
57  void (*_comealive_callback)(HbListener* who, guint64 howlate);
59  guint64 _warn_interval;
60  guint64 nexttime;
61  guint64 warntime;
64 };
65 #define DEFAULT_DEADTIME 60 // seconds
66 
67 WINEXPORT HbListener* hblistener_new(NetAddr*, ConfigContext* config, gsize hblisten_objsize);
68 WINEXPORT void hblistener_unlisten(NetAddr* unlistenaddr);
73 
74 #endif /* _HBLISTENER_H */
Defines Generic Listener interfaces.
guint64 warntime
Warn heartbeat time.
Definition: hblistener.h:61
NetAddr * listenaddr
What address are we listening for?
Definition: hblistener.h:62
WINEXPORT void hblistener_set_martian_callback(void(*)(NetAddr *who))
Call to set a callback to be called when an unrecognized node sends us a heartbeat.
Definition: hblistener.c:362
WINEXPORT void hblistener_shutdown(void)
Shuts down all our hblisteners...
Definition: hblistener.c:200
#define WINEXPORT
Definition: projectcommon.h:45
void(* set_deadtime_callback)(HbListener *, void(*)(HbListener *who))
Definition: hblistener.h:51
void(* set_deadtime)(HbListener *, guint64)
Set deadtime.
Definition: hblistener.h:47
void(* _deadtime_callback)(HbListener *who)
Definition: hblistener.h:55
guint64 _warn_interval
When to warn about late heartbeats.
Definition: hblistener.h:59
void(* set_comealive_callback)(HbListener *, void(*)(HbListener *who, guint64 howlate))
Definition: hblistener.h:53
This is the base HbListener class. object - which listens for heartbeats from a particular sender...
Definition: hblistener.h:44
Listener baseclass
Definition: hblistener.h:45
HbNodeStatus status
What status is this node in?
Definition: hblistener.h:63
Project common header file.
void(* _comealive_callback)(HbListener *who, guint64 howlate)
Definition: hblistener.h:57
WINEXPORT HbListener * hblistener_new(NetAddr *, ConfigContext *config, gsize hblisten_objsize)
Construct a new HbListener - setting up GSource and timeout data structures for it.
Definition: hblistener.c:237
void(* set_heartbeat_callback)(HbListener *, void(*)(HbListener *who))
Definition: hblistener.h:50
guint64(* get_deadtime)(HbListener *)
Retrieve deadtime.
Definition: hblistener.h:46
guint64(* get_warntime)(HbListener *)
Retrieve warntime.
Definition: hblistener.h:48
The NetAddr class class represents a general network address - whether IP, MAC, or any other type of ...
Definition: netaddr.h:43
Defines interfaces for the NetAddr (network address) object.
void(* _warntime_callback)(HbListener *who, guint64 howlate)
Definition: hblistener.h:56
void(* _heartbeat_callback)(HbListener *who)
Definition: hblistener.h:54
guint64 nexttime
When next heartbeat is due.
Definition: hblistener.h:60
Implements NetIO GSource object.
WINEXPORT HbListener * hblistener_find_by_address(const NetAddr *which)
Find the listener that's listening to a particular address.
Definition: hblistener.c:96
HbNodeStatus
Definition: hblistener.h:34
WINEXPORT void hblistener_unlisten(NetAddr *unlistenaddr)
Stop expecting (listening for) heartbeats from a particular address.
Definition: hblistener.c:322
void(* set_warntime)(HbListener *, guint64)
Set warntime.
Definition: hblistener.h:49
void(* set_warntime_callback)(HbListener *, void(*)(HbListener *who, guint64 howlate))
Definition: hblistener.h:52
This is the Listener class. object - which generically listens for packets.
Definition: listener.h:41
guint64 _expected_interval
How often to expect heartbeats.
Definition: hblistener.h:58