sdpd.h revision 957d01bac7a4c448bbe0a15de613af7927d1c7d0
1c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann/* 2e343e0fee7fdaf96156fb35b431ddb0503755843Marcel Holtmann * 3e343e0fee7fdaf96156fb35b431ddb0503755843Marcel Holtmann * BlueZ - Bluetooth protocol stack for Linux 4e343e0fee7fdaf96156fb35b431ddb0503755843Marcel Holtmann * 5e343e0fee7fdaf96156fb35b431ddb0503755843Marcel Holtmann * Copyright (C) 2001-2002 Nokia Corporation 6e343e0fee7fdaf96156fb35b431ddb0503755843Marcel Holtmann * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com> 7e823c15e43a6f924779e466d434c51157002d9eeMarcel Holtmann * Copyright (C) 2002-2008 Marcel Holtmann <marcel@holtmann.org> 8e343e0fee7fdaf96156fb35b431ddb0503755843Marcel Holtmann * Copyright (C) 2002-2003 Stephen Crane <steve.crane@rococosoft.com> 9e343e0fee7fdaf96156fb35b431ddb0503755843Marcel Holtmann * 10e343e0fee7fdaf96156fb35b431ddb0503755843Marcel Holtmann * 11e343e0fee7fdaf96156fb35b431ddb0503755843Marcel Holtmann * This program is free software; you can redistribute it and/or modify 12632a9432774ff3a0c6e556e8f32a565b38890767Marcel Holtmann * it under the terms of the GNU General Public License as published by 13632a9432774ff3a0c6e556e8f32a565b38890767Marcel Holtmann * the Free Software Foundation; either version 2 of the License, or 14632a9432774ff3a0c6e556e8f32a565b38890767Marcel Holtmann * (at your option) any later version. 15e343e0fee7fdaf96156fb35b431ddb0503755843Marcel Holtmann * 16632a9432774ff3a0c6e556e8f32a565b38890767Marcel Holtmann * This program is distributed in the hope that it will be useful, 17632a9432774ff3a0c6e556e8f32a565b38890767Marcel Holtmann * but WITHOUT ANY WARRANTY; without even the implied warranty of 18632a9432774ff3a0c6e556e8f32a565b38890767Marcel Holtmann * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19632a9432774ff3a0c6e556e8f32a565b38890767Marcel Holtmann * GNU General Public License for more details. 20e343e0fee7fdaf96156fb35b431ddb0503755843Marcel Holtmann * 21632a9432774ff3a0c6e556e8f32a565b38890767Marcel Holtmann * You should have received a copy of the GNU General Public License 22632a9432774ff3a0c6e556e8f32a565b38890767Marcel Holtmann * along with this program; if not, write to the Free Software 23632a9432774ff3a0c6e556e8f32a565b38890767Marcel Holtmann * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 24e343e0fee7fdaf96156fb35b431ddb0503755843Marcel Holtmann * 25c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann */ 26c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann 27c6e4778e9cbc61e77ef9d8721bc04343af11d7e9Marcel Holtmann#include <bluetooth/bluetooth.h> 284cfded0ce163301d9723b36340254070b3ab5d7aMarcel Holtmann#include <bluetooth/sdp.h> 294cfded0ce163301d9723b36340254070b3ab5d7aMarcel Holtmann 30c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmanntypedef struct request { 31b0ba2fc57a3da851aa0bb7ff6bbf78347c838221Marcel Holtmann bdaddr_t device; 32c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann bdaddr_t bdaddr; 33c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann int local; 34c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann int sock; 35c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann int mtu; 36e343e0fee7fdaf96156fb35b431ddb0503755843Marcel Holtmann int flags; 37e2a54220b404119a2516a3cac5edc5b2bcf6089aMarcel Holtmann uint8_t *buf; 38c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann int len; 39c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann} sdp_req_t; 40c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann 413f5e2295dd6b747609ad3a893a76af5ba2146c93Marcel Holtmannvoid handle_request(int sk, uint8_t *data, int len); 42c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann 43c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannint service_register_req(sdp_req_t *req, sdp_buf_t *rsp); 44c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannint service_update_req(sdp_req_t *req, sdp_buf_t *rsp); 45c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannint service_remove_req(sdp_req_t *req, sdp_buf_t *rsp); 46c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann 4709e129d5ef90ad61775517e752b8b9918f1a7c3eMarcel Holtmannvoid register_public_browse_group(void); 4809e129d5ef90ad61775517e752b8b9918f1a7c3eMarcel Holtmannvoid register_server_service(void); 49eefb64d927b48d2de2e100b1f7ee715bf86bbb57Marcel Holtmannvoid register_device_id(const uint16_t vendor, const uint16_t product, 50eefb64d927b48d2de2e100b1f7ee715bf86bbb57Marcel Holtmann const uint16_t version); 513f5e2295dd6b747609ad3a893a76af5ba2146c93Marcel Holtmann 52c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmanntypedef struct { 53cfb680f0660169fe231c575cb2a0c7f72826f4f4Marcel Holtmann uint32_t timestamp; 54c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann union { 55c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann uint16_t maxBytesSent; 56c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann uint16_t lastIndexSent; 57c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann } cStateValue; 58c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann} sdp_cont_state_t; 59c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann 60c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann#define SDP_CONT_STATE_SIZE (sizeof(uint8_t) + sizeof(sdp_cont_state_t)) 61c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann 62c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannsdp_buf_t *sdp_get_cached_rsp(sdp_cont_state_t *cstate); 63c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannvoid sdp_cstate_cache_init(void); 64c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannvoid sdp_cstate_clean_buf(void); 65c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann 66c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannvoid sdp_svcdb_reset(void); 67c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannvoid sdp_svcdb_collect_all(int sock); 68c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannvoid sdp_svcdb_set_collectable(sdp_record_t *rec, int sock); 69c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannvoid sdp_svcdb_collect(sdp_record_t *rec); 70c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannsdp_record_t *sdp_record_find(uint32_t handle); 71957d01bac7a4c448bbe0a15de613af7927d1c7d0Luiz Augusto von Dentzvoid sdp_record_add(const bdaddr_t *device, sdp_record_t *rec); 72c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannint sdp_record_remove(uint32_t handle); 73028619a565a8dd60da011170f8ce326de78a1e47Marcel Holtmannsdp_list_t *sdp_get_record_list(void); 74028619a565a8dd60da011170f8ce326de78a1e47Marcel Holtmannsdp_list_t *sdp_get_access_list(void); 75028619a565a8dd60da011170f8ce326de78a1e47Marcel Holtmannint sdp_check_access(uint32_t handle, bdaddr_t *device); 76c8c2b3ffa0c932033a5c666a49481122e58cec27Marcel Holtmannuint32_t sdp_next_handle(void); 77c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann 78cfb680f0660169fe231c575cb2a0c7f72826f4f4Marcel Holtmannuint32_t sdp_get_time(); 79c6e4778e9cbc61e77ef9d8721bc04343af11d7e9Marcel Holtmann 80c6e4778e9cbc61e77ef9d8721bc04343af11d7e9Marcel Holtmann#define SDP_SERVER_COMPAT (1 << 0) 81c6e4778e9cbc61e77ef9d8721bc04343af11d7e9Marcel Holtmann#define SDP_SERVER_MASTER (1 << 1) 82c6e4778e9cbc61e77ef9d8721bc04343af11d7e9Marcel Holtmann 83eefb64d927b48d2de2e100b1f7ee715bf86bbb57Marcel Holtmannint start_sdp_server(uint16_t mtu, const char *did, uint32_t flags); 84c6e4778e9cbc61e77ef9d8721bc04343af11d7e9Marcel Holtmannvoid stop_sdp_server(void); 852006d2ff671751d0ced48827ae8a58887c404a48Marcel Holtmann 86957d01bac7a4c448bbe0a15de613af7927d1c7d0Luiz Augusto von Dentzint add_record_to_server(const bdaddr_t *src, sdp_record_t *rec); 8744847d5dfc0eebba1cebad1fbc89895901bfe09bClaudio Takahasiint remove_record_from_server(uint32_t handle); 88b22d297c0c679b400d7825367e31fed46c552a49Marcel Holtmann 898af5664021b471e769b93a345f451f9a20b08ca8Marcel Holtmanntypedef void (*service_classes_callback_t) (const bdaddr_t *bdaddr, uint8_t value); 908af5664021b471e769b93a345f451f9a20b08ca8Marcel Holtmann 91f205cd06dc4e9da2c1d5109e570008d7d80b8380Marcel Holtmannuint8_t get_service_classes(const bdaddr_t *bdaddr); 928af5664021b471e769b93a345f451f9a20b08ca8Marcel Holtmannvoid set_service_classes_callback(service_classes_callback_t callback); 93eb4d49890ca8a4d8f567e81fdf82b6903d30f326Marcel Holtmannvoid create_ext_inquiry_response(const char *name, uint8_t *data); 94