summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/IOR_Multicast.h
blob: 5e9dfb36354f21a69769efd1b7146d223af22752 (plain)
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
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO/orbsvcs/bin/Naming_Service
//
// = FILENAME
//    svr.h
//
// = DESCRIPTION 
//    Defines a class that listens to a multicast address for client requests 
//    for ior of a bootstrappable service.
//    
// = AUTHORS
//      Sergio Flores-Gaitan
//
// ============================================================================

#if !defined (TAO_IOR_MULTICAST_H)
#define TAO_IOR_MULTICAST_H

#include "tao/corba.h"
#include "orbsvcs/orbsvcs_export.h"
#include "ace/INET_Addr.h"
#include "ace/SOCK_Dgram_Mcast.h"
#include "ace/Reactor.h"

class TAO_ORBSVCS_Export TAO_IOR_Multicast : public ACE_Event_Handler
{
  // @@ Naga, can you please add the standard comments to this class and
  // make sure that all the comments for each method go underneath the
  // method name?
public:

  TAO_IOR_Multicast (void);
  // Default constructor  

  TAO_IOR_Multicast (const char *ior,
                     u_short port,
                     const char *mcast_addr,
                     TAO_Service_ID service_id);

  int init (const char *ior,
            u_short port,
            const char *mcast_addr,
            TAO_Service_ID service_id);
  
  // destructor
  ~TAO_IOR_Multicast (void);

  // call back when input is received on the handle.
  virtual int handle_input (ACE_HANDLE fd);
  
  // callback when a timeout has occurred.
  virtual int handle_timeout (const ACE_Time_Value &tv,
			      const void *arg);

  // returns the internal handle used to receive multicast
  virtual ACE_HANDLE get_handle (void) const;

private:
  char buf_[BUFSIZ];
  // temporary buffer

  TAO_Service_ID service_id_;
  // Service id that we're waiting for. 
  
  ACE_SOCK_Dgram_Mcast mcast_dgram_;
  // multicast endpoint of communication

  ACE_INET_Addr mcast_addr_;
  // multicast address

  const char *ior_;
  // object reference to send in response to the multicast

  ACE_INET_Addr response_addr_;
  // address of response.

  ACE_SOCK_Dgram response_;
  // socket for response to the multicast
};

#endif /* NAMING_SERVICE_H */