Get in some basic infrastructure for Bluetooth SCO support.

MFC after:	3 months
This commit is contained in:
Maksim Yevmenkin 2008-07-10 00:15:29 +00:00
parent ebcc69dad3
commit fb8bcdc044
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=180399
3 changed files with 59 additions and 0 deletions

View File

@ -49,6 +49,7 @@ static u_int32_t bluetooth_hci_connect_timeout_value = 60; /* sec */
static u_int32_t bluetooth_hci_max_neighbor_age_value = 600; /* sec */
static u_int32_t bluetooth_l2cap_rtx_timeout_value = 60; /* sec */
static u_int32_t bluetooth_l2cap_ertx_timeout_value = 300; /* sec */
static u_int32_t bluetooth_sco_rtx_timeout_value = 60; /* sec */
/*
* Define sysctl tree that shared by other parts of Bluetooth stack
@ -207,6 +208,12 @@ bluetooth_l2cap_ertx_timeout(void)
return (bluetooth_l2cap_ertx_timeout_value * hz);
} /* bluetooth_l2cap_ertx_timeout */
u_int32_t
bluetooth_sco_rtx_timeout(void)
{
return (bluetooth_sco_rtx_timeout_value * hz);
} /* bluetooth_sco_rtx_timeout */
/*
* RFCOMM
*/
@ -214,6 +221,37 @@ bluetooth_l2cap_ertx_timeout(void)
SYSCTL_NODE(_net_bluetooth, OID_AUTO, rfcomm, CTLFLAG_RW,
0, "Bluetooth RFCOMM family");
/*
* SCO
*/
SYSCTL_NODE(_net_bluetooth, OID_AUTO, sco, CTLFLAG_RW,
0, "Bluetooth SCO family");
static int
bluetooth_set_sco_rtx_timeout_value(SYSCTL_HANDLER_ARGS)
{
u_int32_t value;
int error;
value = bluetooth_sco_rtx_timeout_value;
error = sysctl_handle_int(oidp, &value, 0, req);
if (error == 0 && req->newptr != NULL) {
if (bluetooth_hci_connect_timeout_value <= value)
bluetooth_sco_rtx_timeout_value = value;
else
error = EINVAL;
}
return (error);
} /* bluetooth_set_sco_rtx_timeout_value */
SYSCTL_PROC(_net_bluetooth_sco, OID_AUTO, rtx_timeout,
CTLTYPE_INT | CTLFLAG_RW,
&bluetooth_sco_rtx_timeout_value, 60,
bluetooth_set_sco_rtx_timeout_value,
"I", "SCO RTX timeout (sec)");
/*
* Handle loading and unloading for this code.
*/

View File

@ -52,6 +52,7 @@ SYSCTL_DECL(_net_bluetooth);
SYSCTL_DECL(_net_bluetooth_hci);
SYSCTL_DECL(_net_bluetooth_l2cap);
SYSCTL_DECL(_net_bluetooth_rfcomm);
SYSCTL_DECL(_net_bluetooth_sco);
#endif /* SYSCTL_DECL */
/*
@ -221,6 +222,7 @@ u_int32_t bluetooth_hci_connect_timeout (void);
u_int32_t bluetooth_hci_max_neighbor_age (void);
u_int32_t bluetooth_l2cap_rtx_timeout (void);
u_int32_t bluetooth_l2cap_ertx_timeout (void);
u_int32_t bluetooth_sco_rtx_timeout (void);
#endif /* _NETGRAPH_BLUETOOTH_H_ */

View File

@ -41,6 +41,7 @@
#define BLUETOOTH_PROTO_HCI 134 /* HCI protocol number */
#define BLUETOOTH_PROTO_L2CAP 135 /* L2CAP protocol number */
#define BLUETOOTH_PROTO_RFCOMM 136 /* RFCOMM protocol number */
#define BLUETOOTH_PROTO_SCO 137 /* SCO protocol number */
/*
* Bluetooth version of struct sockaddr for raw HCI sockets
@ -198,6 +199,23 @@ struct ng_btsocket_hci_raw_node_list_names {
_IOWR('b', NGM_HCI_NODE_LIST_NAMES, \
struct ng_btsocket_hci_raw_node_list_names)
/*
* XXX FIXME: probably does not belong here
* Bluetooth version of struct sockaddr for SCO sockets (SEQPACKET)
*/
struct sockaddr_sco {
u_char sco_len; /* total length */
u_char sco_family; /* address family */
bdaddr_t sco_bdaddr; /* address */
};
/* SCO socket options */
#define SOL_SCO 0x0209 /* socket options level */
#define SO_SCO_MTU 1 /* get sockets mtu */
#define SO_SCO_CONNINFO 2 /* get HCI connection handle */
/*
* XXX FIXME: probably does not belong here
* Bluetooth version of struct sockaddr for L2CAP sockets (RAW and SEQPACKET)
@ -328,6 +346,7 @@ struct ng_btsocket_rfcomm_fc_info {
#define NG_BTSOCKET_HCI_RAW_NODE_TYPE "btsock_hci_raw"
#define NG_BTSOCKET_L2CAP_RAW_NODE_TYPE "btsock_l2c_raw"
#define NG_BTSOCKET_L2CAP_NODE_TYPE "btsock_l2c"
#define NG_BTSOCKET_SCO_NODE_TYPE "btsock_sco"
/*
* Debug levels