123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- #ifndef _BGPDUMP_FORMATS_H
- #define _BGPDUMP_FORMATS_H
- #include "bgpdump_attr.h"
- #include <stdio.h>
- #include <sys/types.h>
- #include <string.h>
- #include <netinet/in.h>
- #define BGPDUMP_TYPE_MRTD_BGP 5
- #define BGPDUMP_SUBTYPE_MRTD_BGP_NULL 0
- #define BGPDUMP_SUBTYPE_MRTD_BGP_UPDATE 1
- #define BGPDUMP_SUBTYPE_MRTD_BGP_PREFUPDATE 2
- #define BGPDUMP_SUBTYPE_MRTD_BGP_STATE_CHANGE 3
- #define BGPDUMP_SUBTYPE_MRTD_BGP_SYNC 4
- #define BGPDUMP_SUBTYPE_MRTD_BGP_OPEN 5
- #define BGPDUMP_SUBTYPE_MRTD_BGP_NOTIFICATION 6
- #define BGPDUMP_SUBTYPE_MRTD_BGP_KEEPALIVE 7
- #define BGPDUMP_SUBTYPE_MRTD_BGP_ROUT_REFRESH 133
- #define BGPDUMP_TYPE_MRTD_TABLE_DUMP 12
- #define BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP 1
- #define BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP6 2
- #define BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP_32BIT_AS 3
- #define BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP6_32BIT_AS 4
- #define BGPDUMP_TYPE_TABLE_DUMP_V2 13
- #define BGPDUMP_SUBTYPE_TABLE_DUMP_V2_PEER_INDEX_TABLE 1
- #define BGPDUMP_SUBTYPE_TABLE_DUMP_V2_RIB_IPV4_UNICAST 2
- #define BGPDUMP_SUBTYPE_TABLE_DUMP_V2_RIB_IPV4_MULTICAST 3
- #define BGPDUMP_SUBTYPE_TABLE_DUMP_V2_RIB_IPV6_UNICAST 4
- #define BGPDUMP_SUBTYPE_TABLE_DUMP_V2_RIB_IPV6_MULTICAST 5
- #define BGPDUMP_SUBTYPE_TABLE_DUMP_V2_RIB_GENERIC 6
- #define BGPDUMP_PEERTYPE_TABLE_DUMP_V2_AFI_IP 0
- #define BGPDUMP_PEERTYPE_TABLE_DUMP_V2_AFI_IP6 1
- #define BGPDUMP_PEERTYPE_TABLE_DUMP_V2_AS2 0
- #define BGPDUMP_PEERTYPE_TABLE_DUMP_V2_AS4 2
- #define BGPDUMP_TYPE_TABLE_DUMP_V2_MAX_VIEWNAME_LEN 255
- #define BGPDUMP_TYPE_ZEBRA_BGP 16
- #define BGPDUMP_TYPE_ZEBRA_BGP_ET 17
- #define BGPDUMP_SUBTYPE_ZEBRA_BGP_STATE_CHANGE 0
- #define BGPDUMP_SUBTYPE_ZEBRA_BGP_MESSAGE 1
- #define BGPDUMP_SUBTYPE_ZEBRA_BGP_ENTRY 2
- #define BGPDUMP_SUBTYPE_ZEBRA_BGP_SNAPSHOT 3
- #define BGPDUMP_SUBTYPE_ZEBRA_BGP_MESSAGE_AS4 4
- #define BGPDUMP_SUBTYPE_ZEBRA_BGP_STATE_CHANGE_AS4 5
- #define BGPDUMP_SUBTYPE_ZEBRA_BGP_MESSAGE_LOCAL 6
- #define BGPDUMP_SUBTYPE_ZEBRA_BGP_MESSAGE_AS4_LOCAL 7
- #define BGPDUMP_SUBTYPE_ZEBRA_BGP_MESSAGE_ADDPATH 8
- #define BGPDUMP_SUBTYPE_ZEBRA_BGP_MESSAGE_AS4_ADDPATH 9
- #define BGPDUMP_SUBTYPE_ZEBRA_BGP_MESSAGE_LOCAL_ADDPATH 10
- #define BGPDUMP_SUBTYPE_ZEBRA_BGP_MESSAGE_AS4_LOCAL_ADDPATH 11
- #define BGPDUMP_SUBTYPE_TABLE_DUMP_V2_RIB_IPV4_UNICAST_ADDPATH 8
- #define BGPDUMP_SUBTYPE_TABLE_DUMP_V2_RIB_IPV4_MULTICAST_ADDPATH 9
- #define BGPDUMP_SUBTYPE_TABLE_DUMP_V2_RIB_IPV6_UNICAST_ADDPATH 10
- #define BGPDUMP_SUBTYPE_TABLE_DUMP_V2_RIB_IPV6_MULTICAST_ADDPATH 11
- #define BGPDUMP_SUBTYPE_TABLE_DUMP_V2_RIB_GENERIC_ADDPATH 12
- #define BGP_STATE_IDLE 1
- #define BGP_STATE_CONNECT 2
- #define BGP_STATE_ACTIVE 3
- #define BGP_STATE_OPENSENT 4
- #define BGP_STATE_OPENCONFIRM 5
- #define BGP_STATE_ESTABLISHED 6
- #define BGP_MSG_OPEN 1
- #define BGP_MSG_UPDATE 2
- #define BGP_MSG_NOTIFY 3
- #define BGP_MSG_KEEPALIVE 4
- #define BGP_MSG_ROUTE_REFRESH_01 5
- #define BGP_MSG_ROUTE_REFRESH 128
- typedef struct struct_BGPDUMP_MRTD_TABLE_DUMP {
- u_int16_t view;
- u_int16_t sequence;
- BGPDUMP_IP_ADDRESS prefix;
- u_char mask;
- u_char status;
- time_t uptime;
- BGPDUMP_IP_ADDRESS peer_ip;
- as_t peer_as;
- u_int16_t attr_len;
- } BGPDUMP_MRTD_TABLE_DUMP;
- typedef struct struct_BGPDUMP_TABLE_DUMP_V2_PEER_INDEX_TABLE_ENTRY {
- u_char afi;
- BGPDUMP_IP_ADDRESS peer_ip;
- struct in_addr peer_bgp_id;
- as_t peer_as;
- } BGPDUMP_TABLE_DUMP_V2_PEER_INDEX_TABLE_ENTRY;
- typedef struct struct_BGPDUMP_TABLE_DUMP_V2_PEER_INDEX_TABLE {
- struct in_addr local_bgp_id;
- char view_name[BGPDUMP_TYPE_TABLE_DUMP_V2_MAX_VIEWNAME_LEN];
- uint16_t peer_count;
- BGPDUMP_TABLE_DUMP_V2_PEER_INDEX_TABLE_ENTRY *entries;
- } BGPDUMP_TABLE_DUMP_V2_PEER_INDEX_TABLE;
- typedef struct struct_BGPDUMP_TABLE_DUMP_V2_ROUTE_ENTRY {
- uint16_t peer_index;
- uint32_t originated_time;
- pathid_t path_id;
- BGPDUMP_TABLE_DUMP_V2_PEER_INDEX_TABLE_ENTRY *peer;
- attributes_t *attr;
- } BGPDUMP_TABLE_DUMP_V2_ROUTE_ENTRY;
- typedef struct struct_BGPDUMP_TABLE_DUMP_V2_PREFIX {
- uint32_t seq;
- uint16_t afi;
- uint8_t safi;
- u_char prefix_length;
- BGPDUMP_IP_ADDRESS prefix;
- uint16_t entry_count;
- BGPDUMP_TABLE_DUMP_V2_ROUTE_ENTRY *entries;
- } BGPDUMP_TABLE_DUMP_V2_PREFIX;
- typedef struct struct_BGPDUMP_ZEBRA_STATE_CHANGE {
- as_t source_as;
- as_t destination_as;
- u_int16_t interface_index;
- u_int16_t address_family;
- BGPDUMP_IP_ADDRESS source_ip;
- BGPDUMP_IP_ADDRESS destination_ip;
- u_int16_t old_state;
- u_int16_t new_state;
- } BGPDUMP_ZEBRA_STATE_CHANGE;
- struct zebra_incomplete {
- u_int16_t afi;
- u_int8_t orig_len;
- struct prefix prefix;
- };
- typedef struct struct_BGPDUMP_ZEBRA_MESSAGE {
-
- as_t source_as;
- as_t destination_as;
- u_int16_t interface_index;
- u_int16_t address_family;
- BGPDUMP_IP_ADDRESS source_ip;
- BGPDUMP_IP_ADDRESS destination_ip;
-
- u_int16_t size;
- u_char type;
-
- u_char version;
- as_t my_as;
- u_int16_t hold_time;
- struct in_addr bgp_id;
- u_char opt_len;
- u_char *opt_data;
-
- u_int16_t withdraw_count;
- u_int16_t announce_count;
- struct prefix withdraw[MAX_PREFIXES];
- struct prefix announce[MAX_PREFIXES];
-
- u_int16_t cut_bytes;
- struct zebra_incomplete incomplete;
-
- u_char error_code;
- u_char sub_error_code;
- u_int16_t notify_len;
- u_char *notify_data;
- } BGPDUMP_ZEBRA_MESSAGE;
- typedef struct struct_BGPDUMP_ZEBRA_ENTRY {
- u_int16_t view;
- u_int16_t status;
- time_t time_last_change;
- u_int16_t address_family;
- u_char SAFI;
- u_char next_hop_len;
- u_char prefix_length;
- u_char *address_prefix;
- u_int16_t empty;
- u_char *bgp_atribute;
- } BGPDUMP_ZEBRA_ENTRY;
- typedef struct struct_BGPDUMP_ZEBRA_SNAPSHOT {
- u_int16_t view;
- u_int16_t file;
- } BGPDUMP_ZEBRA_SNAPSHOT;
- typedef struct struct_BGPDUMP_MRTD_MESSAGE {
- u_int16_t source_as;
- struct in_addr source_ip;
- u_int16_t destination_as;
- struct in_addr destination_ip;
- u_int16_t withdraw_count;
- u_int16_t announce_count;
- struct prefix withdraw[MAX_PREFIXES];
- struct prefix announce[MAX_PREFIXES];
-
- struct zebra_incomplete incomplete;
- } BGPDUMP_MRTD_MESSAGE;
- typedef struct struct_BGPDUMP_MRTD_STATE_CHANGE {
- u_int16_t destination_as;
- struct in_addr destination_ip;
- u_int16_t old_state;
- u_int16_t new_state;
- } BGPDUMP_MRTD_STATE_CHANGE;
- typedef union union_BGPDUMP_BODY {
- BGPDUMP_MRTD_MESSAGE mrtd_message;
- BGPDUMP_MRTD_STATE_CHANGE mrtd_state_change;
- BGPDUMP_MRTD_TABLE_DUMP mrtd_table_dump;
- BGPDUMP_TABLE_DUMP_V2_PEER_INDEX_TABLE mrtd_table_dump_v2_peer_table;
- BGPDUMP_TABLE_DUMP_V2_PREFIX mrtd_table_dump_v2_prefix;
- BGPDUMP_ZEBRA_STATE_CHANGE zebra_state_change;
- BGPDUMP_ZEBRA_MESSAGE zebra_message;
- BGPDUMP_ZEBRA_ENTRY zebra_entry;
- BGPDUMP_ZEBRA_SNAPSHOT zebra_snapshot;
- } BGPDUMP_BODY;
- typedef struct struct_BGPDUMP_ENTRY {
- time_t time;
- long ms;
- u_int16_t type;
- u_int16_t subtype;
- u_int32_t length;
- attributes_t *attr;
- BGPDUMP_BODY body;
- struct struct_BGPDUMP * dump;
- } BGPDUMP_ENTRY;
- #endif
|