Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

TelnetEncryptOption Class Reference

#include <NVT.h>

Inheritance diagram for TelnetEncryptOption:

Inheritance graph
[legend]
Collaboration diagram for TelnetEncryptOption:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TelnetEncryptOption (TCP_NVT *arg_endp)
void RecvSubOption (u_char *data, int len)
int DidRequest () const
int DoingEncryption () const

Protected Attributes

int did_encrypt_request
int doing_encryption

Friends

class TCP_NVT

Constructor & Destructor Documentation

TelnetEncryptOption::TelnetEncryptOption TCP_NVT arg_endp  )  [inline]
 

Definition at line 90 of file NVT.h.

References did_encrypt_request, doing_encryption, and TELNET_OPTION_ENCRYPT.

00091                 : TelnetOption(arg_endp, TELNET_OPTION_ENCRYPT)
00092                         { did_encrypt_request = doing_encryption = 0; }


Member Function Documentation

int TelnetEncryptOption::DidRequest  )  const [inline]
 

Definition at line 96 of file NVT.h.

References did_encrypt_request.

Referenced by RecvSubOption().

00096 { return did_encrypt_request; }

int TelnetEncryptOption::DoingEncryption  )  const [inline]
 

Definition at line 97 of file NVT.h.

References doing_encryption.

Referenced by RecvSubOption().

00097 { return doing_encryption; }

void TelnetEncryptOption::RecvSubOption u_char *  data,
int  len
[virtual]
 

Reimplemented from TelnetOption.

Definition at line 157 of file NVT.cc.

References TCP_NVT::AuthenticationHasBeenAccepted(), TelnetOption::BadOption(), did_encrypt_request, DidRequest(), doing_encryption, DoingEncryption(), ENCRYPT_REQUEST_START_TO_ENCRYPT, ENCRYPT_STARTING_TO_ENCRYPT, TelnetOption::Endpoint(), TCP_NVT::FindPeerOption(), TelnetOption::InconsistentOption(), internal_error(), and TCP_NVT::SetEncrypting().

00158         {
00159         if ( ! active )
00160                 {
00161                 InconsistentOption(0);
00162                 return;
00163                 }
00164 
00165         if ( len <= 0 )
00166                 {
00167                 BadOption();
00168                 return;
00169                 }
00170 
00171         unsigned int opt = data[0];
00172 
00173         if ( opt == ENCRYPT_REQUEST_START_TO_ENCRYPT )
00174                 ++did_encrypt_request;
00175 
00176         else if ( opt == ENCRYPT_STARTING_TO_ENCRYPT )
00177                 {
00178                 TelnetEncryptOption* peer =
00179                         (TelnetEncryptOption*) endp->FindPeerOption(code);
00180 
00181                 if ( ! peer )
00182                         internal_error("option peer missing in TelnetEncryptOption::RecvSubOption");
00183 
00184                 if ( peer->DidRequest() || peer->DoingEncryption() ||
00185                      peer->Endpoint()->AuthenticationHasBeenAccepted() )
00186                         {
00187                         endp->SetEncrypting(1);
00188                         ++doing_encryption;
00189                         }
00190                 else
00191                         InconsistentOption(0);
00192                 }
00193         }


Friends And Related Function Documentation

friend class TCP_NVT [friend]
 

Reimplemented from TelnetOption.

Definition at line 100 of file NVT.h.


Member Data Documentation

int TelnetEncryptOption::did_encrypt_request [protected]
 

Definition at line 101 of file NVT.h.

Referenced by DidRequest(), RecvSubOption(), and TelnetEncryptOption().

int TelnetEncryptOption::doing_encryption [protected]
 

Definition at line 101 of file NVT.h.

Referenced by DoingEncryption(), RecvSubOption(), and TelnetEncryptOption().


The documentation for this class was generated from the following files:
Generated on Sat May 1 15:33:02 2004 for bro_docs.8a82 by doxygen 1.3.6