37 #ifndef ECHOLINK_DISPATCHER_INCLUDED
38 #define ECHOLINK_DISPATCHER_INCLUDED
47 #include <sigc++/sigc++.h>
58 #include <AsyncIpAddress.h>
59 #include <AsyncUdpSocket.h>
144 class Dispatcher :
public sigc::trackable
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;
225 typedef std::map<Async::IpAddress, ConData> ConMap;
227 static const int DEFAULT_PORT_BASE = 5198;
229 static int port_base;
230 static Async::IpAddress bind_ip;
231 static Dispatcher * the_instance;
234 Async::UdpSocket * ctrl_sock;
235 Async::UdpSocket * audio_sock;
237 bool registerConnection(
Qso *con, CtrlInputHandler cih,
238 AudioInputHandler aih);
239 void unregisterConnection(
Qso *con);
242 void ctrlDataReceived(
const Async::IpAddress& ip, uint16_t port,
244 void audioDataReceived(
const Async::IpAddress& ip, uint16_t port,
246 void printData(
const char *buf,
int len);
249 bool sendCtrlMsg(
const Async::IpAddress& to,
const void *buf,
int len);
250 bool sendAudioMsg(
const Async::IpAddress& to,
const void *buf,
int len);