http://marcin-wiacek.fkn.pl/english/zips/mygnokii.tar.gz
[gnokii.git] / Docs / developers / other / sniffs / irda / tools / include / irda.h
1 /*********************************************************************
2  *
3  * Filename:      irda.h
4  * Version:
5  * Description:   irda-specific defines
6  * Status:        Experimental.
7  * Author:        Thomas Schneider <nok-trace-men@dev-thomynet.de>
8  * Created at:    
9  * Modified at:   
10  * Modified by:   Thomas Schneider <nok-trace-men@dev-thomynet.de>
11  *
12  *     Copyright (c) 1999 Thomas Schneider, All Rights Reserved.
13  *
14  *     This program is free software; you can redistribute it and/or
15  *     modify it under the terms of the GNU General Public License as
16  *     published by the Free Software Foundation; either version 2 of
17  *     the License, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful, but
20  * WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software 
26  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27  *
28  * IN NO EVENT SHALL THOMAS SCHNEIDER BE LIABLE TO ANY PARTY FOR
29  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 
30  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
31  * IF THOMAS SCHNEIDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
32  * DAMAGE.
33  *
34  * THOMAS SCHNEIDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
35  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
36  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER
37  * IS ON AN "AS IS" BASIS, AND THOMAS SCHNEIDER HAS NO OBLIGATION TO 
38  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 
39  * MODIFICATIONS.
40  *
41  *         This material is provided "AS-IS" and at no charge.
42  *
43  ********************************************************************/
44
45 #ifndef __NOKTRACE_IRDA_H
46 #define __NOKTRACE_IRDA_H
47
48 #include <glib.h>
49
50
51 /*
52  * service hints
53  * -------------
54  * - first byte
55  */
56 #define PNP_COMP 0x00
57 #define PDA_PALM 0x01
58 #define COMPUTER 0x02
59 #define PRINTER  0x03
60 #define MODEM    0x04
61 #define FAX      0x05
62 #define LAN      0x06
63 #define EXTENS   0x07
64
65
66 /*
67  * output-defines
68  * --------------
69  */
70 #define OUT_ALL        0x01
71 #define OUT_IRLAP      0x02
72 #define OUT_IRLMP      0x03
73 #define OUT_HIGH_LEVEL 0x04
74
75 #define OUT_FORM_LINE  0x01
76 #define OUT_FORM_STEP  0x02
77
78 #define OUT_SCREEN     0x01
79 #define OUT_FILE       0x02
80
81 /*
82  * some types
83  */
84 typedef unsigned char  BYTE;
85 typedef unsigned char  U8  ;
86 typedef unsigned short U16 ;
87 typedef unsigned int   U32 ;
88
89 /*
90  * some structs
91  */
92 typedef struct 
93 {
94   U16  length;
95   U16  a_offset;
96   BYTE buf[4096];
97 } RAW_FRAME;
98
99 typedef struct 
100 {
101   U16  bof_length;
102   BYTE * bof;
103   BYTE a;
104   BYTE c;
105   U16  info_length;
106   BYTE * info;
107   U32  fcs;                     /* must be U32 because escaped fcs */
108   BYTE eof_length;
109   BYTE * eof;
110   BYTE esc_nr;                  /* all ce's - include also esc_fcs */
111   BYTE esc_fcs;                 /* nr of ce's in fcs               */
112   U16  computed_fcs;
113 } IRLAP_FRAME;
114
115 typedef struct 
116 {
117   U16  bof_length;
118   BYTE * bof;
119   BYTE a;
120   BYTE c;
121   U16  info_length;
122   BYTE * info;
123   U32  fcs;                     /* must be U32 because escaped fcs */
124   BYTE eof_length;
125   BYTE * eof;
126   BYTE esc_nr;                  /* all ce's - include also esc_fcs */
127   BYTE esc_fcs;                 /* nr of ce's in fcs               */
128   U16  computed_fcs;
129 } IRLAP_RAW_FRAME;
130
131 typedef struct 
132 {
133   U8    cmd;
134   U8    dlsap_sel;
135   U8    slsap_sel;
136   U16   info_length;
137   U8  * info;
138 } IRLMP_FRAME;
139
140 typedef struct 
141 {
142   BYTE baud_rate_master;
143   BYTE baud_rate_client;
144   BYTE baut_rate_connection;
145   BYTE state;
146 } NEGOTATION_PARAM;
147
148 typedef struct
149 {
150   BYTE irlap_state;
151   BYTE irlmp_state;
152   U32  p_src_adr;               /* primary - source address   */
153   U32  s_src_adr;               /* secondary - source address */
154   U8   conn_adr;                /* connection address         */
155 } CONNECTION;
156
157 typedef struct
158 {
159   U32  prim_nr_bytes;           /* bytes from primary station   */
160   U32  sec_nr_bytes ;           /* bytes from secomdary station */
161   U32  prim_fcs_errors;         /* nr of fcs-errors from prim.  */
162   U32  sec_fcs_errors;          /* nr of fcs-errors from sec.   */
163   U32  prim_frames;             /* frames from primary          */
164   U32  sec_frames;              /* frames from secondary        */
165   U32  prim_esc_nr;             /* nr of ecsapes from primary   */
166   U32  sec_esc_nr;              /* nr of escapes from secondary */
167 } CONNECT_STATISTIC;
168
169 typedef struct
170 {
171   BYTE deep;                    /* deep of output (L2, L3, ...  */
172   BYTE form;                    /* kind of output (line, steps) */
173   BYTE bit_output;              /* if output as bits            */
174   BYTE dest;                    /* file, screen                 */
175   FILE input_fd;                /* input FILE                   */
176   GString infile_name;          /* name of input-file           */
177   FILE output_file;             /* output FILE                  */
178   GString outfile_name;         /* name of input-file           */
179 } OUTPUT_PARAMS;
180
181
182 #endif /* __NOKTRACE_IRDA_H */
183