CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/cache/sources/hcitools/monitor/l2cap.h
Views: 3959
1
/*
2
*
3
* BlueZ - Bluetooth protocol stack for Linux
4
*
5
* Copyright (C) 2011-2012 Intel Corporation
6
* Copyright (C) 2004-2010 Marcel Holtmann <[email protected]>
7
*
8
*
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
*
23
*/
24
25
#include <stdint.h>
26
#include <stdbool.h>
27
28
struct l2cap_frame {
29
uint16_t index;
30
bool in;
31
uint16_t handle;
32
uint16_t cid;
33
const void *data;
34
uint16_t size;
35
};
36
37
static inline void l2cap_frame_init(struct l2cap_frame *frame,
38
uint16_t index, bool in, uint16_t handle,
39
uint16_t cid, const void *data, uint16_t size)
40
{
41
frame->index = index;
42
frame->in = in;
43
frame->handle = handle;
44
frame->cid = cid;
45
frame->data = data;
46
frame->size = size;
47
}
48
49
static inline void l2cap_frame_pull(struct l2cap_frame *frame,
50
const struct l2cap_frame *source, uint16_t len)
51
{
52
frame->index = source->index;
53
frame->in = source->in;
54
frame->handle = source->handle;
55
frame->cid = source->cid;
56
frame->data = source->data + len;
57
frame->size = source->size - len;
58
}
59
60
void l2cap_packet(uint16_t index, bool in, uint16_t handle, uint8_t flags,
61
const void *data, uint16_t size);
62
63