3 * MICO --- an Open Source CORBA implementation
4 * Copyright (c) 1997-2001 by The Mico Team
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 * For more information, visit the MICO Home Page at
21 * http://www.mico.org/
24 #ifndef __mico_intercept_h__
25 #define __mico_intercept_h__
27 // mapped by hand from intercept.idl
29 // workaround for flaw in X11 headers
32 namespace Interceptor {
42 typedef Root *Root_ptr;
43 typedef ObjVar<Root> Root_var;
45 class Root : public CORBA::ServerlessObject {
47 typedef CORBA::ULong Priority;
48 //const Priority LowestPriority = 0;
49 //const Priority HighestPriority = 0x7fffffffL;
52 HighestPriority = 0x7fffffff
56 CORBA::Boolean _is_active;
62 virtual const char *_repoid() const;
63 static Root_ptr _nil ()
67 static Root_ptr _duplicate (Root_ptr o)
73 static Root_ptr _narrow (Root_ptr);
77 virtual void activate (Priority p);
78 virtual void deactivate ();
79 CORBA::Boolean is_active ();
84 typedef Context *Context_ptr;
85 typedef ObjVar<Context> Context_var;
86 typedef ObjOut<Context> Context_out;
88 class Context : public CORBA::ServerlessObject {
93 virtual const char *_repoid() const;
94 static Context_ptr _nil ()
98 static Context_ptr _duplicate (Context_ptr o)
104 static Context_ptr _narrow (Context_ptr);
110 typedef IOP::ServiceID ServiceID;
111 typedef SequenceTmpl<CORBA::Octet,MICO_TID_OCTET> ContextData;
112 typedef TSeqVar<ContextData> ContextData_var;
116 typedef LWRootRequest *LWRootRequest_ptr;
117 typedef ObjVar<LWRootRequest> LWRootRequest_var;
118 typedef ObjOut<LWRootRequest> LWRootRequest_out;
120 class LWRootRequest : public CORBA::ServerlessObject {
122 typedef std::map<Root_ptr, Context_var, std::less<Root_ptr> > CtxMap;
124 IOP::ServiceContextList &_svc;
125 CORBA::String_var &_op;
126 CORBA::Object_var &_obj;
128 LWRootRequest (CORBA::Object_var &obj,
129 CORBA::String_var &op,
130 IOP::ServiceContextList &svc);
131 virtual ~LWRootRequest ();
133 virtual const char *_repoid() const;
134 static LWRootRequest_ptr _nil ()
138 static LWRootRequest_ptr _duplicate (LWRootRequest_ptr o)
144 static LWRootRequest_ptr _narrow (LWRootRequest_ptr);
146 CORBA::Object_ptr target();
147 void target (CORBA::Object_ptr);
148 CORBA::Identifier operation();
149 void operation (const CORBA::Identifier);
151 void set_service_context (ServiceID id,
153 const ContextData &d);
154 ContextData *get_service_context (ServiceID id,
156 void remove_service_context (ServiceID id);
157 CORBA::Boolean has_service_context (ServiceID id);
159 void set_context (Root_ptr interceptor, Context_ptr ctx);
160 Context_ptr get_context (Root_ptr interceptor);
165 typedef LWRequest *LWRequest_ptr;
166 typedef ObjVar<LWRequest> LWRequest_var;
167 typedef ObjOut<LWRequest> LWRequest_out;
169 class LWRequest : public LWRootRequest {
170 CORBA::Request_ptr _req;
172 LWRequest (CORBA::Object_var &obj,
173 CORBA::String_var &op,
174 IOP::ServiceContextList &svc,
175 CORBA::Request_ptr req);
176 virtual ~LWRequest ();
178 virtual const char *_repoid() const;
179 static LWRequest_ptr _nil ()
183 static LWRequest_ptr _duplicate (LWRequest_ptr o)
189 static LWRequest_ptr _narrow (LWRootRequest_ptr);
191 CORBA::Request_ptr request ();
195 class LWServerRequest;
196 typedef LWServerRequest *LWServerRequest_ptr;
197 typedef ObjVar<LWServerRequest> LWServerRequest_var;
198 typedef ObjOut<LWServerRequest> LWServerRequest_out;
200 class LWServerRequest : public LWRootRequest {
201 CORBA::ServerRequest_ptr _req;
202 CORBA::Object_var _obj;
203 CORBA::String_var _op;
205 LWServerRequest (CORBA::Object_ptr obj,
207 IOP::ServiceContextList &svc,
208 CORBA::ServerRequest_ptr req);
209 virtual ~LWServerRequest ();
211 virtual const char *_repoid() const;
212 static LWServerRequest_ptr _nil ()
216 static LWServerRequest_ptr _duplicate (LWServerRequest_ptr o)
222 static LWServerRequest_ptr _narrow (LWRootRequest_ptr);
224 CORBA::ServerRequest_ptr request ();
228 class ClientInterceptor;
229 typedef ClientInterceptor *ClientInterceptor_ptr;
230 typedef ObjVar<ClientInterceptor> ClientInterceptor_var;
231 typedef ObjOut<ClientInterceptor> ClientInterceptor_out;
233 class ClientInterceptor : public Root {
234 static std::list<ClientInterceptor_ptr> *_interceptors;
235 static std::list<ClientInterceptor_ptr> &_ics ();
237 ClientInterceptor ();
238 ClientInterceptor (Priority p);
239 virtual ~ClientInterceptor ();
241 virtual const char *_repoid() const;
242 static ClientInterceptor_ptr _nil ()
246 static ClientInterceptor_ptr _duplicate (ClientInterceptor_ptr o)
252 static ClientInterceptor_ptr _narrow (Root_ptr);
254 virtual Status initialize_request (LWRequest_ptr req,
255 CORBA::Environment_ptr env);
256 virtual Status after_marshal (LWRequest_ptr req,
257 CORBA::Environment_ptr env);
258 virtual Status output_message (CORBA::Buffer *buf,
259 CORBA::Environment_ptr env);
260 virtual Status input_message (CORBA::Buffer *buf,
261 CORBA::Environment_ptr env);
262 virtual Status before_unmarshal (LWRequest_ptr req,
263 CORBA::Environment_ptr env);
264 virtual Status finish_request (LWRequest_ptr req,
265 CORBA::Environment_ptr env);
267 // override Root:: methods
268 void activate (Priority p);
271 typedef Status (ClientInterceptor::*InterceptorMethod1) (
273 CORBA::Environment_ptr);
275 typedef Status (ClientInterceptor::*InterceptorMethod2) (
277 CORBA::Environment_ptr);
279 static CORBA::Boolean _exec (
281 CORBA::Environment_ptr,
282 InterceptorMethod1 m);
284 static CORBA::Boolean _exec (
286 CORBA::Environment_ptr,
287 InterceptorMethod2 m);
289 static CORBA::Boolean _exec_initialize_request (
291 CORBA::Environment_ptr);
293 static CORBA::Boolean _exec_after_marshal (
295 CORBA::Environment_ptr);
297 static CORBA::Boolean _exec_output_message (
299 CORBA::Environment_ptr);
301 static CORBA::Boolean _exec_input_message (
303 CORBA::Environment_ptr);
305 static CORBA::Boolean _exec_before_unmarshal (
307 CORBA::Environment_ptr);
309 static CORBA::Boolean _exec_finish_request (
311 CORBA::Environment_ptr);
313 static LWRequest_ptr _create_request (
314 CORBA::Object_var &obj,
315 CORBA::String_var &op,
316 IOP::ServiceContextList &svc,
317 CORBA::Request_ptr req);
319 static CORBA::Boolean _idle ()
320 { return _ics().size() == 0; }
324 class ServerInterceptor;
325 typedef ServerInterceptor *ServerInterceptor_ptr;
326 typedef ObjVar<ServerInterceptor> ServerInterceptor_var;
327 typedef ObjOut<ServerInterceptor> ServerInterceptor_out;
329 class ServerInterceptor : public Root {
330 static std::list<ServerInterceptor_ptr> *_interceptors;
331 static std::list<ServerInterceptor_ptr> &_ics ();
333 ServerInterceptor ();
334 ServerInterceptor (Priority p);
335 virtual ~ServerInterceptor ();
337 virtual const char *_repoid() const;
338 static ServerInterceptor_ptr _nil ()
342 static ServerInterceptor_ptr _duplicate (ServerInterceptor_ptr o)
348 static ServerInterceptor_ptr _narrow (Root_ptr);
350 virtual Status input_message (CORBA::Buffer *buf,
351 CORBA::Environment_ptr env);
352 virtual Status initialize_request (LWServerRequest_ptr req,
353 CORBA::Environment_ptr env);
354 virtual Status after_unmarshal (LWServerRequest_ptr req,
355 CORBA::Environment_ptr env);
356 virtual Status before_marshal (LWServerRequest_ptr req,
357 CORBA::Environment_ptr env);
358 virtual Status finish_request (LWServerRequest_ptr req,
359 CORBA::Environment_ptr env);
360 virtual Status output_message (CORBA::Buffer *buf,
361 CORBA::Environment_ptr env);
363 // override Root:: methods
364 void activate (Priority p);
367 typedef Status (ServerInterceptor::*InterceptorMethod1) (
369 CORBA::Environment_ptr);
371 typedef Status (ServerInterceptor::*InterceptorMethod2) (
373 CORBA::Environment_ptr);
375 static CORBA::Boolean _exec (
377 CORBA::Environment_ptr,
378 InterceptorMethod1 m);
380 static CORBA::Boolean _exec (
382 CORBA::Environment_ptr,
383 InterceptorMethod2 m);
385 static CORBA::Boolean _exec_input_message (
387 CORBA::Environment_ptr);
389 static CORBA::Boolean _exec_initialize_request (
391 CORBA::Environment_ptr env);
393 static CORBA::Boolean _exec_after_unmarshal (
395 CORBA::Environment_ptr env);
397 static CORBA::Boolean _exec_before_marshal (
399 CORBA::Environment_ptr env);
401 static CORBA::Boolean _exec_finish_request (
403 CORBA::Environment_ptr env);
405 static CORBA::Boolean _exec_output_message (
407 CORBA::Environment_ptr);
409 static LWServerRequest_ptr _create_request (
410 CORBA::Object_ptr obj,
412 IOP::ServiceContextList &svc,
413 CORBA::ServerRequest_ptr req);
415 static CORBA::Boolean _idle ()
416 { return _ics().size() == 0; }
420 class InitInterceptor;
421 typedef InitInterceptor *InitInterceptor_ptr;
422 typedef ObjVar<InitInterceptor> InitInterceptor_var;
423 typedef ObjOut<InitInterceptor> InitInterceptor_out;
425 class InitInterceptor : public Root {
426 static std::list<InitInterceptor_ptr> *_interceptors;
427 static std::list<InitInterceptor_ptr> &_ics ();
430 InitInterceptor (Priority p);
431 virtual ~InitInterceptor ();
433 virtual const char *_repoid() const;
434 static InitInterceptor_ptr _nil ()
438 static InitInterceptor_ptr _duplicate (InitInterceptor_ptr o)
444 static InitInterceptor_ptr _narrow (Root_ptr);
446 virtual Status initialize (CORBA::ORB_ptr orb,
448 int &argc, char *argv[]);
450 // override Root:: methods
451 void activate (Priority p);
454 static CORBA::Boolean _exec_initialize (CORBA::ORB_ptr orb,
456 int &argc, char *argv[]);
460 class BOAInterceptor;
461 typedef BOAInterceptor *BOAInterceptor_ptr;
462 typedef ObjVar<BOAInterceptor> BOAInterceptor_var;
463 typedef ObjOut<BOAInterceptor> BOAInterceptor_out;
465 class BOAInterceptor : public Root {
466 static std::list<BOAInterceptor_ptr> *_interceptors;
467 static std::list<BOAInterceptor_ptr> &_ics ();
470 BOAInterceptor (Priority p);
471 virtual ~BOAInterceptor ();
473 virtual const char *_repoid() const;
474 static BOAInterceptor_ptr _nil ()
478 static BOAInterceptor_ptr _duplicate (BOAInterceptor_ptr o)
484 static BOAInterceptor_ptr _narrow (Root_ptr);
486 virtual Status restore (CORBA::Object_ptr obj);
487 virtual Status create (CORBA::Object_ptr obj);
488 virtual Status bind (const char *repoid,
489 const CORBA::ORB::ObjectTag &);
491 // override Root:: methods
492 void activate (Priority p);
495 static CORBA::Boolean _exec_restore (CORBA::Object_ptr obj);
496 static CORBA::Boolean _exec_create (CORBA::Object_ptr obj);
497 static CORBA::Boolean _exec_bind (const char *repoid,
498 const CORBA::ORB::ObjectTag &);
501 class ConnInterceptor;
502 typedef ConnInterceptor *ConnInterceptor_ptr;
503 typedef ObjVar<ConnInterceptor> ConnInterceptor_var;
504 typedef ObjOut<ConnInterceptor> ConnInterceptor_out;
506 class ConnInterceptor : public Root {
507 static std::list<ConnInterceptor_ptr> *_interceptors;
508 static std::list<ConnInterceptor_ptr> &_ics ();
511 ConnInterceptor (Priority p);
512 virtual ~ConnInterceptor ();
514 virtual const char *_repoid() const;
515 static ConnInterceptor_ptr _nil ()
519 static ConnInterceptor_ptr _duplicate (ConnInterceptor_ptr o)
525 static ConnInterceptor_ptr _narrow (Root_ptr);
527 virtual Status client_connect (const char *addr);
528 virtual Status client_disconnect (const char *addr);
530 // override Root:: methods
531 void activate (Priority p);
534 static CORBA::Boolean _exec_client_connect (const char *addr);
535 static CORBA::Boolean _exec_client_disconnect (const char *addr);
539 #endif // __mico_intercept_h__