Mistake on this page? Email us
l2c_defs.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief L2CAP constants and definitions from the Bluetooth specification.
6  *
7  * Copyright (c) 2009-2018 Arm Ltd. All Rights Reserved.
8  * Arm Ltd. confidential and proprietary.
9  *
10  * IMPORTANT. Your use of this file is governed by a Software License Agreement
11  * ("Agreement") that must be accepted in order to download or otherwise receive a
12  * copy of this file. You may not use or copy this file for any purpose other than
13  * as described in the Agreement. If you do not agree to all of the terms of the
14  * Agreement do not use this file and delete all copies in your possession or control;
15  * if you do not have a copy of the Agreement, you must contact Arm Ltd. prior
16  * to any use, copying or further distribution of this software.
17  */
18 /*************************************************************************************************/
19 #ifndef L2C_DEFS_H
20 #define L2C_DEFS_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /*! \addtogroup STACK_L2CAP_API
27  * \{ */
28 
29 /**************************************************************************************************
30  Macros
31 **************************************************************************************************/
32 
33 /** \name L2CAP Packet Constants
34  *
35  */
36 /**@{*/
37 #define L2C_HDR_LEN 4 /*!< \brief L2CAP packet header length */
38 #define L2C_MIN_MTU 23 /*!< \brief Minimum packet payload MTU for LE */
39 #define L2C_SIG_HDR_LEN 4 /*!< \brief L2CAP signaling command header length */
40 #define L2C_LE_SDU_HDR_LEN 2 /*!< \brief L2CAP LE SDU data header length */
41 /**@}*/
42 
43 /*! \brief Start of L2CAP payload in an HCI ACL packet buffer */
44 #define L2C_PAYLOAD_START (HCI_ACL_HDR_LEN + L2C_HDR_LEN)
45 
46 /*! \brief L2CAP signaling packet base length, including HCI header */
47 #define L2C_SIG_PKT_BASE_LEN (HCI_ACL_HDR_LEN + L2C_HDR_LEN + L2C_SIG_HDR_LEN)
48 
49 /*! \brief L2CAP LE SDU packet base length, including HCI header */
50 #define L2C_LE_SDU_PKT_BASE_LEN (HCI_ACL_HDR_LEN + L2C_HDR_LEN + L2C_LE_SDU_HDR_LEN)
51 
52 /** \name L2CAP Parameter Lengths
53  * Signaling packet parameter lengths
54  */
55 /**@{*/
56 #define L2C_SIG_CONN_UPDATE_REQ_LEN 8 /*!< \brief Connection update request length. */
57 #define L2C_SIG_CONN_UPDATE_RSP_LEN 2 /*!< \brief Connection update response length. */
58 #define L2C_SIG_CMD_REJ_LEN 2 /*!< \brief Command reject length. */
59 #define L2C_SIG_DISCONN_REQ_LEN 4 /*!< \brief Disconnection request length. */
60 #define L2C_SIG_DISCONN_RSP_LEN 4 /*!< \brief Disconnection response length. */
61 #define L2C_SIG_LE_CONN_REQ_LEN 10 /*!< \brief LE connection request length. */
62 #define L2C_SIG_LE_CONN_RSP_LEN 10 /*!< \brief LE connection response length. */
63 #define L2C_SIG_FLOW_CTRL_CREDIT_LEN 4 /*!< \brief Flow control credit lenghth. */
64 /**@}*/
65 
66 /** \name L2CAP Connection Identifiers
67  * BLE Defined Connection Identifiers (CID)
68  */
69 /**@{*/
70 #define L2C_CID_ATT 0x0004 /*!< \brief CID for attribute protocol */
71 #define L2C_CID_LE_SIGNALING 0x0005 /*!< \brief CID for LE signaling */
72 #define L2C_CID_SMP 0x0006 /*!< \brief CID for security manager protocol */
73 /**@}*/
74 
75 /** \name L2CAP Signaling Codes
76  *
77  */
78 /**@{*/
79 #define L2C_SIG_CMD_REJ 0x01 /*!< \brief Comand reject */
80 #define L2C_SIG_DISCONNECT_REQ 0x06 /*!< \brief Disconnect request */
81 #define L2C_SIG_DISCONNECT_RSP 0x07 /*!< \brief Disconnect response */
82 #define L2C_SIG_CONN_UPDATE_REQ 0x12 /*!< \brief Connection parameter update request */
83 #define L2C_SIG_CONN_UPDATE_RSP 0x13 /*!< \brief Connection parameter update response */
84 #define L2C_SIG_LE_CONNECT_REQ 0x14 /*!< \brief LE credit based connection request */
85 #define L2C_SIG_LE_CONNECT_RSP 0x15 /*!< \brief LE credit based connection response */
86 #define L2C_SIG_FLOW_CTRL_CREDIT 0x16 /*!< \brief LE flow control credit */
87 /**@}*/
88 
89 /*! \brief Signaling response code flag */
90 #define L2C_SIG_RSP_FLAG 0x01
91 
92 /** \name L2CAP Command Rejection Codes
93  * BLE defined Command rejection reason codes
94  */
95 /**@{*/
96 #define L2C_REJ_NOT_UNDERSTOOD 0x0000 /*!< \brief Command not understood */
97 #define L2C_REJ_MTU_EXCEEDED 0x0001 /*!< \brief Signaling MTU exceeded */
98 #define L2C_REJ_INVALID_CID 0x0002 /*!< \brief Invalid CID in request */
99 /**@}*/
100 
101 /** \name L2CAP Connection Parameter Update Result Codes
102  * BLE defined result codes
103  */
104 /**@{*/
105 #define L2C_CONN_PARAM_ACCEPTED 0x0000 /*!< \brief Connection parameters accepted */
106 #define L2C_CONN_PARAM_REJECTED 0x0001 /*!< \brief Connection parameters rejected */
107 /**@}*/
108 
109 /** \name L2CAP Connection Result Codes
110  * BLE defined result codes
111  */
112 /**@{*/
113 #define L2C_CONN_SUCCESS 0x0000 /*!< \brief Connection successful */
114 #define L2C_CONN_NONE 0x0001 /*!< \brief No connection result value available */
115 #define L2C_CONN_FAIL_PSM 0x0002 /*!< \brief Connection refused LE_PSM not supported */
116 #define L2C_CONN_FAIL_RES 0x0004 /*!< \brief Connection refused no resources available */
117 #define L2C_CONN_FAIL_AUTH 0x0005 /*!< \brief Connection refused insufficient authentication */
118 #define L2C_CONN_FAIL_AUTHORIZ 0x0006 /*!< \brief Connection refused insufficient authorization */
119 #define L2C_CONN_FAIL_KEY_SIZE 0x0007 /*!< \brief Connection refused insufficient encryption key size */
120 #define L2C_CONN_FAIL_ENC 0x0008 /*!< \brief Connection Refused insufficient encryption */
121 #define L2C_CONN_FAIL_INVALID_SCID 0x0009 /*!< \brief Connection refused invalid source CID */
122 #define L2C_CONN_FAIL_ALLOCATED_SCID 0x000A /*!< \brief Connection refused source CID already allocated */
123 #define L2C_CONN_FAIL_UNACCEPT_PARAM 0x000B /*!< \brief Connection refused unacceptable parameters */
124 /**@}*/
125 
126 /** \name L2CAP Interal Connection Result Codes
127  * Proprietary codes not sent in any L2CAP packet.
128  */
129 /**@{*/
130 #define L2C_CONN_FAIL_TIMEOUT 0xF000 /*!< \brief Request timeout */
131 /**@}*/
132 
133 /** \name L2CAP Signaling Parameter Value Ranges
134  *
135  */
136 /**@{*/
137 #define L2C_PSM_MIN 0x0001 /*!< \brief PSM minimum. */
138 #define L2C_PSM_MAX 0x00FF /*!< \brief PSM maximum. */
139 #define L2C_CID_DYN_MIN 0x0040 /*!< \brief CID dynamic minimum. */
140 #define L2C_CID_DYN_MAX 0x007F /*!< \brief CID dynamic maximum. */
141 #define L2C_MTU_MIN 0x0017 /*!< \brief MTU minimum. */
142 #define L2C_MPS_MIN 0x0017 /*!< \brief MPS minimum. */
143 #define L2C_MPS_MAX 0xFFFD /*!< \brief MPS maximum. */
144 #define L2C_CREDITS_MAX 0xFFFF /*!< \brief Credits maximum. */
145 /**@}*/
146 
147 /*! \} */ /*! STACK_L2CAP_API */
148 
149 #ifdef __cplusplus
150 };
151 #endif
152 
153 #endif /* L2C_DEFS_H */
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.