l2cap.h (ab784b7383735681660ccbdda4569fff196c2672) l2cap.h (7e0ef6ee13ecdf38c2c8b0b0c8ef729710b994eb)
1/*
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated
4 Copyright (C) 2009-2010 Gustavo F. Padovan <gustavo@padovan.org>
5 Copyright (C) 2010 Google Inc.
6
7 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
8

--- 132 unchanged lines hidden (view full) ---

141
142/* L2CAP Supervisory Function */
143#define L2CAP_SUPER_RR 0x00
144#define L2CAP_SUPER_REJ 0x01
145#define L2CAP_SUPER_RNR 0x02
146#define L2CAP_SUPER_SREJ 0x03
147
148/* L2CAP Segmentation and Reassembly */
1/*
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated
4 Copyright (C) 2009-2010 Gustavo F. Padovan <gustavo@padovan.org>
5 Copyright (C) 2010 Google Inc.
6
7 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
8

--- 132 unchanged lines hidden (view full) ---

141
142/* L2CAP Supervisory Function */
143#define L2CAP_SUPER_RR 0x00
144#define L2CAP_SUPER_REJ 0x01
145#define L2CAP_SUPER_RNR 0x02
146#define L2CAP_SUPER_SREJ 0x03
147
148/* L2CAP Segmentation and Reassembly */
149#define L2CAP_SDU_UNSEGMENTED 0x0000
150#define L2CAP_SDU_START 0x4000
151#define L2CAP_SDU_END 0x8000
152#define L2CAP_SDU_CONTINUE 0xC000
149#define L2CAP_SAR_UNSEGMENTED 0x00
150#define L2CAP_SAR_START 0x01
151#define L2CAP_SAR_END 0x02
152#define L2CAP_SAR_CONTINUE 0x03
153
154/* L2CAP Command rej. reasons */
155#define L2CAP_REJ_NOT_UNDERSTOOD 0x0000
156#define L2CAP_REJ_MTU_EXCEEDED 0x0001
157#define L2CAP_REJ_INVALID_CID 0x0002
158
159/* L2CAP structures */
160struct l2cap_hdr {

--- 350 unchanged lines hidden (view full) ---

511
512 return sub == ch->remote_tx_win;
513}
514
515#define __get_txseq(ctrl) (((ctrl) & L2CAP_CTRL_TXSEQ) >> 1)
516#define __get_reqseq(ctrl) (((ctrl) & L2CAP_CTRL_REQSEQ) >> 8)
517#define __is_iframe(ctrl) (!((ctrl) & L2CAP_CTRL_FRAME_TYPE))
518#define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE)
153
154/* L2CAP Command rej. reasons */
155#define L2CAP_REJ_NOT_UNDERSTOOD 0x0000
156#define L2CAP_REJ_MTU_EXCEEDED 0x0001
157#define L2CAP_REJ_INVALID_CID 0x0002
158
159/* L2CAP structures */
160struct l2cap_hdr {

--- 350 unchanged lines hidden (view full) ---

511
512 return sub == ch->remote_tx_win;
513}
514
515#define __get_txseq(ctrl) (((ctrl) & L2CAP_CTRL_TXSEQ) >> 1)
516#define __get_reqseq(ctrl) (((ctrl) & L2CAP_CTRL_REQSEQ) >> 8)
517#define __is_iframe(ctrl) (!((ctrl) & L2CAP_CTRL_FRAME_TYPE))
518#define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE)
519#define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START)
519static inline __u8 __get_ctrl_sar(struct l2cap_chan *chan, __u32 ctrl)
520{
521 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
522 return (ctrl & L2CAP_EXT_CTRL_SAR) >> L2CAP_EXT_CTRL_SAR_SHIFT;
523 else
524 return (ctrl & L2CAP_CTRL_SAR) >> L2CAP_CTRL_SAR_SHIFT;
525}
520
526
527static inline __u32 __set_ctrl_sar(struct l2cap_chan *chan, __u32 sar)
528{
529 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
530 return (sar << L2CAP_EXT_CTRL_SAR_SHIFT) & L2CAP_EXT_CTRL_SAR;
531 else
532 return (sar << L2CAP_CTRL_SAR_SHIFT) & L2CAP_CTRL_SAR;
533}
534
535static inline bool __is_sar_start(struct l2cap_chan *chan, __u32 ctrl)
536{
537 return __get_ctrl_sar(chan, ctrl) == L2CAP_SAR_START;
538}
539
540static inline __u32 __get_sar_mask(struct l2cap_chan *chan)
541{
542 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
543 return L2CAP_EXT_CTRL_SAR;
544 else
545 return L2CAP_CTRL_SAR;
546}
547
521static inline __u8 __get_ctrl_super(struct l2cap_chan *chan, __u32 ctrl)
522{
523 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
524 return (ctrl & L2CAP_EXT_CTRL_SUPERVISE) >>
525 L2CAP_EXT_CTRL_SUPER_SHIFT;
526 else
527 return (ctrl & L2CAP_CTRL_SUPERVISE) >> L2CAP_CTRL_SUPER_SHIFT;
528}

--- 30 unchanged lines hidden ---
548static inline __u8 __get_ctrl_super(struct l2cap_chan *chan, __u32 ctrl)
549{
550 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
551 return (ctrl & L2CAP_EXT_CTRL_SUPERVISE) >>
552 L2CAP_EXT_CTRL_SUPER_SHIFT;
553 else
554 return (ctrl & L2CAP_CTRL_SUPERVISE) >> L2CAP_CTRL_SUPER_SHIFT;
555}

--- 30 unchanged lines hidden ---