TcpConnection.h
Go to the documentation of this file.
A class to make it easier to handle and pass around IP addresses.
Definition: IpAddress.h:45
Definition: IpConnection.h:22
void setConnection(Connection *connection)
Called by TcpConnection to set the established SSL connection.
Definition: Session.h:148
const char * c_str() const
Get a constant (un-modifiable) pointer to String content.
Definition: WString.h:616
size_t length(void) const
Obtain the String length in characters, excluding NUL terminator.
Definition: WString.h:243
Definition: TcpConnection.h:40
virtual bool connect(const String &server, int port, bool useSsl=false)
void internalOnError(err_t err)
virtual err_t onSent(uint16_t len)
bool sslCreateSession()
virtual int write(const char *data, int len, uint8_t apiflags=TCP_WRITE_FLAG_COPY)
Base write operation.
void setDestroyedDelegate(TcpConnectionDestroyedDelegate destroyedDelegate)
Sets a callback to be called when the object instance is destroyed.
Definition: TcpConnection.h:120
void setTimeOut(uint16_t waitTimeOut)
uint16_t timeOut
By default a TCP connection does not have a time out.
Definition: TcpConnection.h:224
int writeString(const char *data, uint8_t apiflags=TCP_WRITE_FLAG_COPY)
Writes string data directly to the TCP buffer.
Definition: TcpConnection.h:67
void setAutoSelfDestruct(bool state)
Definition: TcpConnection.h:57
virtual err_t onPoll()
Ssl::Session * getSsl()
Get a pointer to the current SSL session object.
Definition: TcpConnection.h:152
virtual ~TcpConnection()
virtual err_t onReceive(pbuf *buf)
int write(IDataSourceStream *stream)
Writes stream data directly to the TCP buffer.
err_t internalOnPoll()
TcpConnection(tcp_pcb *connection, bool autoDestruct)
Definition: TcpConnection.h:46
virtual void onReadyToSendData(TcpConnectionEvent sourceEvent)
void setSslInitHandler(Ssl::Session::InitDelegate handler)
Set the SSL session initialisation callback.
Definition: TcpConnection.h:129
int writeString(const String &data, uint8_t apiflags=TCP_WRITE_FLAG_COPY)
Writes string data directly to the TCP buffer.
Definition: TcpConnection.h:77
void flush()
virtual void close()
virtual void sslInitSession(Ssl::Session &session)
Override in inherited classes to perform custom session initialisation.
Definition: TcpConnection.h:168
bool internalConnect(IpAddress addr, uint16_t port)
virtual void onError(err_t err)
void internalOnDnsResponse(const char *name, LWIP_IP_ADDR_T *ipaddr, int port)
err_t internalOnReceive(pbuf *p, err_t err)
void initialize(tcp_pcb *pcb)
err_t internalOnConnected(err_t err)
virtual bool connect(IpAddress addr, uint16_t port, bool useSsl=false)
virtual void onClosed()
Gets called when there is/was a tcp connection, the latter does not have to be established,...
Definition: TcpConnection.h:186
bool setSslConnection(Ssl::Connection *connection)
Definition: TcpConnection.h:135
err_t internalOnSent(uint16_t len)
virtual err_t onConnected(err_t err)
Server server