Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netgraph/bluetooth/include/ng_l2cap.h
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | |||||
* relative to the unit. So the total number of channels that unit can have | * relative to the unit. So the total number of channels that unit can have | ||||
* open at the same time is 0xffff - 0x0040 = 0xffbf (65471). This number | * open at the same time is 0xffff - 0x0040 = 0xffbf (65471). This number | ||||
* does not depend on number of connections. | * does not depend on number of connections. | ||||
*/ | */ | ||||
#define NG_L2CAP_NULL_CID 0x0000 /* DO NOT USE THIS CID */ | #define NG_L2CAP_NULL_CID 0x0000 /* DO NOT USE THIS CID */ | ||||
#define NG_L2CAP_SIGNAL_CID 0x0001 /* signaling channel ID */ | #define NG_L2CAP_SIGNAL_CID 0x0001 /* signaling channel ID */ | ||||
#define NG_L2CAP_CLT_CID 0x0002 /* connectionless channel ID */ | #define NG_L2CAP_CLT_CID 0x0002 /* connectionless channel ID */ | ||||
/* 0x0003 - 0x003f Reserved */ | #define NG_L2CAP_A2MP_CID 0x0003 | ||||
#define NG_L2CAP_ATT_CID 0x0004 | |||||
#define NG_L2CAP_LESIGNAL_CID 0x0005 | |||||
#define NG_L2CAP_SMP_CID 0x0006 | |||||
/* 0x0007 - 0x003f Reserved */ | |||||
#define NG_L2CAP_FIRST_CID 0x0040 /* dynamically alloc. (start) */ | #define NG_L2CAP_FIRST_CID 0x0040 /* dynamically alloc. (start) */ | ||||
#define NG_L2CAP_LAST_CID 0xffff /* dynamically alloc. (end) */ | #define NG_L2CAP_LAST_CID 0xffff /* dynamically alloc. (end) */ | ||||
#define NG_L2CAP_LELAST_CID 0x007f | |||||
/* L2CAP MTU */ | /* L2CAP MTU */ | ||||
#define NG_L2CAP_MTU_LE_MINIMAM 23 | |||||
#define NG_L2CAP_MTU_MINIMUM 48 | #define NG_L2CAP_MTU_MINIMUM 48 | ||||
#define NG_L2CAP_MTU_DEFAULT 672 | #define NG_L2CAP_MTU_DEFAULT 672 | ||||
#define NG_L2CAP_MTU_MAXIMUM 0xffff | #define NG_L2CAP_MTU_MAXIMUM 0xffff | ||||
/* L2CAP flush and link timeouts */ | /* L2CAP flush and link timeouts */ | ||||
#define NG_L2CAP_FLUSH_TIMO_DEFAULT 0xffff /* always retransmit */ | #define NG_L2CAP_FLUSH_TIMO_DEFAULT 0xffff /* always retransmit */ | ||||
#define NG_L2CAP_LINK_TIMO_DEFAULT 0xffff | #define NG_L2CAP_LINK_TIMO_DEFAULT 0xffff | ||||
▲ Show 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | |||||
typedef struct { | typedef struct { | ||||
u_int16_t type; /* requested information type */ | u_int16_t type; /* requested information type */ | ||||
u_int16_t result; /* 0x00 - success */ | u_int16_t result; /* 0x00 - success */ | ||||
/* u_int8_t info[] -- info data (depends on type) | /* u_int8_t info[] -- info data (depends on type) | ||||
* | * | ||||
* NG_L2CAP_CONNLESS_MTU - 2 bytes connectionless MTU | * NG_L2CAP_CONNLESS_MTU - 2 bytes connectionless MTU | ||||
*/ | */ | ||||
} __attribute__ ((packed)) ng_l2cap_info_rsp_cp; | } __attribute__ ((packed)) ng_l2cap_info_rsp_cp; | ||||
typedef union { | typedef union { | ||||
/* NG_L2CAP_CONNLESS_MTU */ | /* NG_L2CAP_CONNLESS_MTU */ | ||||
struct { | struct { | ||||
u_int16_t mtu; | u_int16_t mtu; | ||||
} __attribute__ ((packed)) mtu; | } __attribute__ ((packed)) mtu; | ||||
} ng_l2cap_info_rsp_data_t; | } ng_l2cap_info_rsp_data_t; | ||||
typedef ng_l2cap_info_rsp_data_t * ng_l2cap_info_rsp_data_p; | typedef ng_l2cap_info_rsp_data_t * ng_l2cap_info_rsp_data_p; | ||||
#define NG_L2CAP_CMD_PARAM_UPDATE_REQUEST 0x12 | |||||
typedef struct { | |||||
uint16_t interval_min; | |||||
uint16_t interval_max; | |||||
uint16_t slave_latency; | |||||
uint16_t timeout_mpl; | |||||
} __attribute__ ((packed)) ng_l2cap_param_update_req_cp; | |||||
#define NG_L2CAP_CMD_PARAM_UPDATE_RESPONSE 0x13 | |||||
#define NG_L2CAP_UPDATE_PARAM_ACCEPT 0 | |||||
#define NG_L2CAP_UPDATE_PARAM_REJECT 1 | |||||
//typedef uint16_t update_response; | |||||
/************************************************************************** | /************************************************************************** | ||||
************************************************************************** | ************************************************************************** | ||||
** Upper layer protocol interface. L2CA_xxx messages | ** Upper layer protocol interface. L2CA_xxx messages | ||||
************************************************************************** | ************************************************************************** | ||||
**************************************************************************/ | **************************************************************************/ | ||||
/* | /* | ||||
* NOTE! NOTE! NOTE! | * NOTE! NOTE! NOTE! | ||||
Show All 18 Lines | |||||
* it is somewhat similar. | * it is somewhat similar. | ||||
*/ | */ | ||||
/* L2CA data packet header */ | /* L2CA data packet header */ | ||||
typedef struct { | typedef struct { | ||||
u_int32_t token; /* token to use in L2CAP_L2CA_WRITE */ | u_int32_t token; /* token to use in L2CAP_L2CA_WRITE */ | ||||
u_int16_t length; /* length of the data */ | u_int16_t length; /* length of the data */ | ||||
u_int16_t lcid; /* local channel ID */ | u_int16_t lcid; /* local channel ID */ | ||||
uint16_t idtype; | |||||
} __attribute__ ((packed)) ng_l2cap_l2ca_hdr_t; | } __attribute__ ((packed)) ng_l2cap_l2ca_hdr_t; | ||||
#define NG_L2CAP_L2CA_IDTYPE_BREDR 0 | |||||
#define NG_L2CAP_L2CA_IDTYPE_ATT 1 | |||||
#define NG_L2CAP_L2CA_IDTYPE_LE 2 | |||||
/* L2CA_Connect */ | /* L2CA_Connect */ | ||||
#define NGM_L2CAP_L2CA_CON 0x80 | #define NGM_L2CAP_L2CA_CON 0x80 | ||||
/* Upper -> L2CAP */ | /* Upper -> L2CAP */ | ||||
typedef struct { | typedef struct { | ||||
u_int16_t psm; /* Protocol/Service Multiplexor */ | u_int16_t psm; /* Protocol/Service Multiplexor */ | ||||
bdaddr_t bdaddr; /* remote unit address */ | bdaddr_t bdaddr; /* remote unit address */ | ||||
uint8_t linktype; | |||||
uint8_t idtype; | |||||
} ng_l2cap_l2ca_con_ip; | } ng_l2cap_l2ca_con_ip; | ||||
/* L2CAP -> Upper */ | /* L2CAP -> Upper */ | ||||
typedef struct { | typedef struct { | ||||
u_int16_t lcid; /* local channel ID */ | u_int16_t lcid; /* local channel ID */ | ||||
uint16_t idtype; /*ID type*/ | |||||
u_int16_t result; /* 0x00 - success */ | u_int16_t result; /* 0x00 - success */ | ||||
u_int16_t status; /* if result != 0x00 */ | u_int16_t status; /* if result != 0x00 */ | ||||
} ng_l2cap_l2ca_con_op; | } ng_l2cap_l2ca_con_op; | ||||
/* L2CA_ConnectInd */ | /* L2CA_ConnectInd */ | ||||
#define NGM_L2CAP_L2CA_CON_IND 0x81 | #define NGM_L2CAP_L2CA_CON_IND 0x81 | ||||
/* L2CAP -> Upper */ | /* L2CAP -> Upper */ | ||||
typedef struct { | typedef struct { | ||||
bdaddr_t bdaddr; /* remote unit address */ | bdaddr_t bdaddr; /* remote unit address */ | ||||
u_int16_t lcid; /* local channel ID */ | u_int16_t lcid; /* local channel ID */ | ||||
u_int16_t psm; /* Procotol/Service Multiplexor */ | u_int16_t psm; /* Procotol/Service Multiplexor */ | ||||
u_int8_t ident; /* indentifier */ | u_int8_t ident; /* indentifier */ | ||||
u_int8_t unused; /* place holder */ | u_int8_t linktype; /* link type*/ | ||||
} ng_l2cap_l2ca_con_ind_ip; | } ng_l2cap_l2ca_con_ind_ip; | ||||
/* No output parameters */ | /* No output parameters */ | ||||
/* L2CA_ConnectRsp */ | /* L2CA_ConnectRsp */ | ||||
#define NGM_L2CAP_L2CA_CON_RSP 0x82 | #define NGM_L2CAP_L2CA_CON_RSP 0x82 | ||||
/* Upper -> L2CAP */ | /* Upper -> L2CAP */ | ||||
typedef struct { | typedef struct { | ||||
bdaddr_t bdaddr; /* remote unit address */ | bdaddr_t bdaddr; /* remote unit address */ | ||||
u_int8_t ident; /* "ident" from L2CAP_ConnectInd event */ | u_int8_t ident; /* "ident" from L2CAP_ConnectInd event */ | ||||
u_int8_t unused; /* place holder */ | u_int8_t linktype; /*link type */ | ||||
u_int16_t lcid; /* local channel ID */ | u_int16_t lcid; /* local channel ID */ | ||||
u_int16_t result; /* 0x00 - success */ | u_int16_t result; /* 0x00 - success */ | ||||
u_int16_t status; /* if response != 0x00 */ | u_int16_t status; /* if response != 0x00 */ | ||||
} ng_l2cap_l2ca_con_rsp_ip; | } ng_l2cap_l2ca_con_rsp_ip; | ||||
/* L2CAP -> Upper */ | /* L2CAP -> Upper */ | ||||
typedef struct { | typedef struct { | ||||
u_int16_t result; /* 0x00 - success */ | u_int16_t result; /* 0x00 - success */ | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
} ng_l2cap_l2ca_qos_ind_ip; | } ng_l2cap_l2ca_qos_ind_ip; | ||||
/* No output parameters */ | /* No output parameters */ | ||||
/* L2CA_Disconnect */ | /* L2CA_Disconnect */ | ||||
#define NGM_L2CAP_L2CA_DISCON 0x87 | #define NGM_L2CAP_L2CA_DISCON 0x87 | ||||
/* Upper -> L2CAP */ | /* Upper -> L2CAP */ | ||||
typedef struct { | typedef struct { | ||||
u_int16_t lcid; /* local channel ID */ | u_int16_t lcid; /* local channel ID */ | ||||
u_int16_t idtype; | |||||
} ng_l2cap_l2ca_discon_ip; | } ng_l2cap_l2ca_discon_ip; | ||||
/* L2CAP -> Upper */ | /* L2CAP -> Upper */ | ||||
typedef struct { | typedef struct { | ||||
u_int16_t result; /* 0x00 - sucsess */ | u_int16_t result; /* 0x00 - sucsess */ | ||||
} ng_l2cap_l2ca_discon_op; | } ng_l2cap_l2ca_discon_op; | ||||
/* L2CA_DisconnectInd */ | /* L2CA_DisconnectInd */ | ||||
#define NGM_L2CAP_L2CA_DISCON_IND 0x88 | #define NGM_L2CAP_L2CA_DISCON_IND 0x88 | ||||
/* L2CAP -> Upper */ | /* L2CAP -> Upper */ | ||||
typedef ng_l2cap_l2ca_discon_ip ng_l2cap_l2ca_discon_ind_ip; | typedef ng_l2cap_l2ca_discon_ip ng_l2cap_l2ca_discon_ind_ip; | ||||
/* No output parameters */ | /* No output parameters */ | ||||
/* L2CA_Write response */ | /* L2CA_Write response */ | ||||
#define NGM_L2CAP_L2CA_WRITE 0x89 | #define NGM_L2CAP_L2CA_WRITE 0x89 | ||||
/* No input parameters */ | /* No input parameters */ | ||||
/* L2CAP -> Upper */ | /* L2CAP -> Upper */ | ||||
typedef struct { | typedef struct { | ||||
int result; /* result (0x00 - success) */ | int result; /* result (0x00 - success) */ | ||||
u_int16_t length; /* amount of data written */ | u_int16_t length; /* amount of data written */ | ||||
u_int16_t lcid; /* local channel ID */ | u_int16_t lcid; /* local channel ID */ | ||||
uint16_t idtype; | |||||
} ng_l2cap_l2ca_write_op; | } ng_l2cap_l2ca_write_op; | ||||
/* L2CA_GroupCreate */ | /* L2CA_GroupCreate */ | ||||
#define NGM_L2CAP_L2CA_GRP_CREATE 0x8a | #define NGM_L2CAP_L2CA_GRP_CREATE 0x8a | ||||
/* Upper -> L2CAP */ | /* Upper -> L2CAP */ | ||||
typedef struct { | typedef struct { | ||||
u_int16_t psm; /* Protocol/Service Multiplexor */ | u_int16_t psm; /* Protocol/Service Multiplexor */ | ||||
} ng_l2cap_l2ca_grp_create_ip; | } ng_l2cap_l2ca_grp_create_ip; | ||||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | |||||
} ng_l2cap_l2ca_ping_op; | } ng_l2cap_l2ca_ping_op; | ||||
/* L2CA_GetInfo */ | /* L2CA_GetInfo */ | ||||
#define NGM_L2CAP_L2CA_GET_INFO 0x90 | #define NGM_L2CAP_L2CA_GET_INFO 0x90 | ||||
/* Upper -> L2CAP */ | /* Upper -> L2CAP */ | ||||
typedef struct { | typedef struct { | ||||
bdaddr_t bdaddr; /* remote unit address */ | bdaddr_t bdaddr; /* remote unit address */ | ||||
u_int16_t info_type; /* info type */ | u_int16_t info_type; /* info type */ | ||||
uint8_t linktype; | |||||
uint8_t unused; | |||||
} ng_l2cap_l2ca_get_info_ip; | } ng_l2cap_l2ca_get_info_ip; | ||||
/* L2CAP -> Upper */ | /* L2CAP -> Upper */ | ||||
typedef struct { | typedef struct { | ||||
u_int16_t result; /* 0x00 - success */ | u_int16_t result; /* 0x00 - success */ | ||||
u_int16_t info_size; /* size of info data in bytes */ | u_int16_t info_size; /* size of info data in bytes */ | ||||
/* u_int8_t info_data[] -- info data */ | /* u_int8_t info_data[] -- info data */ | ||||
} ng_l2cap_l2ca_get_info_op; | } ng_l2cap_l2ca_get_info_op; | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | |||||
typedef u_int16_t ng_l2cap_node_flags_ep; | typedef u_int16_t ng_l2cap_node_flags_ep; | ||||
/* Get/Set debug level (see levels above) */ | /* Get/Set debug level (see levels above) */ | ||||
#define NGM_L2CAP_NODE_GET_DEBUG 0x401 /* L2CAP -> User */ | #define NGM_L2CAP_NODE_GET_DEBUG 0x401 /* L2CAP -> User */ | ||||
#define NGM_L2CAP_NODE_SET_DEBUG 0x402 /* User -> L2CAP */ | #define NGM_L2CAP_NODE_SET_DEBUG 0x402 /* User -> L2CAP */ | ||||
typedef u_int16_t ng_l2cap_node_debug_ep; | typedef u_int16_t ng_l2cap_node_debug_ep; | ||||
#define NGM_L2CAP_NODE_HOOK_INFO 0x409 /* L2CAP -> Upper */ | #define NGM_L2CAP_NODE_HOOK_INFO 0x409 /* L2CAP -> Upper */ | ||||
/* bdaddr_t bdaddr; -- local (source BDADDR) */ | typedef struct { | ||||
bdaddr_t addr; | |||||
}ng_l2cap_node_hook_info_ep; | |||||
#define NGM_L2CAP_NODE_GET_CON_LIST 0x40a /* L2CAP -> User */ | #define NGM_L2CAP_NODE_GET_CON_LIST 0x40a /* L2CAP -> User */ | ||||
typedef struct { | typedef struct { | ||||
u_int32_t num_connections; /* number of connections */ | u_int32_t num_connections; /* number of connections */ | ||||
} ng_l2cap_node_con_list_ep; | } ng_l2cap_node_con_list_ep; | ||||
/* Connection flags */ | /* Connection flags */ | ||||
#define NG_L2CAP_CON_TX (1 << 0) /* sending data */ | #define NG_L2CAP_CON_TX (1 << 0) /* sending data */ | ||||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |