The Assimilation Project  based on Assimilation version
Go to the documentation of this file.
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;
34 typedef enum {
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
67 WINEXPORT HbListener* hblistener_new(NetAddr*, ConfigContext* config, gsize hblisten_objsize);
68 WINEXPORT void hblistener_unlisten(NetAddr* unlistenaddr);
74 #endif /* _HBLISTENER_H */
void(* set_deadtime)(HbListener *, guint64)
Set deadtime.
Definition: hblistener.h:47
void(* set_warntime_callback)(HbListener *, void(*)(HbListener *who, guint64 howlate))
Definition: hblistener.h:52
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:410
void(* set_comealive_callback)(HbListener *, void(*)(HbListener *who, guint64 howlate))
Definition: hblistener.h:53
void(* set_deadtime_callback)(HbListener *, void(*)(HbListener *who))
Definition: hblistener.h:51
WINEXPORT void hblistener_shutdown(void)
Shuts down all our hblisteners...
Definition: hblistener.c:222
Definition: projectcommon.h:45
void(* _comealive_callback)(HbListener *who, guint64 howlate)
Definition: hblistener.h:57
void(* set_heartbeat_callback)(HbListener *, void(*)(HbListener *who))
Definition: hblistener.h:50
void(* set_warntime)(HbListener *, guint64)
Set warntime.
Definition: hblistener.h:49
guint64(* get_warntime)(HbListener *)
Retrieve warntime.
Definition: hblistener.h:48
guint64 _warn_interval
When to warn about late heartbeats.
Definition: hblistener.h:59
guint64(* get_deadtime)(HbListener *)
Retrieve deadtime.
Definition: hblistener.h:46
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.
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:264
void(* _warntime_callback)(HbListener *who, guint64 howlate)
Definition: hblistener.h:56
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(* _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
Definition: hblistener.h:34
WINEXPORT void hblistener_unlisten(NetAddr *unlistenaddr)
Stop expecting (listening for) heartbeats from a particular address.
Definition: hblistener.c:358
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
void(* _deadtime_callback)(HbListener *who)
Definition: hblistener.h:55