37 #ifndef ECHOLINK_DISPATCHER_INCLUDED
38 #define ECHOLINK_DISPATCHER_INCLUDED
47 #include <sigc++/sigc++.h>
58 #include <AsyncIpAddress.h>
59 #include <AsyncUdpSocket.h>
190 SigC::Signal4<void,
const Async::IpAddress&,
const std::string&,
198 typedef void (
Qso::*CtrlInputHandler)(
unsigned char *buf,
int len);
199 typedef void (
Qso::*AudioInputHandler)(
unsigned char *buf,
int len);
203 CtrlInputHandler cih;
204 AudioInputHandler aih;
208 bool operator()(
const Async::IpAddress& a1,
const Async::IpAddress& a2)
213 typedef std::map<Async::IpAddress, ConData, ipaddr_lt> ConMap;
215 static const int DEFAULT_PORT_BASE = 5198;
217 static int port_base;
218 static Dispatcher * the_instance;
221 Async::UdpSocket * ctrl_sock;
222 Async::UdpSocket * audio_sock;
224 bool registerConnection(
Qso *con, CtrlInputHandler cih,
225 AudioInputHandler aih);
226 void unregisterConnection(
Qso *con);
229 void ctrlDataReceived(
const Async::IpAddress& ip,
void *buf,
int len);
230 void audioDataReceived(
const Async::IpAddress& ip,
void *buf,
int len);
231 void printData(
const char *buf,
int len);
234 bool sendCtrlMsg(
const Async::IpAddress& to,
const void *buf,
int len);
235 bool sendAudioMsg(
const Async::IpAddress& to,
const void *buf,
int len);
static Dispatcher * instance(void)
Get the Singleton instance.
A class for handling incoming connections and dispatch active connections.
~Dispatcher(void)
Destructor.
SigC::Signal4< void, const Async::IpAddress &, const std::string &, const std::string &, const std::string & > incomingConnection
A signal that is emitted when someone is trying to connect.
static void setPortBase(int base)
Set the port base for the two UDP ports.
A class for creating an EchoLink connection.