Shellminator V3.0.1
Simple Terminal
Loading...
Searching...
No Matches
ShellminatorTcpSocket Class Reference

#include <Shellminator-TcpSocket.hpp>

Inheritance diagram for ShellminatorTcpSocket:
Collaboration diagram for ShellminatorTcpSocket:

Public Types

enum  TelnetNegotiationState_t { TELNET_FIRST_BYTE_STATE , TELNET_COMMAND_BYTE_STATE , TELNET_OPTION_BYTE_STATE }
 

Public Member Functions

 ShellminatorTcpSocket ()
 
 ShellminatorTcpSocket (int port_p)
 
int available () override
 Available bytes in the channel. More...
 
int read () override
 Read one byte form the channel. More...
 
int peek () override
 Peek the firtst byte from the channel. More...
 
void flush () override
 Flush the channel. More...
 
size_t write (uint8_t b) override
 Write one byte to the channel. More...
 
size_t write (const uint8_t *data, size_t size) override
 
void attachConnectCallback (void(*connectCallback_p)(ShellminatorTcpSocket *))
 
void attachDisconnectCallback (void(*disconnectCallback_p)(ShellminatorTcpSocket *))
 
void begin ()
 
void update ()
 
void attachDebugChannel (Stream *dbg_p)
 

Private Member Functions

void resetVariables ()
 
void closeClient ()
 
void appendToCircularBuffer (uint8_t data)
 
void appendToCircularBuffer (uint8_t *data, int dataSize)
 

Private Attributes

int port = 23
 
bool clientConnected = false
 
Stream * dbg = NULL
 
TelnetNegotiationState_t negotiationState
 
WiFiServer * server
 
WiFiClient client
 
uint8_t streamBuffer [SHELLMINATOR_WS_STREAM_BUFFER_SIZE]
 
uint32_t streamBufferWritePointer
 
uint32_t streamBufferReadPointer
 
void(* connectCallback )(ShellminatorTcpSocket *parent) = NULL
 
void(* disconnectCallback )(ShellminatorTcpSocket *parent) = NULL
 

Static Private Attributes

static const uint8_t TELNET_IAC_DONT_LINEMODE [3] = { 255, 254, 34 }
 
static const uint8_t TELNET_IAC_WILL_ECHO [3] = { 255, 251, 1 }
 
static const uint8_t TELNET_IAC_DONT_ECHO [3] = { 255, 254, 1 }
 
static const uint8_t TELNET_IAC_WILL_SUPPRESS_GO_AHEAD [3] = { 255, 251, 3 }
 
static const uint8_t TELNET_IAC_DO_SUPPRESS_GO_AHEAD [3] = { 255, 253, 3 }
 

Detailed Description

Definition at line 72 of file Shellminator-TcpSocket.hpp.

Member Enumeration Documentation

◆ TelnetNegotiationState_t

Enumerator
TELNET_FIRST_BYTE_STATE 
TELNET_COMMAND_BYTE_STATE 
TELNET_OPTION_BYTE_STATE 

Definition at line 76 of file Shellminator-TcpSocket.hpp.

Constructor & Destructor Documentation

◆ ShellminatorTcpSocket() [1/2]

ShellminatorTcpSocket::ShellminatorTcpSocket ( )

Definition at line 50 of file Shellminator-TcpSocket.cpp.

Here is the call graph for this function:

◆ ShellminatorTcpSocket() [2/2]

ShellminatorTcpSocket::ShellminatorTcpSocket ( int  port_p)

Definition at line 43 of file Shellminator-TcpSocket.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ appendToCircularBuffer() [1/2]

void ShellminatorTcpSocket::appendToCircularBuffer ( uint8_t *  data,
int  dataSize 
)
private

Definition at line 86 of file Shellminator-TcpSocket.cpp.

Here is the call graph for this function:

◆ appendToCircularBuffer() [2/2]

void ShellminatorTcpSocket::appendToCircularBuffer ( uint8_t  data)
private

Definition at line 69 of file Shellminator-TcpSocket.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ attachConnectCallback()

void ShellminatorTcpSocket::attachConnectCallback ( void(*)(ShellminatorTcpSocket *)  connectCallback_p)

Definition at line 263 of file Shellminator-TcpSocket.cpp.

◆ attachDebugChannel()

void ShellminatorTcpSocket::attachDebugChannel ( Stream *  dbg_p)

Definition at line 57 of file Shellminator-TcpSocket.cpp.

◆ attachDisconnectCallback()

void ShellminatorTcpSocket::attachDisconnectCallback ( void(*)(ShellminatorTcpSocket *)  disconnectCallback_p)

Definition at line 267 of file Shellminator-TcpSocket.cpp.

◆ available()

int ShellminatorTcpSocket::available ( )
override

Available bytes in the channel.

Returns
The available bytes in the channel.

Definition at line 203 of file Shellminator-TcpSocket.cpp.

◆ begin()

void ShellminatorTcpSocket::begin ( )

Definition at line 61 of file Shellminator-TcpSocket.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ closeClient()

void ShellminatorTcpSocket::closeClient ( )
private

Definition at line 179 of file Shellminator-TcpSocket.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ flush()

void ShellminatorTcpSocket::flush ( )
override

Flush the channel.

Definition at line 244 of file Shellminator-TcpSocket.cpp.

◆ peek()

int ShellminatorTcpSocket::peek ( )
override

Peek the firtst byte from the channel.

Returns
Read and return one byte form the channel. The byte will NOT be removed from the channel.

Definition at line 234 of file Shellminator-TcpSocket.cpp.

◆ read()

int ShellminatorTcpSocket::read ( )
override

Read one byte form the channel.

Returns
Read and return one byte form the channel. The byte will be removed from the channel.

Definition at line 216 of file Shellminator-TcpSocket.cpp.

◆ resetVariables()

void ShellminatorTcpSocket::resetVariables ( )
private

Definition at line 195 of file Shellminator-TcpSocket.cpp.

Here is the caller graph for this function:

◆ update()

void ShellminatorTcpSocket::update ( )

Definition at line 93 of file Shellminator-TcpSocket.cpp.

Here is the call graph for this function:

◆ write() [1/2]

size_t ShellminatorTcpSocket::write ( const uint8_t *  data,
size_t  size 
)
override

Definition at line 256 of file Shellminator-TcpSocket.cpp.

◆ write() [2/2]

size_t ShellminatorTcpSocket::write ( uint8_t  b)
override

Write one byte to the channel.

Parameters
bThe value that has to be written to the channel.
Returns
The number of bytes that has been successfully written to the channel. Because it is the base class, it returns 0.

Definition at line 249 of file Shellminator-TcpSocket.cpp.

Member Data Documentation

◆ client

WiFiClient ShellminatorTcpSocket::client
private

Definition at line 126 of file Shellminator-TcpSocket.hpp.

◆ clientConnected

bool ShellminatorTcpSocket::clientConnected = false
private

Definition at line 120 of file Shellminator-TcpSocket.hpp.

◆ connectCallback

void(* ShellminatorTcpSocket::connectCallback) (ShellminatorTcpSocket *parent) = NULL
private

Definition at line 145 of file Shellminator-TcpSocket.hpp.

◆ dbg

Stream* ShellminatorTcpSocket::dbg = NULL
private

Definition at line 121 of file Shellminator-TcpSocket.hpp.

◆ disconnectCallback

void(* ShellminatorTcpSocket::disconnectCallback) (ShellminatorTcpSocket *parent) = NULL
private

Definition at line 146 of file Shellminator-TcpSocket.hpp.

◆ negotiationState

TelnetNegotiationState_t ShellminatorTcpSocket::negotiationState
private

Definition at line 123 of file Shellminator-TcpSocket.hpp.

◆ port

int ShellminatorTcpSocket::port = 23
private

Definition at line 119 of file Shellminator-TcpSocket.hpp.

◆ server

WiFiServer* ShellminatorTcpSocket::server
private

Definition at line 125 of file Shellminator-TcpSocket.hpp.

◆ streamBuffer

uint8_t ShellminatorTcpSocket::streamBuffer[SHELLMINATOR_WS_STREAM_BUFFER_SIZE]
private

Definition at line 128 of file Shellminator-TcpSocket.hpp.

◆ streamBufferReadPointer

uint32_t ShellminatorTcpSocket::streamBufferReadPointer
private

Definition at line 130 of file Shellminator-TcpSocket.hpp.

◆ streamBufferWritePointer

uint32_t ShellminatorTcpSocket::streamBufferWritePointer
private

Definition at line 129 of file Shellminator-TcpSocket.hpp.

◆ TELNET_IAC_DO_SUPPRESS_GO_AHEAD

const uint8_t ShellminatorTcpSocket::TELNET_IAC_DO_SUPPRESS_GO_AHEAD = { 255, 253, 3 }
staticprivate

Definition at line 143 of file Shellminator-TcpSocket.hpp.

◆ TELNET_IAC_DONT_ECHO

const uint8_t ShellminatorTcpSocket::TELNET_IAC_DONT_ECHO = { 255, 254, 1 }
staticprivate

Definition at line 141 of file Shellminator-TcpSocket.hpp.

◆ TELNET_IAC_DONT_LINEMODE

const uint8_t ShellminatorTcpSocket::TELNET_IAC_DONT_LINEMODE = { 255, 254, 34 }
staticprivate

Definition at line 139 of file Shellminator-TcpSocket.hpp.

◆ TELNET_IAC_WILL_ECHO

const uint8_t ShellminatorTcpSocket::TELNET_IAC_WILL_ECHO = { 255, 251, 1 }
staticprivate

Definition at line 140 of file Shellminator-TcpSocket.hpp.

◆ TELNET_IAC_WILL_SUPPRESS_GO_AHEAD

const uint8_t ShellminatorTcpSocket::TELNET_IAC_WILL_SUPPRESS_GO_AHEAD = { 255, 251, 3 }
staticprivate

Definition at line 142 of file Shellminator-TcpSocket.hpp.