36 #ifndef ECHOLINK_DIRECTORY_INCLUDED
37 #define ECHOLINK_DIRECTORY_INCLUDED
46 #include <sigc++/sigc++.h>
60 #include <AsyncTcpClient.h>
61 #include <AsyncTimer.h>
213 const std::string&
server(
void)
const {
return the_server; }
225 const std::string&
callsign(
void)
const {
return the_callsign; }
237 const std::string&
password(
void)
const {
return the_password; }
253 const std::string&
description(
void)
const {
return the_description; }
263 const std::list<StationData>&
links(
void)
const {
return the_links; }
275 return the_repeaters;
289 return the_conferences;
296 const std::list<StationData>&
stations(
void)
const {
return the_stations; }
306 const std::string&
message(
void)
const {
return the_message; }
335 const std::string& code,
bool exact=
true);
352 SigC::Signal1<void, const std::string&>
error;
359 CS_WAITING_FOR_START, CS_WAITING_FOR_COUNT, CS_WAITING_FOR_CALL,
360 CS_WAITING_FOR_DATA, CS_WAITING_FOR_ID, CS_WAITING_FOR_IP,
361 CS_WAITING_FOR_END, CS_IDLE, CS_WAITING_FOR_OK
364 static const int DIRECTORY_SERVER_PORT = 5200;
365 static const int REGISTRATION_REFRESH_TIME = 5 * 60 * 1000;
366 static const int CMD_TIMEOUT = 120 * 1000;
369 std::string the_server;
370 std::string the_callsign;
371 std::string the_password;
372 std::string the_description;
373 std::list<StationData> the_links;
374 std::list<StationData> the_repeaters;
375 std::list<StationData> the_stations;
376 std::list<StationData> the_conferences;
377 std::string the_message;
378 std::string error_str;
382 std::list<StationData> get_call_list;
384 Async::TcpClient * ctrl_con;
385 std::list<Cmd> cmd_queue;
387 Async::Timer * reg_refresh_timer;
390 Async::Timer * cmd_timer;
395 void printBuf(
const unsigned char *buf,
int len);
396 int handleCallList(
char *buf,
int len);
398 void ctrlSockConnected(
void);
399 void ctrlSockDisconnected(Async::TcpConnection *con,
400 Async::TcpClient::DisconnectReason reason);
401 int ctrlSockDataReceived(Async::TcpConnection *con,
void *ptr,
int len);
402 void sendNextCmd(
void);
403 void addCmdToQueue(Cmd cmd);
405 void createClientObject(
void);
406 void onRefreshRegistration(Async::Timer *timer);
407 void onCmdTimeout(Async::Timer *timer);
408 bool stationCodeEq(
const StationData& stn, std::string code,
bool exact);
413 std::ostream&
operator<<(std::ostream& os,
const StationData& station);