~ubuntu-branches/ubuntu/trusty/linux-linaro-omap/trusty

« back to all changes in this revision

Viewing changes to net/bluetooth/bnep/bnep.h

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-57i0gl3v99b3lkfg
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <linux/crc32.h>
24
24
#include <net/bluetooth/bluetooth.h>
25
25
 
26
 
// Limits
27
 
#define BNEP_MAX_PROTO_FILTERS     5
28
 
#define BNEP_MAX_MULTICAST_FILTERS 20
29
 
 
30
 
// UUIDs
31
 
#define BNEP_BASE_UUID 0x0000000000001000800000805F9B34FB
32
 
#define BNEP_UUID16    0x02
33
 
#define BNEP_UUID32    0x04
34
 
#define BNEP_UUID128   0x16
35
 
 
36
 
#define BNEP_SVC_PANU  0x1115
37
 
#define BNEP_SVC_NAP   0x1116
38
 
#define BNEP_SVC_GN    0x1117
39
 
 
40
 
// Packet types
41
 
#define BNEP_GENERAL               0x00
42
 
#define BNEP_CONTROL               0x01
43
 
#define BNEP_COMPRESSED            0x02
44
 
#define BNEP_COMPRESSED_SRC_ONLY   0x03
45
 
#define BNEP_COMPRESSED_DST_ONLY   0x04
46
 
 
47
 
// Control types
48
 
#define BNEP_CMD_NOT_UNDERSTOOD    0x00
49
 
#define BNEP_SETUP_CONN_REQ        0x01
50
 
#define BNEP_SETUP_CONN_RSP        0x02
51
 
#define BNEP_FILTER_NET_TYPE_SET   0x03
52
 
#define BNEP_FILTER_NET_TYPE_RSP   0x04
53
 
#define BNEP_FILTER_MULTI_ADDR_SET 0x05
54
 
#define BNEP_FILTER_MULTI_ADDR_RSP 0x06
55
 
 
56
 
// Extension types
57
 
#define BNEP_EXT_CONTROL           0x00
58
 
 
59
 
// Response messages
60
 
#define BNEP_SUCCESS               0x00
61
 
 
62
 
#define BNEP_CONN_INVALID_DST      0x01
63
 
#define BNEP_CONN_INVALID_SRC      0x02
64
 
#define BNEP_CONN_INVALID_SVC      0x03
65
 
#define BNEP_CONN_NOT_ALLOWED      0x04
66
 
 
67
 
#define BNEP_FILTER_UNSUPPORTED_REQ    0x01
68
 
#define BNEP_FILTER_INVALID_RANGE      0x02
69
 
#define BNEP_FILTER_INVALID_MCADDR     0x02
70
 
#define BNEP_FILTER_LIMIT_REACHED      0x03
71
 
#define BNEP_FILTER_DENIED_SECURITY    0x04
72
 
 
73
 
// L2CAP settings
74
 
#define BNEP_MTU         1691
75
 
#define BNEP_PSM         0x0f
76
 
#define BNEP_FLUSH_TO    0xffff
77
 
#define BNEP_CONNECT_TO  15
78
 
#define BNEP_FILTER_TO   15
79
 
 
80
 
// Headers
81
 
#define BNEP_TYPE_MASK   0x7f
82
 
#define BNEP_EXT_HEADER  0x80
 
26
/* Limits */
 
27
#define BNEP_MAX_PROTO_FILTERS          5
 
28
#define BNEP_MAX_MULTICAST_FILTERS      20
 
29
 
 
30
/* UUIDs */
 
31
#define BNEP_BASE_UUID  0x0000000000001000800000805F9B34FB
 
32
#define BNEP_UUID16     0x02
 
33
#define BNEP_UUID32     0x04
 
34
#define BNEP_UUID128    0x16
 
35
 
 
36
#define BNEP_SVC_PANU   0x1115
 
37
#define BNEP_SVC_NAP    0x1116
 
38
#define BNEP_SVC_GN     0x1117
 
39
 
 
40
/* Packet types */
 
41
#define BNEP_GENERAL                    0x00
 
42
#define BNEP_CONTROL                    0x01
 
43
#define BNEP_COMPRESSED                 0x02
 
44
#define BNEP_COMPRESSED_SRC_ONLY        0x03
 
45
#define BNEP_COMPRESSED_DST_ONLY        0x04
 
46
 
 
47
/* Control types */
 
48
#define BNEP_CMD_NOT_UNDERSTOOD         0x00
 
49
#define BNEP_SETUP_CONN_REQ             0x01
 
50
#define BNEP_SETUP_CONN_RSP             0x02
 
51
#define BNEP_FILTER_NET_TYPE_SET        0x03
 
52
#define BNEP_FILTER_NET_TYPE_RSP        0x04
 
53
#define BNEP_FILTER_MULTI_ADDR_SET      0x05
 
54
#define BNEP_FILTER_MULTI_ADDR_RSP      0x06
 
55
 
 
56
/* Extension types */
 
57
#define BNEP_EXT_CONTROL 0x00
 
58
 
 
59
/* Response messages */
 
60
#define BNEP_SUCCESS 0x00
 
61
 
 
62
#define BNEP_CONN_INVALID_DST 0x01
 
63
#define BNEP_CONN_INVALID_SRC 0x02
 
64
#define BNEP_CONN_INVALID_SVC 0x03
 
65
#define BNEP_CONN_NOT_ALLOWED 0x04
 
66
 
 
67
#define BNEP_FILTER_UNSUPPORTED_REQ     0x01
 
68
#define BNEP_FILTER_INVALID_RANGE       0x02
 
69
#define BNEP_FILTER_INVALID_MCADDR      0x02
 
70
#define BNEP_FILTER_LIMIT_REACHED       0x03
 
71
#define BNEP_FILTER_DENIED_SECURITY     0x04
 
72
 
 
73
/* L2CAP settings */
 
74
#define BNEP_MTU        1691
 
75
#define BNEP_PSM        0x0f
 
76
#define BNEP_FLUSH_TO   0xffff
 
77
#define BNEP_CONNECT_TO 15
 
78
#define BNEP_FILTER_TO  15
 
79
 
 
80
/* Headers */
 
81
#define BNEP_TYPE_MASK  0x7f
 
82
#define BNEP_EXT_HEADER 0x80
83
83
 
84
84
struct bnep_setup_conn_req {
85
 
        __u8  type;
86
 
        __u8  ctrl;
87
 
        __u8  uuid_size;
88
 
        __u8  service[0];
 
85
        __u8 type;
 
86
        __u8 ctrl;
 
87
        __u8 uuid_size;
 
88
        __u8 service[0];
89
89
} __packed;
90
90
 
91
91
struct bnep_set_filter_req {
92
 
        __u8  type;
93
 
        __u8  ctrl;
 
92
        __u8 type;
 
93
        __u8 ctrl;
94
94
        __be16 len;
95
 
        __u8  list[0];
 
95
        __u8 list[0];
96
96
} __packed;
97
97
 
98
98
struct bnep_control_rsp {
99
 
        __u8  type;
100
 
        __u8  ctrl;
 
99
        __u8 type;
 
100
        __u8 ctrl;
101
101
        __be16 resp;
102
102
} __packed;
103
103
 
104
104
struct bnep_ext_hdr {
105
 
        __u8  type;
106
 
        __u8  len;
107
 
        __u8  data[0];
 
105
        __u8 type;
 
106
        __u8 len;
 
107
        __u8 data[0];
108
108
} __packed;
109
109
 
110
110
/* BNEP ioctl defines */
114
114
#define BNEPGETCONNINFO _IOR('B', 211, int)
115
115
 
116
116
struct bnep_connadd_req {
117
 
        int   sock;       // Connected socket
 
117
        int   sock;             /* Connected socket */
118
118
        __u32 flags;
119
119
        __u16 role;
120
 
        char  device[16]; // Name of the Ethernet device
 
120
        char  device[16];       /* Name of the Ethernet device */
121
121
};
122
122
 
123
123
struct bnep_conndel_req {
148
148
int bnep_get_connlist(struct bnep_connlist_req *req);
149
149
int bnep_get_conninfo(struct bnep_conninfo *ci);
150
150
 
151
 
// BNEP sessions
 
151
/* BNEP sessions */
152
152
struct bnep_session {
153
153
        struct list_head list;
154
154
 
155
155
        unsigned int  role;
156
156
        unsigned long state;
157
157
        unsigned long flags;
158
 
        atomic_t      killed;
 
158
        struct task_struct *task;
159
159
 
160
160
        struct ethhdr eh;
161
161
        struct msghdr msg;
173
173
 
174
174
static inline int bnep_mc_hash(__u8 *addr)
175
175
{
176
 
        return (crc32_be(~0, addr, ETH_ALEN) >> 26);
 
176
        return crc32_be(~0, addr, ETH_ALEN) >> 26;
177
177
}
178
178
 
179
179
#endif