xref: /btstack/src/l2cap_signaling.h (revision a254c508b6129b60098cdefe25689a094f692ea9)
195cbd947Smatthias.ringwald /*
2a0c35809S[email protected]  * Copyright (C) 2014 BlueKitchen GmbH
31713bceaSmatthias.ringwald  *
41713bceaSmatthias.ringwald  * Redistribution and use in source and binary forms, with or without
51713bceaSmatthias.ringwald  * modification, are permitted provided that the following conditions
61713bceaSmatthias.ringwald  * are met:
71713bceaSmatthias.ringwald  *
81713bceaSmatthias.ringwald  * 1. Redistributions of source code must retain the above copyright
91713bceaSmatthias.ringwald  *    notice, this list of conditions and the following disclaimer.
101713bceaSmatthias.ringwald  * 2. Redistributions in binary form must reproduce the above copyright
111713bceaSmatthias.ringwald  *    notice, this list of conditions and the following disclaimer in the
121713bceaSmatthias.ringwald  *    documentation and/or other materials provided with the distribution.
131713bceaSmatthias.ringwald  * 3. Neither the name of the copyright holders nor the names of
141713bceaSmatthias.ringwald  *    contributors may be used to endorse or promote products derived
151713bceaSmatthias.ringwald  *    from this software without specific prior written permission.
166b64433eSmatthias.ringwald  * 4. Any redistribution, use, or modification is done solely for
176b64433eSmatthias.ringwald  *    personal benefit and not for any commercial purpose or for
186b64433eSmatthias.ringwald  *    monetary gain.
191713bceaSmatthias.ringwald  *
20a0c35809S[email protected]  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
211713bceaSmatthias.ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
221713bceaSmatthias.ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
232fca4dadSMilanka Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
242fca4dadSMilanka Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
251713bceaSmatthias.ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
261713bceaSmatthias.ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
271713bceaSmatthias.ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
281713bceaSmatthias.ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
291713bceaSmatthias.ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
301713bceaSmatthias.ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311713bceaSmatthias.ringwald  * SUCH DAMAGE.
321713bceaSmatthias.ringwald  *
33a0c35809S[email protected]  * Please inquire about commercial licensing options at
34a0c35809S[email protected]  * [email protected]
356b64433eSmatthias.ringwald  *
361713bceaSmatthias.ringwald  */
371713bceaSmatthias.ringwald 
38fe5a6c4eSMilanka Ringwald /**
3995cbd947Smatthias.ringwald  * l2cap_signaling.h
4095cbd947Smatthias.ringwald  *
4195cbd947Smatthias.ringwald  */
4295cbd947Smatthias.ringwald 
4380e33422SMatthias Ringwald #ifndef L2CAP_SIGNALING_H
4480e33422SMatthias Ringwald #define L2CAP_SIGNALING_H
4595cbd947Smatthias.ringwald 
4695cbd947Smatthias.ringwald #include <stdint.h>
4797a34cd4Smatthias.ringwald #include <stdarg.h>
48eb886013SMatthias Ringwald #include "btstack_util.h"
4956042629SMatthias Ringwald #include "hci_cmd.h"
5095cbd947Smatthias.ringwald 
51eed533f6S[email protected] #if defined __cplusplus
52eed533f6S[email protected] extern "C" {
53eed533f6S[email protected] #endif
54eed533f6S[email protected] 
5595cbd947Smatthias.ringwald typedef enum {
5695cbd947Smatthias.ringwald     COMMAND_REJECT = 1,
5795cbd947Smatthias.ringwald     CONNECTION_REQUEST,
5895cbd947Smatthias.ringwald     CONNECTION_RESPONSE,
5995cbd947Smatthias.ringwald     CONFIGURE_REQUEST,
6095cbd947Smatthias.ringwald     CONFIGURE_RESPONSE,
6195cbd947Smatthias.ringwald     DISCONNECTION_REQUEST,
6295cbd947Smatthias.ringwald     DISCONNECTION_RESPONSE,
6395cbd947Smatthias.ringwald     ECHO_REQUEST,
6495cbd947Smatthias.ringwald     ECHO_RESPONSE,
659e1615e5Smatthias.ringwald     INFORMATION_REQUEST,
669e795b48S[email protected]     INFORMATION_RESPONSE,
6799b3db54SMatthias Ringwald     /* 0x0c - 0x11 used for AMP */
689e795b48S[email protected]     CONNECTION_PARAMETER_UPDATE_REQUEST = 0x12,
6970efece1S[email protected]     CONNECTION_PARAMETER_UPDATE_RESPONSE,
7099b3db54SMatthias Ringwald     LE_CREDIT_BASED_CONNECTION_REQUEST,
7199b3db54SMatthias Ringwald     LE_CREDIT_BASED_CONNECTION_RESPONSE,
72*a254c508SMatthias Ringwald     L2CAP_FLOW_CONTROL_CREDIT_INDICATION,
73f74aded9SMatthias Ringwald     L2CAP_CREDIT_BASED_CONNECTION_REQUEST,
74f74aded9SMatthias Ringwald     L2CAP_CREDIT_BASED_CONNECTION_RESPONSE,
75f74aded9SMatthias Ringwald     L2CAP_CREDIT_BASED_RECONFIGURE_REQUEST,
76f74aded9SMatthias Ringwald     L2CAP_CREDIT_BASED_RECONFIGURE_RESPONSE,
7715f09267SMilanka Ringwald #ifdef UNIT_TEST
7815f09267SMilanka Ringwald     COMMAND_WITH_INVALID_FORMAT,
7915f09267SMilanka Ringwald #endif
80e6cdcf4bSMatthias Ringwald     // internal to BTstack
81e6cdcf4bSMatthias Ringwald     SM_PAIRING_FAILED = 0x1E,
82e6cdcf4bSMatthias Ringwald     COMMAND_REJECT_LE = 0x1F
8395cbd947Smatthias.ringwald } L2CAP_SIGNALING_COMMANDS;
8495cbd947Smatthias.ringwald 
8543ec931dSMatthias Ringwald typedef enum {
8643ec931dSMatthias Ringwald     L2CAP_CHANNEL_MODE_BASIC                   = 0,
8743ec931dSMatthias Ringwald     L2CAP_CHANNEL_MODE_RETRANSMISSION          = 1,
8843ec931dSMatthias Ringwald     L2CAP_CHANNEL_MODE_FLOW_CONTROL            = 2,
8943ec931dSMatthias Ringwald     L2CAP_CHANNEL_MODE_ENHANCED_RETRANSMISSION = 3,
9043ec931dSMatthias Ringwald     L2CAP_CHANNEL_MODE_STREAMING_MODE          = 4,
9143ec931dSMatthias Ringwald } l2cap_channel_mode_t;
9243ec931dSMatthias Ringwald 
93d5a98629SMatthias Ringwald /**
94d5a98629SMatthias Ringwald  * @brief Create L2CAP signaling packet based on template and va_args
95d5a98629SMatthias Ringwald  * @param acl_buffer to create packet
96d5a98629SMatthias Ringwald  * @param handle
97d5a98629SMatthias Ringwald  * @param pb_flags
98d5a98629SMatthias Ringwald  * @param cid
99d5a98629SMatthias Ringwald  * @param cmd
100d5a98629SMatthias Ringwald  * @param identifier
101d5a98629SMatthias Ringwald  * @param argptr
102d5a98629SMatthias Ringwald  * @return
103d5a98629SMatthias Ringwald  */
104d5a98629SMatthias Ringwald uint16_t l2cap_create_signaling_packet(uint8_t * acl_buffer, hci_con_handle_t handle, uint8_t pb_flags, uint16_t cid, L2CAP_SIGNALING_COMMANDS cmd, uint8_t identifier, va_list argptr);
105da269baaSmatthias.ringwald 
106eed533f6S[email protected] #if defined __cplusplus
107eed533f6S[email protected] }
108eed533f6S[email protected] #endif
109eed533f6S[email protected] 
11080e33422SMatthias Ringwald #endif // L2CAP_SIGNALING_H
111