Subject: Updated advanced API document

From: Erik Nordmark <[email-masked]>
Date: Tue, 26 Oct 1999 06:35:22 -0700 (PDT)

I did manage to send in an updated API document (-ipngwg-2292bis-01.txt)
before the I-D cutoff, but not all TODO and open issues are taken care of
yet. But I felt it would be good to get additional review at this point in
time. 

However, due to some formatting problems (tab characters being "eaten" by
nroff) some of the new data structures are hard to read. Thus they should be:
2.1.3.  IPv6 Options

   Eleven options are defined for IPv6 at the time of writing this
   document.  We define structures for all except the unspecified EID
   option.  The following structures are defined as a result of
   including <netinet/ip6.h>.

       /* IPv6 options */
       struct ip6_opt {
         uint8_t  ip6o_type;
         uint8_t  ip6o_len;
       };

       /*
        * The high-order 3 bits of the option type define the behavior
        * when processing an unknown option and whether or not the option
        * content changes in flight.
        */
       #define IP6OPT_TYPE(o)        ((o) & 0xc0)
       #define IP6OPT_TYPE_SKIP      0x00
       #define IP6OPT_TYPE_DISCARD   0x40
       #define IP6OPT_TYPE_FORCEICMP 0x80
       #define IP6OPT_TYPE_ICMP      0xc0
       #define IP6OPT_MUTABLE        0x20

       #define IP6OPT_PAD1           0x00  /* 00 0 00000 */
       #define IP6OPT_PADN           0x01  /* 00 0 00001 */
       #define IP6OPT_JUMBO          0xc2  /* 11 0 00010 = 194 */
       #define IP6OPT_NSAP_ADDR      0xc3  /* 11 0 00011 */
       #define IP6OPT_TUNNEL_LIMIT   0x04  /* 00 0 00100 */
       #define IP6OPT_ROUTER_ALERT   0x05  /* 00 0 00101 */

draft-ietf-ipngwg-2292bis-01.txt                               [Page 10]

INTERNET-DRAFT        Advanced Sockets API for IPv6         Oct 22, 1999

       #define IP6OPT_BINDING_UPDATE 0xc6  /* 11 0 00110 */
       #define IP6OPT_BINDING_ACK    0x07  /* 00 0 00111 */
       #define IP6OPT_BINDING_REQ    0x08  /* 00 0 01000 */
       #define IP6OPT_HOME_ADDRESS   0xc9  /* 11 0 01001 */
       #define IP6OPT_EID            0x8a  /* 10 0 01010 */

       /* Jumbo Payload Option */
       struct ip6_opt_jumbo {
         uint8_t  ip6oj_type;
         uint8_t  ip6oj_len;
         uint8_t  ip6oj_jumbo_len[4];
       };
       #define IP6OPT_JUMBO_LEN   6

       /* NSAP Address Option */
       struct ip6_opt_nsap {
         uint8_t  ip6on_type;
         uint8_t  ip6on_len;
         uint8_t  ip6on_src_nsap_len;
         uint8_t  ip6on_dst_nsap_len;
           /* followed by source NSAP */
           /* followed by destination NSAP */
       };

       /* Tunnel Limit Option */
       struct ip6_opt_tunnel {
         uint8_t  ip6ot_type;
         uint8_t  ip6ot_len;
         uint8_t  ip6ot_encap_limit;
       };

       /* Router Alert Option */
       struct ip6_opt_router {
         uint8_t  ip6or_type;
         uint8_t  ip6or_len;
         uint8_t  ip6or_value[2];
       };

       /* Router alert values (in network byte order) */
       #ifdef _BIG_ENDIAN
       #define IP6_ALERT_MLD      0x0000
       #define IP6_ALERT_RSVP     0x0001
       #define  IP6_ALERT_AN      0x0002
       #else
       #define IP6_ALERT_MLD      0x0000
       #define IP6_ALERT_RSVP     0x0100
       #define IP6_ALERT_AN       0x0200
       #endif

draft-ietf-ipngwg-2292bis-01.txt                               [Page 11]

INTERNET-DRAFT        Advanced Sockets API for IPv6         Oct 22, 1999

       /* Binding Update Option */
       struct ip6_opt_binding_update {
         uint8_t  ip6ou_type;
         uint8_t  ip6ou_len;
         uint8_t  ip6ou_flags;
         uint8_t  ip6ou_prefixlen;
         uint8_t  ip6ou_seqno[2];
         uint8_t  ip6ou_lifetime[4];
         uint8_t  ip6ou_coa[16];        /* Optional based on flags */
           /* followed by sub-options */
       };

       /* Binding Update Flags */
       #define IP6_BUF_ACK        0x80  /* Request a binding ack */
       #define IP6_BUF_HOME       0x40  /* Home Registration */
       #define IP6_BUF_COA        0x20  /* Care-of-address present in option */
       #define IP6_BUF_ROUTER     0x10  /* Sending mobile node is a router */

       /* Binding Ack Option */
       struct ip6_opt_binding_ack {
         uint8_t  ip6oa_type;
         uint8_t  ip6oa_len;
         uint8_t  ip6oa_status;
         uint8_t  ip6oa_seqno[2];
         uint8_t  ip6oa_lifetime[4];
         uint8_t  ip6oa_refresh[4];
           /* followed by sub-options */
       };

       /* Binding Request Option */
       struct ip6_opt_binding_request {
         uint8_t  ip6or_type;
         uint8_t  ip6or_len;
           /* followed by sub-options */
       };

       /* Home Address Option */
       struct ip6_opt_home_address {
         uint8_t  ip6oh_type;
         uint8_t  ip6oh_len;
         uint8_t  ip6oh_addr[16];    /* Home Address */
           /* followed by sub-options */
       };

2.2.3.  Multicast Listener Discovery Type and Code Values

draft-ietf-ipngwg-2292bis-01.txt                               [Page 16]

INTERNET-DRAFT        Advanced Sockets API for IPv6         Oct 22, 1999

   The following structures and definitions are defined as a result of
   including <netinet/icmp6.h>.

       struct mld_hdr {
         struct icmp6_hdr  mld_hdr;
         struct in6_addr   mld_addr; /* multicast address */
       };
       #define mld_type                 mld_hdr.icmp6_type
       #define mld_code                 mld_hdr.icmp6_code
       #define mld_cksum                mld_hdr.icmp6_cksum
       #define mld_maxdelay             mld_hdr.icmp6_data16[0]
       #define mld_reserved             mld_hdr.icmp6_data16[1]

2.2.4.  ICMPv6 Router Renumbering Type and Code Values

   The following structures and definitions are defined as a result of
   including <netinet/icmp6.h>.

       struct icmp6_router_renum {  /* router renumbering header */
         struct icmp6_hdr  rr_hdr;
         u_int8_t          rr_segnum;
         u_int8_t          rr_flags;
         u_int16_t         rr_maxdelay;
         u_int32_t         rr_reserved;
       };
       #define rr_type                  rr_hdr.icmp6_type
       #define rr_code                  rr_hdr.icmp6_code
       #define rr_cksum                 rr_hdr.icmp6_cksum
       #define rr_seqnum                rr_hdr.icmp6_data32[0]

       /* Router renumbering flags */
       #define ICMP6_RR_FLAGS_TEST        0x80
       #define ICMP6_RR_FLAGS_REQRESULT   0x40
       #define ICMP6_RR_FLAGS_FORCEAPPLY  0x20
       #define ICMP6_RR_FLAGS_SPECSITE    0x10
       #define ICMP6_RR_FLAGS_PREVDONE    0x08

       struct rr_pco_match {    /* match prefix part */
         u_int8_t          rpm_code;
         u_int8_t          rpm_len;
         u_int8_t          rpm_ordinal;
         u_int8_t          rpm_matchlen;
         u_int8_t          rpm_minlen;
         u_int8_t          rpm_maxlen;
         u_int16_t         rpm_reserved;

draft-ietf-ipngwg-2292bis-01.txt                               [Page 17]

INTERNET-DRAFT        Advanced Sockets API for IPv6         Oct 22, 1999

         struct in6_addr   rpm_prefix;
       };

       /* PCI code values */
       #define RPM_PCO_ADD              1
       #define RPM_PCO_CHANGE           2
       #define RPM_PCO_SETGLOBAL        3

       struct rr_pco_use {    /* use prefix part */
         u_int8_t          rpu_uselen;
         u_int8_t          rpu_keeplen;
         u_int8_t          rpu_ramask;
         u_int8_t          rpu_raflags;
         u_int32_t         rpu_vltime;
         u_int32_t         rpu_pltime;
         u_int32_t         rpu_flags;
         struct in6_addr   rpu_prefix;
       };
       #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK   0x20
       #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO     0x10

       #if BYTE_ORDER == BIG_ENDIAN
       #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000
       #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000
       #elif BYTE_ORDER == LITTLE_ENDIAN
       #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80
       #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40
       #endif

       struct rr_result {    /* router renumbering result message */
         u_int16_t         rrr_flags;
         u_int8_t          rrr_ordinal;
         u_int8_t          rrr_matchedlen;
         u_int32_t         rrr_ifid;
         struct in6_addr   rrr_prefix;
       };

       #if BYTE_ORDER == BIG_ENDIAN
       #define ICMP6_RR_RESULT_FLAGS_OOB        0x0002
       #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN  0x0001
       #elif BYTE_ORDER == LITTLE_ENDIAN
       #define ICMP6_RR_RESULT_FLAGS_OOB        0x0200
       #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN  0x0100
       #endif

  Erik

--------------------------------------------------------------------
IETF IPng Working Group Mailing List
IPng Home Page:                      http://playground.sun.com/ipng
FTP archive:                      ftp://playground.sun.com/pub/ipng
Direct all administrative requests to [email-masked]
--------------------------------------------------------------------