1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _OSPF6_H 28*7c478bd9Sstevel@tonic-gate #define _OSPF6_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate /* 31*7c478bd9Sstevel@tonic-gate * Definitions for parsing OSPF packets (RFC 2328) 32*7c478bd9Sstevel@tonic-gate */ 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 35*7c478bd9Sstevel@tonic-gate extern "C" { 36*7c478bd9Sstevel@tonic-gate #endif 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate struct lsa6_hdr { 39*7c478bd9Sstevel@tonic-gate uint16_t ls6_age; 40*7c478bd9Sstevel@tonic-gate uint16_t ls6_type; 41*7c478bd9Sstevel@tonic-gate uint32_t ls6_stateid; 42*7c478bd9Sstevel@tonic-gate uint32_t ls6_router; 43*7c478bd9Sstevel@tonic-gate uint32_t ls6_seq; 44*7c478bd9Sstevel@tonic-gate uint16_t ls6_chksum; 45*7c478bd9Sstevel@tonic-gate uint16_t ls6_length; 46*7c478bd9Sstevel@tonic-gate }; 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate struct lsa6_prefix { 49*7c478bd9Sstevel@tonic-gate uint8_t lsa6_plen; 50*7c478bd9Sstevel@tonic-gate uint8_t lsa6_popt; 51*7c478bd9Sstevel@tonic-gate uint16_t lsa6_pmbz; 52*7c478bd9Sstevel@tonic-gate uint8_t lsa6_pfx[4]; 53*7c478bd9Sstevel@tonic-gate }; 54*7c478bd9Sstevel@tonic-gate 55*7c478bd9Sstevel@tonic-gate /* link state advertisement */ 56*7c478bd9Sstevel@tonic-gate struct lsa6 { 57*7c478bd9Sstevel@tonic-gate struct lsa6_hdr ls6_hdr; 58*7c478bd9Sstevel@tonic-gate 59*7c478bd9Sstevel@tonic-gate /* Link state types */ 60*7c478bd9Sstevel@tonic-gate union { 61*7c478bd9Sstevel@tonic-gate /* Router links advertisements */ 62*7c478bd9Sstevel@tonic-gate struct { 63*7c478bd9Sstevel@tonic-gate union { 64*7c478bd9Sstevel@tonic-gate uint8_t rla_flg; 65*7c478bd9Sstevel@tonic-gate uint32_t rla_opt; 66*7c478bd9Sstevel@tonic-gate } un_rla_flgopt; 67*7c478bd9Sstevel@tonic-gate #define rla6_flags un_rla_flgopt.rla_flg 68*7c478bd9Sstevel@tonic-gate #define rla6_options un_rla_flgopt.rla_opt 69*7c478bd9Sstevel@tonic-gate struct rla6link { 70*7c478bd9Sstevel@tonic-gate uint8_t link_type; 71*7c478bd9Sstevel@tonic-gate uint8_t link_zero[1]; 72*7c478bd9Sstevel@tonic-gate uint16_t link_metric; 73*7c478bd9Sstevel@tonic-gate uint32_t link_ifid; 74*7c478bd9Sstevel@tonic-gate uint32_t link_nifid; 75*7c478bd9Sstevel@tonic-gate uint32_t link_nrtid; 76*7c478bd9Sstevel@tonic-gate } rla_link[1]; /* may repeat */ 77*7c478bd9Sstevel@tonic-gate } un_rla; 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate /* Network links advertisements */ 80*7c478bd9Sstevel@tonic-gate struct { 81*7c478bd9Sstevel@tonic-gate uint32_t nla_options; 82*7c478bd9Sstevel@tonic-gate uint32_t nla_router[1]; /* may repeat */ 83*7c478bd9Sstevel@tonic-gate } un_nla; 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate /* Inter Area Prefix LSA */ 86*7c478bd9Sstevel@tonic-gate struct { 87*7c478bd9Sstevel@tonic-gate uint32_t inter_ap_metric; 88*7c478bd9Sstevel@tonic-gate struct lsa6_prefix inter_ap_prefix[1]; 89*7c478bd9Sstevel@tonic-gate } un_inter_ap; 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate /* Link LSA */ 92*7c478bd9Sstevel@tonic-gate struct llsa { 93*7c478bd9Sstevel@tonic-gate union { 94*7c478bd9Sstevel@tonic-gate uint8_t pri; 95*7c478bd9Sstevel@tonic-gate uint32_t opt; 96*7c478bd9Sstevel@tonic-gate } llsa_priandopt; 97*7c478bd9Sstevel@tonic-gate #define llsa_priority llsa_priandopt.pri 98*7c478bd9Sstevel@tonic-gate #define llsa_options llsa_priandopt.opt 99*7c478bd9Sstevel@tonic-gate struct in6_addr llsa_lladdr; 100*7c478bd9Sstevel@tonic-gate uint32_t llsa_nprefix; 101*7c478bd9Sstevel@tonic-gate struct lsa6_prefix llsa_prefix[1]; 102*7c478bd9Sstevel@tonic-gate } un_llsa; 103*7c478bd9Sstevel@tonic-gate 104*7c478bd9Sstevel@tonic-gate /* Intra-Area-Prefix */ 105*7c478bd9Sstevel@tonic-gate struct { 106*7c478bd9Sstevel@tonic-gate uint16_t intra_ap_nprefix; 107*7c478bd9Sstevel@tonic-gate uint16_t intra_ap_lstype; 108*7c478bd9Sstevel@tonic-gate uint32_t intra_ap_lsid; 109*7c478bd9Sstevel@tonic-gate uint32_t intra_ap_rtid; 110*7c478bd9Sstevel@tonic-gate struct lsa6_prefix intra_ap_prefix[1]; 111*7c478bd9Sstevel@tonic-gate } un_intra_ap; 112*7c478bd9Sstevel@tonic-gate } lsa_un; 113*7c478bd9Sstevel@tonic-gate }; 114*7c478bd9Sstevel@tonic-gate 115*7c478bd9Sstevel@tonic-gate struct ospf6hdr { 116*7c478bd9Sstevel@tonic-gate uint8_t ospf6_version; 117*7c478bd9Sstevel@tonic-gate uint8_t ospf6_type; 118*7c478bd9Sstevel@tonic-gate uint16_t ospf6_len; 119*7c478bd9Sstevel@tonic-gate uint32_t ospf6_routerid; 120*7c478bd9Sstevel@tonic-gate uint32_t ospf6_areaid; 121*7c478bd9Sstevel@tonic-gate uint16_t ospf6_chksum; 122*7c478bd9Sstevel@tonic-gate uint8_t ospf6_instanceid; 123*7c478bd9Sstevel@tonic-gate uint8_t ospf6_rsvd; 124*7c478bd9Sstevel@tonic-gate union { 125*7c478bd9Sstevel@tonic-gate 126*7c478bd9Sstevel@tonic-gate /* Hello packet */ 127*7c478bd9Sstevel@tonic-gate struct { 128*7c478bd9Sstevel@tonic-gate uint32_t hello_ifid; 129*7c478bd9Sstevel@tonic-gate union { 130*7c478bd9Sstevel@tonic-gate uint8_t pri; 131*7c478bd9Sstevel@tonic-gate uint32_t opt; 132*7c478bd9Sstevel@tonic-gate } hello_priandopt; 133*7c478bd9Sstevel@tonic-gate #define hello6_priority hello_priandopt.pri 134*7c478bd9Sstevel@tonic-gate #define hello6_options hello_priandopt.opt 135*7c478bd9Sstevel@tonic-gate uint16_t hello_helloint; 136*7c478bd9Sstevel@tonic-gate uint16_t hello_deadint; 137*7c478bd9Sstevel@tonic-gate uint32_t hello_dr; 138*7c478bd9Sstevel@tonic-gate uint32_t hello_bdr; 139*7c478bd9Sstevel@tonic-gate uint32_t hello_neighbor[1]; /* may repeat */ 140*7c478bd9Sstevel@tonic-gate } un_hello; 141*7c478bd9Sstevel@tonic-gate 142*7c478bd9Sstevel@tonic-gate /* Database Description packet */ 143*7c478bd9Sstevel@tonic-gate struct { 144*7c478bd9Sstevel@tonic-gate uint32_t db_options; 145*7c478bd9Sstevel@tonic-gate uint16_t db_mtu; 146*7c478bd9Sstevel@tonic-gate uint8_t db_mbz; 147*7c478bd9Sstevel@tonic-gate uint8_t db_flags; 148*7c478bd9Sstevel@tonic-gate uint32_t db_seq; 149*7c478bd9Sstevel@tonic-gate struct lsa6_hdr db_lshdr[1]; /* may repeat */ 150*7c478bd9Sstevel@tonic-gate } un_db; 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate /* Link State Request */ 153*7c478bd9Sstevel@tonic-gate struct lsr6 { 154*7c478bd9Sstevel@tonic-gate uint16_t ls_mbz; 155*7c478bd9Sstevel@tonic-gate uint16_t ls_type; 156*7c478bd9Sstevel@tonic-gate uint32_t ls_stateid; 157*7c478bd9Sstevel@tonic-gate uint32_t ls_router; 158*7c478bd9Sstevel@tonic-gate } un_lsr[1]; /* may repeat */ 159*7c478bd9Sstevel@tonic-gate 160*7c478bd9Sstevel@tonic-gate /* Link State Update */ 161*7c478bd9Sstevel@tonic-gate struct { 162*7c478bd9Sstevel@tonic-gate uint32_t lsu_count; 163*7c478bd9Sstevel@tonic-gate struct lsa6 lsu_lsa[1]; /* may repeat */ 164*7c478bd9Sstevel@tonic-gate } un_lsu; 165*7c478bd9Sstevel@tonic-gate 166*7c478bd9Sstevel@tonic-gate /* Link State Acknowledgement */ 167*7c478bd9Sstevel@tonic-gate struct { 168*7c478bd9Sstevel@tonic-gate struct lsa6_hdr lsa_lshdr[1]; /* may repeat */ 169*7c478bd9Sstevel@tonic-gate } un_lsa; 170*7c478bd9Sstevel@tonic-gate } ospf6_un; 171*7c478bd9Sstevel@tonic-gate }; 172*7c478bd9Sstevel@tonic-gate 173*7c478bd9Sstevel@tonic-gate #define ospf6_hello ospf6_un.un_hello 174*7c478bd9Sstevel@tonic-gate #define ospf6_db ospf6_un.un_db 175*7c478bd9Sstevel@tonic-gate #define ospf6_lsr ospf6_un.un_lsr 176*7c478bd9Sstevel@tonic-gate #define ospf6_lsu ospf6_un.un_lsu 177*7c478bd9Sstevel@tonic-gate #define ospf6_lsa ospf6_un.un_lsa 178*7c478bd9Sstevel@tonic-gate 179*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 180*7c478bd9Sstevel@tonic-gate } 181*7c478bd9Sstevel@tonic-gate #endif 182*7c478bd9Sstevel@tonic-gate 183*7c478bd9Sstevel@tonic-gate #endif /* _OSPF6_H */ 184