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 namespace OpenDDS {
00026 namespace Federator {
00027 
00028 /**
00029  * @class InfoRepoMulticastResponder
00030  *
00031  * @brief Event Handler that services multicast requests for IOR of a
00032  * bootstrappable service.
00033  *
00034  * This class uses the ACE_SOCK_Dgram_Mcast class and should be
00035  * registered with a reactor and should be initialized with the
00036  * ior of the  service to be multicasted.
00037  */
00038 class OpenDDS_Federator_Export InfoRepoMulticastResponder : public ACE_Event_Handler {
00039 public:
00040   /// Constructor.
00041   InfoRepoMulticastResponder();
00042 
00043   /// Destructor.
00044   virtual ~InfoRepoMulticastResponder();
00045 
00046   /// Initialization method.
00047   int init(
00048     CORBA::ORB_ptr orb,
00049     u_short port,
00050     const char *mcast_addr);
00051 
00052   /// Initialization method. Takes in "address:port" string as a
00053   /// parameter.
00054   int init(
00055     CORBA::ORB_ptr orb,
00056     const char *mcast_addr);
00057 
00058   /// Callback when input is received on the handle.
00059   virtual int handle_input(ACE_HANDLE n);
00060 
00061   /// Callback when a timeout has occurred.
00062   virtual int handle_timeout(const ACE_Time_Value &tv,
00063                              const void *arg);
00064 
00065   /// Returns the internal handle used to receive multicast.
00066   virtual ACE_HANDLE get_handle() const;
00067 
00068 private:
00069   /// Factor common functionality from the two init functions.
00070   int common_init(
00071     CORBA::ORB_ptr orb);
00072 
00073   /// Are we initialized?
00074   bool initialized_;
00075 
00076   /// The ORB
00077   CORBA::ORB_var orb_;
00078 
00079   /// multicast endpoint of communication
00080   ACE_SOCK_Dgram_Mcast mcast_dgram_;
00081 
00082   /// multicast address
00083   ACE_INET_Addr mcast_addr_;
00084 
00085   /// address of response.
00086   ACE_INET_Addr response_addr_;
00087 
00088   /// socket for response to the multicast
00089   ACE_SOCK_Dgram response_;
00090 
00091   ACE_CString mcast_nic_;
00092 };
00093 
00094 } // namespace Federator
00095 } // namespace OpenDDS
00096 
00097 #include /**/ "ace/post.h"
00098 
00099 #endif /* INFOREPOMULTICASTRESPONDER_H */

Generated on Fri Feb 12 20:05:23 2016 for OpenDDS by  doxygen 1.4.7