ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

telnetd.h
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #define _CRT_SECURE_NO_WARNINGS
00004 
00005 #define WIN32_NO_STATUS
00006 #include <stdio.h>
00007 #include <winsock2.h>
00008 #include <tchar.h>
00009 #include <time.h>
00010 
00011 /*
00012 ** macro definitions
00013 */
00014 #define TELNET_PORT      (23)
00015 
00016 #define BUFSIZE        (4096)  
00017 #define USERID_SIZE      (64)
00018 #define CTRLC             (3)
00019 #define BS                (8)
00020 #define CR               (13)
00021 #define LF               (10)
00022 #define DEL             (127)
00023 
00024 #define IAC "\xff"
00025 #define DONT "\xfe"
00026 #define WONT "\xfc"
00027 #define WILL "\xfb"
00028 #define DO "\xfd"
00029 #define SB "\xfa"
00030 #define SE "\xf0"
00031 #define ECHO "\x01"
00032 #define SUPPRESS_GO_AHEAD "\x03"
00033 #define TERMINAL_TYPE "\x18"
00034 #define NAWS "\x1f"
00035 #define LINEMODE "\x22"
00036 #define NEWENVIRON "\x27"
00037 #define MODE "\x01"
00038 
00039 #define HANDSHAKE_TIMEOUT (3)
00040 
00041 /*
00042 ** types
00043 */
00044 
00045 typedef struct client_s
00046 {
00047   char     userID[USERID_SIZE];
00048   int      socket;
00049   BOOLEAN  bTerminate;
00050   BOOLEAN  bReadFromPipe;
00051   BOOLEAN  bWriteToPipe;
00052   HANDLE   hProcess;
00053   DWORD    dwProcessId;
00054   HANDLE   hChildStdinWr;   
00055   HANDLE   hChildStdoutRd;
00056 } client_t;
00057 
00058 typedef enum
00059 {
00060   NoEcho = 0,
00061   Echo = 1,
00062   Password = 2
00063 } EchoMode;
00064 
00065 /*
00066 ** Forward function declarations
00067 */
00068 static BOOL WINAPI Cleanup(DWORD dwControlType);
00069 static void WaitForConnect(void);
00070 static BOOLEAN StartSocketInterface(void);
00071 static void CreateSocket(void);
00072 static void UserLogin(int client_socket);
00073 static DWORD WINAPI UserLoginThread(LPVOID);
00074 static int DoTelnetHandshake(int sock);
00075 static int ReceiveLine(int sock, char *buffer, int len, EchoMode echo);
00076 static void RunShell(client_t *client); 
00077 //static BOOL CreateChildProcess(const char *); 
00078 static DWORD WINAPI MonitorChildThread(LPVOID);
00079 static DWORD WINAPI WriteToPipeThread(LPVOID); 
00080 static DWORD WINAPI ReadFromPipeThread(LPVOID); 
00081 static void TerminateShell(client_t *client);
00082 static VOID ErrorExit(LPTSTR);
00083 int kickoff_telnetd(void);

Generated on Sun May 27 2012 04:17:55 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.