/usr/include/omniORB4/giopEndpoint.h is in libomniorb4-dev 4.1.6-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | // -*- Mode: C++; -*-
// Package : omniORB
// giopEndpoint.h Created on: 20 Dec 2000
// Author : Sai Lai Lo (sll)
//
// Copyright (C) 2002-2006 Apasphere Ltd
// Copyright (C) 2000 AT&T Laboratories Cambridge
//
// This file is part of the omniORB library
//
// The omniORB library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA
//
//
// Description:
// *** PROPRIETORY INTERFACE ***
//
/*
$Log$
Revision 1.1.6.8 2006/06/22 13:53:49 dgrisby
Add flags to strand.
Revision 1.1.6.7 2006/06/05 13:34:31 dgrisby
Make connection thread limit a per-connection value.
Revision 1.1.6.6 2006/04/09 19:52:31 dgrisby
More IPv6, endPointPublish parameter.
Revision 1.1.6.5 2005/09/05 17:12:20 dgrisby
Merge again. Mainly SSL transport changes.
Revision 1.1.6.4 2005/03/02 12:10:50 dgrisby
setSelectable / Peek fixes.
Revision 1.1.6.3 2005/01/13 21:09:57 dgrisby
New SocketCollection implementation, using poll() where available and
select() otherwise. Windows specific version to follow.
Revision 1.1.6.2 2005/01/06 23:08:09 dgrisby
Big merge from omni4_0_develop.
Revision 1.1.6.1 2003/03/23 21:04:16 dgrisby
Start of omniORB 4.1.x development branch.
Revision 1.1.4.8 2002/08/21 06:23:15 dgrisby
Properly clean up bidir connections and ropes. Other small tweaks.
Revision 1.1.4.7 2002/03/19 15:42:03 dpg1
Use list of IP addresses to pick a non-loopback interface if there is one.
Revision 1.1.4.6 2001/12/03 13:39:54 dpg1
Explicit socket shutdown flag for Windows.
Revision 1.1.4.5 2001/08/23 16:00:34 sll
Added method in giopTransportImpl to return the addresses of the host
interfaces.
Revision 1.1.4.4 2001/07/31 16:16:27 sll
New transport interface to support the monitoring of active connections.
Revision 1.1.4.3 2001/07/13 15:15:04 sll
Replaced giopEndpoint::Accept with giopEndpoint::AcceptAndMonitor.
giopConnection is now reference counted.
Added setSelectable, clearSelectable and Peek to giopConnection.
Revision 1.1.4.2 2001/06/20 18:35:18 sll
Upper case send,recv,connect,shutdown to avoid silly substutition by
macros defined in socket.h to rename these socket functions
to something else.
Revision 1.1.4.1 2001/04/18 17:26:29 sll
Big checkin with the brand new internal APIs.
*/
#ifndef __GIOPENDPOINT_H__
#define __GIOPENDPOINT_H__
#include <omniORB4/omniutilities.h>
OMNI_NAMESPACE_BEGIN(omni)
class giopActiveConnection; // Active in the sense that it is created with
// Connect()
class giopConnection;
class giopEndpoint;
class giopActiveCollection; // Singleton to act on a bunch of
// giopActiveConnection.
class giopServer;
class giopConnection {
public:
typedef void (*notifyReadable_t)(void* cookie,giopConnection* conn);
// None of the members raise an exception.
virtual int Send(void* buf, size_t sz,
unsigned long deadline_secs = 0,
unsigned long deadline_nanosecs = 0) = 0;
virtual int Recv(void* buf, size_t sz,
unsigned long deadline_secs = 0,
unsigned long deadline_nanosecs = 0) = 0;
virtual void Shutdown() = 0;
virtual const char* myaddress() = 0;
virtual const char* peeraddress() = 0;
virtual const char* peeridentity();
// Return a string identifying the peer, if appropriate for the
// connection type. By default returns zero to indicate no peer
// identification is possible.
virtual void setSelectable(int now = 0,
_CORBA_Boolean data_in_buffer = 0) = 0;
// Indicates that this connection should be watched by a select()
// so that any new data arriving on the connection will be noted.
// If now == 1, immediately make this connection part of the select
// set (if the platforms allows it).
// If now == 2, immediately make this connection part of the select
// set, but only if it is already marked selectable.
// If data_in_buffer == 1, treat this connection as if there are
// data available from the connection already.
virtual void clearSelectable() = 0;
// Indicates that this connection need not be watched any more.
virtual _CORBA_Boolean isSelectable() = 0;
// Returns true if this connection is selectable, false if not. It
// may not be if the server is very heavily loaded and there are
// more file descriptors in use than available in a select() fd_set.
virtual _CORBA_Boolean Peek() = 0;
// Do nothing and return immediately if the socket has not been set
// to be watched by a previous setSelectable(). Otherwise, monitor
// the connection's status for a short time. Return true if it
// becomes readable, otherwise returns false.
giopConnection() : pd_refcount(1), pd_dying(0),
pd_has_dedicated_thread(0),
pd_dedicated_thread_in_upcall(0),
pd_n_workers(0), pd_max_workers(0),
pd_has_hit_n_workers_limit(0) {}
int decrRefCount(_CORBA_Boolean forced=0);
// Thread Safety preconditions:
// Caller must hold omniTransportLock unless forced == 1.
void incrRefCount();
// Thread Safety preconditions:
// Caller must hold omniTransportLock.
inline int max_workers() { return pd_max_workers; }
inline void max_workers(int mw) { pd_max_workers = mw; }
// Functions to get/set the maximum number of worker threads that
// will service this connection. Interceptors can change the value.
//
// Thread Safety preconditions:
// None. In a serverReceiveRequest interceptor, the thread has
// exclusive access to the connection, so modifications are safe.
// In other contexts, access is not thread safe.
friend class giopServer;
protected:
virtual ~giopConnection() {}
private:
int pd_refcount;
_CORBA_Boolean pd_dying;
// Initialised to 0. Read and write by giopServer exclusively.
_CORBA_Boolean pd_has_dedicated_thread;
// Initialised to 0. Read and write by giopServer exclusively.
_CORBA_Boolean pd_dedicated_thread_in_upcall;
// Initialised to 0. Read and write by giopServer exclusively.
int pd_n_workers;
// Initialised to 0. Read and write by giopServer exclusively.
int pd_max_workers;
// Initialised to 0. Read and write by giopServer and interceptors.
_CORBA_Boolean pd_has_hit_n_workers_limit;
// Initialised to 0. Read and write by giopServer exclusively.
giopConnection(const giopConnection&);
giopConnection& operator=(const giopConnection&);
};
class giopAddress {
public:
// Each giopAddress must register via decodeIOR interceptor if it
// wants to decode its own IOR component.
// None of the members raise an exception.
static giopAddress* str2Address(const char* address);
// Given a string, returns an instance that can be used to connect to
// the address.
// The format of the address string is as follows:
// giop:<transport name>:[<transport specific fields]+
// ^^^^^^^^^^^^^^^^^^^^^
// transport identifier
//
// The format of the following transports are defined (but may not be
// implemented yet):
//
// giop:tcp:<hostname>:<port no.>
// giop:ssl:<hostname>:<port no.>
// giop:unix:<filename>
// giop:fd:<file no.>
//
// Returns 0 if no suitable endpoint can be created.
virtual const char* type() const = 0;
// return the transport identifier, e.g. "giop:tcp","giop:ssl", etc.
virtual const char* address() const = 0;
// return the string that describe this remote address.
// The string format is described in str2Address().
virtual giopActiveConnection*
Connect(unsigned long deadline_secs = 0,
unsigned long deadline_nanosecs = 0,
_CORBA_ULong strand_flags = 0) const = 0;
// Connect to the remote address.
// Return 0 if no connection can be established.
virtual giopAddress* duplicate() const = 0;
// Return an identical instance.
giopAddress() {}
virtual ~giopAddress() {}
static giopAddress* fromTcpAddress(const IIOP::Address& addr);
static giopAddress* fromSslAddress(const IIOP::Address& addr);
private:
giopAddress(const giopAddress&);
giopAddress& operator= (const giopAddress&);
};
typedef omnivector<giopAddress*> giopAddressList;
class giopEndpoint {
public:
// None of the members raise an exception.
static giopEndpoint* str2Endpoint(const char* endpoint);
// Given a string, returns an instance that represent the endpoint
// The format of an endpoint string is as follows:
// giop:<transport name>:[<transport specific fields]+
// ^^^^^^^^^^^^^^^^^^^^^
// transport identifier
//
// The format of the following transports are defined (but may not be
// implemented yet):
//
// giop:tcp:<hostname>:<port no.> note 1
// giop:ssl:<hostname>:<port no.> note 1
// giop:unix:<filename>
// giop:fd:<file no.>
//
// Note 1: if <hostname> is empty, the IP address of one of the host
// network interfaces will be used.
// if <port no.> is not present, a port number is chosen by
// the operation system.
//
// Returns 0 if no suitable endpoint can be created.
static _CORBA_Boolean strIsValidEndpoint(const char* endpoint);
// Return true if endpoint is syntactically correct as described
// in str2Endpoint(). None of the fields are optional.
static _CORBA_Boolean addToIOR(const char* endpoint);
// Return true if the endpoint has been sucessfully registered so that
// all IORs generated by the ORB will include this endpoint.
virtual const char* type() const = 0;
// return the transport identifier
virtual const char* address() const = 0;
// return the string that describes this endpoint.
// The string format is described in str2Endpoint().
virtual const orbServer::EndpointList* addresses() const = 0;
// return all the addresses that can be used to contact this
// endpoint. There can be more than one in the case of multiple IP
// addresses, for example.
virtual _CORBA_Boolean
publish(const orbServer::PublishSpecs& publish_specs,
_CORBA_Boolean all_specs,
_CORBA_Boolean all_eps,
orbServer::EndpointList& published_eps) = 0;
// Publish endpoints according to the publish_specs. Returns true if
// the publish specs were understood and handled, false otherwise.
virtual _CORBA_Boolean Bind() = 0;
// Establish a binding to the this address.
// Return TRUE(1) if the binding has been established successfully,
// otherwise returns FALSE(0).
virtual giopConnection*
AcceptAndMonitor(giopConnection::notifyReadable_t func,
void* cookie) = 0;
// Accept a new connection. Returns 0 if no connection can be accepted.
// In addition, for all the connections of this endpoint that has been
// marked, monitors their status. If data have arrived at a connection,
// call the callback function <func> with the <cookie> and the pointer to
// the connection as the arguments.
virtual void Poke() = 0;
// Call to unblock any thread blocking in accept().
virtual void Shutdown() = 0;
// Remove the binding.
void set_no_publish() { pd_no_publish = 1; }
_CORBA_Boolean no_publish() { return pd_no_publish; }
giopEndpoint() : pd_no_publish(0) {}
virtual ~giopEndpoint() {}
private:
giopEndpoint(const giopEndpoint&);
giopEndpoint& operator=(const giopEndpoint&);
_CORBA_Boolean pd_no_publish;
};
typedef omnivector<giopEndpoint*> giopEndpointList;
class giopActiveConnection {
public:
// 'Active' in the sense that this is created with Connect().
virtual giopActiveCollection* registerMonitor() = 0;
virtual giopConnection& getConnection() = 0;
// This class could have been written to inherit from giopConnection and
// with just one abstract function added. The trouble is if we do so,
// giopConnection must be a public virtual base class. If that is
// the case, then we cannot simply cast a giopConnection* back to its
// implementation class. Instead dynamic_cast has to be used. This is not
// what we want to do.
giopActiveConnection() {}
virtual ~giopActiveConnection() {}
private:
giopActiveConnection(const giopActiveConnection&);
giopActiveConnection& operator=(const giopActiveConnection&);
};
class giopActiveCollection {
public:
// A singleton to act on a bunch of giopActiveConnection of the same
// transport type.
virtual const char* type() const = 0;
virtual void Monitor(giopConnection::notifyReadable_t func,void* cookie) = 0;
// For all the connections that are associated with this singleton and
// have previously been registered via registerMonitor(), watches their
// status. If data have arrived at a connection, call the callback
// function <func> with the <cookie> and the pointer to the connection as
// the arguments. This function will only returns when there is no
// connection to monitor, i.e. all the connections that were registered
// have been deleted, or when deactivate() is called.
virtual _CORBA_Boolean isEmpty() const = 0;
// Returns TRUE(1) if no connections have been added via registerMonitor().
virtual void deactivate() = 0;
// Stop monitoring connections.
giopActiveCollection() {}
virtual ~giopActiveCollection() {}
private:
giopActiveCollection(const giopActiveCollection&);
giopActiveCollection& operator=(const giopActiveCollection&);
};
class giopTransportImpl {
public:
virtual giopEndpoint* toEndpoint(const char* param) = 0;
// Returns the endpoint object for this endpoint if it is recognised by
// this transport.
virtual giopAddress* toAddress(const char* param) = 0;
// Returns the address object for this address if it is recognised by
// this transport.
virtual _CORBA_Boolean isValid(const char* param) = 0;
// Returns 1 if the address/endpoint is recognised by this transport
virtual _CORBA_Boolean addToIOR(const char* param) = 0;
// Make this endpoint part of the IORs created by this ORB.
virtual const omnivector<const char*>* getInterfaceAddress() = 0;
// Get the addresses of all the interfaces that can be used to talk to
// this host using this transport.
virtual void initialise();
// Initialise the transport implementation. Called once the 1st time
// ORB_init() is called.
static const omnivector<const char*>* getInterfaceAddress(const char* type);
// Get the addresses of all the interfaces that belongs to the transport
// type <type>. These addresses can be used to talk to this host.
// e.g. type == "giop:tcp" causes the tcp transport implementation to
// returns the IP address of all the network interfaces of this host.
// If <type> does not match returns 0.
static giopTransportImpl* str2Transport(const char* endpoint);
// Return the giopTransportImpl that matches the given endpoint URI.
const char* type;
giopTransportImpl* next;
giopTransportImpl(const char* t);
virtual ~giopTransportImpl();
private:
giopTransportImpl();
giopTransportImpl(const giopTransportImpl&);
giopTransportImpl& operator=(const giopTransportImpl&);
};
OMNI_NAMESPACE_END(omni)
#endif // __GIOPENDPOINT_H__
|