37 #ifndef ECHOLINK_DISPATCHER_INCLUDED
38 #define ECHOLINK_DISPATCHER_INCLUDED
47 #include <sigc++/sigc++.h>
58 #include <AsyncIpAddress.h>
59 #include <AsyncUdpSocket.h>
171 static void setBindAddr(
const Async::IpAddress& ip);
209 sigc::signal<void,
const Async::IpAddress&,
const std::string&,
217 typedef void (
Qso::*CtrlInputHandler)(
unsigned char *buf,
int len);
218 typedef void (
Qso::*AudioInputHandler)(
unsigned char *buf,
int len);
222 CtrlInputHandler cih;
223 AudioInputHandler aih;
227 bool operator()(
const Async::IpAddress& a1,
const Async::IpAddress& a2)
232 typedef std::map<Async::IpAddress, ConData, ipaddr_lt> ConMap;
234 static const int DEFAULT_PORT_BASE = 5198;
236 static int port_base;
237 static Async::IpAddress bind_ip;
238 static Dispatcher * the_instance;
241 Async::UdpSocket * ctrl_sock;
242 Async::UdpSocket * audio_sock;
244 bool registerConnection(
Qso *con, CtrlInputHandler cih,
245 AudioInputHandler aih);
246 void unregisterConnection(
Qso *con);
249 void ctrlDataReceived(
const Async::IpAddress& ip,
void *buf,
int len);
250 void audioDataReceived(
const Async::IpAddress& ip,
void *buf,
int len);
251 void printData(
const char *buf,
int len);
254 bool sendCtrlMsg(
const Async::IpAddress& to,
const void *buf,
int len);
255 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.
static void setBindAddr(const Async::IpAddress &ip)
Set the bind address for the two UDP ports.
Namespace to encapsulate EchoLink communication classes.
static void setPortBase(int base)
Set the port base for the two UDP ports.
sigc::signal< 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.
A class for creating an EchoLink connection.
static void deleteInstance(void)
Delete the singleton object if it exists.