⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hci_core.h

📁 linux2.6.16版本
💻 H
📖 第 1 页 / 共 2 页
字号:
			hci_conn_set_timer(conn, timeo);		} else			hci_conn_set_timer(conn, HZ / 100);	}}/* ----- HCI tasks ----- */static inline void hci_sched_cmd(struct hci_dev *hdev){	tasklet_schedule(&hdev->cmd_task);}static inline void hci_sched_rx(struct hci_dev *hdev){	tasklet_schedule(&hdev->rx_task);}static inline void hci_sched_tx(struct hci_dev *hdev){	tasklet_schedule(&hdev->tx_task);}/* ----- HCI Devices ----- */static inline void __hci_dev_put(struct hci_dev *d){	if (atomic_dec_and_test(&d->refcnt))		d->destruct(d);}static inline void hci_dev_put(struct hci_dev *d){ 	__hci_dev_put(d);	module_put(d->owner);}static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d){	atomic_inc(&d->refcnt);	return d;}static inline struct hci_dev *hci_dev_hold(struct hci_dev *d){	if (try_module_get(d->owner))		return __hci_dev_hold(d);	return NULL;}#define hci_dev_lock(d)		spin_lock(&d->lock)#define hci_dev_unlock(d)	spin_unlock(&d->lock)#define hci_dev_lock_bh(d)	spin_lock_bh(&d->lock)#define hci_dev_unlock_bh(d)	spin_unlock_bh(&d->lock)struct hci_dev *hci_dev_get(int index);struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst);struct hci_dev *hci_alloc_dev(void);void hci_free_dev(struct hci_dev *hdev);int hci_register_dev(struct hci_dev *hdev);int hci_unregister_dev(struct hci_dev *hdev);int hci_suspend_dev(struct hci_dev *hdev);int hci_resume_dev(struct hci_dev *hdev);int hci_dev_open(__u16 dev);int hci_dev_close(__u16 dev);int hci_dev_reset(__u16 dev);int hci_dev_reset_stat(__u16 dev);int hci_dev_cmd(unsigned int cmd, void __user *arg);int hci_get_dev_list(void __user *arg);int hci_get_dev_info(void __user *arg);int hci_get_conn_list(void __user *arg);int hci_get_conn_info(struct hci_dev *hdev, void __user *arg);int hci_inquiry(void __user *arg);void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);/* Receive frame from HCI drivers */static inline int hci_recv_frame(struct sk_buff *skb){	struct hci_dev *hdev = (struct hci_dev *) skb->dev;	if (!hdev || (!test_bit(HCI_UP, &hdev->flags) 			&& !test_bit(HCI_INIT, &hdev->flags))) {		kfree_skb(skb);		return -ENXIO;	}	/* Incomming skb */	bt_cb(skb)->incoming = 1;	/* Time stamp */	__net_timestamp(skb);	/* Queue frame for rx task */	skb_queue_tail(&hdev->rx_q, skb);	hci_sched_rx(hdev);	return 0;}int hci_register_sysfs(struct hci_dev *hdev);void hci_unregister_sysfs(struct hci_dev *hdev);#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->class_dev.dev = (pdev))/* ----- LMP capabilities ----- */#define lmp_rswitch_capable(dev) (dev->features[0] & LMP_RSWITCH)#define lmp_encrypt_capable(dev) (dev->features[0] & LMP_ENCRYPT)/* ----- HCI protocols ----- */struct hci_proto {	char 		*name;	unsigned int	id;	unsigned long	flags;	void		*priv;	int (*connect_ind) 	(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type);	int (*connect_cfm)	(struct hci_conn *conn, __u8 status);	int (*disconn_ind)	(struct hci_conn *conn, __u8 reason);	int (*recv_acldata)	(struct hci_conn *conn, struct sk_buff *skb, __u16 flags);	int (*recv_scodata)	(struct hci_conn *conn, struct sk_buff *skb);	int (*auth_cfm)		(struct hci_conn *conn, __u8 status);	int (*encrypt_cfm)	(struct hci_conn *conn, __u8 status);};static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type){	register struct hci_proto *hp;	int mask = 0;		hp = hci_proto[HCI_PROTO_L2CAP];	if (hp && hp->connect_ind)		mask |= hp->connect_ind(hdev, bdaddr, type);	hp = hci_proto[HCI_PROTO_SCO];	if (hp && hp->connect_ind)		mask |= hp->connect_ind(hdev, bdaddr, type);	return mask;}static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status){	register struct hci_proto *hp;	hp = hci_proto[HCI_PROTO_L2CAP];	if (hp && hp->connect_cfm)		hp->connect_cfm(conn, status);	hp = hci_proto[HCI_PROTO_SCO];	if (hp && hp->connect_cfm)		hp->connect_cfm(conn, status);}static inline void hci_proto_disconn_ind(struct hci_conn *conn, __u8 reason){	register struct hci_proto *hp;	hp = hci_proto[HCI_PROTO_L2CAP];	if (hp && hp->disconn_ind)		hp->disconn_ind(conn, reason);	hp = hci_proto[HCI_PROTO_SCO];	if (hp && hp->disconn_ind)		hp->disconn_ind(conn, reason);}static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status){	register struct hci_proto *hp;	hp = hci_proto[HCI_PROTO_L2CAP];	if (hp && hp->auth_cfm)		hp->auth_cfm(conn, status);	hp = hci_proto[HCI_PROTO_SCO];	if (hp && hp->auth_cfm)		hp->auth_cfm(conn, status);}static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status){	register struct hci_proto *hp;	hp = hci_proto[HCI_PROTO_L2CAP];	if (hp && hp->encrypt_cfm)		hp->encrypt_cfm(conn, status);	hp = hci_proto[HCI_PROTO_SCO];	if (hp && hp->encrypt_cfm)		hp->encrypt_cfm(conn, status);}int hci_register_proto(struct hci_proto *hproto);int hci_unregister_proto(struct hci_proto *hproto);/* ----- HCI callbacks ----- */struct hci_cb {	struct list_head list;	char *name;	void (*auth_cfm)	(struct hci_conn *conn, __u8 status);	void (*encrypt_cfm)	(struct hci_conn *conn, __u8 status, __u8 encrypt);	void (*key_change_cfm)	(struct hci_conn *conn, __u8 status);	void (*role_switch_cfm)	(struct hci_conn *conn, __u8 status, __u8 role);};static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status){	struct list_head *p;	hci_proto_auth_cfm(conn, status);	read_lock_bh(&hci_cb_list_lock);	list_for_each(p, &hci_cb_list) {		struct hci_cb *cb = list_entry(p, struct hci_cb, list);		if (cb->auth_cfm)			cb->auth_cfm(conn, status);	}	read_unlock_bh(&hci_cb_list_lock);}static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt){	struct list_head *p;	hci_proto_encrypt_cfm(conn, status);	read_lock_bh(&hci_cb_list_lock);	list_for_each(p, &hci_cb_list) {		struct hci_cb *cb = list_entry(p, struct hci_cb, list);		if (cb->encrypt_cfm)			cb->encrypt_cfm(conn, status, encrypt);	}	read_unlock_bh(&hci_cb_list_lock);}static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status){	struct list_head *p;	read_lock_bh(&hci_cb_list_lock);	list_for_each(p, &hci_cb_list) {		struct hci_cb *cb = list_entry(p, struct hci_cb, list);		if (cb->key_change_cfm)			cb->key_change_cfm(conn, status);	}	read_unlock_bh(&hci_cb_list_lock);}static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, __u8 role){	struct list_head *p;	read_lock_bh(&hci_cb_list_lock);	list_for_each(p, &hci_cb_list) {		struct hci_cb *cb = list_entry(p, struct hci_cb, list);		if (cb->role_switch_cfm)			cb->role_switch_cfm(conn, status, role);	}	read_unlock_bh(&hci_cb_list_lock);}int hci_register_cb(struct hci_cb *hcb);int hci_unregister_cb(struct hci_cb *hcb);int hci_register_notifier(struct notifier_block *nb);int hci_unregister_notifier(struct notifier_block *nb);int hci_send_cmd(struct hci_dev *hdev, __u16 ogf, __u16 ocf, __u32 plen, void *param);int hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags);int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb);void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 ogf, __u16 ocf);void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data);/* ----- HCI Sockets ----- */void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb);/* HCI info for socket */#define hci_pi(sk) ((struct hci_pinfo *) sk)struct hci_pinfo {	struct bt_sock    bt;	struct hci_dev    *hdev;	struct hci_filter filter;	__u32             cmsg_mask;};/* HCI security filter */#define HCI_SFLT_MAX_OGF  5struct hci_sec_filter {	__u32 type_mask;	__u32 event_mask[2];	__u32 ocf_mask[HCI_SFLT_MAX_OGF + 1][4];};/* ----- HCI requests ----- */#define HCI_REQ_DONE	  0#define HCI_REQ_PEND	  1#define HCI_REQ_CANCELED  2#define hci_req_lock(d)		down(&d->req_lock)#define hci_req_unlock(d)	up(&d->req_lock)void hci_req_complete(struct hci_dev *hdev, int result);#endif /* __HCI_CORE_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -