1#ifndef VRPN_REDUNDANT_TRANSMISSION_H
2#define VRPN_REDUNDANT_TRANSMISSION_H
40 virtual void setDefaults(vrpn_uint32 numRetransmissions,
41 timeval transmissionInterval);
44 virtual int pack_message(vrpn_uint32 len, timeval time, vrpn_uint32 type,
45 vrpn_uint32 sender,
const char *buffer,
46 vrpn_uint32 class_of_service,
47 vrpn_int32 numRetransmissions = -1,
48 timeval *transmissionInterval = NULL);
80 char *
encode_set(
int *len, vrpn_uint32 num, timeval interval);
81 void decode_set(
const char **buf, vrpn_uint32 *num, timeval *interval);
129 void set(
int numRetransmissions, timeval transmissionInterval);
155#define VRPN_RR_LENGTH 8
vrpn_BaseClass(const char *name, vrpn_Connection *c=NULL)
Names the device and assigns or opens connection, calls registration methods.
Generic connection class not specific to the transport mechanism.
virtual int register_types(void)
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail.
void mainloop(void)
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
static int VRPN_CALLBACK handle_enable(void *, vrpn_HANDLERPARAM)
vrpn_RedundantController(vrpn_RedundantTransmission *, vrpn_Connection *)
vrpn_RedundantTransmission * d_object
vrpn_RedundantController_Protocol d_protocol
static int VRPN_CALLBACK handle_set(void *, vrpn_HANDLERPARAM)
vrpn_RedundantReceiver(vrpn_Connection *)
void clearMemory(void)
Throws away / resets statistics.
RRRecord d_records[vrpn_CONNECTION_MAX_TYPES]
void writeMemory(const char *filename)
Writes statistics to the named file: timestamp of every message received and number of copies of that...
virtual int unregister_handler(vrpn_int32 type, vrpn_MESSAGEHANDLER handler, void *userdata, vrpn_int32 sender=vrpn_ANY_SENDER)
void record(vrpn_bool)
Turns "memory" (tracking statistics of redundant reception) on and off.
virtual int register_handler(vrpn_int32 type, vrpn_MESSAGEHANDLER handler, void *userdata, vrpn_int32 sender=vrpn_ANY_SENDER)
static int VRPN_CALLBACK handle_possiblyRedundantMessage(void *, vrpn_HANDLERPARAM)
vrpn_Connection * d_connection
void set(int numRetransmissions, timeval transmissionInterval)
vrpn_RedundantController_Protocol d_protocol
int register_types(void)
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail.
void mainloop(void)
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_RedundantRemote(vrpn_Connection *)
Helper class for vrpn_Connection that automates redundant transmission for unreliable (low-latency) m...
vrpn_uint32 defaultRetransmissions(void) const
timeval defaultInterval(void) const
virtual int pack_message(vrpn_uint32 len, timeval time, vrpn_uint32 type, vrpn_uint32 sender, const char *buffer, vrpn_uint32 class_of_service, vrpn_int32 numRetransmissions=-1, timeval *transmissionInterval=NULL)
If !isEnabled(), does a normal pack_message(), but if isEnabled() ignores class_of_service and sends ...
virtual void mainloop(void)
Determines which messages need to be resent and queues them up on the connection for transmission.
vrpn_Connection * d_connection
vrpn_RedundantTransmission(vrpn_Connection *c)
timeval d_transmissionInterval
vrpn_uint32 d_numTransmissions
vrpn_bool isEnabled(void) const
queuedMessage * d_messageList
vrpn_uint32 d_numMessagesQueued
For debugging, mostly.
virtual void setDefaults(vrpn_uint32 numRetransmissions, timeval transmissionInterval)
Set default values for future calls to pack_message().
Description of a callback entry for a user type.
This structure is what is passed to a vrpn_Connection message callback.
char * encode_set(int *len, vrpn_uint32 num, timeval interval)
void register_types(vrpn_Connection *)
void decode_enable(const char **buf, vrpn_bool *)
char * encode_enable(int *len, vrpn_bool)
void decode_set(const char **buf, vrpn_uint32 *num, timeval *interval)
vrpnMsgCallbackEntry * cb
int numSeen[VRPN_RR_LENGTH]
vrpn_bool handlerIsRegistered
timeval timestampSeen[VRPN_RR_LENGTH]
int nextTimestampToReplace
timeval transmissionInterval
vrpn_uint32 remainingTransmissions
All types of client/server/peer objects in VRPN should be derived from the vrpn_BaseClass type descri...
const int vrpn_ANY_SENDER
vrpn_ANY_SENDER can be used to register callbacks on a given message type from any sender.
int(VRPN_CALLBACK * vrpn_MESSAGEHANDLER)(void *userdata, vrpn_HANDLERPARAM p)
Type of a message handler for vrpn_Connection messages.
const int vrpn_CONNECTION_MAX_TYPES
class VRPN_API vrpn_RedundantTransmission