ReactOS 0.4.15-dev-7958-gcd0bb1a
telnetd.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <windef.h>
#include <winbase.h>
#include <wincon.h>
#include <winsock2.h>
#include <strsafe.h>
Include dependency graph for telnetd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  client_s
 

Macros

#define _CRT_SECURE_NO_WARNINGS
 
#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define TELNET_PORT   (23)
 
#define BUFSIZE   (4096)
 
#define USERID_SIZE   (64)
 
#define CTRLC   (3)
 
#define BS   (8)
 
#define CR   (13)
 
#define LF   (10)
 
#define DEL   (127)
 
#define IAC   "\xff"
 
#define DONT   "\xfe"
 
#define WONT   "\xfc"
 
#define WILL   "\xfb"
 
#define DO   "\xfd"
 
#define SB   "\xfa"
 
#define SE   "\xf0"
 
#define ECHO   "\x01"
 
#define SUPPRESS_GO_AHEAD   "\x03"
 
#define TERMINAL_TYPE   "\x18"
 
#define NAWS   "\x1f"
 
#define LINEMODE   "\x22"
 
#define NEWENVIRON   "\x27"
 
#define MODE   "\x01"
 
#define HANDSHAKE_TIMEOUT   (3)
 

Typedefs

typedef struct client_s client_t
 

Enumerations

enum  EchoMode { NoEcho = 0 , Echo = 1 , Password = 2 }
 

Functions

static BOOL WINAPI Cleanup (DWORD dwControlType)
 
static void WaitForConnect (void)
 
static BOOLEAN StartSocketInterface (void)
 
static void CreateSocket (void)
 
static void UserLogin (int client_socket)
 
static DWORD WINAPI UserLoginThread (LPVOID)
 
static int DoTelnetHandshake (int sock)
 
static int ReceiveLine (int sock, char *buffer, int len, EchoMode echo)
 
static void RunShell (client_t *client)
 
static DWORD WINAPI MonitorChildThread (LPVOID)
 
static DWORD WINAPI WriteToPipeThread (LPVOID)
 
static DWORD WINAPI ReadFromPipeThread (LPVOID)
 
static void TerminateShell (client_t *client)
 
static VOID ErrorExit (LPTSTR)
 
int kickoff_telnetd (void)
 

Macro Definition Documentation

◆ _CRT_SECURE_NO_WARNINGS

#define _CRT_SECURE_NO_WARNINGS

Definition at line 3 of file telnetd.h.

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 10 of file telnetd.h.

◆ BS

#define BS   (8)

Definition at line 22 of file telnetd.h.

◆ BUFSIZE

#define BUFSIZE   (4096)

Definition at line 19 of file telnetd.h.

◆ CR

#define CR   (13)

Definition at line 23 of file telnetd.h.

◆ CTRLC

#define CTRLC   (3)

Definition at line 21 of file telnetd.h.

◆ DEL

#define DEL   (127)

Definition at line 25 of file telnetd.h.

◆ DO

#define DO   "\xfd"

Definition at line 31 of file telnetd.h.

◆ DONT

#define DONT   "\xfe"

Definition at line 28 of file telnetd.h.

◆ ECHO

#define ECHO   "\x01"

Definition at line 34 of file telnetd.h.

◆ HANDSHAKE_TIMEOUT

#define HANDSHAKE_TIMEOUT   (3)

Definition at line 42 of file telnetd.h.

◆ IAC

#define IAC   "\xff"

Definition at line 27 of file telnetd.h.

◆ LF

#define LF   (10)

Definition at line 24 of file telnetd.h.

◆ LINEMODE

#define LINEMODE   "\x22"

Definition at line 38 of file telnetd.h.

◆ MODE

#define MODE   "\x01"

Definition at line 40 of file telnetd.h.

◆ NAWS

#define NAWS   "\x1f"

Definition at line 37 of file telnetd.h.

◆ NEWENVIRON

#define NEWENVIRON   "\x27"

Definition at line 39 of file telnetd.h.

◆ SB

#define SB   "\xfa"

Definition at line 32 of file telnetd.h.

◆ SE

#define SE   "\xf0"

Definition at line 33 of file telnetd.h.

◆ SUPPRESS_GO_AHEAD

#define SUPPRESS_GO_AHEAD   "\x03"

Definition at line 35 of file telnetd.h.

◆ TELNET_PORT

#define TELNET_PORT   (23)

Definition at line 17 of file telnetd.h.

◆ TERMINAL_TYPE

#define TERMINAL_TYPE   "\x18"

Definition at line 36 of file telnetd.h.

◆ USERID_SIZE

#define USERID_SIZE   (64)

Definition at line 20 of file telnetd.h.

◆ WILL

#define WILL   "\xfb"

Definition at line 30 of file telnetd.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 4 of file telnetd.h.

◆ WONT

#define WONT   "\xfc"

Definition at line 29 of file telnetd.h.

Typedef Documentation

◆ client_t

Enumeration Type Documentation

◆ EchoMode

Enumerator
NoEcho 
Echo 
Password 

Definition at line 61 of file telnetd.h.

62{
63 NoEcho = 0,
64 Echo = 1,
65 Password = 2
66} EchoMode;
EchoMode
Definition: telnetd.h:62
@ Password
Definition: telnetd.h:65
@ NoEcho
Definition: telnetd.h:63
@ Echo
Definition: telnetd.h:64

Function Documentation

◆ Cleanup()

static BOOL WINAPI Cleanup ( DWORD  dwControlType)
static

◆ CreateSocket()

static void CreateSocket ( void  )
static

◆ DoTelnetHandshake()

static int DoTelnetHandshake ( int  sock)
static

◆ ErrorExit()

static VOID ErrorExit ( LPTSTR  )
static

◆ kickoff_telnetd()

int kickoff_telnetd ( void  )

Definition at line 48 of file telnetd.c.

49{
50 printf("Attempting to start Simple TelnetD\n");
51
52// DetectPlatform();
54
56 ErrorExit("Unable to start socket interface\n");
57
59
60 while(!bShutdown) {
62 }
63
64 WSACleanup();
65 return 0;
66}
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine, BOOL Add)
Definition: console.c:2109
static const WCHAR Cleanup[]
Definition: register.c:80
#define printf
Definition: freeldr.h:97
static VOID ErrorExit(LPTSTR lpszMessage)
Definition: telnetd.c:647
static BOOLEAN StartSocketInterface(void)
Definition: telnetd.c:79
static void CreateSocket(void)
Definition: telnetd.c:102
static BOOLEAN bShutdown
Definition: telnetd.c:36
static void WaitForConnect(void)
Definition: telnetd.c:120
int PASCAL FAR WSACleanup(void)
Definition: startup.c:60

◆ MonitorChildThread()

static DWORD WINAPI MonitorChildThread ( LPVOID  )
static

◆ ReadFromPipeThread()

static DWORD WINAPI ReadFromPipeThread ( LPVOID  )
static

◆ ReceiveLine()

static int ReceiveLine ( int  sock,
char buffer,
int  len,
EchoMode  echo 
)
static

◆ RunShell()

static void RunShell ( client_t client)
static

◆ StartSocketInterface()

static BOOLEAN StartSocketInterface ( void  )
static

◆ TerminateShell()

static void TerminateShell ( client_t client)
static

◆ UserLogin()

static void UserLogin ( int  client_socket)
static

◆ UserLoginThread()

static DWORD WINAPI UserLoginThread ( LPVOID  )
static

◆ WaitForConnect()

static void WaitForConnect ( void  )
static

◆ WriteToPipeThread()

static DWORD WINAPI WriteToPipeThread ( LPVOID  )
static