Mistake on this page?
Report an issue in GitHub or email us
l2c_main.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief L2CAP main module.
6  *
7  * Copyright (c) 2009-2018 Arm Ltd. All Rights Reserved.
8  *
9  * Copyright (c) 2019 Packetcraft, Inc.
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 /*************************************************************************************************/
24 #ifndef L2C_MAIN_H
25 #define L2C_MAIN_H
26 
27 #include "l2c_api.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /**************************************************************************************************
34  Macros
35 **************************************************************************************************/
36 
37 /* Return the next L2CAP signaling req identifier. Cannot be zero. */
38 #define L2C_NEXT_ID(id) (((id) == 255) ? (1) : ((id) + 1))
39 
40 /* L2C event handler message types */
41 #define L2C_MSG_REQ_TIMEOUT 1 /* L2CAP slave signaling request timeout */
42 #define L2C_MSG_TYPE_MAX 1
43 
44 /**************************************************************************************************
45  Data Types
46 **************************************************************************************************/
47 
48 /* Data callback with CID */
49 typedef void (*l2cDataCidCback_t)(uint16_t handle, uint16_t cid, uint16_t len, uint8_t *pPacket);
50 
51 /* Main control block of the L2C subsystem */
52 typedef struct
53 {
54  l2cDataCback_t attDataCback; /* Data callback for ATT */
55  l2cDataCback_t smpDataCback; /* Data callback for SMP */
56  l2cDataCback_t l2cSignalingCback; /* Data callback for L2CAP signaling */
57  l2cCtrlCback_t attCtrlCback; /* Control callback for ATT */
58  l2cCtrlCback_t smpCtrlCback; /* Control callback for SMP */
59  l2cCtrlCback_t l2cCocCtrlCback; /* Control callback for L2CAP connection oriented channels */
60  l2cDataCback_t masterRxSignalingPkt; /* Master signaling packet processing function */
61  l2cDataCback_t slaveRxSignalingPkt; /* Slave signaling packet processing function */
62  l2cDataCidCback_t l2cDataCidCback; /* Data callback for L2CAP on other CIDs */
63  uint8_t identifier; /* Signaling request identifier */
64 } l2cCb_t;
65 
66 /**************************************************************************************************
67  Function Prototypes
68 **************************************************************************************************/
69 
70 void l2cSendCmdReject(uint16_t handle, uint8_t identifier, uint16_t reason);
71 void l2cRxSignalingPkt(uint16_t handle, uint16_t len, uint8_t *pPacket);
72 void *l2cMsgAlloc(uint16_t len);
73 
74 /* Control block */
75 extern l2cCb_t l2cCb;
76 
77 #ifdef __cplusplus
78 };
79 #endif
80 
81 #endif /* L2C_MAIN_H */
void(* l2cDataCback_t)(uint16_t handle, uint16_t len, uint8_t *pPacket)
This callback function sends a received L2CAP packet to the client.
Definition: l2c_api.h:233
void(* l2cCtrlCback_t)(wsfMsgHdr_t *pMsg)
This callback function sends control messages to the client.
Definition: l2c_api.h:244
L2CAP subsystem API.
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.