class Appl

topmost class

Public Methods

Appl( int argc, char **argv )
void run()
void shutdown()
void wait_for_network_event()
check if we have nothing to do and wait for incoming packets or check for input when nextTimeToCheckInput come
void readControlData()
wait_for_network_event calls this to read data
void acceptNewConnection()
after readControlData receive command accept_stream, it open the server socket and wait for incoming connection
void closeOldBroadcasting()
as is
void loadIncomingData()
nonblock read of all pending TCP stream data at the socket
void execute_send_event()
forced to execute the next send event
void execute_load_event()
process next event, even it is too early to do it if this function is called, then we have nothing to do else
void parse_command( const char *cmd, const Sockaddr &addr )
parse, call callbacks, but do not delete buf
void play_impl( istrstream &cmd, const Sockaddr &addr )
callback to parse interface commands are postfixed with _impl
void stop_impl( istrstream &cmd, const Sockaddr &addr )
void setfilename_impl( istrstream &cmd, const Sockaddr &addr )
void stoprecording_impl( istrstream &cmd, const Sockaddr &addr )
void accept_stream_impl( istrstream &cmd, const Sockaddr &addr )
no parameters passed: push server should be configured to what port to listen from environment
void add_broadcast_destination_impl( istrstream &cmd, const Sockaddr &addr )
void trim_string( string &s )
util
void log( int level, const char *s, ... )
log message if its level is equal or less than verbose level

Private Fields

int controlSocket
Control socket
int acceptWaitSocket
socket to accept incoming broadcast TCP stream
int acceptWaitPortnum
remember the port number of acceptWaitSocket for future reconnections
int incomingDataSocket
use this socket to read incoming TCP data stream
Sockaddr incomingDataSockaddr
this single sockaddr uniquely identify the incoming data stream
char incomingDataBuffer[ maxPacketSize * 10 ]
buffer to preload incoming data from the acquisition server
unsigned incomingDataBufferOffset
unsigned incomingDataBufferDataLength
string videoFileName
current fname to store video stream
int videoFileHandle
file handle to store video stream
commandsMapT commandsMap
fill this map in constructor
usersT users
list of users, organized as map, key = sockaddr
RemoteUser* broadcast_user
this is special user, which represents the outgoing broadcasts connections
typedef priority_queue < Event > eQueueT
eQueueT eventQueue
int queueLowWaterMark
int queueHighWaterMark
stack < PacketHeader * > inusedBuffers
Timeval nextTimeToCheckInput
store the next time when input sockets must be checked
ostream* log_output
stream to output all logging
int verbose_level
debug level
static const char env_prefix[]
static const char env_postfix_cp[]
static const char env_postfix_wp[]

Private Methods

bool bindAcceptWaitSocket()
return true if no errors

Documentation

topmost class
int controlSocket
Control socket. For all sockets - not used value is -1, check for it. The port number for this control socket is loaded from environment variable PUSH1CP, where 1 is the sequence number to determine the control/data port pairs. If binding this port fails - try the next PUSH2CP and so on. Then use the same sequence number to determine the acceptWaitSocket value from the environment PUSH1WP (wait port). The value of PUSH1CP should be equal to corresponding PushServN_Control and value of PUSH1WP - to PushServN_BroadcastInPort properties of the database server. For example 7078 & 7081

int acceptWaitSocket
socket to accept incoming broadcast TCP stream. If it -1 - server do not expect any incoming data anymore, it should have the opened stream at present, from the previous acceptWaitSocket. When connection is established, this socket is closed, when data connection is lost, this socket should be reopen again

int acceptWaitPortnum
remember the port number of acceptWaitSocket for future reconnections

int incomingDataSocket
use this socket to read incoming TCP data stream

Sockaddr incomingDataSockaddr
this single sockaddr uniquely identify the incoming data stream. It is initialized in acceptNewConnection(). The fact that push server accepts only one incoming stream from the acquisition server in fact does not reduce its capabilities - Video Server expects that we have multiple push servers, even on the single computer

char incomingDataBuffer[ maxPacketSize * 10 ]
buffer to preload incoming data from the acquisition server. It is not circular - reset to zero when empty, move to start when close to the end. The fact that all data must be saved and pumped out to broadcast network means that this buffer is almost empty

unsigned incomingDataBufferOffset

unsigned incomingDataBufferDataLength

string videoFileName
current fname to store video stream

int videoFileHandle
file handle to store video stream

commandsMapT commandsMap
fill this map in constructor

usersT users
list of users, organized as map, key = sockaddr

RemoteUser* broadcast_user
this is special user, which represents the outgoing broadcasts connections. This must be allocated once and forever

typedef priority_queue < Event > eQueueT

eQueueT eventQueue

int queueLowWaterMark

int queueHighWaterMark

stack < PacketHeader * > inusedBuffers

Timeval nextTimeToCheckInput
store the next time when input sockets must be checked. Check must be forced when timeout expire, even if we have no time right now. Broadcast input TCP stream don't loose data, but let not waste our buffers. Load stream at least every 1/5 second. We do not use the event queue for this event.

ostream* log_output
stream to output all logging

int verbose_level
debug level

static const char env_prefix[]

static const char env_postfix_cp[]

static const char env_postfix_wp[]

bool bindAcceptWaitSocket()
return true if no errors

Appl( int argc, char **argv )

void run()

void shutdown()

void wait_for_network_event()
check if we have nothing to do and wait for incoming packets or check for input when nextTimeToCheckInput come

void readControlData()
wait_for_network_event calls this to read data

void acceptNewConnection()
after readControlData receive command accept_stream, it open the server socket and wait for incoming connection. Call this when new connection is pending after select call. At this point incomingDataSocket must be zero - we may have only 1 connection

void closeOldBroadcasting()
as is

void loadIncomingData()
nonblock read of all pending TCP stream data at the socket

void execute_send_event()
forced to execute the next send event. This call is also resposible to remove jobs from list, when done

void execute_load_event()
process next event, even it is too early to do it if this function is called, then we have nothing to do else

void parse_command( const char *cmd, const Sockaddr &addr )
parse, call callbacks, but do not delete buf

void play_impl( istrstream &cmd, const Sockaddr &addr )
callback to parse interface commands are postfixed with _impl

void stop_impl( istrstream &cmd, const Sockaddr &addr )

void setfilename_impl( istrstream &cmd, const Sockaddr &addr )

void stoprecording_impl( istrstream &cmd, const Sockaddr &addr )

void accept_stream_impl( istrstream &cmd, const Sockaddr &addr )
no parameters passed: push server should be configured to what port to listen from environment

void add_broadcast_destination_impl( istrstream &cmd, const Sockaddr &addr )

void trim_string( string &s )
util

void log( int level, const char *s, ... )
log message if its level is equal or less than verbose level


This class has no child classes.

alphabetic index html hierarchy of classes or java



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