Leaked source code of windows server 2003
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.

156 lines
5.3 KiB

  1. // RFCProto.h : This file contains the
  2. // Created: Feb '98
  3. // Author : a-rakeba
  4. // History:
  5. // Copyright (C) 1998 Microsoft Corporation
  6. // All rights reserved.
  7. // Microsoft Confidential
  8. #if !defined( _RFCPROTO_H_ )
  9. #define _RFCPROTO_H_
  10. #include <cmnhdr.h>
  11. #include <windows.h>
  12. #include <vtnt.h>
  13. #include <IoHandlr.h>
  14. #define NUM_TS_STATES 6
  15. #define NUM_CHARS 256
  16. #define NUM_SS_STATES 12
  17. #define VERSION1 "1"
  18. #define VERSION2 "2"
  19. #define STREAM "stream"
  20. #define CONSOLE "console"
  21. #define T_INVALID 0xFF // an invalid transition index
  22. enum { E_UNDEFINED, E_DEFINED_BUT_NONE };
  23. enum { E_UNKNOWN, E_USER, E_SFUTLNTVER, E_SFUTLNTMODE };
  24. class CSession;
  25. struct CRFCProtocol {
  26. friend class CIoHandler;
  27. UCHAR m_telnetFSM[ NUM_TS_STATES ][ NUM_CHARS ];
  28. INT m_telnetState;
  29. UCHAR m_subNegFSM[ NUM_SS_STATES ][ NUM_CHARS ];
  30. INT m_subNegState;
  31. DWORD m_dwExcludeTerm;
  32. bool m_fPasswordConcealMode;
  33. bool m_fWaitingForResponseToA_DO_ForTO_ECHO;
  34. bool m_fWaitingForAResponseToA_WILL_ForTO_ECHO;
  35. bool m_fWaitingForAResponseToA_DO_ForTO_AUTH;
  36. bool m_fWaitingForResponseToA_DO_ForTO_NAWS;
  37. bool m_fWaitingForResponseToA_DO_ForTO_SGA;
  38. bool m_fWaitingForAResponseToA_WILL_ForTO_SGA;
  39. bool m_fWaitingForResponseToA_DO_ForTO_TXBINARY;
  40. bool m_fWaitingForAResponseToA_WILL_ForTO_TXBINARY;
  41. bool m_fWaitingForResponseToA_DO_ForTO_TERMTYPE;
  42. bool m_fWaitingForResponseToA_DO_ForTO_NEWENVIRON;
  43. CRFCProtocol();
  44. virtual ~CRFCProtocol();
  45. void Init( CSession * );
  46. bool InitialNegotiation();
  47. void ChangeCurrentTerm();
  48. void DisAllowVtnt( PUCHAR * );
  49. void BuildFSMs( void );
  50. //void FSMInit( UCHAR fSM[][ NUM_CHARS ], FSM_TRANSITION transTable[],
  51. void FSMInit( UCHAR fSM[][ NUM_CHARS ], void* transTable,
  52. INT numStates );
  53. CIoHandler::IO_OPERATIONS ProcessDataReceivedOnSocket( LPDWORD lpdwIoSize );
  54. bool StrToVTNTResponse( LPSTR, DWORD, VOID**, DWORD* );
  55. void FillVtntHeader( UCHAR*, WORD, WORD, WORD, WORD, WORD, SHORT*, LPTSTR, DWORD );
  56. void NoOp( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  57. void GoAhead( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  58. void EraseLine( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  59. void EraseChar( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  60. void AreYouThere( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  61. void AbortOutput( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  62. void InterruptProcess( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  63. void Break( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  64. void PutBack( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  65. void RecordOption( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  66. void WillNotSup( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  67. void DoNotSup( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  68. void DoEcho( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  69. void DoNaws( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  70. void DoSuppressGA( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  71. void DoTxBinary( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  72. void DoTermType( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  73. void AskForSendingTermType( PUCHAR* pBuffer );
  74. void DoAuthentication( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  75. void DoNewEnviron( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  76. void AskForSendingNewEnviron( PUCHAR* pBuffer );
  77. //void WillTermType( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  78. void WillTxBinary( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  79. void WillSuppressGA( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  80. void WillEcho( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  81. void WillNTLM( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  82. void SubOption( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  83. void SubTermType( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  84. void SubNaws( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  85. void SubAuth( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  86. void SubEnd( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  87. void DataMark( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  88. void Abort( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  89. void SubNewEnvShowLoginPrompt( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  90. void SubNewEnvGetValue( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  91. void SubNewEnvGetVariable( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  92. void SubNewEnvGetString( LPBYTE* ppPutBack, PUCHAR* pBuffer, BYTE b );
  93. void FindVariable();
  94. private:
  95. bool fSubTermType;
  96. CHAR m_szPrevTermType[ MAX_PATH + 1 ];
  97. CHAR m_szCurrentEnvVariable[ MAX_PATH + 1 ];
  98. bool m_bIsUserNameProvided;
  99. bool m_fSubNewEnv;
  100. DWORD m_dwWhichVar;
  101. DWORD m_dwWhatVal;
  102. bool fSubNaws;
  103. bool m_fSubNawsFirstTime;
  104. DWORD m_dwSubNawsByteNumber;
  105. bool fSubAuth;
  106. CHAR m_NTLMDataBuffer[ 2048 ];
  107. WORD m_wNTLMDataBufferIndex;
  108. BYTE m_optionCmd;
  109. BYTE m_remoteOptions[ 256 ];
  110. BYTE m_localOptions[ 256 ];
  111. CSession *m_pSession;
  112. CRFCProtocol( const CRFCProtocol& );
  113. CRFCProtocol& operator=( const CRFCProtocol& );
  114. };
  115. #endif // _RFCPROTO_H_