Security_Current.cpp

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 #include "orbsvcs/Security/Security_Current.h"
00004 #include "tao/debug.h"
00005 
00006 ACE_RCSID (Security,
00007            Security_Current,
00008            "Security_Current.cpp,v 1.7 2006/03/14 06:14:35 jtc Exp")
00009 
00010 #if !defined (__ACE_INLINE__)
00011 # include "orbsvcs/Security/Security_Current.inl"
00012 #endif /* __ACE_INLINE__ */
00013 
00014 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00015 
00016 TAO_Security_Current::TAO_Security_Current (size_t tss_slot,
00017                                             const char *orb_id)
00018   : tss_slot_ (tss_slot),
00019     orb_id_ (orb_id),
00020     orb_core_ (0)
00021 {
00022 }
00023 
00024 TAO_Security_Current::~TAO_Security_Current (void)
00025 {
00026 }
00027 
00028 Security::AttributeList *
00029 TAO_Security_Current::get_attributes (
00030     const Security::AttributeTypeList &attributes
00031     ACE_ENV_ARG_DECL)
00032   ACE_THROW_SPEC ((CORBA::SystemException))
00033 {
00034   TAO::Security::Current_Impl *impl = this->implementation ();
00035 
00036   // If the implementation pointer returned from TSS is zero, then
00037   // we're not in the middle of a request/upcall.  Throw an exception
00038   // to indicate that.
00039   if (impl == 0)
00040     ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
00041 
00042   return impl->get_attributes (attributes ACE_ENV_ARG_PARAMETER);
00043 }
00044 
00045 SecurityLevel2::ReceivedCredentials_ptr
00046 TAO_Security_Current::received_credentials (
00047     ACE_ENV_SINGLE_ARG_DECL)
00048   ACE_THROW_SPEC ((CORBA::SystemException))
00049 {
00050   TAO::Security::Current_Impl *impl = this->implementation ();
00051 
00052   // If the implementation pointer returned from TSS is zero, then
00053   // we're not in the middle of a request/upcall.  Throw an exception
00054   // to indicate that.
00055   if (impl == 0)
00056     ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (), 0);
00057 
00058   return impl->received_credentials (ACE_ENV_SINGLE_ARG_PARAMETER);
00059 }
00060 
00061 int
00062 TAO_Security_Current::init (void)
00063 {
00064   int result = 0;
00065 
00066   ACE_DECLARE_NEW_CORBA_ENV;
00067   ACE_TRY
00068     {
00069       int argc = 0;
00070       char **argv = 0;
00071       CORBA::ORB_var orb = CORBA::ORB_init (argc,
00072                                             argv,
00073                                             this->orb_id_.in ()
00074                                             ACE_ENV_ARG_PARAMETER);
00075       ACE_TRY_CHECK;
00076 
00077       this->orb_core_ = orb.in ()->orb_core ();
00078 
00079       // No longer need the ORBid, so reclaim the memory it was
00080       // occupying.
00081       (void) this->orb_id_.out ();
00082     }
00083   ACE_CATCHANY
00084     {
00085       if (TAO_debug_level >= 1)
00086         ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
00087                              "Could not initialize SecurityCurrent:");
00088 
00089       result = -1;
00090     }
00091   ACE_ENDTRY;
00092   ACE_CHECK_RETURN (-1);
00093 
00094   return result;
00095 }
00096 
00097 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 13:50:47 2006 for TAO_Security by doxygen 1.3.6