Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/next/external/cache/sources/hcitools/lib/bluetooth/l2cap.h
Views: 3960
/*1*2* BlueZ - Bluetooth protocol stack for Linux3*4* Copyright (C) 2000-2001 Qualcomm Incorporated5* Copyright (C) 2002-2003 Maxim Krasnyansky <[email protected]>6* Copyright (C) 2002-2010 Marcel Holtmann <[email protected]>7* Copyright (c) 2012 Code Aurora Forum. All rights reserved.8*9*10* This program is free software; you can redistribute it and/or modify11* it under the terms of the GNU General Public License as published by12* the Free Software Foundation; either version 2 of the License, or13* (at your option) any later version.14*15* This program is distributed in the hope that it will be useful,16* but WITHOUT ANY WARRANTY; without even the implied warranty of17* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18* GNU General Public License for more details.19*20* You should have received a copy of the GNU General Public License21* along with this program; if not, write to the Free Software22* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA23*24*/2526#ifndef __L2CAP_H27#define __L2CAP_H2829#ifdef __cplusplus30extern "C" {31#endif3233#include <sys/socket.h>3435/* L2CAP defaults */36#define L2CAP_DEFAULT_MTU 67237#define L2CAP_DEFAULT_FLUSH_TO 0xFFFF3839/* L2CAP socket address */40struct sockaddr_l2 {41sa_family_t l2_family;42unsigned short l2_psm;43bdaddr_t l2_bdaddr;44unsigned short l2_cid;45uint8_t l2_bdaddr_type;46};4748/* L2CAP socket options */49#define L2CAP_OPTIONS 0x0150struct l2cap_options {51uint16_t omtu;52uint16_t imtu;53uint16_t flush_to;54uint8_t mode;55uint8_t fcs;56uint8_t max_tx;57uint16_t txwin_size;58};5960#define L2CAP_CONNINFO 0x0261struct l2cap_conninfo {62uint16_t hci_handle;63uint8_t dev_class[3];64};6566#define L2CAP_LM 0x0367#define L2CAP_LM_MASTER 0x000168#define L2CAP_LM_AUTH 0x000269#define L2CAP_LM_ENCRYPT 0x000470#define L2CAP_LM_TRUSTED 0x000871#define L2CAP_LM_RELIABLE 0x001072#define L2CAP_LM_SECURE 0x00207374/* L2CAP command codes */75#define L2CAP_COMMAND_REJ 0x0176#define L2CAP_CONN_REQ 0x0277#define L2CAP_CONN_RSP 0x0378#define L2CAP_CONF_REQ 0x0479#define L2CAP_CONF_RSP 0x0580#define L2CAP_DISCONN_REQ 0x0681#define L2CAP_DISCONN_RSP 0x0782#define L2CAP_ECHO_REQ 0x0883#define L2CAP_ECHO_RSP 0x0984#define L2CAP_INFO_REQ 0x0a85#define L2CAP_INFO_RSP 0x0b86#define L2CAP_CREATE_REQ 0x0c87#define L2CAP_CREATE_RSP 0x0d88#define L2CAP_MOVE_REQ 0x0e89#define L2CAP_MOVE_RSP 0x0f90#define L2CAP_MOVE_CFM 0x1091#define L2CAP_MOVE_CFM_RSP 0x119293/* L2CAP extended feature mask */94#define L2CAP_FEAT_FLOWCTL 0x0000000195#define L2CAP_FEAT_RETRANS 0x0000000296#define L2CAP_FEAT_BIDIR_QOS 0x0000000497#define L2CAP_FEAT_ERTM 0x0000000898#define L2CAP_FEAT_STREAMING 0x0000001099#define L2CAP_FEAT_FCS 0x00000020100#define L2CAP_FEAT_EXT_FLOW 0x00000040101#define L2CAP_FEAT_FIXED_CHAN 0x00000080102#define L2CAP_FEAT_EXT_WINDOW 0x00000100103#define L2CAP_FEAT_UCD 0x00000200104105/* L2CAP fixed channels */106#define L2CAP_FC_L2CAP 0x02107#define L2CAP_FC_CONNLESS 0x04108#define L2CAP_FC_A2MP 0x08109110/* L2CAP structures */111typedef struct {112uint16_t len;113uint16_t cid;114} __attribute__ ((packed)) l2cap_hdr;115#define L2CAP_HDR_SIZE 4116117typedef struct {118uint8_t code;119uint8_t ident;120uint16_t len;121} __attribute__ ((packed)) l2cap_cmd_hdr;122#define L2CAP_CMD_HDR_SIZE 4123124typedef struct {125uint16_t reason;126} __attribute__ ((packed)) l2cap_cmd_rej;127#define L2CAP_CMD_REJ_SIZE 2128129typedef struct {130uint16_t psm;131uint16_t scid;132} __attribute__ ((packed)) l2cap_conn_req;133#define L2CAP_CONN_REQ_SIZE 4134135typedef struct {136uint16_t dcid;137uint16_t scid;138uint16_t result;139uint16_t status;140} __attribute__ ((packed)) l2cap_conn_rsp;141#define L2CAP_CONN_RSP_SIZE 8142143/* connect result */144#define L2CAP_CR_SUCCESS 0x0000145#define L2CAP_CR_PEND 0x0001146#define L2CAP_CR_BAD_PSM 0x0002147#define L2CAP_CR_SEC_BLOCK 0x0003148#define L2CAP_CR_NO_MEM 0x0004149150/* connect status */151#define L2CAP_CS_NO_INFO 0x0000152#define L2CAP_CS_AUTHEN_PEND 0x0001153#define L2CAP_CS_AUTHOR_PEND 0x0002154155typedef struct {156uint16_t dcid;157uint16_t flags;158uint8_t data[0];159} __attribute__ ((packed)) l2cap_conf_req;160#define L2CAP_CONF_REQ_SIZE 4161162typedef struct {163uint16_t scid;164uint16_t flags;165uint16_t result;166uint8_t data[0];167} __attribute__ ((packed)) l2cap_conf_rsp;168#define L2CAP_CONF_RSP_SIZE 6169170#define L2CAP_CONF_SUCCESS 0x0000171#define L2CAP_CONF_UNACCEPT 0x0001172#define L2CAP_CONF_REJECT 0x0002173#define L2CAP_CONF_UNKNOWN 0x0003174#define L2CAP_CONF_PENDING 0x0004175#define L2CAP_CONF_EFS_REJECT 0x0005176177typedef struct {178uint8_t type;179uint8_t len;180uint8_t val[0];181} __attribute__ ((packed)) l2cap_conf_opt;182#define L2CAP_CONF_OPT_SIZE 2183184#define L2CAP_CONF_MTU 0x01185#define L2CAP_CONF_FLUSH_TO 0x02186#define L2CAP_CONF_QOS 0x03187#define L2CAP_CONF_RFC 0x04188#define L2CAP_CONF_FCS 0x05189#define L2CAP_CONF_EFS 0x06190#define L2CAP_CONF_EWS 0x07191192#define L2CAP_CONF_MAX_SIZE 22193194#define L2CAP_MODE_BASIC 0x00195#define L2CAP_MODE_RETRANS 0x01196#define L2CAP_MODE_FLOWCTL 0x02197#define L2CAP_MODE_ERTM 0x03198#define L2CAP_MODE_STREAMING 0x04199200#define L2CAP_SERVTYPE_NOTRAFFIC 0x00201#define L2CAP_SERVTYPE_BESTEFFORT 0x01202#define L2CAP_SERVTYPE_GUARANTEED 0x02203204typedef struct {205uint16_t dcid;206uint16_t scid;207} __attribute__ ((packed)) l2cap_disconn_req;208#define L2CAP_DISCONN_REQ_SIZE 4209210typedef struct {211uint16_t dcid;212uint16_t scid;213} __attribute__ ((packed)) l2cap_disconn_rsp;214#define L2CAP_DISCONN_RSP_SIZE 4215216typedef struct {217uint16_t type;218} __attribute__ ((packed)) l2cap_info_req;219#define L2CAP_INFO_REQ_SIZE 2220221typedef struct {222uint16_t type;223uint16_t result;224uint8_t data[0];225} __attribute__ ((packed)) l2cap_info_rsp;226#define L2CAP_INFO_RSP_SIZE 4227228/* info type */229#define L2CAP_IT_CL_MTU 0x0001230#define L2CAP_IT_FEAT_MASK 0x0002231232/* info result */233#define L2CAP_IR_SUCCESS 0x0000234#define L2CAP_IR_NOTSUPP 0x0001235236typedef struct {237uint16_t psm;238uint16_t scid;239uint8_t id;240} __attribute__ ((packed)) l2cap_create_req;241#define L2CAP_CREATE_REQ_SIZE 5242243typedef struct {244uint16_t dcid;245uint16_t scid;246uint16_t result;247uint16_t status;248} __attribute__ ((packed)) l2cap_create_rsp;249#define L2CAP_CREATE_RSP_SIZE 8250251typedef struct {252uint16_t icid;253uint8_t id;254} __attribute__ ((packed)) l2cap_move_req;255#define L2CAP_MOVE_REQ_SIZE 3256257typedef struct {258uint16_t icid;259uint16_t result;260} __attribute__ ((packed)) l2cap_move_rsp;261#define L2CAP_MOVE_RSP_SIZE 4262263typedef struct {264uint16_t icid;265uint16_t result;266} __attribute__ ((packed)) l2cap_move_cfm;267#define L2CAP_MOVE_CFM_SIZE 4268269typedef struct {270uint16_t icid;271} __attribute__ ((packed)) l2cap_move_cfm_rsp;272#define L2CAP_MOVE_CFM_RSP_SIZE 2273274#ifdef __cplusplus275}276#endif277278#endif /* __L2CAP_H */279280281