Initial revision
[obnox/wireshark/wip.git] / packet-ospf.h
1 /* packet-ospf.h (c) 1998 Hannes Boehm */
2
3 #define OSPF_HEADER_LENGTH      24
4
5 #define OSPF_HELLO      1
6 #define OSPF_DB_DESC    2
7 #define OSPF_LS_REQ     3
8 #define OSPF_LS_UPD     4
9 #define OSPF_LS_ACK     5
10
11 #define OSPF_AUTH_NONE          0
12 #define OSPF_AUTH_SIMPLE        1
13 #define OSPF_AUTH_CRYPT         2
14
15 #define OSPF_OPTIONS_E          2
16 #define OSPF_OPTIONS_MC         4
17 #define OSPF_OPTIONS_NP         8
18 #define OSPF_OPTIONS_EA         16
19 #define OSPF_OPTIONS_DC         32
20
21 #define OSPF_DBD_FLAG_MS        1
22 #define OSPF_DBD_FLAG_M         2
23 #define OSPF_DBD_FLAG_I         4
24
25 #define OSPF_LS_REQ_LENGTH      12
26
27 #define OSPF_LSTYPE_ROUTER      1
28 #define OSPF_LSTYPE_NETWORK     2
29 #define OSPF_LSTYPE_SUMMERY     3
30 #define OSPF_LSTYPE_ASBR        4
31 #define OSPF_LSTYPE_ASEXT       5
32
33 #define OSPF_LINK_PTP           1
34 #define OSPF_LINK_TRANSIT       2
35 #define OSPF_LINK_STUB          3
36 #define OSPF_LINK_VIRTUAL       4
37
38 #define OSPF_LSA_HEADER_LENGTH  20
39
40 typedef struct _e_ospfhdr {
41     guint8  version;
42     guint8  packet_type;
43     guint16 length;
44     guint32 routerid;
45     guint32 area;
46     guint16 checksum;
47     guint16 auth_type;
48     char auth_data[8];
49 } e_ospfhdr;
50
51 typedef struct _e_ospf_hello {
52     guint32 network_mask;
53     guint16 hellointervall;
54     guint8  options;
55     guint8  priority;
56     guint32 dead_interval;
57     guint32 drouter;
58     guint32 bdrouter;
59 } e_ospf_hello ;
60
61 typedef struct _e_ospf_dbd {
62    guint16 interface_mtu;
63    guint8  options;
64    guint8  flags;
65    guint32 dd_sequence;
66 } e_ospf_dbd;
67
68 typedef struct _e_ospf_ls_req {
69     guint32     ls_type;
70     guint32     ls_id;
71     guint32     adv_router;
72 } e_ospf_ls_req;
73
74 typedef struct _e_ospf_lsa_hdr {
75     guint16     ls_age;
76     guint8      options;
77     guint8      ls_type;
78     guint32     ls_id;
79     guint32     adv_router;
80     guint32     ls_seq;
81     guint16     ls_checksum;
82     guint16     length;
83 } e_ospf_lsa_hdr;
84
85 typedef struct _e_ospf_router_lsa {
86     guint8 flags;
87     guint8 empfty;
88     guint16 nr_links;
89 } e_ospf_router_lsa;
90
91 typedef struct _e_ospf_router_data {
92     guint32 link_id;
93     guint32 link_data;
94     guint8 link_type;
95     guint8 nr_tos;
96     guint16 tos0_metric;
97 } e_ospf_router_data;
98
99 typedef struct _e_ospf_router_metric {
100     guint8      tos;
101     guint8      empty;
102     guint16     metric;
103 } e_ospf_router_metric;
104
105 typedef struct  _e_ospf_network_lsa {
106     guint32     network_mask;
107 } e_ospf_network_lsa;
108
109 typedef struct _e_ospf_lsa_upd_hdr {
110     guint32     lsa_nr;
111 } e_ospf_lsa_upd_hdr;
112
113 typedef struct _e_ospf_summary_lsa {
114     guint32     network_mask;
115 } e_ospf_summary_lsa;
116
117 void dissect_ospf_hello(const u_char*, int, frame_data*, GtkTree*);
118 void dissect_ospf_db_desc(const u_char*, int, frame_data*, GtkTree*); 
119 void dissect_ospf_ls_req(const u_char*, int, frame_data*, GtkTree*); 
120 void dissect_ospf_ls_upd(const u_char*, int, frame_data*, GtkTree*); 
121 void dissect_ospf_ls_ack(const u_char*, int, frame_data*, GtkTree*); 
122
123 /* dissect_ospf_lsa returns the length of the LSA 
124  * if disassemble_body is set to FALSE (e.g. in LSA ACK 
125  * packets), the header length is returned
126  */
127 int dissect_ospf_lsa(const u_char*, int, frame_data*, GtkTree*, int disassemble_body);