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