EchoLib
1.3.3
|
Implements the EchoLink Proxy protocol. More...
#include <EchoLinkProxy.h>
Public Types | |
enum | ProxyState { STATE_DISCONNECTED, STATE_WAITING_FOR_DIGEST, STATE_CONNECTED } |
enum | TcpState { TCP_STATE_DISCONNECTED, TCP_STATE_DISCONNECTING, TCP_STATE_CONNECTING, TCP_STATE_CONNECTED } |
Public Member Functions | |
Proxy (const std::string &host, uint16_t port, const std::string &callsign, const std::string &password) | |
Default constuctor. More... | |
~Proxy (void) | |
Destructor. More... | |
void | connect (void) |
Connect to the proxy server. More... | |
void | disconnect (void) |
Disconnect from the proxy server. More... | |
void | reset (void) |
Disconnect from proxy server then connect again after a delay. More... | |
bool | tcpOpen (const Async::IpAddress &remote_ip) |
Open a TCP connection to port 5200 to the specified host. More... | |
bool | tcpClose (void) |
Close an active TCP connection. More... | |
TcpState | tcpState (void) |
Read back the current TCP connection state. More... | |
bool | tcpData (const void *data, unsigned len) |
Send TCP data through an established TCP connection. More... | |
bool | udpData (const Async::IpAddress &addr, const void *data, unsigned len) |
Send UDP data to the specified remote IP. More... | |
bool | udpCtrl (const Async::IpAddress &addr, const void *data, unsigned len) |
Send UDP control data to the specified remote IP. More... | |
Static Public Member Functions | |
static Proxy * | instance (void) |
Public Attributes | |
sigc::signal< void, bool > | proxyReady |
A signal that is emitted when the proxy is ready for operation. More... | |
sigc::signal< void > | tcpConnected |
Signal that is emitted when a TCP connection is established. More... | |
sigc::signal< void > | tcpDisconnected |
Signal that is emitted when a TCP connection is closed. More... | |
sigc::signal< int, void *, unsigned > | tcpDataReceived |
Signal emitted when TCP data has been received. More... | |
sigc::signal< void, const Async::IpAddress &, uint16_t, void *, unsigned > | udpDataReceived |
Signal emitted when UDP data has been received. More... | |
sigc::signal< void, const Async::IpAddress &, uint16_t, void *, unsigned > | udpCtrlReceived |
Signal emitted when UDP control data has been received. More... | |
sigc::signal< void, uint32_t > | tcpStatusReceived |
Signal emitted when the TCP_STATUS proxy message is received. More... | |
sigc::signal< void > | tcpCloseReceived |
Signal emitted when the TCP_CLOSE proxy message is received. More... | |
Implements the EchoLink Proxy protocol.
This class implements the EchoLink Proxy protocol. This protocol is used to wrap all EchoLink protocol connections in one TCP connection. Both the two UDP connections (port 5198 and 5199) and the TCP connection to the EchoLink directory server will be wrapped inside the TCP connection to the EchoLink proxy server. This is of most use when the two UDP ports cannot be forwarded to your local EchoLink computer for one or the other reason, like when being on a public network. Instead of your computer listening directly to the two UDP ports, the EchoLink proxy server will do it for you.
Definition at line 121 of file EchoLinkProxy.h.
Enumerator | |
---|---|
STATE_DISCONNECTED | |
STATE_WAITING_FOR_DIGEST | |
STATE_CONNECTED |
Definition at line 124 of file EchoLinkProxy.h.
Enumerator | |
---|---|
TCP_STATE_DISCONNECTED | |
TCP_STATE_DISCONNECTING | |
TCP_STATE_CONNECTING | |
TCP_STATE_CONNECTED |
Definition at line 129 of file EchoLinkProxy.h.
EchoLink::Proxy::Proxy | ( | const std::string & | host, |
uint16_t | port, | ||
const std::string & | callsign, | ||
const std::string & | password | ||
) |
Default constuctor.
Referenced by instance().
EchoLink::Proxy::~Proxy | ( | void | ) |
Destructor.
Referenced by instance().
void EchoLink::Proxy::connect | ( | void | ) |
Connect to the proxy server.
Referenced by instance().
void EchoLink::Proxy::disconnect | ( | void | ) |
Disconnect from the proxy server.
Referenced by instance().
|
inlinestatic |
Definition at line 135 of file EchoLinkProxy.h.
References connect(), disconnect(), Proxy(), reset(), tcpClose(), tcpOpen(), and ~Proxy().
void EchoLink::Proxy::reset | ( | void | ) |
Disconnect from proxy server then connect again after a delay.
Referenced by instance().
bool EchoLink::Proxy::tcpClose | ( | void | ) |
Close an active TCP connection.
This function is used to close a previously established TCP connection to an EchoLink directory server. The function will indicate success if the disconnect is successfully sent to the EchoLink proxy server. Success does not mean that the connection has been closed. This is indicated by the emission of the tcpDisconnected signal If no connection is established at the moment, the function will indicate success.
Referenced by instance().
bool EchoLink::Proxy::tcpData | ( | const void * | data, |
unsigned | len | ||
) |
Send TCP data through an established TCP connection.
data | Pointer to a buffer containing the data to send |
len | The size of the data buffer |
Use this function to send data to the EchoLink directory server through an already established connection through the proxy server. Before calling this function, tcpOpen should have been called to open the connection.
Referenced by tcpState().
bool EchoLink::Proxy::tcpOpen | ( | const Async::IpAddress & | remote_ip | ) |
Open a TCP connection to port 5200 to the specified host.
remote_ip | The remote IP address to open the TCP connection to |
This function is used to initialize the connection to the EchoLink directory server. It will indicate success if the connection request was successfully sent tot he proxy server. Success does not mean that the connection to the directory server has been established. That is indicated by the emission of the tcpConnected signal. If the connection fail, the tcpDisconnected signal will be emitted instead.
Referenced by instance().
|
inline |
bool EchoLink::Proxy::udpCtrl | ( | const Async::IpAddress & | addr, |
const void * | data, | ||
unsigned | len | ||
) |
Send UDP control data to the specified remote IP.
addr | The remote IP address to send to |
data | Pointer to a buffer containing the data to send |
len | The size of the data buffer |
Use this function to send UDP frames to the specified remote IP address. The UDP frames should contain control data.
Referenced by tcpState().
bool EchoLink::Proxy::udpData | ( | const Async::IpAddress & | addr, |
const void * | data, | ||
unsigned | len | ||
) |
Send UDP data to the specified remote IP.
addr | The remote IP address to send to |
data | Pointer to a buffer containing the data to send |
len | The size of the data buffer |
Use this function to send UDP frames to the specified remote IP address. The UDP frames should contain data, like audio.
Referenced by tcpState().
sigc::signal<void, bool> EchoLink::Proxy::proxyReady |
A signal that is emitted when the proxy is ready for operation.
is_ready | Set to true if the proxy is ready or false if it's not |
Beofre calling any communication functions in this class one should wait for this signal to be emitted with a true argument. The user of this class should first call the connect method and then wait for this signal.
Definition at line 243 of file EchoLinkProxy.h.
sigc::signal<void> EchoLink::Proxy::tcpCloseReceived |
Signal emitted when the TCP_CLOSE proxy message is received.
This signal will be emitted when a TCP_CLOSE proxy protocol message is received. This signal should normally not be used since it's better to use the tcpDisconnected signal.
Definition at line 324 of file EchoLinkProxy.h.
sigc::signal<void> EchoLink::Proxy::tcpConnected |
Signal that is emitted when a TCP connection is established.
This signal will be emitted when a TCP connection to the EchoLink directory server has been established through the proxy server.
Definition at line 251 of file EchoLinkProxy.h.
sigc::signal<int, void*, unsigned> EchoLink::Proxy::tcpDataReceived |
Signal emitted when TCP data has been received.
data | Pointer to a buffer containing the data to send |
len | The size of the data buffer |
This signal will be emitted when TCP data has been received from the EchoLink directory server via the proxy. The receiver of the signal must indicate with the return value how many bytes of the received data was processed. Any unprocessed data will be present in the next emission of this signal. The signal will not be emitted again until more data have been received. This behaviour will make it easy to handle the data stream in suitable chunks.
Definition at line 275 of file EchoLinkProxy.h.
sigc::signal<void> EchoLink::Proxy::tcpDisconnected |
Signal that is emitted when a TCP connection is closed.
This signal will be emitted when a TCP connection to the EchoLink directory server has been closed.
Definition at line 259 of file EchoLinkProxy.h.
sigc::signal<void, uint32_t> EchoLink::Proxy::tcpStatusReceived |
Signal emitted when the TCP_STATUS proxy message is received.
status | The status word |
This signal will be emitted when a TCP_STATUS message has been received from the EchoLink proxy server. The user of this class should not need to use this raw protocol message signal since it's easier to use the tcpConnected signal. A status word set to zero will indicate a successful connection. A non zero status word does not mean anything special other than that the connection failed.
Definition at line 315 of file EchoLinkProxy.h.
sigc::signal<void, const Async::IpAddress&, uint16_t, void*, unsigned> EchoLink::Proxy::udpCtrlReceived |
Signal emitted when UDP control data has been received.
addr | The remote IP address |
port | The remote UDP port number |
data | Pointer to a buffer containing the data to send |
len | The size of the data buffer |
This signal will be emitted when UDP control data have been received through the EchoLink proxy server.
Definition at line 301 of file EchoLinkProxy.h.
sigc::signal<void, const Async::IpAddress&, uint16_t, void*, unsigned> EchoLink::Proxy::udpDataReceived |
Signal emitted when UDP data has been received.
addr | The remote IP address |
port | The remote UDP port number |
data | Pointer to a buffer containing the data to send |
len | The size of the data buffer |
This signal will be emitted when UDP data, like audio, have been received through the EchoLink proxy server.
Definition at line 288 of file EchoLinkProxy.h.