Change dissect_ppp() to accept offset.
[obnox/wireshark/wip.git] / packet-ospf.h
1 /* packet-ospf.h (c) 1998 Hannes Boehm */
2
3 /* $Id: packet-ospf.h,v 1.7 2000/03/09 18:31:51 ashokn 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 /* Opaque LSA types */
36 #define OSPF_LSTYPE_OP_LINKLOCAL 9
37 #define OSPF_LSTYPE_OP_AREALOCAL 10
38 #define OSPF_LSTYPE_OP_ASWIDE    11
39
40 #define OSPF_LINK_PTP           1
41 #define OSPF_LINK_TRANSIT       2
42 #define OSPF_LINK_STUB          3
43 #define OSPF_LINK_VIRTUAL       4
44
45 #define OSPF_LSA_HEADER_LENGTH  20
46
47 /* Known opaque LSAs */
48 #define OSPF_LSA_MPLS_TE        1
49
50 typedef struct _e_ospfhdr {
51     guint8  version;
52     guint8  packet_type;
53     guint16 length;
54     guint32 routerid;
55     guint32 area;
56     guint16 checksum;
57     guint16 auth_type;
58     char auth_data[8];
59 } e_ospfhdr;
60
61 typedef struct _e_ospf_hello {
62     guint32 network_mask;
63     guint16 hellointervall;
64     guint8  options;
65     guint8  priority;
66     guint32 dead_interval;
67     guint32 drouter;
68     guint32 bdrouter;
69 } e_ospf_hello ;
70
71 typedef struct _e_ospf_dbd {
72    guint16 interface_mtu;
73    guint8  options;
74    guint8  flags;
75    guint32 dd_sequence;
76 } e_ospf_dbd;
77
78 typedef struct _e_ospf_ls_req {
79     guint32     ls_type;
80     guint32     ls_id;
81     guint32     adv_router;
82 } e_ospf_ls_req;
83
84 typedef struct _e_ospf_lsa_hdr {
85     guint16     ls_age;
86     guint8      options;
87     guint8      ls_type;
88     guint32     ls_id;
89     guint32     adv_router;
90     guint32     ls_seq;
91     guint16     ls_checksum;
92     guint16     length;
93 } e_ospf_lsa_hdr;
94
95 typedef struct _e_ospf_router_lsa {
96     guint8 flags;
97     guint8 empfty;
98     guint16 nr_links;
99 } e_ospf_router_lsa;
100
101 typedef struct _e_ospf_router_data {
102     guint32 link_id;
103     guint32 link_data;
104     guint8 link_type;
105     guint8 nr_tos;
106     guint16 tos0_metric;
107 } e_ospf_router_data;
108
109 typedef struct _e_ospf_router_metric {
110     guint8      tos;
111     guint8      empty;
112     guint16     metric;
113 } e_ospf_router_metric;
114
115 typedef struct  _e_ospf_network_lsa {
116     guint32     network_mask;
117 } e_ospf_network_lsa;
118
119 typedef struct _e_ospf_lsa_upd_hdr {
120     guint32     lsa_nr;
121 } e_ospf_lsa_upd_hdr;
122
123 typedef struct _e_ospf_summary_lsa {
124     guint32     network_mask;
125 } e_ospf_summary_lsa;
126
127 typedef struct _e_ospf_asexternal_lsa {
128     guint8      options;
129     guint8      metric[3];
130     guint32     gateway;
131     guint32     external_tag;
132 } e_ospf_asexternal_lsa;
133
134 typedef struct _e_ospf_crypto {
135     guint16   mbz;
136     guint8      key_id;
137     guint8      length;
138     guint32   sequence_num;
139 } e_ospf_crypto;
140
141 void dissect_ospf(const u_char *, int, frame_data *, proto_tree *);
142 void dissect_ospf_hello(const u_char*, int, frame_data*, proto_tree*);
143 void dissect_ospf_db_desc(const u_char*, int, frame_data*, proto_tree*); 
144 void dissect_ospf_ls_req(const u_char*, int, frame_data*, proto_tree*); 
145 void dissect_ospf_ls_upd(const u_char*, int, frame_data*, proto_tree*); 
146 void dissect_ospf_ls_ack(const u_char*, int, frame_data*, proto_tree*); 
147
148 /* dissect_ospf_lsa returns the length of the LSA 
149  * if disassemble_body is set to FALSE (e.g. in LSA ACK 
150  * packets), the LSA-header length is returned (20)
151  */
152 int dissect_ospf_lsa(const u_char*, int, frame_data*, proto_tree*, int disassemble_body);