NAME

  tst_inet6_rth_space - Returns the number of bytes required to hold a Routing header of the specified type


PURPOSE

  To check that inet6_rth_space() can be used calculate to the number of bytes
  required to hold a Routing header of the specified type.


SYNOPSIS

  ./tst_inet6_rth_space [-tooloption ...]
    -tooloption : v6api tool option


TEST PROCEDURE

  1. Calculate the number of bytes required while segments is set to 0
  2. Check A: return value is 8
  3. Calculate the number of bytes required while segments is set to 1
  4. Check B: return value is 24
  5. Calculate the number of bytes required while segments is set to 2
  6. Check C: return value is 40
  7. Calculate the number of bytes required while segments is set to 127
  8. Check D: return value is 2040


NOTE

  None


REFERENCE

  RFC 3542
  7.1.  inet6_rth_space
      socklen_t inet6_rth_space(int type, int segments);
    This function returns the number of bytes required to hold a Routing
    header of the specified type containing the specified number of
    segments (addresses).  For an IPv6 Type 0 Routing header, the number
    of segments must be between 0 and 127, inclusive.  The return value
    is just the space for the Routing header.  When the application uses
    ancillary data it must pass the returned length to CMSG_SPACE() to
    determine how much memory is needed for the ancillary data object
    (including the cmsghdr structure).
    If the return value is 0, then either the type of the Routing header
    is not supported by this implementation or the number of segments is
    invalid for this type of Routing header.
    (Note: This function returns the size but does not allocate the space
    required for the ancillary data.  This allows an application to
    allocate a larger buffer, if other ancillary data objects are
    desired, since all the ancillary data objects must be specified to
    sendmsg() as a single msg_control buffer.)