Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
4.6 KiB

  1. #if !defined(AFX_WATCHERTELNETCLIEN_H__5CB77E83_A530_4398_B134_353F5F0C84E5__INCLUDED_)
  2. #define AFX_WatcherTelnetClient_H__5CB77E83_A530_4398_B134_353F5F0C84E5__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // WatcherTelnetClient.h : header file
  7. //
  8. #include "WatcherSocket.h"
  9. /////////////////////////////////////////////////////////////////////////////
  10. // WatcherTelnetClient command target
  11. /*
  12. * Definitions for the TELNET protocol.
  13. */
  14. #define NO_COMMAND 0 /* No command processing */
  15. #define IAC 255 /* interpret as command: */
  16. #define DONT 254 /* you are not to use option */
  17. #define DO 253 /* please, you use option */
  18. #define WONT 252 /* I won't use option */
  19. #define WILL 251 /* I will use option */
  20. #define SB 250 /* interpret as subnegotiation */
  21. #define GA 249 /* you may reverse the line */
  22. #define EL 248 /* erase the current line */
  23. #define EC 247 /* erase the current character */
  24. #define AYT 246 /* are you there */
  25. #define AO 245 /* abort output--but let prog finish */
  26. #define IP 244 /* interrupt process--permanently */
  27. #define BREAK 243 /* break */
  28. #define DM 242 /* data mark--for connect. cleaning */
  29. #define NOP 241 /* nop */
  30. #define SE 240 /* end sub negotiation */
  31. #define SYNCH 242 /* for telfunc calls */
  32. /* Telnet options - Names have been truncated to be unique in 7 chars */
  33. #define TO_BINARY 0 /* 8-bit data path */
  34. #define TO_ECHO 1 /* echo */
  35. #define TO_RCP 2 /* prepare to reconnect */
  36. #define TO_SGA 3 /* suppress go ahead */
  37. #define TO_NAMS 4 /* approximate message size */
  38. #define TO_STATUS 5 /* give status */
  39. #define TO_TM 6 /* timing mark */
  40. #define TO_RCTE 7 /* remote controlled transmission and echo */
  41. #define TO_NL 8 /* negotiate about output line width */
  42. #define TO_NP 9 /* negotiate about output page size */
  43. #define TO_NCRD 10 /* negotiate about CR disposition */
  44. #define TO_NHTS 11 /* negotiate about horizontal tabstops */
  45. #define TO_NHTD 12 /* negotiate about horizontal tab disposition */
  46. #define TO_NFFD 13 /* negotiate about formfeed disposition */
  47. #define TO_NVTS 14 /* negotiate about vertical tab stops */
  48. #define TO_NVTD 15 /* negotiate about vertical tab disposition */
  49. #define TO_NLFD 16 /* negotiate about output LF disposition */
  50. #define TO_XASCII 17 /* extended ascic character set */
  51. #define TO_LOGOUT 18 /* force logout */
  52. #define TO_BM 19 /* byte macro */
  53. #define TO_DET 20 /* data entry terminal */
  54. #define TO_SUPDUP 21 /* supdup protocol */
  55. #define TO_TERM_TYPE 24 /* terminal type */
  56. #define TO_NAWS 31 // Negotiate About Window Size
  57. #define TO_TOGGLE_FLOW_CONTROL 33 /* Enable & disable Flow control */
  58. #define TO_ENVIRON 36 /* Environment Option */
  59. #define TO_NEW_ENVIRON 39 /* New Environment Option */
  60. #define TO_EXOPL 255 /* extended-options-list */
  61. #define TO_AUTH 37
  62. #define TT_SEND 1
  63. #define TT_IS 0
  64. class WatcherTelnetClient : public WatcherSocket
  65. {
  66. // Attributes
  67. public:
  68. public:
  69. WatcherTelnetClient(LPBYTE cmd = NULL, int cmdLen=0, LPBYTE lgn = NULL, int lngLen=0 );
  70. virtual ~WatcherTelnetClient();
  71. // Overrides
  72. public:
  73. // ClassWizard generated virtual function overrides
  74. //{{AFX_VIRTUAL(WatcherTelnetClient)
  75. //}}AFX_VIRTUAL
  76. void OnReceive(int nErrorCode);
  77. void OnClose(int nErrorCode);
  78. // Generated message map functions
  79. //{{AFX_MSG(WatcherTelnetClient)
  80. // NOTE - the ClassWizard will add and remove member functions here.
  81. //}}AFX_MSG
  82. // Implementation
  83. protected:
  84. BYTE CommandSequence;
  85. int lenLogin;
  86. LPBYTE Login;
  87. int OptionIndex;
  88. int PacketNumber;
  89. BOOL SentTermType;
  90. BYTE Options[MAX_BUFFER_SIZE];
  91. void ProcessSBCommand(BYTE cmd);
  92. int ProcessByte(BYTE Char);
  93. void ProcessCommand(BYTE cmd);
  94. };
  95. /////////////////////////////////////////////////////////////////////////////
  96. //{{AFX_INSERT_LOCATION}}
  97. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  98. #endif // !defined(AFX_WatcherTelnetClient_H__5CB77E83_A530_4398_B134_353F5F0C84E5__INCLUDED_)