Set the svn:eol-style property on all text files to "native", so that
[obnox/wireshark/wip.git] / wiretap / lanalyzer.h
1 /* lanalyzer.h
2  *
3  * $Id$
4  *
5  * Wiretap Library
6  * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21  *
22  */
23
24 #ifndef __LANALYZER_H__
25 #define __LANALYZER_H__
26
27 /*    Record type codes:                */
28
29 #define     RT_HeaderRegular       0x1001
30 #define     RT_HeaderCyclic        0x1007
31 #define     RT_RxChannelName       0x1006
32 #define     RT_TxChannelName       0x100b
33 #define     RT_FilterName          0x1032
34 #define     RT_RxTemplateName      0x1035
35 #define     RT_TxTemplateName      0x1036
36 #define     RT_DisplayOptions      0x100a
37 #define     RT_Summary             0x1002
38 #define     RT_SubfileSummary      0x1003
39 #define     RT_CyclicInformation   0x1009
40 #define     RT_Index               0x1004
41 #define     RT_PacketData          0x1005
42
43 #define     LA_ProFileLimit       (1024 * 1024 * 32)
44
45 typedef guint8  Eadr[6];
46 typedef guint16 TimeStamp[3];  /* 0.5 microseconds since start of trace */
47
48 /*
49  * These records have only 2-byte alignment for 4-byte quantities,
50  * so the structures aren't necessarily valid; they're kept as comments
51  * for reference purposes.
52  */
53
54 /*
55  * typedef struct {
56  *       guint8      day;
57  *       guint8      mon;
58  *       gint16      year;
59  *       } Date;
60  */
61
62 /*
63  * typedef struct {
64  *       guint8      second;
65  *       guint8      minute;
66  *       guint8      hour;
67  *       guint8      day;
68  *       gint16      reserved;
69  *       } Time;
70  */
71
72 /*
73  * typedef struct {
74  *       guint16     rx_channels;
75  *       guint16     rx_errors;
76  *       gint16      rx_frm_len;
77  *       gint16      rx_frm_sln;
78  *       TimeStamp   rx_time;
79  *       guint32     pktno;
80  *       gint16      prvlen;
81  *       gint16      offset;
82  *       gint16      tx_errs;
83  *       gint16      rx_filters;
84  *       gint8       unused[2];
85  *       gint16      hwcolls;
86  *       gint16      hwcollschans;
87  *       Packetdata ....;
88  *       } LA_PacketRecord;
89  */
90
91 #define LA_PacketRecordSize 32
92
93 /*
94  * typedef struct {
95  *       Date        datcre;
96  *       Date        datclo;
97  *       Time        timeopn;
98  *       Time        timeclo;
99  *       Eadr        statadr;
100  *       gint16      mxseqno;
101  *       gint16      slcoff;
102  *       gint16      mxslc;
103  *       gint32      totpktt;
104  *       gint32      statrg;
105  *       gint32      stptrg;
106  *       gint32      mxpkta[36];
107  *       gint16      board_type;
108  *       gint16      board_version;
109  *       gint8       reserved[18];
110  *       } Summary;
111  */
112
113 #define SummarySize (18+22+(4*36)+6+6+6+4+4)
114
115
116 /*
117  * typedef struct {
118  *       gint16      rid;
119  *       gint16      rlen;
120  *       Summary     s;
121  *       } LA_SummaryRecord;
122  */
123
124 #define LA_SummaryRecordSize (SummarySize + 4)
125
126
127 /*
128  * typedef struct {
129  *       gint16      rid;
130  *       gint16      rlen;
131  *       gint16      seqno;
132  *       gint32      totpktf;
133  *       } LA_SubfileSummaryRecord;
134  */
135
136 #define LA_SubfileSummaryRecordSize 10
137
138
139 #define LA_IndexSize 500
140
141 /*
142  * typedef struct {
143  *       gint16      rid;
144  *       gint16      rlen;
145  *       gint16      idxsp;                    = LA_IndexSize
146  *       gint16      idxct;
147  *       gint8       idxgranu;
148  *       gint8       idxvd;
149  *       gint32      trcidx[LA_IndexSize + 2]; +2 undocumented but used by La 2.2
150  *       } LA_IndexRecord;
151  */
152
153 #define LA_IndexRecordSize (10 + 4 * (LA_IndexSize + 2))
154
155 /*
156  * typedef struct {
157  *       gint16      rid;
158  *       gint16      rlen;
159  *       } LA_RecordHeader;
160  */
161
162 #define LA_RecordHeaderSize 4
163
164 typedef struct {
165       gboolean        init;
166       struct timeval  start;
167       guint32         pkts;
168       int             encap;
169       int             lastlen;
170       } LA_TmpInfo;
171
172 int         lanalyzer_open(wtap *wth, int *err, gchar **err_info);
173 gboolean    lanalyzer_dump_open(wtap_dumper *wdh, gboolean cant_seek, int *err);
174 int         lanalyzer_dump_can_write_encap(int encap);
175
176 #endif