亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? l2cap.c

?? bluetooth 驅動
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* * l2cap.c -- Implementation of Bluetooth Logical Link Control  *            and Adaption Protocol (L2CAP)           * * Copyright (C) 2000, 2001  Axis Communications AB * * Author: Mattias Agren <mattias.agren@axis.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. * * Exceptionally, Axis Communications AB grants discretionary and * conditional permissions for additional use of the text contained * in the company's release of the AXIS OpenBT Stack under the * provisions set forth hereunder. * * Provided that, if you use the AXIS OpenBT Stack with other files, * that do not implement functionality as specified in the Bluetooth * System specification, to produce an executable, this does not by * itself cause the resulting executable to be covered by the GNU * General Public License. Your use of that executable is in no way * restricted on account of using the AXIS OpenBT Stack code with it. * * This exception does not however invalidate any other reasons why * the executable file might be covered by the provisions of the GNU * General Public License. * * $Id: l2cap.c,v 1.122 2001/10/16 10:51:29 pkj Exp $ * *//****************** INCLUDE FILES SECTION ***********************************/#define __NO_VERSION__ /* don't define kernel_version in module.h */#ifdef __KERNEL__#include <linux/config.h>#include <linux/bluetooth/sysdep-2.1.h>#include <linux/malloc.h>#include <linux/bluetooth/l2cap.h>#include <linux/bluetooth/hci.h>#include <linux/bluetooth/hci_internal.h>#include <linux/bluetooth/rfcomm.h>#include <linux/bluetooth/sdp.h>#include <linux/bluetooth/test.h>#include <linux/bluetooth/btmem.h>#include <linux/bluetooth/l2cap_internal.h>#include <linux/bluetooth/l2cap_con.h>#include <linux/bluetooth/l2cap_sec.h>#include <linux/bluetooth/bt_errno.h>#include <asm/byteorder.h>#include <asm/unaligned.h>#else /* user mode */#include <stdlib.h>#include <string.h>#include <sys/time.h>#include <signal.h>#include <errno.h>#include <asm/unaligned.h>#include "include/l2cap.h"#include "include/hci.h"#include "include/hci_internal.h"#include "include/l2cap_internal.h"#include "include/l2cap_con.h"#include "include/l2cap_sec.h"#include "include/rfcomm.h"#include "include/sdp.h"#include "include/test.h"#include "include/btmem.h"#include "include/local.h"#include "include/bt_errno.h"#endif/****************** DEBUG CONSTANT AND MACRO SECTION ************************/#if L2CAP_DEBUG_STATE/* State machine */#define D_STATE(fmt...) printk(L2CAP_DBG_STR fmt)#define PRINTSTATE(con) (printk(L2CAP_DBG_STR "Current state of (%d:%d) is %s\n", con->local_cid, con->remote_cid, state_name[con->current_state]))#else/* State machine */#define D_STATE(fmt...)#define PRINTSTATE(con)#endif#if L2CAP_DEBUG_TIMER#define D_TIM(fmt...) printk(L2CAP_DBG_STR fmt)#else#define D_TIM(fmt...)#endif#if L2CAP_DEBUG_CON/* Connection manager */#define D_CON(fmt...) printk(L2CAP_DBG_STR fmt)#define SHOW_CON(str, con) show_con(str, con)#define SHOW_LIST() show_list()#else#define D_CON(fmt...)#define SHOW_CON(str, con)#define SHOW_LIST()#endif#if L2CAP_DEBUG_RCV/* Receive data */#define D_RCV(fmt...) printk(L2CAP_DBG_STR fmt)#else#define D_RCV(fmt...)#endif#if L2CAP_DEBUG_XMIT/* Send data */#define D_XMIT(fmt...) printk(L2CAP_DBG_STR fmt)#else#define D_XMIT(fmt...)#endif#if L2CAP_DEBUG_MISC/* Misc */#define D_MISC(fmt...) printk(L2CAP_DBG_STR fmt)#else#define D_MISC(fmt...)#endif#if L2CAP_DEBUG_DATA#define PRINTPKT(str, data, len) print_data(str, data, len)#else#define PRINTPKT(str, data, len)#endif/****************** CONSTANT AND MACRO SECTION ******************************/#define CON_LESS 0#define CON_ORIENTED 1#define MIN_CID 0x0040#define MAX_CID 0xffff/* EVEN => REQUEST */ #define ISREQUEST(x) (!(x%2))#define SET_L2CAP_HDR(frame, len, cid) {\        (*(u8 *)(frame)) = (u8)(((len) & 0xff)); \        (*(u8 *)(frame + 1)) = (u8)((len) >> 8); \        (*(u8 *)(frame + 2)) = (u8)(((cid) & 0xff)); \        (*(u8 *)(frame + 3)) = (u8)((cid) >> 8); \}#define ENTERSTATE(con, state) (con->current_state = state)#define RCID_NOT_SET 0#define RCID_SET 1#define CMDREJ_NOTUNDERSTOOD 0x0#define CMDREJ_MTUEXCEEDED 0x1#define CMDREJ_INVALIDCID 0x2#define CONFREQ_NO_OPTIONS 0x11const u8* psm2str(u16 psm){	switch (psm) {	case 1:		return "SDP";		break;	case 3:		return "RFCOMM";		break;	case 5:		return "TCS";		break;	case 0x1231:		return "TEST";		break;	case 0x1233:		return "TEST-2";		break;	case 0x4561:		return "TEST-3";		break;	default :		return "unknown";	}}const u8* cmdrej_reason[] = {	"Command not understood",	"Signalling MTU exceeded",	"Invalid CID in request",};/****************** TYPE DEFINITION SECTION *********************************//****************** LOCAL FUNCTION DECLARATION SECTION **********************//* MISC */static u8 set_id(l2cap_con* con);static u8 get_id(void);static s32 id_matched(l2cap_con* con, u8 rcv_id);static s32 parse_options(l2cap_con* con, u8 *data, u32 len);static void print_flow(flow *f);static s32 l2cap_cmdrej(s32 hci_hdl, u8 reason, u8 *opt_data, s32 opt_len);static s32 insert_upper(protocol_layer *upper_layer);static protocol_layer* get_upper(u32 psm);static void remove_all_upper(void);#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS/* fixme -- calculate this using flush timeout */#define MAX_NO_RTX 3#define RTX_TIMEOUT 2 /* sec */#define ERTX_TIMEOUT 60 /* sec */#ifdef __KERNEL__static void l2cap_rtx_timeout(unsigned long ptr);static void l2cap_ertx_timeout(unsigned long ptr);#else /* usermode stack */static l2cap_con *timeout_con = NULL;static s32 timer_cancelled = 0;static void l2cap_rtx_timeout(void);static void l2cap_ertx_timeout(unsigned long ptr);#endifstatic void start_rtx(l2cap_con *con, unsigned short timeout, unsigned short action);static void disable_rtx(l2cap_con *con);static void start_ertx(l2cap_con *con, unsigned short timeout);static void disable_ertx(l2cap_con *con);#endif/****************** GLOBAL VARIABLE DECLARATION SECTION *********************//****************** LOCAL VARIABLE DECLARATION SECTION **********************/static l2cap_layer l2capmain; /* Main structure */static l2cap_layer* l2cap;static struct protocol_layer default_protocol;extern int bt_max_connections;extern hci_controller hci_ctrl;/****************** FUNCTION DEFINITION SECTION *****************************/  /*********************************************************************//*---------------------- INIT AND SHUTDOWN --------------------------*//*********************************************************************/s32l2cap_init(void){	s32 i;	u8 bd_name[20];	DSYS("Initialising L2CAP\n");	l2cap = &l2capmain;	init_con_list();        l2cap->cid_count = MIN_CID; /* Moved from init_con_list */	/* Set all upper layers to default */	l2cap_protocol_default(&default_protocol);		l2cap->id_count = 1;	l2cap->mtu = MTU_DEFAULT ;	l2cap->flush_timeout = FLUSHTIMEOUT_DEFAULT; /* Always retransmit */	l2cap->upper_layers = NULL;	init_flow(&l2cap->qos);	/* get local bd address */	hci_read_local_bd(l2cap->my_bd);	/* check result... */	if (!l2cap->my_bd[0] && !l2cap->my_bd[1] && !l2cap->my_bd[2] &&	    !l2cap->my_bd[3] && !l2cap->my_bd[4] && !l2cap->my_bd[5])		D_ERR(__FUNCTION__ ": Failed to get local BD addr\n");	else {		i = l2cap_sprint_bd(bd_name, l2cap->my_bd);		bd_name[i] = 0;		DSYS("Local bd [%s]\n", bd_name);	}#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER        /* Initialize security */        l2cap_sec_man_init();#endif        #if L2CAP_SELFTEST	test_conlist();#endif#ifdef CONFIG_BLUETOOTH_L2CAP_CONNECTIONLESS	l2cap->allow_conless = 1;#else	l2cap->allow_conless = 0;#endif	l2cap->initiated = 1;	return 0;}void l2cap_protocol_default(struct protocol_layer *prot){	prot->psm = 0;	prot->con_pnd = not_registered_cfm;	prot->con_cfm = not_registered_cfm;	prot->conf_cfm = not_registered_cfm;	prot->disc_cfm = not_registered_cfm_noparams;	prot->con_ind = not_registered_ind;	prot->conf_ind = not_registered_ind;	prot->disc_ind = not_registered_ind;	prot->receive_data = not_registered_rcv;	prot->next_layer = NULL;}void l2cap_register_default_upper(struct protocol_layer *prot){	memcpy(&default_protocol, prot, sizeof default_protocol);}s32 l2cap_shutdown(void){	DSYS("Shutting down L2CAP\n");	if (!l2cap->initiated) {		D_ERR(__FUNCTION__ ": L2CAP not initiated\n");		return -1;	}		/* fixme -- experimental */#if 0	{		l2cap_con *con;		con = get_first_con();		while (con != NULL) {			if (l2ca_disconnect_req(con) != 0)				break;			con = get_first_con();		}	}#endif	free_con_list();	remove_all_upper();	/* ALWAYS SUCCESS */	return 0;}/* is called with a struct of functions to handle incoming data */s32 l2cap_register_upper(u16 psm, struct protocol_layer *prot) {        if (((psm % 2) == 0) || (prot == NULL)) {		D_ERR(__FUNCTION__ ": incorrect parameters\n");		return -EINVAL;        }    	D_MISC(__FUNCTION__ ": psm 0x%x\n", psm);        if ((psm > MAX_PSM) && (psm < MIN_DYNAMIC_PSM)) {		D_ERR(__FUNCTION__ ": value of psm reserved\n");		return -EINVAL;        }        if (psm > MAX_DYNAMIC_PSM) {		D_ERR(__FUNCTION__ ": psm not valid!\n");		return -EINVAL;        }	prot->psm = psm;	return insert_upper(prot);}/* Inserts the function pointers to a new upper layer in the list */s32insert_upper(protocol_layer *upper_layer){	protocol_layer *new_layer;	D_MISC(__FUNCTION__ ": Inserting layer psm:0x%x\n", upper_layer->psm);	if (!(new_layer = kmalloc(sizeof *new_layer, GFP_ATOMIC)))		return -ENOMEM;	memcpy(new_layer, upper_layer, sizeof *new_layer);	/* Add to head of list of upper layers */	new_layer->next_layer = l2cap->upper_layers;	l2cap->upper_layers = new_layer;	return 0;} protocol_layer*get_upper(u32 psm){	protocol_layer *tmp_layer;		/* Check PSM value */        if((psm % 2) == 0) {		D_ERR(__FUNCTION__ ": incorrect psm\n");		return &default_protocol;        }        if((psm > MAX_PSM) && (psm < MIN_DYNAMIC_PSM)) {		D_ERR(__FUNCTION__ ": value of psm reserved\n");		return &default_protocol;        }        if(psm > MAX_DYNAMIC_PSM) {		D_ERR(__FUNCTION__ ": psm not valid!\n");		return &default_protocol;        }	D_MISC(__FUNCTION__ ": Try to retrieve psm 0x%x\n",psm);	tmp_layer = l2cap->upper_layers;	while (tmp_layer != NULL) {		if (tmp_layer->psm == psm) {			D_MISC(__FUNCTION__ ": Actually got psm:0x%x\n",			       tmp_layer->psm);			return tmp_layer;		}		tmp_layer = tmp_layer->next_layer;	}	D_MISC(__FUNCTION__ ": Didn't get any layer, returning default\n");	return &default_protocol;}voidremove_all_upper(void){	protocol_layer *tmp_layer;	D_MISC(__FUNCTION__ ": Freeing all upper layers\n");	while (l2cap->upper_layers != NULL) {		tmp_layer = l2cap->upper_layers;		l2cap->upper_layers = tmp_layer->next_layer;		kfree(tmp_layer);	}}/* needed ? */void not_registered_cfm(l2cap_con *con, s32 result){	DSYS("No upper layer confirm function defined (psm:0x%x)\n", con->psm);	DSYS("silent discard...\n");}void not_registered_cfm_noparams(l2cap_con *con){	DSYS("No upper layer confirm function defined (psm:0x%x)\n", con->psm);	DSYS("silent discard...\n");}void not_registered_ind(l2cap_con *con){	DSYS("No upper layer ind function defined (psm:0x%x)\n", con->psm);	DSYS("silent discard...\n");}void not_registered_rcv(l2cap_con *con, u8 *data, u32 len){	DSYS("No upper layer receive_data function defined (psm:0x%x)\n", 	     con->psm);	DSYS("silent discard...\n");}/****************************************************************//*---------------------- STATE MACHINE -------------------------*//****************************************************************//* If l2cap_len is 0 then we know we have a new frame. Parse the length field   and set l2cap_len and compare len to this value each time new data arrives.   When equal a whole frame is received and we can parse it */  void l2cap_receive_data(u8 *data,  u32 len, u16 hci_handle, /*u8 pb_flag,*/                     /*u8 bc_flag,*/ u32 *l2cap_len){	l2cap_packet *pkt = NULL;	l2cap_con *con;	u16 pkt_len;	CID pkt_cid;	D_RCV(__FUNCTION__ ": got %d bytes on hci_handle : %d\n", len, hci_handle);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
丰满放荡岳乱妇91ww| 欧美一区二区网站| 在线播放国产精品二区一二区四区| 欧美日韩黄色影视| 欧美激情一区二区三区蜜桃视频| 亚洲最新视频在线播放| 激情综合色播五月| 日本韩国一区二区三区视频| 久久久国产精品午夜一区ai换脸 | 成人免费va视频| 日韩欧美国产综合| 亚洲第一福利一区| 91在线视频网址| 精品国产不卡一区二区三区| 亚洲综合无码一区二区| av在线一区二区| 国产亚洲精久久久久久| 男人的j进女人的j一区| 色综合久久综合网| 国产精品短视频| 大陆成人av片| 国产精品日产欧美久久久久| 捆绑紧缚一区二区三区视频| 欧美视频一区二区三区四区| 国产精品短视频| 成人午夜精品一区二区三区| 久久精品一区二区三区四区| 国模一区二区三区白浆| 3d动漫精品啪啪一区二区竹菊| 亚洲一区中文在线| 色噜噜久久综合| 国产成人av一区二区三区在线| 6080日韩午夜伦伦午夜伦| 亚洲一区二区美女| 欧美网站大全在线观看| 亚洲一区二区三区在线看| 欧美在线免费播放| 亚洲狠狠爱一区二区三区| 在线观看国产日韩| 亚洲成在线观看| 欧美日韩日本视频| 秋霞午夜av一区二区三区| 日韩一区二区视频| 久久99久久精品欧美| 日韩精品中文字幕在线一区| 亚洲午夜电影在线观看| 欧美日本视频在线| 免费高清成人在线| 久久婷婷一区二区三区| 粉嫩av一区二区三区粉嫩 | 久久99久久精品| 日韩午夜av电影| 国内成人免费视频| 国产精品视频免费| 欧美中文字幕一区| 免费在线观看一区二区三区| 亚洲精品在线免费播放| 国产.精品.日韩.另类.中文.在线.播放| 欧美激情一区三区| 欧美午夜一区二区三区 | 91.com视频| 国内精品久久久久影院色| 国产精品久久三区| 欧美精品v国产精品v日韩精品| 日av在线不卡| 国产精品免费久久| 欧美视频在线一区| 久久爱www久久做| 国产精品美女久久久久aⅴ| 97精品电影院| 久久99九九99精品| 亚洲日本一区二区| 日韩三级免费观看| 91蝌蚪porny九色| 男人的j进女人的j一区| 国产精品久99| 日韩欧美精品在线| 成人app在线| 视频一区二区中文字幕| 日本一区二区成人| 日韩女优电影在线观看| 色婷婷国产精品| 国产精品18久久久久久vr| 一区二区三区高清不卡| 久久色在线视频| 91麻豆精品国产91久久久| 7777精品伊人久久久大香线蕉超级流畅| 国产麻豆一精品一av一免费| 一区二区三区久久| 久久精品人人做| 4438x成人网最大色成网站| av福利精品导航| 国产一区二区福利| 日本色综合中文字幕| 亚洲精选一二三| 中文字幕巨乱亚洲| 久久久无码精品亚洲日韩按摩| 精品污污网站免费看| 波多野结衣精品在线| 韩国女主播一区| 美女一区二区久久| 日韩成人一区二区三区在线观看| 中文字幕精品一区| 国产女人aaa级久久久级| 日韩三级电影网址| 日韩视频免费观看高清完整版在线观看| 日本福利一区二区| 99久久综合99久久综合网站| 国产成人高清在线| 成人在线一区二区三区| 精品一区精品二区高清| 免费亚洲电影在线| 蜜桃视频一区二区| 视频一区二区三区在线| 天堂久久一区二区三区| 午夜欧美视频在线观看 | 亚洲国产日韩在线一区模特| 国产精品天美传媒| 亚洲欧洲美洲综合色网| 国产精品亲子伦对白| 欧美国产日产图区| 国产精品乱码妇女bbbb| 国产精品久久久久久久浪潮网站 | av一区二区三区四区| 成人黄色在线视频| 91在线云播放| 欧美伊人精品成人久久综合97| 色综合久久88色综合天天6| 色欧美88888久久久久久影院| 日本国产一区二区| 欧洲精品一区二区三区在线观看| 欧美性猛交xxxxxxxx| 欧美喷水一区二区| 欧美va天堂va视频va在线| 久久久久一区二区三区四区| 中文一区在线播放| 亚洲人成小说网站色在线| 一区二区三区在线视频免费| 亚洲成人av电影| 午夜精品爽啪视频| 免费观看91视频大全| 国产成人亚洲综合a∨猫咪| 99国产欧美另类久久久精品| 欧洲精品一区二区| 欧美成人精品福利| 国产精品美女久久久久高潮| 亚洲一区二区三区不卡国产欧美| 久久精品国产99国产| 成人久久久精品乱码一区二区三区| eeuss影院一区二区三区| 欧美三级三级三级| 日本一区二区三区电影| 亚洲va在线va天堂| 国产福利一区在线| 欧美三级乱人伦电影| 久久综合色播五月| 亚洲一区二区免费视频| 国产在线精品一区二区夜色| 色噜噜狠狠成人中文综合| 欧美xxxxxxxx| 一级做a爱片久久| 国产精品69毛片高清亚洲| 欧美日韩免费观看一区三区| 国产亚洲欧美中文| 免费观看日韩电影| 欧美亚洲国产一区在线观看网站 | 久久精品av麻豆的观看方式| 成人黄色综合网站| 精品日韩99亚洲| 夜夜嗨av一区二区三区网页 | 国产日韩影视精品| 午夜激情久久久| 91丝袜呻吟高潮美腿白嫩在线观看| 制服丝袜亚洲精品中文字幕| 国产精品美女久久久久av爽李琼| 亚洲一区免费视频| 亚洲影院免费观看| 国产成人午夜精品影院观看视频| 欧美日韩小视频| 亚洲乱码国产乱码精品精可以看| 久久国产尿小便嘘嘘尿| 欧美午夜精品一区二区蜜桃| 国产精品久久久久久久久免费丝袜 | 夫妻av一区二区| 欧美一区二区在线免费观看| 樱花影视一区二区| kk眼镜猥琐国模调教系列一区二区| 精品国产自在久精品国产| 亚洲第一激情av| 色天使色偷偷av一区二区| 国产精品白丝在线| 成人av电影免费在线播放| 国产亚洲综合av| 激情六月婷婷综合| 精品久久国产字幕高潮| 日韩av电影免费观看高清完整版| 欧美日韩一区二区三区在线看 | 国产福利不卡视频| 精品国产百合女同互慰| 国产在线精品一区在线观看麻豆|