summaryrefslogtreecommitdiff
path: root/TAO/tao/GIOP_Message_Generator_Parser_Impl.inl
blob: 49f47beff45d9e97cf93dfa4523f93fc5c220f40 (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
// -*- C++ -*-
//
//$Id$

ACE_INLINE CORBA::Boolean
TAO_GIOP_Message_Generator_Parser_Impl::check_revision (
  CORBA::Octet incoming_major,
  CORBA::Octet incoming_minor)
{
  CORBA::UShort const version_as_whole_num =
    incoming_major << 8 | incoming_minor;

  static CORBA::UShort const max_allowable_version =
    TAO_DEF_GIOP_MAJOR << 8 | TAO_DEF_GIOP_MINOR;

  // If it's greater than the max, we know it's not allowed.
  if (version_as_whole_num > max_allowable_version)
    return 0;

  // If it's less than the max, though, we still have to check for
  // each explicit version and only allow the ones we know work.
  switch (version_as_whole_num)
    {
    case 0x0100:
    case 0x0101:
    case 0x0102:
      return 1;
    }

  return 0;
}