sdpd.h revision 09e129d5ef90ad61775517e752b8b9918f1a7c3e
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> 7607695ed109340f4b7a5628420e0a8e8aee34f4eMarcel Holtmann * Copyright (C) 2002-2007 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); 65cfb680f0660169fe231c575cb2a0c7f72826f4f4Marcel Holtmannuint32_t sdp_cstate_alloc_buf(sdp_buf_t *buf); 66c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann 67c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannvoid sdp_svcdb_reset(void); 68c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannvoid sdp_svcdb_collect_all(int sock); 69c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannvoid sdp_svcdb_set_collectable(sdp_record_t *rec, int sock); 70c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannvoid sdp_svcdb_collect(sdp_record_t *rec); 71c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannsdp_record_t *sdp_record_find(uint32_t handle); 72b0ba2fc57a3da851aa0bb7ff6bbf78347c838221Marcel Holtmannvoid sdp_record_add(bdaddr_t *device, sdp_record_t *rec); 73c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmannint sdp_record_remove(uint32_t handle); 74028619a565a8dd60da011170f8ce326de78a1e47Marcel Holtmannsdp_list_t *sdp_get_record_list(void); 75028619a565a8dd60da011170f8ce326de78a1e47Marcel Holtmannsdp_list_t *sdp_get_access_list(void); 76028619a565a8dd60da011170f8ce326de78a1e47Marcel Holtmannint sdp_check_access(uint32_t handle, bdaddr_t *device); 77c8c2b3ffa0c932033a5c666a49481122e58cec27Marcel Holtmannuint32_t sdp_next_handle(void); 78c787259b854f12bd827d1e05ccde53d748d22b30Marcel Holtmann 79cfb680f0660169fe231c575cb2a0c7f72826f4f4Marcel Holtmannuint32_t sdp_get_time(); 80c6e4778e9cbc61e77ef9d8721bc04343af11d7e9Marcel Holtmann 81c6e4778e9cbc61e77ef9d8721bc04343af11d7e9Marcel Holtmann#define SDP_SERVER_COMPAT (1 << 0) 82c6e4778e9cbc61e77ef9d8721bc04343af11d7e9Marcel Holtmann#define SDP_SERVER_MASTER (1 << 1) 83c6e4778e9cbc61e77ef9d8721bc04343af11d7e9Marcel Holtmann 84eefb64d927b48d2de2e100b1f7ee715bf86bbb57Marcel Holtmannint start_sdp_server(uint16_t mtu, const char *did, uint32_t flags); 85c6e4778e9cbc61e77ef9d8721bc04343af11d7e9Marcel Holtmannvoid stop_sdp_server(void); 862006d2ff671751d0ced48827ae8a58887c404a48Marcel Holtmann 872006d2ff671751d0ced48827ae8a58887c404a48Marcel Holtmannint add_record_to_server(sdp_record_t *rec); 8844847d5dfc0eebba1cebad1fbc89895901bfe09bClaudio Takahasiint remove_record_from_server(uint32_t handle); 89