#include <URLBase.h>
Public Member Functions | |
URL_INetAuthBase (u_short port) | |
virtual | ~URL_INetAuthBase () |
const ACE_CString & | get_user_info () const |
void | set_user_info (const ACE_CString &userinfo) |
virtual ACE_CString | get_authority () const |
Static Public Member Functions | |
static bool | add_authenticator (const ACE_CString &auth_id, AuthenticatorBase *authenticator) |
static bool | has_authenticator (const ACE_CString &auth_id) |
static AuthenticatorBase * | remove_authenticator (const ACE_CString &auth_id) |
static bool | authenticate (AuthenticationBase &authentication) |
Protected Member Functions | |
virtual int | parse_authority (std::istream &is) |
Private Types | |
typedef ACE_Refcounted_Auto_Ptr < AuthenticatorBase, ACE_SYNCH::NULL_MUTEX > | authenticator_ptr |
typedef ACE_Map_Manager < ACE_CString, authenticator_ptr, ACE_SYNCH::RECURSIVE_MUTEX > | authenticator_map |
Private Attributes | |
ACE_CString | userinfo_ |
Static Private Attributes | |
static authenticator_map | authenticators_ |
Definition at line 193 of file URLBase.h.
typedef ACE_Map_Manager<ACE_CString, authenticator_ptr, ACE_SYNCH::RECURSIVE_MUTEX> ACE::INet::URL_INetAuthBase::authenticator_map [private] |
typedef ACE_Refcounted_Auto_Ptr<AuthenticatorBase, ACE_SYNCH::NULL_MUTEX> ACE::INet::URL_INetAuthBase::authenticator_ptr [private] |
ACE::INet::URL_INetAuthBase::URL_INetAuthBase | ( | u_short | port | ) |
Definition at line 346 of file URLBase.cpp.
: URL_INetBase (port) { }
ACE::INet::URL_INetAuthBase::~URL_INetAuthBase | ( | ) | [virtual] |
Definition at line 351 of file URLBase.cpp.
{}
bool ACE::INet::URL_INetAuthBase::add_authenticator | ( | const ACE_CString & | auth_id, | |
AuthenticatorBase * | authenticator | |||
) | [static] |
Definition at line 396 of file URLBase.cpp.
{ if (URL_INetAuthBase::authenticators_.find (auth_id) == -1) { return URL_INetAuthBase::authenticators_.bind (auth_id, authenticator_ptr (authenticator)) == 0; } return false; }
bool ACE::INet::URL_INetAuthBase::authenticate | ( | AuthenticationBase & | authentication | ) | [static] |
Definition at line 422 of file URLBase.cpp.
{ ACE_GUARD_RETURN (ACE_SYNCH::RECURSIVE_MUTEX, _guard, URL_INetAuthBase::authenticators_.mutex (), false); authenticator_map::iterator it = URL_INetAuthBase::authenticators_.begin (); for (; it != URL_INetAuthBase::authenticators_.end (); ++it) { authenticator_ptr auth_ptr = (*it).int_id_; // release lock before calling user code if (URL_INetAuthBase::authenticators_.mutex ().release () != 0) return false; if (auth_ptr->authenticate (authentication)) return true; // re-acquire lock if (URL_INetAuthBase::authenticators_.mutex ().acquire () != 0) return false; } return false; }
ACE_CString ACE::INet::URL_INetAuthBase::get_authority | ( | ) | const [virtual] |
Reimplemented from ACE::INet::URL_INetBase.
Definition at line 353 of file URLBase.cpp.
{ ACE::IOS::CString_OStream sos; if (!this->get_user_info ().empty ()) sos << this->get_user_info ().c_str () << "@"; sos << this->get_host().c_str (); if (this->get_port () != this->default_port ()) sos << ':' << this->get_port (); return sos.str (); }
const ACE_CString & ACE::INet::URL_INetAuthBase::get_user_info | ( | ) | const [inline] |
Definition at line 82 of file URLBase.inl.
{ return this->userinfo_; }
bool ACE::INet::URL_INetAuthBase::has_authenticator | ( | const ACE_CString & | auth_id | ) | [static] |
Definition at line 407 of file URLBase.cpp.
{ return (URL_INetAuthBase::authenticators_.find (auth_id) == 0); }
int ACE::INet::URL_INetAuthBase::parse_authority | ( | std::istream & | is | ) | [protected, virtual] |
Reimplemented from ACE::INet::URL_INetBase.
Definition at line 364 of file URLBase.cpp.
{ static const int eof = std::char_traits<ACE::IOS::CString_OStream::char_type>::eof (); ACE::IOS::CString_OStream sos; int ch; // parse userinfo (if any) for (ch = is.get (); #if defined (ACE_HAS_IPV6) ch != '[' && ch != '/' && ch != ':' && ch != '@' && ch != '?' && ch != '#' && ch != eof ; #else ch != '/' && ch != ':' && ch != '@' && ch != '?' && ch != '#' && ch != eof ; #endif ch = is.get ()) sos.put (ch); if (ch == '@') { this->set_user_info (sos.str ()); sos.clear (); ch = URL_INetBase::parse_authority_i (is, sos, 0); } else { ch = URL_INetBase::parse_authority_i (is, sos, ch); } return ch; }
AuthenticatorBase * ACE::INet::URL_INetAuthBase::remove_authenticator | ( | const ACE_CString & | auth_id | ) | [static] |
Definition at line 412 of file URLBase.cpp.
{ authenticator_ptr auth; if (URL_INetAuthBase::authenticators_.unbind (auth_id, auth) == 0) { auth.release (); } return 0; }
void ACE::INet::URL_INetAuthBase::set_user_info | ( | const ACE_CString & | userinfo | ) | [inline] |
Definition at line 88 of file URLBase.inl.
{ this->userinfo_ = userinfo; }