X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fnet%2Fbluetooth%2Fhci_core.h;h=a27161a0e8d49c901a3c269148625dd919a6df56;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=63f73088b3ce2db51669e29410f4d30055f161e5;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 63f73088b..a27161a0e 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -38,10 +38,20 @@ extern struct proc_dir_entry *proc_bt_hci; /* HCI Core structures */ +struct inquiry_data { + bdaddr_t bdaddr; + __u8 pscan_rep_mode; + __u8 pscan_period_mode; + __u8 pscan_mode; + __u8 dev_class[3]; + __u16 clock_offset; + __s8 rssi; +}; + struct inquiry_entry { struct inquiry_entry *next; __u32 timestamp; - struct inquiry_info info; + struct inquiry_data data; }; struct inquiry_cache { @@ -53,7 +63,8 @@ struct inquiry_cache { struct hci_conn_hash { struct list_head list; spinlock_t lock; - unsigned int num; + unsigned int acl_num; + unsigned int sco_num; }; struct hci_dev { @@ -108,6 +119,8 @@ struct hci_dev { struct hci_dev_stats stat; + struct sk_buff_head driver_init; + void *driver_data; void *core_data; @@ -141,6 +154,7 @@ struct hci_conn { __u16 state; __u8 type; __u8 out; + __u8 dev_class[3]; __u32 link_mode; unsigned long pend; @@ -160,7 +174,9 @@ struct hci_conn { extern struct hci_proto *hci_proto[]; extern struct list_head hci_dev_list; +extern struct list_head hci_cb_list; extern rwlock_t hci_dev_list_lock; +extern rwlock_t hci_cb_list_lock; /* ----- Inquiry cache ----- */ #define INQUIRY_CACHE_AGE_MAX (HZ*30) // 30 seconds @@ -196,7 +212,7 @@ static inline long inquiry_entry_age(struct inquiry_entry *e) } struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); -void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_info *info); +void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data); /* ----- HCI Connections ----- */ enum { @@ -209,21 +225,28 @@ static inline void hci_conn_hash_init(struct hci_dev *hdev) struct hci_conn_hash *h = &hdev->conn_hash; INIT_LIST_HEAD(&h->list); spin_lock_init(&h->lock); - h->num = 0; + h->acl_num = 0; + h->sco_num = 0; } static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) { struct hci_conn_hash *h = &hdev->conn_hash; list_add(&c->list, &h->list); - h->num++; + if (c->type == ACL_LINK) + h->acl_num++; + else + h->sco_num++; } static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) { struct hci_conn_hash *h = &hdev->conn_hash; list_del(&c->list); - h->num--; + if (c->type == ACL_LINK) + h->acl_num--; + else + h->sco_num--; } static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, @@ -256,7 +279,6 @@ static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, return NULL; } -void hci_acl_connect(struct hci_conn *conn); void hci_acl_disconn(struct hci_conn *conn, __u8 reason); void hci_add_sco(struct hci_conn *conn, __u16 handle); @@ -267,6 +289,7 @@ void hci_conn_hash_flush(struct hci_dev *hdev); struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *src); int hci_conn_auth(struct hci_conn *conn); int hci_conn_encrypt(struct hci_conn *conn); +int hci_conn_change_link_key(struct hci_conn *conn); static inline void hci_conn_set_timer(struct hci_conn *conn, unsigned long timeout) { @@ -483,6 +506,50 @@ static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 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); +}; + +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); +} + +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); @@ -523,6 +590,5 @@ struct hci_sec_filter { #define hci_req_unlock(d) up(&d->req_lock) void hci_req_complete(struct hci_dev *hdev, int result); -void hci_req_cancel(struct hci_dev *hdev, int err); #endif /* __HCI_CORE_H */