InfoRepoMulticastResponder.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef INFOREPOMULTICASTRESPONDER_H
00009 #define INFOREPOMULTICASTRESPONDER_H
00010 
00011 #include /**/ "ace/pre.h"
00012 
00013 #include "federator_export.h"
00014 #include "tao/ORB.h"
00015 
00016 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00017 # pragma once
00018 #endif /* ACE_LACKS_PRAGMA_ONCE */
00019 
00020 #include "ace/INET_Addr.h"
00021 #include "ace/SOCK_Dgram_Mcast.h"
00022 #include "ace/Reactor.h"
00023 #include "ace/SString.h"
00024 
00025 #include "dds/Versioned_Namespace.h"
00026 
00027 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00028 
00029 namespace OpenDDS {
00030 namespace Federator {
00031 
00032 /**
00033  * @class InfoRepoMulticastResponder
00034  *
00035  * @brief Event Handler that services multicast requests for IOR of a
00036  * bootstrappable service.
00037  *
00038  * This class uses the ACE_SOCK_Dgram_Mcast class and should be
00039  * registered with a reactor and should be initialized with the
00040  * ior of the  service to be multicasted.
00041  */
00042 class OpenDDS_Federator_Export InfoRepoMulticastResponder : public ACE_Event_Handler {
00043 public:
00044   InfoRepoMulticastResponder();
00045 
00046   virtual ~InfoRepoMulticastResponder();
00047 
00048   /// Initialization method.
00049   int init(
00050     CORBA::ORB_ptr orb,
00051     u_short port,
00052     const char *mcast_addr);
00053 
00054   /// Initialization method. Takes in "address:port" string as a
00055   /// parameter.
00056   int init(
00057     CORBA::ORB_ptr orb,
00058     const char *mcast_addr);
00059 
00060   /// Callback when input is received on the handle.
00061   virtual int handle_input(ACE_HANDLE n);
00062 
00063   /// Callback when a timeout has occurred.
00064   virtual int handle_timeout(const ACE_Time_Value &tv,
00065                              const void *arg);
00066 
00067   /// Returns the internal handle used to receive multicast.
00068   virtual ACE_HANDLE get_handle() const;
00069 
00070 private:
00071   /// Factor common functionality from the two init functions.
00072   int common_init(
00073     CORBA::ORB_ptr orb);
00074 
00075   /// Are we initialized?
00076   bool initialized_;
00077 
00078   /// The ORB
00079   CORBA::ORB_var orb_;
00080 
00081   /// multicast endpoint of communication
00082   ACE_SOCK_Dgram_Mcast mcast_dgram_;
00083 
00084   /// multicast address
00085   ACE_INET_Addr mcast_addr_;
00086 
00087   /// address of response.
00088   ACE_INET_Addr response_addr_;
00089 
00090   /// socket for response to the multicast
00091   ACE_SOCK_Dgram response_;
00092 
00093   ACE_CString mcast_nic_;
00094 };
00095 
00096 } // namespace Federator
00097 } // namespace OpenDDS
00098 
00099 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00100 
00101 #include /**/ "ace/post.h"
00102 
00103 #endif /* INFOREPOMULTICASTRESPONDER_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1