snoop_ospf.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _OSPF_H
#define _OSPF_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Definitions for parsing OSPF packets (RFC 2328 and RFC 2740)
*/
#ifdef __cplusplus
extern "C" {
#endif
#define OSPF_TYPE_UMD 0 /* UMD's special monitoring packets */
#define OSPF_TYPE_MAX 6
extern char *ospf_types[];
struct bits {
const char *str;
};
char *ospf_print_lsa_age(long);
/* Options *_options */
/* ospf_authtype */
#define OSPF_AUTH_NONE 0 /* No auth-data */
#define OSPF_AUTH_TYPE_MAX 3
/* db_flags */
/* ls_type */
/* extensions 23 July 1991) */
#define LS_TYPE_MAX 10
#define LS_TYPE_MASK 0x1fff
#define LS6_SCOPE_LINKLOCAL 0x0000
#define LS6_SCOPE_AREA 0x2000
#define LS6_SCOPE_AS 0x4000
#define LS6_SCOPE_MASK 0x6000
/* rla_link.link_type */
/* rla_flags */
#define RLA_FLAG_B 0x01
#define RLA_FLAG_E 0x02
#define RLA_FLAG_V 0x04
#define RLA_FLAG_W 0x08
/* sla_tosmetric breakdown */
#define SLA_MASK_TOS 0x7f000000
#define SLA_MASK_METRIC 0x00ffffff
#define SLA_SHIFT_TOS 24
/* asla_tosmetric breakdown */
#define ASLA_FLAG_EXTERNAL 0x80000000
#define ASLA_MASK_TOS 0x7f000000
#define ASLA_SHIFT_TOS 24
#define ASLA_MASK_METRIC 0x00ffffff
/* multicast vertex type */
#define MCLA_VERTEX_ROUTER 1
#define MCLA_VERTEX_NETWORK 2
/* link state advertisement header */
struct lsa_hdr {
struct in_addr ls_stateid;
};
/* link state advertisement */
struct lsa {
/* Link state types */
union {
/* Router links advertisements */
struct {
struct rlalink {
} un_rla;
/* Network links advertisements */
struct {
} un_nla;
/* Summary links advertisements */
struct {
} un_sla;
/* AS external links advertisements */
struct {
struct aslametric {
struct in_addr asla_forward;
} un_asla;
/* Multicast group membership */
struct mcla {
} un_mcla[1];
} lsa_un;
};
/*
* TOS metric struct (will be 0 or more in router links update)
*/
struct tos_metric {
};
/*
* OSPF minimum header sizes
*/
#define OSPF_AUTH_SIZE 8
#define OSPF_MIN_HEADER_SIZE 24
#define OSPF6_MIN_HEADER_SIZE 16
#define OSPF_MIN_HELLO_HEADER_SIZE 20
#define OSPF_MIN_DB_HEADER_SIZE 8
#define OSPF6_MIN_DB_HEADER_SIZE 12
#define OSPF_MIN_LSR_HEADER_SIZE 12
#define OSPF_MIN_LSU_HEADER_SIZE 4
/*
* ospf packet header
*/
struct ospfhdr {
struct in_addr ospf_routerid;
struct in_addr ospf_areaid;
union {
/* Hello packet */
struct {
struct in_addr hello_mask;
} un_hello;
/* Database Description packet */
struct {
} un_db;
/* Link State Request */
struct lsr {
struct in_addr ls_stateid;
/* Link State Update */
struct {
} un_lsu;
/* Link State Acknowledgement */
struct {
} un_lsa;
} ospf_un;
};
#ifdef __cplusplus
}
#endif
#endif /* _OSPF_H */