OpenCores
URL https://opencores.org/ocsvn/or1k_soc_on_altera_embedded_dev_kit/or1k_soc_on_altera_embedded_dev_kit/trunk

Subversion Repositories or1k_soc_on_altera_embedded_dev_kit

[/] [or1k_soc_on_altera_embedded_dev_kit/] [trunk/] [linux-2.6/] [linux-2.6.24/] [net/] [bluetooth/] [bnep/] [bnep.h] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 xianfeng
/*
2
  BNEP protocol definition for Linux Bluetooth stack (BlueZ).
3
  Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License, version 2, as
7
  published by the Free Software Foundation.
8
 
9
  This program is distributed in the hope that it will be useful,
10
  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
  GNU General Public License for more details.
13
 
14
  You should have received a copy of the GNU General Public License
15
  along with this program; if not, write to the Free Software
16
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17
*/
18
 
19
/*
20
 * $Id: bnep.h,v 1.5 2002/08/04 21:23:58 maxk Exp $
21
 */
22
 
23
#ifndef _BNEP_H
24
#define _BNEP_H
25
 
26
#include <linux/types.h>
27
#include <linux/crc32.h>
28
#include <net/bluetooth/bluetooth.h>
29
 
30
// Limits
31
#define BNEP_MAX_PROTO_FILTERS     5
32
#define BNEP_MAX_MULTICAST_FILTERS 20
33
 
34
// UUIDs
35
#define BNEP_BASE_UUID 0x0000000000001000800000805F9B34FB
36
#define BNEP_UUID16    0x02
37
#define BNEP_UUID32    0x04
38
#define BNEP_UUID128   0x16
39
 
40
#define BNEP_SVC_PANU  0x1115
41
#define BNEP_SVC_NAP   0x1116
42
#define BNEP_SVC_GN    0x1117
43
 
44
// Packet types
45
#define BNEP_GENERAL               0x00
46
#define BNEP_CONTROL               0x01
47
#define BNEP_COMPRESSED            0x02
48
#define BNEP_COMPRESSED_SRC_ONLY   0x03
49
#define BNEP_COMPRESSED_DST_ONLY   0x04
50
 
51
// Control types
52
#define BNEP_CMD_NOT_UNDERSTOOD    0x00
53
#define BNEP_SETUP_CONN_REQ        0x01
54
#define BNEP_SETUP_CONN_RSP        0x02
55
#define BNEP_FILTER_NET_TYPE_SET   0x03
56
#define BNEP_FILTER_NET_TYPE_RSP   0x04
57
#define BNEP_FILTER_MULTI_ADDR_SET 0x05
58
#define BNEP_FILTER_MULTI_ADDR_RSP 0x06
59
 
60
// Extension types
61
#define BNEP_EXT_CONTROL           0x00
62
 
63
// Response messages
64
#define BNEP_SUCCESS               0x00
65
 
66
#define BNEP_CONN_INVALID_DST      0x01
67
#define BNEP_CONN_INVALID_SRC      0x02
68
#define BNEP_CONN_INVALID_SVC      0x03
69
#define BNEP_CONN_NOT_ALLOWED      0x04
70
 
71
#define BNEP_FILTER_UNSUPPORTED_REQ    0x01
72
#define BNEP_FILTER_INVALID_RANGE      0x02
73
#define BNEP_FILTER_INVALID_MCADDR     0x02
74
#define BNEP_FILTER_LIMIT_REACHED      0x03
75
#define BNEP_FILTER_DENIED_SECURITY    0x04
76
 
77
// L2CAP settings
78
#define BNEP_MTU         1691
79
#define BNEP_PSM         0x0f
80
#define BNEP_FLUSH_TO    0xffff
81
#define BNEP_CONNECT_TO  15
82
#define BNEP_FILTER_TO   15
83
 
84
// Headers
85
#define BNEP_TYPE_MASK   0x7f
86
#define BNEP_EXT_HEADER  0x80
87
 
88
struct bnep_setup_conn_req {
89
        __u8  type;
90
        __u8  ctrl;
91
        __u8  uuid_size;
92
        __u8  service[0];
93
} __attribute__((packed));
94
 
95
struct bnep_set_filter_req {
96
        __u8  type;
97
        __u8  ctrl;
98
        __be16 len;
99
        __u8  list[0];
100
} __attribute__((packed));
101
 
102
struct bnep_control_rsp {
103
        __u8  type;
104
        __u8  ctrl;
105
        __be16 resp;
106
} __attribute__((packed));
107
 
108
struct bnep_ext_hdr {
109
        __u8  type;
110
        __u8  len;
111
        __u8  data[0];
112
} __attribute__((packed));
113
 
114
/* BNEP ioctl defines */
115
#define BNEPCONNADD     _IOW('B', 200, int)
116
#define BNEPCONNDEL     _IOW('B', 201, int)
117
#define BNEPGETCONNLIST _IOR('B', 210, int)
118
#define BNEPGETCONNINFO _IOR('B', 211, int)
119
 
120
struct bnep_connadd_req {
121
        int   sock;       // Connected socket
122
        __u32 flags;
123
        __u16 role;
124
        char  device[16]; // Name of the Ethernet device
125
};
126
 
127
struct bnep_conndel_req {
128
        __u32 flags;
129
        __u8  dst[ETH_ALEN];
130
};
131
 
132
struct bnep_conninfo {
133
        __u32 flags;
134
        __u16 role;
135
        __u16 state;
136
        __u8  dst[ETH_ALEN];
137
        char  device[16];
138
};
139
 
140
struct bnep_connlist_req {
141
        __u32  cnum;
142
        struct bnep_conninfo __user *ci;
143
};
144
 
145
struct bnep_proto_filter {
146
        __u16 start;
147
        __u16 end;
148
};
149
 
150
int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock);
151
int bnep_del_connection(struct bnep_conndel_req *req);
152
int bnep_get_connlist(struct bnep_connlist_req *req);
153
int bnep_get_conninfo(struct bnep_conninfo *ci);
154
 
155
// BNEP sessions
156
struct bnep_session {
157
        struct list_head list;
158
 
159
        unsigned int  role;
160
        unsigned long state;
161
        unsigned long flags;
162
        atomic_t      killed;
163
 
164
        struct ethhdr eh;
165
        struct msghdr msg;
166
 
167
        struct bnep_proto_filter proto_filter[BNEP_MAX_PROTO_FILTERS];
168
        u64    mc_filter;
169
 
170
        struct socket    *sock;
171
        struct net_device *dev;
172
        struct net_device_stats stats;
173
};
174
 
175
void bnep_net_setup(struct net_device *dev);
176
int bnep_sock_init(void);
177
int bnep_sock_cleanup(void);
178
 
179
static inline int bnep_mc_hash(__u8 *addr)
180
{
181
        return (crc32_be(~0, addr, ETH_ALEN) >> 26);
182
}
183
 
184
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.