Choco OS  V.0.16.9.0
Join to the chocolate world
oc_telnet.c File Reference

The file with functions of TELNET. More...

#include <oc_telnet.h>
#include <oc_tcp.h>
#include <oc_thread.h>
#include <oc_list.h>
#include <oc_service.h>
#include <oc_dynamic_config.h>
#include <oc_process.h>
#include <oc_program.h>
#include <oc_programman.h>
#include <oc_intman.h>
#include <oc_mutex.h>
#include <oc_semaphore.h>

Go to the source code of this file.

Data Structures

struct  Context_t
 stores ETH context More...
 
struct  ConnectionContext_t
 context of the Telnet connection More...
 
struct  VirtualDriverConfig_t
 configuration for a virtual driver More...
 
struct  WindowSize_t
 
struct  TelnetOptionParser_t
 stores Telnet option data More...
 

Typedefs

typedef struct Context_tServiceContext_t
 context of the Telnet Service More...
 
typedef struct ConnectionContext_tConnectionContext_t
 context of the Telnet connection More...
 

Enumerations

Functions

static bool IsConnectionContextCorrect (ConnectionContext_t Context)
 checks if the telnet connection context is correct
 
static ConnectionContext_t ConnectionContext_New (oC_Tcp_Connection_t Connection, oC_Process_t Process)
 allocates memory for the telnet connection context
 
static bool ConnectionContext_Delete (ConnectionContext_t Context)
 releases memory of the telnet connection context
 
static bool ServiceContext_IsCorrect (ServiceContext_t Context)
 checks if the telnet context is correct
 
static ServiceContext_t ServiceContext_New (void)
 allocates memory for a service context
 
static bool ServiceContext_Delete (ServiceContext_t Context)
 releases memory of a service context
 
static oC_ErrorCode_t StartService (ServiceContext_t *outContext)
 prepares Telnet service to work
 
static oC_ErrorCode_t StopService (ServiceContext_t *Context)
 releases Telnet service resources
 
static oC_ErrorCode_t RunProgramForConnection (oC_Tcp_Connection_t Connection, oC_Tcp_Server_t Server)
 runs default program for specific TCP connection
 
static oC_ErrorCode_t ServiceThread (ServiceContext_t Context)
 main Telnet service thread
 
static oC_ErrorCode_t Configure (VirtualDriverConfig_t *Config, ConnectionContext_t *outContext)
 configures TELNET connection to work
 
static oC_ErrorCode_t Unconfigure (void *Dummy, ConnectionContext_t *Context)
 unconfigures virtual telnet driver More...
 
static oC_ErrorCode_t Write (ConnectionContext_t Context, const char *Buffer, uint32_t *Size, oC_Time_t Timeout)
 function called when process want to write data on STDOUT stream
 
static oC_ErrorCode_t Read (ConnectionContext_t Context, char *outBuffer, uint32_t *Size, oC_Time_t Timeout)
 function called when process want to read data from STDIN stream
 
static void ConnectionFinished (oC_Tcp_Connection_t Connection, void *Context)
 function called when the connection has been finished
 
static void MainThreadFinished (oC_Thread_t Thread, void *Connection)
 function called when the main thread is finished
 
static oC_ErrorCode_t SaveDataInNagleBuffer (ConnectionContext_t Context, const char *Data, uint32_t *Size, oC_Time_t Timeout)
 saves data in Nagle's Buffer
 
static oC_ErrorCode_t Fflush (ConnectionContext_t Context, oC_Time_t Timeout)
 flushes data from Nagle's buffer
 
static void NagleThread (void *Context)
 thread for handling Nagle's buffering
 
static oC_ErrorCode_t EstablishTelnetConnection (oC_Tcp_Connection_t Connection)
 function for establishing telnet connection
 

Variables

const oC_Service_Registration_t Telnet
 registration of the Telnet service
 
static const oC_Driver_Registration_t DriverRegistration
 registration of the Telnet dummy driver
 

Detailed Description


Author
Patryk Kubiak - (Created on: 16.01.2017 21:32:17)
Note
Copyright (C) 2017 Patryk Kubiak patry.nosp@m.k.ku.nosp@m.biak@.nosp@m.choc.nosp@m.oos.o.nosp@m.rg
           This program is free software; you can redistribute it and/or modify
           it under the terms of the GNU General Public License as published by
           the Free Software Foundation; either version 2 of the License, or
           (at your option) any later version.

           This program is distributed in the hope that it will be useful,
           but WITHOUT ANY WARRANTY; without even the implied warranty of
           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
           GNU General Public License for more details.

           You should have received a copy of the GNU General Public License
           along with this program; if not, write to the Free Software
           Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

Definition in file oc_telnet.c.

Typedef Documentation

The object stores informations required for handling Telnet TCP connection

typedef struct Context_t * ServiceContext_t

The object stores informations required for handling Telnet Service

Function Documentation

static oC_ErrorCode_t Unconfigure ( void *  Dummy,
ConnectionContext_t Context 
)
static

The function is for deconfiguration of the virtual telnet driver (closing TCP connection). It should disconnect TCP connection and delete connection object.

Parameters
DummyThis parameter CANNOT BE USED - it can points to different configuration, that we have received during call of Configure function
ContextContext of the virtual driver
Returns
code of error or oC_ErrorCode_None if not used

Definition at line 671 of file oc_telnet.c.