JackTrip
Signals | Public Member Functions | Private Slots | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
UdpMasterListener Class Reference

Master UDP listener on the Server. More...

#include <UdpMasterListener.h>

Collaboration diagram for UdpMasterListener:
Collaboration graph
[legend]

Signals

void Listening ()
void ClientAddressSet ()

Public Member Functions

 UdpMasterListener (int server_port=gServerUdpPort)
virtual ~UdpMasterListener ()
void run ()
 Implements the Thread Loop. To start the thread, call start() ( DO NOT CALL run() )
void stop ()
 Stops the execution of the Thread.
int releasePort (int id)

Private Slots

void testRecieve ()

Private Member Functions

void sendToPoolPrototype (int id)
int isNewAddress (uint32_t address, uint16_t port)
 Check if address is already handled, if not add to array.

Static Private Member Functions

static void bindUdpSocket (QUdpSocket &udpsocket, int port)
 Binds a QUdpSocket. It chooses the available (active) interface.

Private Attributes

QUdpSocket mUdpMasterSocket
 The UDP socket.
QHostAddress mPeerAddress
 The Peer Address.
JackTripWorker * mJTWorker
 Class that will be used as prototype.
QThreadPool mThreadPool
 The Thread Pool.
int mServerPort
int mBasePort
uint32_t mActiveAddress [gMaxThreads][2]
 Active addresses pool numbers (32 bits IPv4 numbers)
QHash< uint32_t, uint16_t > mActiveAddresPortPair
volatile bool mStopped
 Boolean stop the execution of the thread.
int mTotalRunningThreads
 Number of Threads running in the pool.

Detailed Description

Master UDP listener on the Server.

This creates a server that will listen on the well know port (the server port) and will spawn JackTrip threads into the Thread pool. Clients request a connection.

Constructor & Destructor Documentation

UdpMasterListener::UdpMasterListener ( int  server_port = gServerUdpPort)
UdpMasterListener::~UdpMasterListener ( )
virtual

Member Function Documentation

void UdpMasterListener::bindUdpSocket ( QUdpSocket &  udpsocket,
int  port 
)
staticprivate

Binds a QUdpSocket. It chooses the available (active) interface.

Parameters
udpsocketa QUdpSocket
portPort number
void UdpMasterListener::ClientAddressSet ( )
signal
int UdpMasterListener::isNewAddress ( uint32_t  address,
uint16_t  port 
)
private

Check if address is already handled, if not add to array.

Parameters
IPv4address as a number
Returns
-1 if address is busy, id number if not
Todo:
Add the port number in the comparison, i.e., compart IP/port pair
void UdpMasterListener::Listening ( )
signal
int UdpMasterListener::releasePort ( int  id)
Todo:
Check if we really need to return an argument here
void UdpMasterListener::run ( )

Implements the Thread Loop. To start the thread, call start() ( DO NOT CALL run() )

Todo:
Get number of channels in the client from header
Todo:
Add the port number in the comparison
void UdpMasterListener::sendToPoolPrototype ( int  id)
private
Todo:
temp default to 1 channel
void UdpMasterListener::stop ( )
inline

Stops the execution of the Thread.

void UdpMasterListener::testRecieve ( )
inlineprivateslot

Member Data Documentation

QHash<uint32_t, uint16_t> UdpMasterListener::mActiveAddresPortPair
private
uint32_t UdpMasterListener::mActiveAddress[gMaxThreads][2]
private

Active addresses pool numbers (32 bits IPv4 numbers)

int UdpMasterListener::mBasePort
private
JackTripWorker* UdpMasterListener::mJTWorker
private

Class that will be used as prototype.

QHostAddress UdpMasterListener::mPeerAddress
private

The Peer Address.

int UdpMasterListener::mServerPort
private
volatile bool UdpMasterListener::mStopped
private

Boolean stop the execution of the thread.

QThreadPool UdpMasterListener::mThreadPool
private

The Thread Pool.

int UdpMasterListener::mTotalRunningThreads
private

Number of Threads running in the pool.

QUdpSocket UdpMasterListener::mUdpMasterSocket
private

The UDP socket.


The documentation for this class was generated from the following files: