NAME

  tst_inet6_opt_append_init - Initialize the option and returns a pointer to the location for the option content


PURPOSE

  To check that inet6_opt_append() initialize the option
  and return a pointer to the location for the option content
  if extbuf is not NULL. Function call with bad parameter will
  returns -1.


SYNOPSIS

  ./tst_inet6_opt_append_init [-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. Append option with option type set to 0
  4. Check B: Function inet6_opt_append() return -1
  5. Append option with option type set to 1
  6. Check C: Function inet6_opt_append() return -1  
  7. Append option with align set to 3
  8. Check D: Function inet6_opt_append() return -1  
  9. Append option with align set to 6
  10.Check E: Function inet6_opt_append() return -1  
  11.Append option with align set to 16
  12.Check F: Function inet6_opt_append() return -1  
  13.Append option to extension header with valid parameters
  14.Check G: The value of option type, option length is correct.
     The pointer to the location for the option content is correct.
     The total length taking into account adding an option with
     length 'len' and alignment 'align'.


NOTE

  None


REFERENCE

  RFC 3542
  10.2.  inet6_opt_append
      int inet6_opt_append(void *extbuf, socklen_t extlen, int offset,
                           uint8_t type, socklen_t len, uint_t align,
                           void **databufp);
    Offset should be the length returned by inet6_opt_init() or a
    previous inet6_opt_append().  This function returns the updated total
    length taking into account adding an option with length 'len' and
    alignment 'align'.  If extbuf is not NULL then, in addition to
    returning the length, the function inserts any needed pad option,
    initializes the option (setting the type and length fields) and
    returns a pointer to the location for the option content in databufp.
    If the option does not fit in the extension header buffer the
    function returns -1.
    Type is the 8-bit option type.  Len is the length of the option data
    (i.e., excluding the option type and option length fields).
    Once inet6_opt_append() has been called the application can use the
    databuf directly, or use inet6_opt_set_val() to specify the content
    of the option.
    The option type must have a value from 2 to 255, inclusive.  (0 and 1
    are reserved for the Pad1 and PadN options, respectively.)
    The option data length must have a value between 0 and 255,
    inclusive, and is the length of the option data that follows.
    The align parameter must have a value of 1, 2, 4, or 8.  The align
    value can not exceed the value of len.