ReactOS  0.4.13-dev-563-g0561610
Telnet Class Reference

#include <tnclass.h>

Collaboration diagram for Telnet:

Public Member Functions

 Telnet ()
 
 Telnet (const char *szHost1, const char *strPort1)
 
 ~Telnet ()
 
int Open (const char *szHost, const char *strPort="23")
 
int Close ()
 
int Resume ()
 
int LoadKeyMap (const char *file, const char *name)
 
void DisplayKeyMap ()
 
int SwitchKeyMap (int)
 

Private Member Functions

SOCKET Connect ()
 
void telSetConsoleTitle (const char *szHost)
 
void DoInit ()
 
void NewProcess ()
 
void SetLocalAddress (SOCKET s)
 

Private Attributes

SOCKET Socket
 
char strPort [32]
 
char szHost [127]
 
volatile int bConnected
 
volatile int bWinsockUp
 
volatile int bNetPaused
 
volatile int bNetFinished
 
volatile int bNetFinish
 
TNetwork Network
 
TCharmap Charmap
 
KeyTranslator KeyTrans
 
TMapLoader MapLoader
 
TConsole Console
 
TTelnetHandler TelHandler
 
TelThreadParams ThreadParams
 
Tnclip Clipboard
 
TMouse Mouse
 
TScroller Scroller
 
TANSIParser Parser
 
HWND hConsoleWindow
 
LPARAM oldBIcon
 
LPARAM oldSIcon
 
bool iconChange
 
HANDLE hThread
 
HANDLE hProcess
 

Detailed Description

Definition at line 16 of file tnclass.h.

Constructor & Destructor Documentation

◆ Telnet() [1/2]

Telnet::Telnet ( )

Definition at line 100 of file tnclass.cpp.

100  :
109  DoInit();
110 }
TCharmap Charmap
Definition: tnclass.h:50
TelThreadParams ThreadParams
Definition: tnclass.h:55
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:152
TNetwork Network
Definition: tnclass.h:49
TMouse Mouse
Definition: tnclass.h:57
TConsole Console
Definition: tnclass.h:53
void DoInit()
Definition: tnclass.cpp:63
TConfig ini
Definition: tnconfig.cpp:45
int get_scroll_size() const
Definition: tnconfig.h:91
TScroller Scroller
Definition: tnclass.h:58
#define STD_OUTPUT_HANDLE
Definition: winbase.h:265
TMapLoader MapLoader
Definition: tnclass.h:52
TTelnetHandler TelHandler
Definition: tnclass.h:54
HWND TelnetGetConsoleWindow()
Definition: tnmisc.cpp:115
TANSIParser Parser
Definition: tnclass.h:59
Tnclip Clipboard
Definition: tnclass.h:56
KeyTranslator KeyTrans
Definition: tnclass.h:51

◆ Telnet() [2/2]

Telnet::Telnet ( const char szHost1,
const char strPort1 
)

Definition at line 112 of file tnclass.cpp.

112  :
121  DoInit();
122  Open( szHost1, strPort1);
123 }
TCharmap Charmap
Definition: tnclass.h:50
TelThreadParams ThreadParams
Definition: tnclass.h:55
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:152
TNetwork Network
Definition: tnclass.h:49
int Open(const char *szHost, const char *strPort="23")
Definition: tnclass.cpp:160
TMouse Mouse
Definition: tnclass.h:57
TConsole Console
Definition: tnclass.h:53
void DoInit()
Definition: tnclass.cpp:63
TConfig ini
Definition: tnconfig.cpp:45
int get_scroll_size() const
Definition: tnconfig.h:91
TScroller Scroller
Definition: tnclass.h:58
#define STD_OUTPUT_HANDLE
Definition: winbase.h:265
TMapLoader MapLoader
Definition: tnclass.h:52
TTelnetHandler TelHandler
Definition: tnclass.h:54
HWND TelnetGetConsoleWindow()
Definition: tnmisc.cpp:115
TANSIParser Parser
Definition: tnclass.h:59
Tnclip Clipboard
Definition: tnclass.h:56
KeyTranslator KeyTrans
Definition: tnclass.h:51

◆ ~Telnet()

Telnet::~Telnet ( )

Definition at line 125 of file tnclass.cpp.

125  {
126  if (bWinsockUp){
127  if(bConnected) Close();
128  WSACleanup();
129  }
130 
131  // Paul Brannan 8/10/98
132  if(iconChange) {
134  }
135 
136 }
LPARAM oldBIcon
Definition: tnclass.h:62
INT WSAAPI WSACleanup(VOID)
Definition: startup.c:60
HWND hConsoleWindow
Definition: tnclass.h:61
void ResetIcon(HWND hConsoleWindow, LPARAM oldBIcon, LPARAM oldSIcon)
Definition: tnmisc.cpp:179
volatile int bWinsockUp
Definition: tnclass.h:42
volatile int bConnected
Definition: tnclass.h:41
bool iconChange
Definition: tnclass.h:63
LPARAM oldSIcon
Definition: tnclass.h:62
int Close()
Definition: tnclass.cpp:226

Member Function Documentation

◆ Close()

int Telnet::Close ( )

Definition at line 226 of file tnclass.cpp.

226  {
227  Console.sync();
228  switch(Network.get_net_type()) {
229  case TN_NETSOCKET:
232  break;
233  case TN_NETPIPE:
234  if(hProcess != 0) {
237  hProcess = 0;
238  }
239  break;
240  }
241 
242  // Enable Ctrl-break (PB 5/14/98);
243  // Ioannou : this must be FALSE
245 
246  if (hThread) CloseHandle(hThread); // Paul Brannan 8/11/98
247  hThread = NULL; // Daniel Straub 11/12/98
248 
250  bNetFinish = 1;
251  while (!bNetFinished)
252  Sleep (0); // give up our time slice- this lets our connection thread
253  // finish itself, so we don't hang -crn@ozemail.com.au
254  telSetConsoleTitle("No Connection");
255  bConnected = 0;
256  return 1;
257 }
void telSetConsoleTitle(const char *szHost)
Definition: tnclass.cpp:353
TelThreadParams ThreadParams
Definition: tnclass.h:55
#define CloseHandle
Definition: compat.h:398
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
HANDLE hUnPause
Definition: tparams.h:7
void sync()
Definition: tconsole.cpp:109
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
TNetwork Network
Definition: tnclass.h:49
NetParams p
Definition: tparams.h:19
volatile int bConnected
Definition: tnclass.h:41
#define closesocket
Definition: main.c:39
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine, BOOL Add)
Definition: console.c:2111
TConsole Console
Definition: tnclass.h:53
HANDLE hThread
Definition: tnclass.h:65
smooth NULL
Definition: ftsmooth.c:416
TConfig ini
Definition: tnconfig.cpp:45
#define INVALID_SOCKET
Definition: winsock.h:332
HANDLE hProcess
Definition: tnclass.h:66
volatile int bNetFinish
Definition: tnclass.h:45
NetworkType get_net_type()
Definition: tnetwork.h:35
SOCKET Socket
Definition: tnclass.h:38
bool get_disable_break() const
Definition: tnconfig.h:48
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1562
volatile int bNetFinished
Definition: tnclass.h:44

Referenced by Resume(), telCommandLine(), and ~Telnet().

◆ Connect()

SOCKET Telnet::Connect ( )
private

Definition at line 298 of file tnclass.cpp.

299 {
300  SOCKET Socket1 = socket(AF_INET, SOCK_STREAM, 0);
301  SOCKADDR_IN SockAddr;
302  SockAddr.sin_family = AF_INET;
303  SockAddr.sin_addr.s_addr = inet_addr(szHost);
304 
305  // determine the port correctly -crn@ozemail.com.au 15/12/98
306  SERVENT *sp;
307  sp = getservbyname (strPort, "tcp");
308  if (sp == NULL) {
309  if (isdigit (*(strPort)))
310  SockAddr.sin_port = htons(atoi(strPort));
311  else {
313  return INVALID_SOCKET;
314  }
315  } else
316  SockAddr.sin_port = sp->s_port;
318 
319  // Were we given host name?
320  if (SockAddr.sin_addr.s_addr == INADDR_NONE) {
321 
322  // Resolve host name to IP address.
324  hostent* pHostEnt = gethostbyname(szHost);
325  if (!pHostEnt)
326  return INVALID_SOCKET;
327  printit("\n");
328 
329  SockAddr.sin_addr.s_addr = *(DWORD*)pHostEnt->h_addr;
330  }
331 
332  // Print a message telling the user the IP we are connecting to
333  // (Paul Brannan 5/14/98)
334  char ss_b1[4], ss_b2[4], ss_b3[4], ss_b4[4], ss_b5[12];
335  itoa(SockAddr.sin_addr.S_un.S_un_b.s_b1, ss_b1, 10);
336  itoa(SockAddr.sin_addr.S_un.S_un_b.s_b2, ss_b2, 10);
337  itoa(SockAddr.sin_addr.S_un.S_un_b.s_b3, ss_b3, 10);
338  itoa(SockAddr.sin_addr.S_un.S_un_b.s_b4, ss_b4, 10);
339  itoa(ntohs(SockAddr.sin_port), ss_b5, 10);
340  printm(0, FALSE, MSG_TRYING, ss_b1, ss_b2, ss_b3, ss_b4, ss_b5);
341 
342  if (connect(Socket1, (sockaddr*)&SockAddr, sizeof(SockAddr)))
343  return INVALID_SOCKET;
344 
345  char esc[2];
346  esc [0] = ini.get_escape_key();
347  esc [1] = 0;
348  printm(0, FALSE, MSG_CONNECTED, szHost, esc);
349 
350  return Socket1;
351 }
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
Definition: socklife.c:143
u_short sin_port
Definition: winsock.h:511
#define inet_addr(cp)
Definition: inet.h:98
#define INADDR_NONE
Definition: tcp.c:42
INT WSAAPI connect(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: sockctrl.c:23
#define MSG_NOSERVICE
Definition: resource.h:24
#define ntohs(x)
Definition: module.h:208
#define MSG_TRYING
Definition: resource.h:13
#define MSG_RESOLVING
Definition: resource.h:23
smooth NULL
Definition: ftsmooth.c:416
char strPort[32]
Definition: tnclass.h:39
#define isdigit(c)
Definition: acclib.h:68
TConfig ini
Definition: tnconfig.cpp:45
_CRTIMP char *__cdecl itoa(_In_ int _Val, _Pre_notnull_ _Post_z_ char *_DstBuf, _In_ int _Radix)
PHOSTENT WSAAPI gethostbyname(IN const char FAR *name)
Definition: getxbyxx.c:221
PSERVENT WSAAPI getservbyname(IN const char FAR *name, IN const char FAR *proto)
Definition: getxbyxx.c:500
#define MSG_CONNECTED
Definition: resource.h:14
#define INVALID_SOCKET
Definition: winsock.h:332
unsigned long DWORD
Definition: ntddk_ex.h:95
int printit(const char *it)
Definition: tnerror.cpp:58
int printm(LPTSTR szModule, BOOL fSystem, DWORD dwMessageId,...)
Definition: tnerror.cpp:84
char szHost[127]
Definition: tnclass.h:40
struct in_addr sin_addr
Definition: winsock.h:512
char get_escape_key() const
Definition: tnconfig.h:82
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define AF_INET
Definition: tcpip.h:117
static const WCHAR sp[]
Definition: suminfo.c:288
UINT_PTR SOCKET
Definition: winsock.h:47
#define SOCK_STREAM
Definition: tcpip.h:118
#define htons(x)
Definition: module.h:213
short sin_family
Definition: winsock.h:510

Referenced by Open().

◆ DisplayKeyMap()

void Telnet::DisplayKeyMap ( )

Definition at line 145 of file tnclass.cpp.

145  { // display available keymaps
146  MapLoader.Display();
147 };
void Display()
Definition: tmapldr.cpp:741
TMapLoader MapLoader
Definition: tnclass.h:52

Referenced by telCommandLine().

◆ DoInit()

void Telnet::DoInit ( )
private

Definition at line 63 of file tnclass.cpp.

63  {
65  bConnected = 0;
66  bNetPaused = 1;
67  bNetFinished = 1;
68  bNetFinish = 0;
69  hThread = 0; // Sam Robertson 12/7/98
70  hProcess = 0;
71 
72  WSADATA WsaData;
73 
74  // Set the title
75  telSetConsoleTitle("No Connection");
76 
77  // Change the icon
80 
81  if (WSAStartup(MAKEWORD(1, 1), &WsaData)) {
82  DWORD dwLastError = GetLastError();
83  printm(0, FALSE, MSG_ERROR, "WSAStartup()");
84  printm(0, TRUE, dwLastError);
85  bWinsockUp = 0;
86  return;
87  }
88  bWinsockUp = 1;
89 
90  // Get keyfile (Paul Brannan 5/12/98)
91  const char *keyfile = ini.get_keyfile();
92 
93  // This should be changed later to use the Tnerror routines
94  // This has been done (Paul Brannan 6/5/98)
95  if(LoadKeyMap( keyfile, ini.get_default_config()) != 1)
96  // printf("Error loading keymap.\n");
98 }
int LoadKeyMap(const char *file, const char *name)
Definition: tnclass.cpp:139
void telSetConsoleTitle(const char *szHost)
Definition: tnclass.cpp:353
#define TRUE
Definition: types.h:120
LPARAM oldBIcon
Definition: tnclass.h:62
#define MAKEWORD(a, b)
Definition: typedefs.h:247
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HWND hConsoleWindow
Definition: tnclass.h:61
volatile int bWinsockUp
Definition: tnclass.h:42
volatile int bConnected
Definition: tnclass.h:41
HANDLE hThread
Definition: tnclass.h:65
bool iconChange
Definition: tnclass.h:63
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
Definition: startup.c:113
volatile int bNetPaused
Definition: tnclass.h:43
#define MSG_ERRKEYMAP
Definition: resource.h:17
TConfig ini
Definition: tnconfig.cpp:45
#define INVALID_SOCKET
Definition: winsock.h:332
LPARAM oldSIcon
Definition: tnclass.h:62
unsigned long DWORD
Definition: ntddk_ex.h:95
HANDLE hProcess
Definition: tnclass.h:66
volatile int bNetFinish
Definition: tnclass.h:45
SOCKET Socket
Definition: tnclass.h:38
const char * get_keyfile() const
Definition: tnconfig.h:34
int printm(LPTSTR szModule, BOOL fSystem, DWORD dwMessageId,...)
Definition: tnerror.cpp:84
const char * get_default_config() const
Definition: tnconfig.h:39
const char * get_startdir() const
Definition: tnconfig.h:32
volatile int bNetFinished
Definition: tnclass.h:44
HWND TelnetGetConsoleWindow()
Definition: tnmisc.cpp:115
bool SetIcon(HWND hConsoleWindow, HANDLE hIcon, LPARAM *pOldBIcon, LPARAM *pOldSIcon, const char *icondir)
Definition: tnmisc.cpp:136
#define MSG_ERROR
Definition: resource.h:10

Referenced by Telnet().

◆ LoadKeyMap()

int Telnet::LoadKeyMap ( const char file,
const char name 
)

Definition at line 139 of file tnclass.cpp.

139  {
140  // printf("Loading %s from %s.\n", name ,file);
142  return MapLoader.Load(file,name);
143 }
#define MSG_KEYMAP
Definition: resource.h:16
int printm(LPTSTR szModule, BOOL fSystem, DWORD dwMessageId,...)
Definition: tnerror.cpp:84
TMapLoader MapLoader
Definition: tnclass.h:52
Definition: name.c:36
int Load(const char *filename, const char *szKeysetName)
Definition: tmapldr.cpp:466
Definition: fci.c:126

Referenced by DoInit(), and telCommandLine().

◆ NewProcess()

void Telnet::NewProcess ( )
private

Definition at line 360 of file tnclass.cpp.

360  {
361  char cmd_line[MAX_PATH*2];
363 
364  strcpy(cmd_line, ini.get_startdir());
365  strcat(cmd_line, ini.get_exename()); // Thomas Briggs 12/7/98
366 
367  if(!SpawnProcess(cmd_line, &pi)) printm(0, FALSE, MSG_NOSPAWN);
368 }
const char * get_exename() const
Definition: tnconfig.h:33
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
TConfig ini
Definition: tnconfig.cpp:45
#define MAX_PATH
Definition: compat.h:26
static DWORD pi
Definition: protocol.c:150
int printm(LPTSTR szModule, BOOL fSystem, DWORD dwMessageId,...)
Definition: tnerror.cpp:84
const char * get_startdir() const
Definition: tnconfig.h:32
#define MSG_NOSPAWN
Definition: resource.h:22
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
BOOL SpawnProcess(char *cmd_line, PROCESS_INFORMATION *pi)
Definition: tnmisc.cpp:87

Referenced by Resume().

◆ Open()

int Telnet::Open ( const char szHost,
const char strPort = "23" 
)

Definition at line 160 of file tnclass.cpp.

160  {
161  if (bWinsockUp && !bConnected){
162  telSetConsoleTitle(szHost1);
163 
164  strncpy (szHost,szHost1, 127);
165  strncpy(strPort, strPort1, sizeof(strPort));
166 
167  // Determine whether to pipe to an executable or use our own sockets
168  // (Paul Brannan March 18, 1999)
169  const char *netpipe;
170  if(*(netpipe=ini.get_netpipe())) {
172  HANDLE hInWrite, hOutRead, hErrRead;
173  if(!CreateHiddenConsoleProcess(netpipe, &pi, &hInWrite,
174  &hOutRead, &hErrRead)) {
175  printm(0, FALSE, MSG_ERRPIPE);
176  return TNNOCON;
177  }
178  Network.SetPipe(hOutRead, hInWrite);
179  hProcess = pi.hProcess;
180  } else {
181  Socket = Connect();
182  if (Socket == INVALID_SOCKET) {
183  printm(0, FALSE, GetLastError());
184  return TNNOCON;
185  }
188  }
189 
190  bNetFinish = 0;
191  bConnected = 1;
198  DWORD idThread;
199 
200  // Disable Ctrl-break (PB 5/14/98);
201  // Fixed (Thomas Briggs 8/17/98)
204 
205  hThread = CreateThread(0, 0,
207  (LPVOID)&ThreadParams, 0, &idThread);
208  // This helps the display thread a little (Paul Brannan 8/3/98)
210  return Resume();
211  } else if(bWinsockUp && bConnected) {
213  }
214 
215  return TNNOCON; // cannot do winsock stuff or already connected
216 }
#define CreateEvent
Definition: winbase.h:3562
void telSetConsoleTitle(const char *szHost)
Definition: tnclass.cpp:353
TelThreadParams ThreadParams
Definition: tnclass.h:55
#define TRUE
Definition: types.h:120
HANDLE hUnPause
Definition: tparams.h:7
void SetPipe(HANDLE pIn, HANDLE pOut)
Definition: tnetwork.cpp:46
#define MSG_ERRPIPE
Definition: resource.h:26
#define MSG_ALREADYCONNECTED
Definition: resource.h:28
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
TNetwork Network
Definition: tnclass.h:49
const char * get_netpipe() const
Definition: tnconfig.h:98
DWORD WINAPI telProcessNetwork(LPVOID lpParameter)
Definition: ttelhndl.cpp:479
NetParams p
Definition: tparams.h:19
volatile int * bNetPaused
Definition: tparams.h:8
volatile int bWinsockUp
Definition: tnclass.h:42
#define THREAD_PRIORITY_ABOVE_NORMAL
Definition: winbase.h:272
bool get_control_break_as_c() const
Definition: tnconfig.h:61
volatile int bConnected
Definition: tnclass.h:41
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine, BOOL Add)
Definition: console.c:2111
HANDLE hThread
Definition: tnclass.h:65
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:111
volatile int bNetPaused
Definition: tnclass.h:43
char strPort[32]
Definition: tnclass.h:39
Definition: tncon.h:15
BOOL WINAPI SetThreadPriority(IN HANDLE hThread, IN int nPriority)
Definition: thread.c:661
BOOL WINAPI ControlEventHandler(DWORD event)
Definition: tncon.cpp:357
TConfig ini
Definition: tnconfig.cpp:45
void SetSocket(SOCKET s)
Definition: tnetwork.cpp:40
#define INVALID_SOCKET
Definition: winsock.h:332
BOOL CreateHiddenConsoleProcess(LPCTSTR szChildName, PROCESS_INFORMATION *ppi, LPHANDLE phInWrite, LPHANDLE phOutRead, LPHANDLE phErrRead)
Definition: tnmisc.cpp:5
unsigned long DWORD
Definition: ntddk_ex.h:95
HANDLE hProcess
Definition: tnclass.h:66
volatile int bNetFinish
Definition: tnclass.h:45
static DWORD pi
Definition: protocol.c:150
SOCKET Socket
Definition: tnclass.h:38
SOCKET Connect()
Definition: tnclass.cpp:298
int printm(LPTSTR szModule, BOOL fSystem, DWORD dwMessageId,...)
Definition: tnerror.cpp:84
int Resume()
Definition: tnclass.cpp:259
char szHost[127]
Definition: tnclass.h:40
bool get_disable_break() const
Definition: tnconfig.h:48
HANDLE hExit
Definition: tparams.h:6
volatile int bNetFinished
Definition: tnclass.h:44
HANDLE hPause
Definition: tparams.h:7
void SetLocalAddress(SOCKET s)
Definition: tnclass.cpp:370
volatile int * bNetFinished
Definition: tparams.h:9
volatile int * bNetFinish
Definition: tparams.h:10

Referenced by main(), telCommandLine(), and Telnet().

◆ Resume()

int Telnet::Resume ( )

Definition at line 259 of file tnclass.cpp.

259  {
260  int i;
261  if (bConnected) {
262  Console.sync();
263  for(;;){
267  if (i) bConnected = 1;
268  else bConnected = 0;
271  while (!bNetPaused)
272  Sleep (0); // give up our time slice- this lets our connection thread
273  // unpause itself, so we don't hang -crn@ozemail.com.au
274  switch (i){
275  case TNNOCON:
276  Close();
277  return TNDONE;
278  case TNPROMPT:
279  return TNPROMPT;
280  case TNSCROLLBACK:
282  break;
283  case TNSPAWN:
284  NewProcess();
285  }
286  }
287  }
288  return TNNOCON;
289 }
TelThreadParams ThreadParams
Definition: tnclass.h:55
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
HANDLE hUnPause
Definition: tparams.h:7
void sync()
Definition: tconsole.cpp:109
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
TNetwork Network
Definition: tnclass.h:49
NetParams p
Definition: tparams.h:19
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
TMouse Mouse
Definition: tnclass.h:57
volatile int bConnected
Definition: tnclass.h:41
TConsole Console
Definition: tnclass.h:53
HANDLE hThread
Definition: tnclass.h:65
volatile int bNetPaused
Definition: tnclass.h:43
Definition: tncon.h:15
void NewProcess()
Definition: tnclass.cpp:360
TScroller Scroller
Definition: tnclass.h:58
Definition: tncon.h:18
int Close()
Definition: tnclass.cpp:226
Definition: tncon.h:19
void ScrollBack()
Definition: tscroll.cpp:163
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:660
HANDLE hPause
Definition: tparams.h:7
int telProcessConsole(NetParams *pParams, KeyTranslator &KeyTrans, TConsole &Console, TNetwork &Network, TMouse &Mouse, Tnclip &Clipboard, HANDLE hThread)
Definition: tncon.cpp:199
Definition: tncon.h:16
Tnclip Clipboard
Definition: tnclass.h:56
KeyTranslator KeyTrans
Definition: tnclass.h:51

Referenced by Open(), and telCommandLine().

◆ SetLocalAddress()

void Telnet::SetLocalAddress ( SOCKET  s)
private

Definition at line 370 of file tnclass.cpp.

370  {
371  SOCKADDR_IN SockAddr;
372  int size = sizeof(SOCKADDR_IN);
373  memset(&SockAddr, 0, sizeof(SockAddr));
374  SockAddr.sin_family = AF_INET;
375 
376  getsockname(Network.GetSocket(), (sockaddr*)&SockAddr, &size);
377  char ss_b1[4], ss_b2[4], ss_b3[4], ss_b4[4];
378  itoa(SockAddr.sin_addr.S_un.S_un_b.s_b1, ss_b1, 10);
379  itoa(SockAddr.sin_addr.S_un.S_un_b.s_b2, ss_b2, 10);
380  itoa(SockAddr.sin_addr.S_un.S_un_b.s_b3, ss_b3, 10);
381  itoa(SockAddr.sin_addr.S_un.S_un_b.s_b4, ss_b4, 10);
382 
383  char addr[40];
384  strcpy(addr, ss_b1);
385  strcat(addr, ".");
386  strcat(addr, ss_b2);
387  strcat(addr, ".");
388  strcat(addr, ss_b3);
389  strcat(addr, ".");
390  strcat(addr, ss_b4);
391  strcat(addr, ":0.0");
392 
394 }
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
TNetwork Network
Definition: tnclass.h:49
void SetLocalAddress(char *buf)
Definition: tnetwork.cpp:88
_CRTIMP char *__cdecl itoa(_In_ int _Val, _Pre_notnull_ _Post_z_ char *_DstBuf, _In_ int _Radix)
GLsizeiptr size
Definition: glext.h:5919
GLenum const GLvoid * addr
Definition: glext.h:9621
struct in_addr sin_addr
Definition: winsock.h:512
struct sockaddr_in SOCKADDR_IN
Definition: winsock.h:487
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define AF_INET
Definition: tcpip.h:117
SOCKET GetSocket()
Definition: tnetwork.h:29
#define memset(x, y, z)
Definition: compat.h:39
short sin_family
Definition: winsock.h:510
INT WSAAPI getsockname(IN SOCKET s, OUT LPSOCKADDR name, IN OUT INT FAR *namelen)
Definition: sockctrl.c:213

Referenced by Open().

◆ SwitchKeyMap()

int Telnet::SwitchKeyMap ( int  to)

Definition at line 149 of file tnclass.cpp.

149  { // switch to selected keymap
150  int ret = KeyTrans.SwitchTo(to);
151  switch(ret) {
152  case -1: printm(0, FALSE, MSG_KEYNOKEYMAPS); break;
153  case 0: printm(0, FALSE, MSG_KEYBADMAP); break;
154  case 1: printm(0, FALSE, MSG_KEYMAPSWITCHED); break;
155  }
156  return ret;
157 };
#define MSG_KEYNOKEYMAPS
Definition: resource.h:47
#define MSG_KEYMAPSWITCHED
Definition: resource.h:50
#define MSG_KEYBADMAP
Definition: resource.h:49
int ret
int printm(LPTSTR szModule, BOOL fSystem, DWORD dwMessageId,...)
Definition: tnerror.cpp:84
int SwitchTo(int)
Definition: keytrans.cpp:82
KeyTranslator KeyTrans
Definition: tnclass.h:51

Referenced by telCommandLine().

◆ telSetConsoleTitle()

void Telnet::telSetConsoleTitle ( const char szHost)
private

Definition at line 353 of file tnclass.cpp.

354 {
355  char szTitle[128] = "Telnet - ";
356  strcat(szTitle, szHost1);
358 }
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
TConfig ini
Definition: tnconfig.cpp:45
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define SetConsoleTitle
Definition: wincon.h:771
bool get_set_title() const
Definition: tnconfig.h:55

Referenced by Close(), DoInit(), and Open().

Member Data Documentation

◆ bConnected

volatile int Telnet::bConnected
private

Definition at line 41 of file tnclass.h.

Referenced by Close(), DoInit(), Open(), Resume(), and ~Telnet().

◆ bNetFinish

volatile int Telnet::bNetFinish
private

Definition at line 45 of file tnclass.h.

Referenced by Close(), DoInit(), and Open().

◆ bNetFinished

volatile int Telnet::bNetFinished
private

Definition at line 44 of file tnclass.h.

Referenced by Close(), DoInit(), and Open().

◆ bNetPaused

volatile int Telnet::bNetPaused
private

Definition at line 43 of file tnclass.h.

Referenced by DoInit(), Open(), and Resume().

◆ bWinsockUp

volatile int Telnet::bWinsockUp
private

Definition at line 42 of file tnclass.h.

Referenced by DoInit(), Open(), and ~Telnet().

◆ Charmap

TCharmap Telnet::Charmap
private

Definition at line 50 of file tnclass.h.

◆ Clipboard

Tnclip Telnet::Clipboard
private

Definition at line 56 of file tnclass.h.

Referenced by Resume().

◆ Console

TConsole Telnet::Console
private

Definition at line 53 of file tnclass.h.

Referenced by Close(), and Resume().

◆ hConsoleWindow

HWND Telnet::hConsoleWindow
private

Definition at line 61 of file tnclass.h.

Referenced by DoInit(), and ~Telnet().

◆ hProcess

HANDLE Telnet::hProcess
private

Definition at line 66 of file tnclass.h.

Referenced by Close(), DoInit(), and Open().

◆ hThread

HANDLE Telnet::hThread
private

Definition at line 65 of file tnclass.h.

Referenced by Close(), DoInit(), Open(), and Resume().

◆ iconChange

bool Telnet::iconChange
private

Definition at line 63 of file tnclass.h.

Referenced by DoInit(), and ~Telnet().

◆ KeyTrans

KeyTranslator Telnet::KeyTrans
private

Definition at line 51 of file tnclass.h.

Referenced by Resume(), and SwitchKeyMap().

◆ MapLoader

TMapLoader Telnet::MapLoader
private

Definition at line 52 of file tnclass.h.

Referenced by DisplayKeyMap(), and LoadKeyMap().

◆ Mouse

TMouse Telnet::Mouse
private

Definition at line 57 of file tnclass.h.

Referenced by Resume().

◆ Network

TNetwork Telnet::Network
private

Definition at line 49 of file tnclass.h.

Referenced by Close(), Open(), Resume(), and SetLocalAddress().

◆ oldBIcon

LPARAM Telnet::oldBIcon
private

Definition at line 62 of file tnclass.h.

Referenced by DoInit(), and ~Telnet().

◆ oldSIcon

LPARAM Telnet::oldSIcon
private

Definition at line 62 of file tnclass.h.

Referenced by DoInit(), and ~Telnet().

◆ Parser

TANSIParser Telnet::Parser
private

Definition at line 59 of file tnclass.h.

◆ Scroller

TScroller Telnet::Scroller
private

Definition at line 58 of file tnclass.h.

Referenced by Resume().

◆ Socket

SOCKET Telnet::Socket
private

Definition at line 38 of file tnclass.h.

Referenced by Close(), DoInit(), and Open().

◆ strPort

char Telnet::strPort[32]
private

Definition at line 39 of file tnclass.h.

Referenced by Connect(), and Open().

◆ szHost

char Telnet::szHost[127]
private

Definition at line 40 of file tnclass.h.

Referenced by Connect(), and Open().

◆ TelHandler

TTelnetHandler Telnet::TelHandler
private

Definition at line 54 of file tnclass.h.

◆ ThreadParams

TelThreadParams Telnet::ThreadParams
private

Definition at line 55 of file tnclass.h.

Referenced by Close(), Open(), and Resume().


The documentation for this class was generated from the following files: