vrpn 07.35
Virtual Reality Peripheral Network
|
Logs a VRPN stream. More...
#include <vrpn_Log.h>
Public Member Functions | |
vrpn_Log (vrpn_TranslationTable *senders, vrpn_TranslationTable *types) | |
~vrpn_Log (void) | |
char * | getName () |
Allocates a new string and copies the log file name to it. IMPORTANT: code calling this function is responsible for freeing the memory. | |
int | open (void) |
Opens the log file. | |
int | close (void) |
Closes and saves the log file. | |
int | saveLogSoFar (void) |
Saves any messages logged so far. | |
int | logIncomingMessage (size_t payloadLen, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer) |
Should be called with the timeval adjusted by the clock offset on the receiving Endpoint. | |
int | logOutgoingMessage (vrpn_int32 payloadLen, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer) |
int | logMessage (vrpn_int32 payloadLen, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer, vrpn_bool isRemote=VRPN_FALSE) |
We'd like to make this protected, but there's one place it needs to be exposed, at least until we get cleverer. | |
int | setCookie (const char *cookieBuffer) |
The magic cookie is set to the default value of the version of VRPN compiled, but a more correct value to write in the logfile (if we're logging incoming messages) is that of the version of VRPN we're communicating with. | |
int | setCompoundName (const char *name, int index) |
Takes a name of the form foo.bar and an index <n> and sets the name of the log file to be foo-<n>.bar; if there is no period in the name, merely appends -<n>. | |
int | setName (const char *name) |
int | setName (const char *name, size_t len) |
long & | logMode (void) |
Returns a reference so we can |= it. | |
int | addFilter (vrpn_LOGFILTER filter, void *userdata) |
timeval | lastLogTime () |
Returns the time of the last message that was logged. | |
Protected Member Functions | |
int | checkFilters (vrpn_int32 payloadLen, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer) |
Protected Attributes | |
char * | d_logFileName |
long | d_logmode |
vrpn_LOGLIST * | d_logTail |
vrpn_LOGLIST * | d_firstEntry |
FILE * | d_file |
char * | d_magicCookie |
vrpn_bool | d_wroteMagicCookie |
vrpnLogFilterEntry * | d_filters |
vrpn_TranslationTable * | d_senders |
vrpn_TranslationTable * | d_types |
timeval | d_lastLogTime |
vrpn_Log::vrpn_Log | ( | vrpn_TranslationTable * | senders, |
vrpn_TranslationTable * | types ) |
Definition at line 464 of file vrpn_Connection.C.
References d_lastLogTime, d_magicCookie, vrpn_cookie_size(), vrpn_LOG_NONE, and write_vrpn_cookie().
vrpn_Log::~vrpn_Log | ( | void | ) |
Definition at line 491 of file vrpn_Connection.C.
References close(), d_file, d_filters, d_magicCookie, and vrpnLogFilterEntry::next.
int vrpn_Log::addFilter | ( | vrpn_LOGFILTER | filter, |
void * | userdata ) |
Definition at line 921 of file vrpn_Connection.C.
References d_filters, vrpnLogFilterEntry::filter, vrpnLogFilterEntry::next, and vrpnLogFilterEntry::userdata.
|
protected |
Definition at line 941 of file vrpn_Connection.C.
References vrpn_HANDLERPARAM::buffer, d_filters, vrpnLogFilterEntry::filter, vrpn_HANDLERPARAM::msg_time, vrpnLogFilterEntry::next, vrpn_HANDLERPARAM::payload_len, vrpn_HANDLERPARAM::sender, vrpn_HANDLERPARAM::type, and vrpnLogFilterEntry::userdata.
Referenced by logMessage().
int vrpn_Log::close | ( | void | ) |
Closes and saves the log file.
Definition at line 597 of file vrpn_Connection.C.
References d_file, d_logFileName, and saveLogSoFar().
Referenced by vrpn_Endpoint_IP::drop_connection(), and ~vrpn_Log().
char * vrpn_Log::getName | ( | ) |
Allocates a new string and copies the log file name to it. IMPORTANT: code calling this function is responsible for freeing the memory.
Definition at line 521 of file vrpn_Connection.C.
References d_logFileName.
Referenced by vrpn_Connection::get_log_names().
timeval vrpn_Log::lastLogTime | ( | ) |
Returns the time of the last message that was logged.
Definition at line 939 of file vrpn_Connection.C.
References d_lastLogTime.
int vrpn_Log::logIncomingMessage | ( | size_t | payloadLen, |
struct timeval | time, | ||
vrpn_int32 | type, | ||
vrpn_int32 | sender, | ||
const char * | buffer ) |
Should be called with the timeval adjusted by the clock offset on the receiving Endpoint.
Definition at line 741 of file vrpn_Connection.C.
References logMessage(), logMode(), and vrpn_LOG_INCOMING.
Referenced by vrpn_Endpoint_IP::getOneTCPMessage(), vrpn_Endpoint_IP::getOneUDPMessage(), and vrpn_File_Connection::playone_to_filetime().
int vrpn_Log::logMessage | ( | vrpn_int32 | payloadLen, |
struct timeval | time, | ||
vrpn_int32 | type, | ||
vrpn_int32 | sender, | ||
const char * | buffer, | ||
vrpn_bool | isRemote = VRPN_FALSE ) |
We'd like to make this protected, but there's one place it needs to be exposed, at least until we get cleverer.
Definition at line 772 of file vrpn_Connection.C.
References vrpn_HANDLERPARAM::buffer, checkFilters(), d_firstEntry, d_lastLogTime, d_logTail, d_senders, d_types, vrpn_LOGLIST::data, vrpn_HANDLERPARAM::msg_time, vrpn_LOGLIST::next, vrpn_HANDLERPARAM::payload_len, vrpn_LOGLIST::prev, vrpn_HANDLERPARAM::sender, and vrpn_HANDLERPARAM::type.
Referenced by vrpn_Endpoint_IP::drop_connection(), logIncomingMessage(), and logOutgoingMessage().
long & vrpn_Log::logMode | ( | void | ) |
Returns a reference so we can |= it.
Definition at line 919 of file vrpn_Connection.C.
References d_logmode.
Referenced by vrpn_Endpoint_IP::drop_connection(), vrpn_Endpoint_IP::finish_new_connection_setup(), vrpn_Connection::handle_log_message(), logIncomingMessage(), logOutgoingMessage(), saveLogSoFar(), vrpn_Connection_IP::server_check_for_incoming_connections(), vrpn_Connection::vrpn_Connection(), and vrpn_Connection::vrpn_Connection().
int vrpn_Log::logOutgoingMessage | ( | vrpn_int32 | payloadLen, |
struct timeval | time, | ||
vrpn_int32 | type, | ||
vrpn_int32 | sender, | ||
const char * | buffer ) |
Definition at line 760 of file vrpn_Connection.C.
References logMessage(), logMode(), and vrpn_LOG_OUTGOING.
Referenced by vrpn_Endpoint_IP::pack_message().
int vrpn_Log::open | ( | void | ) |
Opens the log file.
Definition at line 535 of file vrpn_Connection.C.
References d_file, and d_logFileName.
Referenced by vrpn_Connection::handle_log_message(), vrpn_Endpoint::openLogs(), vrpn_Connection_IP::server_check_for_incoming_connections(), vrpn_Connection::vrpn_Connection(), and vrpn_Connection::vrpn_Connection().
int vrpn_Log::saveLogSoFar | ( | void | ) |
Saves any messages logged so far.
Definition at line 622 of file vrpn_Connection.C.
References vrpn_HANDLERPARAM::buffer, d_file, d_firstEntry, d_logTail, d_magicCookie, d_wroteMagicCookie, vrpn_LOGLIST::data, logMode(), vrpn_HANDLERPARAM::msg_time, vrpn_LOGLIST::next, vrpn_HANDLERPARAM::payload_len, vrpn_LOGLIST::prev, vrpn_HANDLERPARAM::sender, vrpn_HANDLERPARAM::type, and vrpn_cookie_size().
Referenced by close().
int vrpn_Log::setCompoundName | ( | const char * | name, |
int | index ) |
Takes a name of the form foo.bar and an index <n> and sets the name of the log file to be foo-<n>.bar; if there is no period in the name, merely appends -<n>.
Definition at line 845 of file vrpn_Connection.C.
References setName().
Referenced by vrpn_Connection_IP::server_check_for_incoming_connections().
int vrpn_Log::setCookie | ( | const char * | cookieBuffer | ) |
The magic cookie is set to the default value of the version of VRPN compiled, but a more correct value to write in the logfile (if we're logging incoming messages) is that of the version of VRPN we're communicating with.
Definition at line 898 of file vrpn_Connection.C.
References d_magicCookie, and vrpn_cookie_size().
Referenced by vrpn_Endpoint_IP::finish_new_connection_setup(), and vrpn_File_Connection::read_cookie().
int vrpn_Log::setName | ( | const char * | name | ) |
Definition at line 875 of file vrpn_Connection.C.
References setName().
Referenced by setCompoundName(), vrpn_Endpoint::setLogNames(), setName(), vrpn_Connection::vrpn_Connection(), and vrpn_Connection::vrpn_Connection().
int vrpn_Log::setName | ( | const char * | name, |
size_t | len ) |
Definition at line 877 of file vrpn_Connection.C.
References d_logFileName.
|
protected |
Definition at line 80 of file vrpn_Log.h.
Referenced by close(), open(), saveLogSoFar(), and ~vrpn_Log().
|
protected |
Definition at line 86 of file vrpn_Log.h.
Referenced by addFilter(), checkFilters(), and ~vrpn_Log().
|
protected |
Definition at line 78 of file vrpn_Log.h.
Referenced by logMessage(), and saveLogSoFar().
|
protected |
Definition at line 91 of file vrpn_Log.h.
Referenced by lastLogTime(), logMessage(), and vrpn_Log().
|
protected |
|
protected |
Definition at line 75 of file vrpn_Log.h.
Referenced by logMode().
|
protected |
Definition at line 77 of file vrpn_Log.h.
Referenced by logMessage(), and saveLogSoFar().
|
protected |
Definition at line 82 of file vrpn_Log.h.
Referenced by saveLogSoFar(), setCookie(), vrpn_Log(), and ~vrpn_Log().
|
protected |
Definition at line 88 of file vrpn_Log.h.
Referenced by logMessage().
|
protected |
Definition at line 89 of file vrpn_Log.h.
Referenced by logMessage().
|
protected |
Definition at line 84 of file vrpn_Log.h.
Referenced by saveLogSoFar().