Allow "-w" and/or "-R" to be specified either when doing a live capture
[obnox/wireshark/wip.git] / packet-isis-lsp.h
1 /* packet-isis-lsp.h
2  * Defines and such for LSP and their CLV decodes
3  *
4  * $Id: packet-isis-lsp.h,v 1.1 1999/12/15 04:34:18 guy Exp $
5  * Stuart Stanley <stuarts@mxmail.net>
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@zing.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * 
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  * 
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  * 
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25  *
26  *
27  */
28
29 #ifndef _PACKET_ISIS_LSP_H
30 #define _PACKET_ISIS_LSP_H
31
32 /*
33  * Declare what an LSP id looks like (used by LSP and sequence number
34  * packets)
35  */
36 typedef struct {
37         guint8  source_id[6];                   /* source id part */
38         guint8  psuodonode_id;                  /* psn id */
39         guint8  lsp_number;                     /* frag number */
40 } isis_lsp_id_t;
41    
42
43 /*
44  * Declare L1/L2 LSP base header.  
45  */
46 typedef struct {
47         guint8  isis_lsp_pdu_length[2];         /* pdu length including hdr */
48         guint8  isis_lsp_remaining_life[2];     /* seconds before expiration */
49         isis_lsp_id_t isis_lsp_id;
50         guint8  isis_lsp_sequence_number[4];
51         guint8  isis_lsp_checksum[2];
52         guint8  isis_lsp_type_block;            /* partition/att/hip/istype */
53 } isis_lsp_t;
54
55 #define ISIS_LSP_PARTITION_MASK 0x80
56 #define ISIS_LSP_ATT_MASK       0x78
57 #define ISIS_LSP_ATT_SHIFT      3
58 #define ISIS_LSP_HIPPITY_MASK   0x04
59 #define ISIS_LSP_IS_TYPE_MASK   0x03
60
61 #define ISIS_LSP_PARTITION(x)   (x&ISIS_LSP_PARTITION_MASK)
62 #define ISIS_LSP_ATT(x)         ((x&ISIS_LSP_ATT_MASK)>>ISIS_LSP_ATT_SHIFT)
63 #define ISIS_LSP_HIPPITY(x)     (x&ISIS_LSP_HIPPITY_MASK)
64 #define ISIS_LSP_IS_TYPE(x)     (x&ISIS_LSP_IS_TYPE_MASK)
65
66 #define ISIS_LSP_TYPE_UNUSED0           0
67 #define ISIS_LSP_TYPE_LEVEL_1           1
68 #define ISIS_LSP_TYPE_UNUSED2           2
69 #define ISIS_LSP_TYPE_LEVEL_2           3
70
71 #define ISIS_LSP_CLV_METRIC_SUPPORTED(x)        ((x)&0xf0)
72 #define ISIS_LSP_CLV_METRIC_RESERVED(x)         ((x)&0x40)
73 #define ISIS_LSP_CLV_METRIC_VALUE(x)            ((x)&0x3f)
74
75 /*
76  * detail clv information on L1 lsp packets
77  */
78 #define ISIS_CLV_L1_LSP_AREA_ADDRESS            1
79 #define ISIS_CLV_L1_LSP_IS_NEIGHBORS            2
80 #define ISIS_CLV_L1_LSP_ES_NEIGHBORS            3
81 #define ISIS_CLV_L1_LSP_IP_INT_REACHABLE        128
82 #define ISIS_CLV_L1_LSP_NLPID                   129
83 #define ISIS_CLV_L1_LSP_IP_INTERFACE_ADDR       132
84 /* 
85  * Note, the spec say 133, but everyone seems to use 10. Any clue on why
86  * this is would be appreciated!
87  */
88 #define ISIS_CLV_L1_LSP_AUTHENTICATION_NS       10      /* non spec */
89 #define ISIS_CLV_L1_LSP_AUTHENTICATION          133
90
91 /*
92  * detail clv information on L2 lsp packets
93  */
94 #define ISIS_CLV_L2_LSP_AREA_ADDRESS            1
95 #define ISIS_CLV_L2_LSP_IS_NEIGHBORS            2
96 #define ISIS_CLV_L2_LSP_PARTITION_DIS           4
97 #define ISIS_CLV_L2_LSP_PREFIX_NEIGHBORS        5
98 #define ISIS_CLV_L2_LSP_IP_INT_REACHABLE        128
99 #define ISIS_CLV_L2_LSP_NLPID                   129
100 #define ISIS_CLV_L2_LSP_IP_EXT_REACHABLE        130
101 #define ISIS_CLV_L2_LSP_IDRP_INFO               131
102 #define ISIS_CLV_L2_LSP_IP_INTERFACE_ADDR       132
103 /* 
104  * Note, the spec say 133, but everyone seems to use 10. Any clue on why
105  * this is would be appreciated!
106  */
107 #define ISIS_CLV_L2_LSP_AUTHENTICATION_NS       10      /*non spec */
108 #define ISIS_CLV_L2_LSP_AUTHENTICATION          133
109
110 /*
111  * Published API functions.  NOTE, this are "local" API functions and
112  * are only valid from with isis decodes.
113  */
114 extern void isis_dissect_isis_lsp(int hello_type, int header_length,
115         const u_char *pd, int offset, frame_data *fd, proto_tree *tree);
116 extern void isis_lsp_decode_lsp_id(char *tstr, proto_tree *tree, int offset,
117                 isis_lsp_id_t *id );
118
119 #endif /* _PACKET_ISIS_LSP_H */