Include "conversation.h", as the plugin API now includes the routines to
[obnox/wireshark/wip.git] / packet-bgp.h
index 3902c5ffbd7ee126ea1a12e0804f5672d6b59d0d..a549b6a97aa95af3b04995d9ce292820b73d2bfb 100644 (file)
@@ -1,10 +1,10 @@
 /* packet-bgp.c
  * Definitions for BGP packet disassembly structures and routine
  *
- * $Id: packet-bgp.h,v 1.9 2000/04/11 14:21:37 itojun Exp $
+ * $Id: packet-bgp.h,v 1.16 2001/11/03 21:25:12 guy Exp $
  *
  * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
  * Copyright 1998 Gerald Combs
  *
  * This program is free software; you can redistribute it and/or
 #define BGP_MIN_UPDATE_MSG_SIZE                23
 #define BGP_MIN_NOTIFICATION_MSG_SIZE  21
 #define BGP_MIN_KEEPALVE_MSG_SIZE      BGP_HEADER_SIZE
+#define BGP_TCP_PORT                   179
 
 /* BGP message types */
 #define BGP_OPEN               1
 #define BGP_UPDATE             2
 #define BGP_NOTIFICATION       3
 #define BGP_KEEPALIVE          4
+#define BGP_ROUTE_REFRESH       5
+#define BGP_ROUTE_REFRESH_CISCO 0x80
 
 /* BGP header */
 struct bgp {
@@ -70,6 +73,16 @@ struct bgp_notification {
     /* data should follow */
 };
 
+/* BGP ROUTE-REFRESH message */
+struct bgp_route_refresh {
+    guint8 bgpr_marker[BGP_MARKER_SIZE];
+    guint16 bgpr_len;
+    guint8 bgpr_type;
+    guint16 bgpr_afi;
+    guint8 bgpr_reserved;
+    guint8 bgpr_safi;
+};
+
 /* path attribute */
 struct bgp_attr {
     guint8 bgpa_flags;
@@ -85,10 +98,20 @@ struct bgp_attr {
 /* AS_PATH segment types */
 #define AS_SET             1   /* RFC1771 */
 #define AS_SEQUENCE        2   /* RFC1771 */
-/* This is wrong according to the RFC... in the Zebra code they say that
-   cisco reversed it.  Packet traces seem to agree.                      */
-#define AS_CONFED_SET      4   /* RFC1965 */
-#define AS_CONFED_SEQUENCE 3   /* RFC1965 */
+#define AS_CONFED_SET      4   /* RFC1965 has the wrong values, corrected in  */
+#define AS_CONFED_SEQUENCE 3   /* draft-ietf-idr-bgp-confed-rfc1965bis-01.txt */
+
+/* OPEN message Optional Parameter types  */
+#define BGP_OPTION_AUTHENTICATION      1   /* RFC1771 */
+#define BGP_OPTION_CAPABILITY          2   /* RFC2842 */
+
+/* BGP capability code */
+#define BGP_CAPABILITY_RESERVED                0   /* RFC2434 */
+#define BGP_CAPABILITY_MULTIPROTOCOL   1   /* RFC2858 */
+#define BGP_CAPABILITY_ROUTE_REFRESH   2   /* RFC2918 */
+#define BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING     3       /* draft-ietf-idr-route-filter-04.txt */
+#define BGP_CAPABILITY_ROUTE_REFRESH_CISCO      0x80   /* Cisco */
+
 
 /* well-known communities, from RFC1997 */
 #define BGP_COMM_NO_EXPORT           0xFFFFFF01
@@ -106,36 +129,49 @@ struct bgp_attr {
 #define BGPTYPE_ATOMIC_AGGREGATE  6   /* RFC1771          */
 #define BGPTYPE_AGGREGATOR        7   /* RFC1771          */
 #define BGPTYPE_COMMUNITIES       8   /* RFC1997          */
-#define BGPTYPE_ORIGINATOR_ID     9   /* RFC1966          */
-#define BGPTYPE_CLUSTER_LIST     10   /* RFC1966          */
+#define BGPTYPE_ORIGINATOR_ID     9   /* RFC2796          */
+#define BGPTYPE_CLUSTER_LIST     10   /* RFC2796          */
 #define BGPTYPE_DPA              11   /* work in progress */
 #define BGPTYPE_ADVERTISER       12   /* RFC1863          */
 #define BGPTYPE_RCID_PATH        13   /* RFC1863          */
-#define BGPTYPE_MP_REACH_NLRI    14   /* RFC2283          */
-#define BGPTYPE_MP_UNREACH_NLRI  15   /* RFC2283          */
-
-/* RFC1700 address family numbers */
-#define AFNUM_INET     1
-#define AFNUM_INET6    2
-#define AFNUM_NSAP     3
-#define AFNUM_HDLC     4
-#define AFNUM_BBN1822  5
-#define AFNUM_802      6
-#define AFNUM_E163     7
-#define AFNUM_E164     8
-#define AFNUM_F69      9
-#define AFNUM_X121     10
-#define AFNUM_IPX      11
-#define AFNUM_ATALK    12
-#define AFNUM_DECNET   13
-#define AFNUM_BANYAN   14
-#define AFNUM_E164NSAP 15
-
-#define CHECK_SIZE(x, s, l) \
-do {                           \
-    if ((x) + (s) > (l))       \
-       return;                 \
-} while (0)
+#define BGPTYPE_MP_REACH_NLRI    14   /* RFC2858          */
+#define BGPTYPE_MP_UNREACH_NLRI  15   /* RFC2858          */
+#define BGPTYPE_EXTENDED_COMMUNITY 16 /* Draft Ramachandra */
+
+/* Extended community type */
+                                        /* draft-ramachandra-bgp-ext-communities */
+#define BGP_EXT_COM_RT_0        0x0002  /* Route Target,Format AS(2bytes):AN(4bytes) */
+#define BGP_EXT_COM_RT_1        0x0102  /* Route Target,Format IP address:AN(2bytes) */
+#define BGP_EXT_COM_RO_0        0x0003  /* Route Origin,Format AS(2bytes):AN(4bytes) */
+#define BGP_EXT_COM_RO_1        0x0103  /* Route Origin,Format IP address:AN(2bytes) */
+#define BGP_EXT_COM_LINKBAND    0x4004  /* Link Bandwidth,Format AS(2B):Bandwidth(4B) */
+                                        /* rfc2547 bgp-mpls-vpns */
+#define BGP_EXT_COM_VPN_ORIGIN  0x0005  /* OSPF Domin ID / VPN of Origin  */
+                                        /* draft-rosen-vpns-ospf-bgp-mpls */
+#define BGP_EXT_COM_OSPF_RTYPE  0X8000  /* OSPF Route Type,Format Area(4B):RouteType(1B):Options(1B) */
+#define BGP_EXT_COM_OSPF_RID    0x8001  /* OSPF Router ID,Format RouterID(4B):Unused(2B) */
+
+
+/* OSPF codes for  BGP_EXT_COM_OSPF_RTYPE draft-rosen-vpns-ospf-bgp-mpls  */
+#define BGP_OSPF_RTYPE_RTR      1 /* OSPF Router LSA */
+#define BGP_OSPF_RTYPE_NET      2 /* OSPF Network LSA */
+#define BGP_OSPF_RTYPE_SUM      3 /* OSPF Summary LSA */
+#define BGP_OSPF_RTYPE_EXT      5 /* OSPF External LSA, note that ASBR doesn't apply to MPLS-VPN */
+#define BGP_OSPF_RTYPE_NSSA     7 /* OSPF NSSA External*/
+#define BGP_OSPF_RTYPE_SHAM     129 /* OSPF-MPLS-VPN Sham link */
+#define BGP_OSPF_RTYPE_METRIC_TYPE 0x1 /* LSB of RTYPE Options Field */
+
+/* Extended community & Route dinstinguisher formats */
+#define FORMAT_AS2_LOC      0x00    /* Format AS(2bytes):AN(4bytes) */
+#define FORMAT_IP_LOC       0x01    /* Format IP address:AN(2bytes) */
+#define FORMAT_AS4_LOC      0x02    /* FOrmat AS(4bytes):AN(2bytes) */
+
+/* RFC 2858 subsequent address family numbers */
+#define SAFNUM_UNICAST  1
+#define SAFNUM_MULCAST  2
+#define SAFNUM_UNIMULC  3
+#define SAFNUM_MPLS_LABEL 4     /* rfc3107 */
+#define SAFNUM_LBVPNIP  128     /* Draft-rosen-rfc2547bis-03 */
 
 #ifndef offsetof
 #define offsetof(type, member)  ((size_t)(&((type *)0)->member))