class protocol_thread


Public Methods

protocol_thread( int argc, char **argv )
only set-up initial values
static void protocol_thread_entry_func( void *instance )
static thread - entry function
void cleanup()
close sockets, etc
void open_connection()
this may be called several times after timeout
void cleanup_connection()
deallocate data associated with connection - but not to shutdown! only to reconnect later
void handshake()
handshake with server
void request_broadcast_parameters()
void loop()
never exit, work until some exception
void process_unknown_input()
we have something on input
void shutdown_requested()
call from outside thread
void report_push_serv_ok( int push_id )
report to db server that push server id is operating fine
void new_text_data( text_data *data )
pass new text data to protocol thread
void dump_log()
take log from old input stream messages
void log( int level, const char *s, ... )
log this message

Private Fields

protocol_stream* protocolStream
connection status is determined by checking this to be NULL
Sockaddr dbServerAddr
Timeval whenTryToRetryConnection
int acquisition_server_id
received from handshake
bool shutdown_now
std::queue < protocol_cmd * > commands
commands from other threads are queued in this queue
ostream* log_output
abstract log destination
mutex lock_log
mutex to lock log out stream
std::queue < int > connected_push_servers
queue of push servers where we successfully connected - to report to the db server
mutex lock_various_cmdstacks
lock connected_push_servers
std::queue < text_data * > new_text
queue of text data to be sent to the database server
mutex lock_new_text
access to the queue is shared
int verbose_level
logging level
static const int retryConnectionInterval
static const int setupConnectionTimeout
static const char register_acquisition_server[]
static const char cmd_request_broadcast_parameters[]
static const char cmd_push_server_ok[]
static const char cmd_add_caption_noid[]

Private Methods

void sleep( int seconds )
sleep for spec num of seconds
void lookup_cmd_stack()
look in command queue for commands from others threads
void check_new_text()
acquisition server do not knows whether this channel is recorded now or not

Documentation

protocol_stream* protocolStream
connection status is determined by checking this to be NULL

Sockaddr dbServerAddr

Timeval whenTryToRetryConnection

int acquisition_server_id
received from handshake

bool shutdown_now

std::queue < protocol_cmd * > commands
commands from other threads are queued in this queue

ostream* log_output
abstract log destination

mutex lock_log
mutex to lock log out stream

std::queue < int > connected_push_servers
queue of push servers where we successfully connected - to report to the db server

mutex lock_various_cmdstacks
lock connected_push_servers

std::queue < text_data * > new_text
queue of text data to be sent to the database server

mutex lock_new_text
access to the queue is shared

int verbose_level
logging level

static const int retryConnectionInterval

static const int setupConnectionTimeout

static const char register_acquisition_server[]

static const char cmd_request_broadcast_parameters[]

static const char cmd_push_server_ok[]

static const char cmd_add_caption_noid[]

protocol_thread( int argc, char **argv )
only set-up initial values

static void protocol_thread_entry_func( void *instance )
static thread - entry function. When it ends - thread ends gets the address and port of database video server from command line, -a address_ip_or_text -p portnum try to connect. If connection fails - set up timeout and reconnect again

void cleanup()
close sockets, etc

void open_connection()
this may be called several times after timeout

void cleanup_connection()
deallocate data associated with connection - but not to shutdown! only to reconnect later. Call cleanup if want to shutdown after call

void handshake()
handshake with server

void request_broadcast_parameters()

void loop()
never exit, work until some exception

void process_unknown_input()
we have something on input...

void sleep( int seconds )
sleep for spec num of seconds

void lookup_cmd_stack()
look in command queue for commands from others threads

void check_new_text()
acquisition server do not knows whether this channel is recorded now or not. It just send the text - database server will drop it if it don't need it

void shutdown_requested()
call from outside thread

void report_push_serv_ok( int push_id )
report to db server that push server id is operating fine

void new_text_data( text_data *data )
pass new text data to protocol thread. This call should never be blocked by any I/O - only place pointer into queue. The queue is protected by mutex and mutex should never lock the queue while any I/O on the way

void dump_log()
take log from old input stream messages

void log( int level, const char *s, ... )
log this message


This class has no child classes.

alphabetic index html hierarchy of classes or java



This page was generated with the help of DOC++.