diff options
author | John W. Linville <linville@tuxdriver.com> | 2011-06-22 16:06:58 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-06-22 16:06:58 -0400 |
commit | 1c1236e3af9c0a52e63c1c386413f13627e68e67 (patch) | |
tree | 554430c73c927a8a3fcab132cad83f4a04a7626d /include/net/bluetooth/l2cap.h | |
parent | e10542c447abf7c840931ff12f7d0dee976ca2ea (diff) | |
parent | 43f3dc41571c47a1fbded9aca1cf0a737967b005 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/padovan/bluetooth-next-2.6
Diffstat (limited to 'include/net/bluetooth/l2cap.h')
-rw-r--r-- | include/net/bluetooth/l2cap.h | 95 |
1 files changed, 62 insertions, 33 deletions
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 0529d278e068..9c18e555b6ed 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -287,6 +287,10 @@ struct l2cap_chan { | |||
287 | 287 | ||
288 | struct l2cap_conn *conn; | 288 | struct l2cap_conn *conn; |
289 | 289 | ||
290 | __u8 state; | ||
291 | |||
292 | atomic_t refcnt; | ||
293 | |||
290 | __le16 psm; | 294 | __le16 psm; |
291 | __u16 dcid; | 295 | __u16 dcid; |
292 | __u16 scid; | 296 | __u16 scid; |
@@ -320,8 +324,8 @@ struct l2cap_chan { | |||
320 | __u16 monitor_timeout; | 324 | __u16 monitor_timeout; |
321 | __u16 mps; | 325 | __u16 mps; |
322 | 326 | ||
323 | __u8 conf_state; | 327 | unsigned long conf_state; |
324 | __u16 conn_state; | 328 | unsigned long conn_state; |
325 | 329 | ||
326 | __u8 next_tx_seq; | 330 | __u8 next_tx_seq; |
327 | __u8 expected_ack_seq; | 331 | __u8 expected_ack_seq; |
@@ -354,6 +358,18 @@ struct l2cap_chan { | |||
354 | 358 | ||
355 | struct list_head list; | 359 | struct list_head list; |
356 | struct list_head global_l; | 360 | struct list_head global_l; |
361 | |||
362 | void *data; | ||
363 | struct l2cap_ops *ops; | ||
364 | }; | ||
365 | |||
366 | struct l2cap_ops { | ||
367 | char *name; | ||
368 | |||
369 | struct l2cap_chan *(*new_connection) (void *data); | ||
370 | int (*recv) (void *data, struct sk_buff *skb); | ||
371 | void (*close) (void *data); | ||
372 | void (*state_change) (void *data, int state); | ||
357 | }; | 373 | }; |
358 | 374 | ||
359 | struct l2cap_conn { | 375 | struct l2cap_conn { |
@@ -379,6 +395,15 @@ struct l2cap_conn { | |||
379 | 395 | ||
380 | __u8 disc_reason; | 396 | __u8 disc_reason; |
381 | 397 | ||
398 | __u8 preq[7]; /* SMP Pairing Request */ | ||
399 | __u8 prsp[7]; /* SMP Pairing Response */ | ||
400 | __u8 prnd[16]; /* SMP Pairing Random */ | ||
401 | __u8 pcnf[16]; /* SMP Pairing Confirm */ | ||
402 | __u8 tk[16]; /* SMP Temporary Key */ | ||
403 | __u8 smp_key_size; | ||
404 | |||
405 | struct timer_list security_timer; | ||
406 | |||
382 | struct list_head chan_l; | 407 | struct list_head chan_l; |
383 | rwlock_t chan_lock; | 408 | rwlock_t chan_lock; |
384 | }; | 409 | }; |
@@ -399,36 +424,45 @@ struct l2cap_pinfo { | |||
399 | struct l2cap_chan *chan; | 424 | struct l2cap_chan *chan; |
400 | }; | 425 | }; |
401 | 426 | ||
402 | #define L2CAP_CONF_REQ_SENT 0x01 | 427 | enum { |
403 | #define L2CAP_CONF_INPUT_DONE 0x02 | 428 | CONF_REQ_SENT, |
404 | #define L2CAP_CONF_OUTPUT_DONE 0x04 | 429 | CONF_INPUT_DONE, |
405 | #define L2CAP_CONF_MTU_DONE 0x08 | 430 | CONF_OUTPUT_DONE, |
406 | #define L2CAP_CONF_MODE_DONE 0x10 | 431 | CONF_MTU_DONE, |
407 | #define L2CAP_CONF_CONNECT_PEND 0x20 | 432 | CONF_MODE_DONE, |
408 | #define L2CAP_CONF_NO_FCS_RECV 0x40 | 433 | CONF_CONNECT_PEND, |
409 | #define L2CAP_CONF_STATE2_DEVICE 0x80 | 434 | CONF_NO_FCS_RECV, |
435 | CONF_STATE2_DEVICE, | ||
436 | }; | ||
410 | 437 | ||
411 | #define L2CAP_CONF_MAX_CONF_REQ 2 | 438 | #define L2CAP_CONF_MAX_CONF_REQ 2 |
412 | #define L2CAP_CONF_MAX_CONF_RSP 2 | 439 | #define L2CAP_CONF_MAX_CONF_RSP 2 |
413 | 440 | ||
414 | #define L2CAP_CONN_SAR_SDU 0x0001 | 441 | enum { |
415 | #define L2CAP_CONN_SREJ_SENT 0x0002 | 442 | CONN_SAR_SDU, |
416 | #define L2CAP_CONN_WAIT_F 0x0004 | 443 | CONN_SREJ_SENT, |
417 | #define L2CAP_CONN_SREJ_ACT 0x0008 | 444 | CONN_WAIT_F, |
418 | #define L2CAP_CONN_SEND_PBIT 0x0010 | 445 | CONN_SREJ_ACT, |
419 | #define L2CAP_CONN_REMOTE_BUSY 0x0020 | 446 | CONN_SEND_PBIT, |
420 | #define L2CAP_CONN_LOCAL_BUSY 0x0040 | 447 | CONN_REMOTE_BUSY, |
421 | #define L2CAP_CONN_REJ_ACT 0x0080 | 448 | CONN_LOCAL_BUSY, |
422 | #define L2CAP_CONN_SEND_FBIT 0x0100 | 449 | CONN_REJ_ACT, |
423 | #define L2CAP_CONN_RNR_SENT 0x0200 | 450 | CONN_SEND_FBIT, |
424 | #define L2CAP_CONN_SAR_RETRY 0x0400 | 451 | CONN_RNR_SENT, |
425 | 452 | CONN_SAR_RETRY, | |
426 | #define __mod_retrans_timer() mod_timer(&chan->retrans_timer, \ | 453 | }; |
427 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); | 454 | |
428 | #define __mod_monitor_timer() mod_timer(&chan->monitor_timer, \ | 455 | #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) |
429 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); | 456 | #define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer) |
430 | #define __mod_ack_timer() mod_timer(&chan->ack_timer, \ | 457 | #define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \ |
431 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO)); | 458 | L2CAP_DEFAULT_RETRANS_TO); |
459 | #define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer) | ||
460 | #define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \ | ||
461 | L2CAP_DEFAULT_MONITOR_TO); | ||
462 | #define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer) | ||
463 | #define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \ | ||
464 | L2CAP_DEFAULT_ACK_TO); | ||
465 | #define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer) | ||
432 | 466 | ||
433 | static inline int l2cap_tx_window_full(struct l2cap_chan *ch) | 467 | static inline int l2cap_tx_window_full(struct l2cap_chan *ch) |
434 | { | 468 | { |
@@ -459,11 +493,6 @@ int __l2cap_wait_ack(struct sock *sk); | |||
459 | int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm); | 493 | int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm); |
460 | int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); | 494 | int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); |
461 | 495 | ||
462 | void l2cap_sock_kill(struct sock *sk); | ||
463 | void l2cap_sock_init(struct sock *sk, struct sock *parent); | ||
464 | struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, | ||
465 | int proto, gfp_t prio); | ||
466 | |||
467 | struct l2cap_chan *l2cap_chan_create(struct sock *sk); | 496 | struct l2cap_chan *l2cap_chan_create(struct sock *sk); |
468 | void l2cap_chan_close(struct l2cap_chan *chan, int reason); | 497 | void l2cap_chan_close(struct l2cap_chan *chan, int reason); |
469 | void l2cap_chan_destroy(struct l2cap_chan *chan); | 498 | void l2cap_chan_destroy(struct l2cap_chan *chan); |