ircproxy The Ultimate Cyborg |
00001 // ircproxy -- An intelligent IRC proxy 00002 // 00003 //! @file AuthState.h 00004 //! @brief Header of class AuthState 00005 // 00006 // Copyright (C) 2007 by 00007 // 00008 // Carlo Wood, Run on IRC <carlo@alinoe.com> 00009 // RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt 00010 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61 00011 // 00012 // This file may be distributed under the terms of the Q Public License 00013 // version 1.0 as appearing in the file LICENSE.QPL included in the 00014 // packaging of this file. 00015 00016 #ifndef AUTHSTATE_H 00017 #define AUTHSTATE_H 00018 00019 #ifndef USE_PCH 00020 #include <string> 00021 #endif 00022 00023 #include "IdentityReference.h" 00024 #include "Bool.h" 00025 #include "Watched.h" 00026 00027 /*! @brief State information very early in a new connection. 00028 */ 00029 class AuthState : public virtual event_client_ct { 00030 private: 00031 ServerConnection& M_server_connection; //!< Reference to the underlying server connection. 00032 Bool M_auth_one_second_passed; //!< Set to true one second after connect. 00033 Watched<std::string> M_auth_ping_argument; //!< The argument of the first PING message. 00034 Bool M_doing_hostname_lookup; //!< Set to true if the notice '*** Looking up your hostname' was received. 00035 Bool M_finished_hostname_lookup; //!< Set to true if the hostname lookup finished. 00036 Bool M_doing_ident_lookup; //!< Set to true if the notice '*** Checking Ident' was received. 00037 Bool M_finished_ident_lookup; //!< Set to true if the ident lookup finished. 00038 public: 00039 AuthState(ServerConnection& server_connection); 00040 ~AuthState(); 00041 00042 //! Remember the argument of the first PING. 00043 void set_auth_ping_argument(std::string const& auth_ping_argument) { M_auth_ping_argument = auth_ping_argument; } 00044 //! Return argument of the first PING. 00045 std::string const& auth_ping_argument(void) const { return M_auth_ping_argument.value(); } 00046 00047 void auth_notice_looking_up_hostname(MatcherEventType const& event_type); 00048 void auth_notice_fin_hostname(MatcherEventType const& event_type); 00049 void auth_notice_looking_up_ident(MatcherEventType const& event_type); 00050 void auth_notice_fin_ident(MatcherEventType const& event_type); 00051 void auth_timeout(timer_event_type_ct const& expired_at); 00052 void send_pong_and_mode(ExpressionEventType const& event_type); 00053 00054 #ifdef CWDEBUG 00055 void print_on(std::ostream& os) const 00056 { 00057 os << "{server_connection:" << M_server_connection << 00058 "; auth_one_second_passed:" << M_auth_one_second_passed << 00059 "; auth_ping_argument:" << M_auth_ping_argument << 00060 "; doing_hostname_lookup:" << M_doing_hostname_lookup << 00061 "; finished_hostname_lookup:" << M_finished_hostname_lookup << 00062 "; doing_ident_lookup:" << M_doing_ident_lookup << 00063 "; finished_ident_lookup:" << M_finished_ident_lookup; 00064 } 00065 #endif 00066 }; 00067 00068 #endif // AUTHSTATE_H
Copyright © 2005-2007 Carlo Wood. All rights reserved. |
---|