NAME

  tst_inet6_opt_next - Parse received option extension headers returning the next option


PURPOSE

  To check that inet6_opt_next() can be used to parse received option
  extension headers returning the next option.


SYNOPSIS

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


TEST PROCEDURE

  1. Calculate the needed buffer size
  2. Check A: Function inet6_opt_init() return a valid buffer size
  3. Parse received option extension headers
  4. Check B: return value is -1
  5. Append option to extension header with valid parameters
  6. Check C: The value of option type, option length is correct
  7. Inserts data items of various sizes
  8. Check D: return length is correct and data set correctly
  9. Parse received option extension headers
  10.Check B: return the next option, type and length of option is correct


NOTE

  None


REFERENCE

  RFC 3542
  10.5.  inet6_opt_next
      int inet6_opt_next(void *extbuf, socklen_t extlen, int offset,
                         uint8_t *typep, socklen_t *lenp,
                         void **databufp);
    This function parses received option extension headers returning the
    next option.  Extbuf and extlen specifies the extension header.
    Offset should either be zero (for the first option) or the length
    returned by a previous call to inet6_opt_next() or inet6_opt_find().
    It specifies the position where to continue scanning the extension
    buffer.  The next option is returned by updating typep, lenp, and
    databufp.  Typep stores the option type, lenp stores the length of
    the option data (i.e., excluding the option type and option length
    fields), and databufp points the data field of the option.  This
    function returns the updated "previous" length computed by advancing
    past the option that was returned.  This returned "previous" length
    can then be passed to subsequent calls to inet6_opt_next().  This
    function does not return any PAD1 or PADN options.  When there are no
    more options or if the option extension header is malformed the
    return value is -1.