1 #include "ClientInterceptor.h"
2 #include "tao/OctetSeqC.h"
3 #include "tao/PI/ClientRequestInfo.h"
4 #include "ace/OS_NS_string.h"
7 const CORBA::ULong service_ctx_id
= 0xdeed;
11 : myname_ ("Client_Authentication_Interceptor")
13 std::cout
<< "Calling ClientInterceptor constructor." << std::endl
;
16 ClientInterceptor::~ClientInterceptor ()
21 ClientInterceptor::name ()
23 std::cout
<< "Calling ClientInterceptor name() method" << std::endl
;
24 return CORBA::string_dup (this->myname_
);
28 ClientInterceptor::destroy ()
33 ClientInterceptor::send_poll (
34 PortableInterceptor::ClientRequestInfo_ptr
)
36 std::cout
<< "Calling send_poll()." << std::endl
;
41 ClientInterceptor::send_request (
42 PortableInterceptor::ClientRequestInfo_ptr ri
)
44 std::cout
<< "Calling send_request()." << std::endl
;
46 IOP::ServiceContext sc
;
47 sc
.context_id
= service_ctx_id
;
49 const char user_name
[] = "Ron Klein";
50 std::cout
<< "User's Name: " << user_name
<< std::endl
;
51 CORBA::ULong string_len
= sizeof (user_name
) + 1;
52 CORBA::Octet
*buf
= 0;
54 buf
= new CORBA::Octet
[string_len
];
56 ACE_OS::strcpy (reinterpret_cast<char*> (buf
), user_name
);
58 sc
.context_data
.replace (string_len
, string_len
, buf
, true);
60 // Add this context to the service context list.
61 ri
->add_request_service_context (sc
, false);
65 ClientInterceptor::receive_reply (
66 PortableInterceptor::ClientRequestInfo_ptr ri
)
69 std::cout
<< "Calling receive_reply()." << std::endl
;
73 ClientInterceptor::receive_other (
74 PortableInterceptor::ClientRequestInfo_ptr
)
76 std::cout
<< "Calling receive_other()." << std::endl
;
80 ClientInterceptor::receive_exception (
81 PortableInterceptor::ClientRequestInfo_ptr ri
)
84 std::cout
<< "Calling receive_exception()." << std::endl
;