Import 2.3.18pre1
[davej-history.git] / include / net / irda / parameters.h
blobe661f2dfac83a85f4b20d6c6270c2d96602edc44
1 /*********************************************************************
2 *
3 * Filename: parameters.h
4 * Version: 1.0
5 * Description: A more general way to handle (pi,pl,pv) parameters
6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Mon Jun 7 08:47:28 1999
9 * Modified at: Sun Jun 13 09:17:54 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no>
12 * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
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.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
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., 59 Temple Place, Suite 330, Boston,
27 * MA 02111-1307 USA
29 ********************************************************************/
31 #ifndef IRDA_PARAMS_H
32 #define IRDA_PARAMS_H
35 * The currently supported types. Beware not to change the sequence since
36 * it a good reason why the sized integers has a value equal to their size
38 typedefenum{
39 PV_INTEGER,/* Integer of any (pl) length */
40 PV_INT_8_BITS,/* Integer of 8 bits in length */
41 PV_INT_16_BITS,/* Integer of 16 bits in length */
42 PV_STRING,/* \0 terminated string */
43 PV_INT_32_BITS,/* Integer of 32 bits in length */
44 PV_OCT_SEQ,/* Octet sequence */
45 PV_NO_VALUE /* Does not contain any value (pl=0) */
46 } PV_TYPE;
48 /* Bit 7 of type field */
49 #define PV_BIG_ENDIAN 0x80
50 #define PV_LITTLE_ENDIAN 0x00
51 #define PV_MASK 0x7f/* To mask away endian bit */
53 #define PV_PUT 0
54 #define PV_GET 1
56 typedefunion{
57 char*c;
58 __u8 b;
59 __u16 s;
60 __u32 i;
61 __u8 *bp;
62 __u16 *sp;
63 __u32 *ip;
64 } pv_t;
66 typedefstruct{
67 __u8 pi;
68 __u8 pl;
69 pv_t pv;
70 } param_t;
72 typedefint(*PI_HANDLER)(void*self, param_t *param,int get);
73 typedefint(*PV_HANDLER)(void*self, __u8 *buf,int len, __u8 pi,
74 PV_TYPE type, PI_HANDLER func);
76 typedefstruct{
77 PI_HANDLER func;/* Handler for this parameter identifier */
78 PV_TYPE type;/* Data type for this parameter */
79 } pi_minor_info_t;
81 typedefstruct{
82 pi_minor_info_t *pi_minor_call_table;
83 int len;
84 } pi_major_info_t;
86 typedefstruct{
87 pi_major_info_t *tables;
88 int len;
89 __u8 pi_mask;
90 int pi_major_offset;
91 } pi_param_info_t;
93 intirda_param_pack(__u8 *buf,char*fmt, ...);
94 intirda_param_unpack(__u8 *buf,char*fmt, ...);
96 intirda_param_insert(void*self, __u8 pi, __u8 *buf,int len,
97 pi_param_info_t *info);
98 intirda_param_extract(void*self, __u8 *buf,int len, pi_param_info_t *info);
99 intirda_param_extract_all(void*self, __u8 *buf,int len,
100 pi_param_info_t *info);
102 extern inlineintirda_param_insert_byte(__u8 *buf, __u8 pi, __u8 pv)
104 returnirda_param_pack(buf,"bbb", pi,1, pv);
107 #endif/* IRDA_PARAMS_H */
close