ReactOS 0.4.15-dev-7674-gc0b4db1
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
BOOL local_echo
Definition: tnetwork.h:15
Naws_func_t naws_func
Definition: tnetwork.h:19
SOCKET socket
Definition: tnetwork.h:14
BOOL line_mode
Definition: tnetwork.h:16
char * local_address
Definition: tnetwork.h:20
#define NULL
Definition: types.h:112
GLdouble s
Definition: gl.h:2039
@ TN_NETSOCKET
Definition: tnetwork.h:8
int(* Naws_func_t)(char *, int, int)
Definition: tnetwork.h:10

◆ ~TNetwork()

TNetwork::~TNetwork ( )
inline

Definition at line 26 of file tnetwork.h.

26{if(local_address) delete[] local_address;}

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}
int WriteString(const char *str, const int length)
Definition: tnetwork.cpp:53
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722

◆ get_line_mode()

BOOL TNetwork::get_line_mode ( )
inline

Definition at line 43 of file tnetwork.h.

43{return line_mode;}

◆ get_local_echo()

BOOL TNetwork::get_local_echo ( )
inline

Definition at line 40 of file tnetwork.h.

40{return local_echo;}

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;}

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;}

Referenced by TTelnetHandler::ParseIAC().

◆ GetSocket()

SOCKET TNetwork::GetSocket ( )
inline

Definition at line 29 of file tnetwork.h.

29{return socket;}

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
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
Definition: recv.c:23
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
const WCHAR * str
@ TN_NETPIPE
Definition: tnetwork.h:8

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

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;}

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
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

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;
51}
HANDLE pipeOut
Definition: tnetwork.h:18

Referenced by Telnet::Open().

◆ SetSocket()

void TNetwork::SetSocket ( SOCKET  s)

Definition at line 40 of file tnetwork.cpp.

40 {
41 socket = s;
44}

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
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
Definition: send.c:23

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: