ReactOS  0.4.14-dev-115-g4576127
TNetwork Class Reference

#include <tnetwork.h>

Collaboration diagram for TNetwork:

Public Member Functions

 TNetwork (SOCKET s=0)
 
 ~TNetwork ()
 
void SetSocket (SOCKET s)
 
SOCKET GetSocket ()
 
void SetPipe (HANDLE pIn, HANDLE pOut)
 
void SetNawsFunc (Naws_func_t func)
 
void SetLocalAddress (char *buf)
 
const charGetLocalAddress ()
 
NetworkType get_net_type ()
 
int WriteString (const char *str, const int length)
 
int ReadString (char *str, const int length)
 
BOOL get_local_echo ()
 
void set_local_echo (BOOL b)
 
BOOL get_line_mode ()
 
void set_line_mode (BOOL b)
 
void do_naws (int width, int height)
 

Private Attributes

SOCKET socket
 
BOOL local_echo
 
BOOL line_mode
 
NetworkType net_type
 
HANDLE pipeIn
 
HANDLE pipeOut
 
Naws_func_t naws_func
 
charlocal_address
 

Detailed Description

Definition at line 12 of file tnetwork.h.

Constructor & Destructor Documentation

◆ TNetwork()

TNetwork::TNetwork ( SOCKET  s = 0)
inline

Definition at line 23 of file tnetwork.h.

23  : socket(s), local_echo(1), line_mode(1),
25  local_address((char *)NULL) {}
NetworkType net_type
Definition: tnetwork.h:17
smooth NULL
Definition: ftsmooth.c:416
SOCKET socket
Definition: tnetwork.h:14
int(* Naws_func_t)(char *, int, int)
Definition: tnetwork.h:10
BOOL local_echo
Definition: tnetwork.h:15
BOOL line_mode
Definition: tnetwork.h:16
char * local_address
Definition: tnetwork.h:20
GLdouble s
Definition: gl.h:2039
Naws_func_t naws_func
Definition: tnetwork.h:19

◆ ~TNetwork()

TNetwork::~TNetwork ( )
inline

Definition at line 26 of file tnetwork.h.

26 {if(local_address) delete[] local_address;}
char * local_address
Definition: tnetwork.h:20

Member Function Documentation

◆ do_naws()

void TNetwork::do_naws ( int  width,
int  height 
)

Definition at line 81 of file tnetwork.cpp.

81  {
82  if(!naws_func) return;
83  char buf[100];
84  int len = (*naws_func)(buf, width, height);
86 }
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
int WriteString(const char *str, const int length)
Definition: tnetwork.cpp:53
GLenum GLsizei len
Definition: glext.h:6722
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
Naws_func_t naws_func
Definition: tnetwork.h:19

◆ get_line_mode()

BOOL TNetwork::get_line_mode ( )
inline

Definition at line 43 of file tnetwork.h.

43 {return line_mode;}
BOOL line_mode
Definition: tnetwork.h:16

◆ get_local_echo()

BOOL TNetwork::get_local_echo ( )
inline

Definition at line 40 of file tnetwork.h.

40 {return local_echo;}
BOOL local_echo
Definition: tnetwork.h:15

Referenced by TANSIParser::ParseANSIBuffer(), and TTelnetHandler::ParseIAC().

◆ get_net_type()

NetworkType TNetwork::get_net_type ( )
inline

Definition at line 35 of file tnetwork.h.

35 {return net_type;}
NetworkType net_type
Definition: tnetwork.h:17

Referenced by Telnet::Close(), and TTelnetHandler::ParseBuffer().

◆ GetLocalAddress()

const char* TNetwork::GetLocalAddress ( )
inline

Definition at line 33 of file tnetwork.h.

33 {return local_address;}
char * local_address
Definition: tnetwork.h:20

Referenced by TTelnetHandler::ParseIAC().

◆ GetSocket()

SOCKET TNetwork::GetSocket ( )
inline

Definition at line 29 of file tnetwork.h.

29 {return socket;}
SOCKET socket
Definition: tnetwork.h:14

Referenced by Telnet::SetLocalAddress().

◆ ReadString()

int TNetwork::ReadString ( char str,
const int  length 
)

Definition at line 67 of file tnetwork.cpp.

67  {
68  switch(net_type) {
69  case TN_NETSOCKET:
70  return recv(socket, str, length, 0);
71  case TN_NETPIPE:
72  {
73  DWORD dwRead;
74  if(!ReadFile(pipeIn, str, length, &dwRead, (LPOVERLAPPED)NULL)) return -1;
75  return dwRead;
76  }
77  }
78  return 0;
79 }
HANDLE pipeIn
Definition: tnetwork.h:18
NetworkType net_type
Definition: tnetwork.h:17
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
SOCKET socket
Definition: tnetwork.h:14
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
Definition: recv.c:23

Referenced by TTelnetHandler::Go().

◆ set_line_mode()

void TNetwork::set_line_mode ( BOOL  b)
inline

Definition at line 44 of file tnetwork.h.

44 {line_mode = b;}
#define b
Definition: ke_i.h:79
BOOL line_mode
Definition: tnetwork.h:16

Referenced by TTelnetHandler::ParseIAC().

◆ set_local_echo()

void TNetwork::set_local_echo ( BOOL  b)
inline

Definition at line 41 of file tnetwork.h.

41 {local_echo = b;}
#define b
Definition: ke_i.h:79
BOOL local_echo
Definition: tnetwork.h:15

Referenced by TTelnetHandler::init(), and TTelnetHandler::ParseIAC().

◆ SetLocalAddress()

void TNetwork::SetLocalAddress ( char buf)

Definition at line 88 of file tnetwork.cpp.

88  {
89  local_address = new char[strlen(buf) + 1];
91 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
char * local_address
Definition: tnetwork.h:20
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by Telnet::SetLocalAddress().

◆ SetNawsFunc()

void TNetwork::SetNawsFunc ( Naws_func_t  func)
inline

Definition at line 31 of file tnetwork.h.

31 {naws_func = func;}
GLenum func
Definition: glext.h:6028
Naws_func_t naws_func
Definition: tnetwork.h:19

Referenced by TTelnetHandler::ParseIAC(), and TTelnetHandler::TTelnetHandler().

◆ SetPipe()

void TNetwork::SetPipe ( HANDLE  pIn,
HANDLE  pOut 
)

Definition at line 46 of file tnetwork.cpp.

46  {
47  pipeIn = pIn;
48  pipeOut = pOut;
50  local_echo = line_mode = 0;
51 }
HANDLE pipeIn
Definition: tnetwork.h:18
NetworkType net_type
Definition: tnetwork.h:17
HANDLE pipeOut
Definition: tnetwork.h:18
BOOL local_echo
Definition: tnetwork.h:15
BOOL line_mode
Definition: tnetwork.h:16

Referenced by Telnet::Open().

◆ SetSocket()

void TNetwork::SetSocket ( SOCKET  s)

Definition at line 40 of file tnetwork.cpp.

40  {
41  socket = s;
43  local_echo = line_mode = 1;
44 }
NetworkType net_type
Definition: tnetwork.h:17
SOCKET socket
Definition: tnetwork.h:14
BOOL local_echo
Definition: tnetwork.h:15
BOOL line_mode
Definition: tnetwork.h:16
GLdouble s
Definition: gl.h:2039

Referenced by Telnet::Open().

◆ WriteString()

int TNetwork::WriteString ( const char str,
const int  length 
)

Definition at line 53 of file tnetwork.cpp.

53  {
54  switch(net_type) {
55  case TN_NETSOCKET:
56  return send(socket, str, length, 0);
57  case TN_NETPIPE:
58  {
59  DWORD dwWritten;
60  if(!WriteFile(pipeOut, str, length, &dwWritten, (LPOVERLAPPED)NULL)) return -1;
61  return dwWritten;
62  }
63  }
64  return 0;
65 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
NetworkType net_type
Definition: tnetwork.h:17
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
HANDLE pipeOut
Definition: tnetwork.h:18
SOCKET socket
Definition: tnetwork.h:14
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
Definition: send.c:23
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by ControlEventHandler(), do_naws(), TANSIParser::ParseEscape(), TANSIParser::ParseEscapeANSI(), TTelnetHandler::ParseIAC(), Tnclip::Paste(), TTelnetHandler::SendIAC(), and TTelnetHandler::SendIACParams().

Member Data Documentation

◆ line_mode

BOOL TNetwork::line_mode
private

Definition at line 16 of file tnetwork.h.

Referenced by get_line_mode(), set_line_mode(), SetPipe(), and SetSocket().

◆ local_address

char* TNetwork::local_address
private

Definition at line 20 of file tnetwork.h.

Referenced by GetLocalAddress(), SetLocalAddress(), and ~TNetwork().

◆ local_echo

BOOL TNetwork::local_echo
private

Definition at line 15 of file tnetwork.h.

Referenced by get_local_echo(), set_local_echo(), SetPipe(), and SetSocket().

◆ naws_func

Naws_func_t TNetwork::naws_func
private

Definition at line 19 of file tnetwork.h.

Referenced by do_naws(), and SetNawsFunc().

◆ net_type

NetworkType TNetwork::net_type
private

Definition at line 17 of file tnetwork.h.

Referenced by get_net_type(), ReadString(), SetPipe(), SetSocket(), and WriteString().

◆ pipeIn

HANDLE TNetwork::pipeIn
private

Definition at line 18 of file tnetwork.h.

Referenced by ReadString(), and SetPipe().

◆ pipeOut

HANDLE TNetwork::pipeOut
private

Definition at line 18 of file tnetwork.h.

Referenced by SetPipe(), and WriteString().

◆ socket

SOCKET TNetwork::socket
private

Definition at line 14 of file tnetwork.h.

Referenced by GetSocket(), ReadString(), SetSocket(), and WriteString().


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