summaryrefslogtreecommitdiff
path: root/TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp
blob: 76ebf35a09e658bb6274d6b2d49a24f285e97f73 (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
// @(#) $Id$

#include "RT_Acceptor_Filters.h"
#include "tao/Pluggable.h"
#include "tao/MProfile.h"

#if ! defined (__ACE_INLINE__)
#include "RT_Acceptor_Filters.i"
#endif /* __ACE_INLINE__ */

ACE_RCSID(tao, RT_Acceptor_Filter, "$Id$")

TAO_Server_Protocol_Acceptor_Filter::
TAO_Server_Protocol_Acceptor_Filter (RTCORBA::ProtocolList &protocols)
  :  protocols_ (protocols)
{
}

int
TAO_Server_Protocol_Acceptor_Filter::
fill_mprofile (const TAO_ObjectKey &object_key,
               TAO_MProfile &mprofile,
               TAO_Acceptor **acceptors_begin,
               TAO_Acceptor **acceptors_end)
{
  // RTCORBA 1.0, Section 4.15.1: ServerProtocolPolicy determines
  // which protocols get included into IOR and in what order.
  for (CORBA::ULong j = 0; j < this->protocols_.length (); ++j)
    {
      CORBA::ULong protocol_type = this->protocols_[j].protocol_type;

      for (TAO_Acceptor** acceptor = acceptors_begin;
           acceptor != acceptors_end;
           ++acceptor)
        if ((*acceptor)->tag () == protocol_type
            && this->validate_acceptor (*acceptor)
            && ((*acceptor)->create_mprofile (object_key,
                                              mprofile,
                                              1 /* >=1 endpoints per profile */)
                == -1))
          return -1;
    }

  return 0;
}

int
TAO_Server_Protocol_Acceptor_Filter::
encode_endpoints (TAO_MProfile &mprofile)
{
  // Encode endpoints.
  for (CORBA::ULong i = 0;
       i < mprofile.profile_count ();
       ++i)
    {
      TAO_Profile *profile = mprofile.get_profile (i);
      if (profile->encode_endpoints () == -1)
        return -1;
    }

  return 0;
}
int
TAO_Server_Protocol_Acceptor_Filter::
validate_acceptor (TAO_Acceptor * /*acceptor*/)
{
  return 1;
}