summaryrefslogtreecommitdiff
path: root/TAO/tao/MCAST_Parser.h
blob: 82b0fb48d3be2c9610ece80358aa150b7e4ec34c (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// -*- C++ -*-

//=============================================================================
/**
 *  @file   MCAST_Parser.h
 *
 *  @author Priyanka Gontla (gontla_p@ociweb.com)
 */
//=============================================================================


#ifndef TAO_MCAST_PARSER_H
#define TAO_MCAST_PARSER_H

#include /**/ "ace/pre.h"
#include "ace/Service_Config.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "tao/CORBA_String.h"
#include "tao/IOR_Parser.h"

#if (TAO_HAS_MCAST_PARSER == 1)

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

/**
 * @class TAO_MCAST_Parser
 *
 * @brief Implements the @c mcast: IOR format
 *
 * This class implements the @c mcast: IOR format.
 * It is dynamically loaded by the ORB and used to parse the
 * string to separate the individual <obj_addr> from the list of object
 * addresses <obj_addr_list>.
 */
class TAO_Export TAO_MCAST_Parser : public TAO_IOR_Parser
{
public:
  /// Constructor
  TAO_MCAST_Parser (void);

  /// The destructor
  virtual ~TAO_MCAST_Parser (void);

  /// = The IOR_Parser methods, please read the documentation in
  ///   IOR_Parser.h
  virtual bool match_prefix (const char *ior_string) const;

  /// Parse the ior-string that is passed.
  virtual CORBA::Object_ptr parse_string (const char *ior,
                                          CORBA::ORB_ptr orb);

private:

  CORBA::Object_ptr multicast_to_service (const char *service_name,
                                          unsigned short port,
                                          const char *mcast_address,
                                          int mcast_ttl,
                                          const char *mcast_nic,
                                          CORBA::ORB_ptr orb,
                                          ACE_Time_Value *timeout);

  int multicast_query (char *&buf,
                       const char *service_name,
                       unsigned short port,
                       const char *mcast_address,
                       int mcast_ttl,
                       const char *mcast_nic,
                       ACE_Time_Value *timeout,
                       CORBA::ORB_ptr orb);

  /* Simple method to assign values to the global members:
     mcast_address_, mcast_port_, mcast_nic_, mcast_ttl_ */
  void assign_to_variables (char const * mcast_name_ptr);

private:

  CORBA::String_var mcast_address_;

  /// Default multicast port (currently Name Service mcast port).
  unsigned short    mcast_port_;

  /// Multicast network interface card.
  CORBA::String_var mcast_nic_;

  /// Default time-to-live (default is 1).
  int               mcast_ttl_;

  /// Multicast service name
  CORBA::String_var service_name_;

};

ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_MCAST_Parser)
ACE_FACTORY_DECLARE (TAO, TAO_MCAST_Parser)

TAO_END_VERSIONED_NAMESPACE_DECL

#if defined (__ACE_INLINE__)
# include "tao/MCAST_Parser.inl"
#endif /* __ACE_INLINE__ */

#endif /* TAO_HAS_MCAST_PARSER == 1 */

#include /**/ "ace/post.h"
#endif /* TAO_MCAST_PARSER_H */