1 /* 2 * 3 * BlueZ - Bluetooth protocol stack for Linux 4 * 5 * Copyright (C) 2000-2001 Qualcomm Incorporated 6 * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk (at) qualcomm.com> 7 * Copyright (C) 2002-2009 Marcel Holtmann <marcel (at) holtmann.org> 8 * 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; either version 2 of the License, or 13 * (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program; if not, write to the Free Software 22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 23 * 24 */ 25 26 /* When all services should trust a remote device */ 27 #define GLOBAL_TRUST "[all]" 28 29 /* 30 * Scanning modes, used by DEV_SET_MODE 31 * off: remote devices are not allowed to find or connect to this device 32 * connectable: remote devices are allowed to connect, but they are not 33 * allowed to find it. 34 * discoverable: remote devices are allowed to connect and find this device 35 * limited: limited discoverable - GIAC + IAC enabled and set limited 36 * bit on device class. 37 */ 38 39 #define MODE_OFF 0x00 40 #define MODE_CONNECTABLE 0x01 41 #define MODE_DISCOVERABLE 0x02 42 #define MODE_LIMITED 0x03 43 #define MODE_UNKNOWN 0xff 44 45 #define HCID_DEFAULT_DISCOVERABLE_TIMEOUT 180 /* 3 minutes */ 46 47 /* Timeout for hci_send_req (milliseconds) */ 48 #define HCI_REQ_TIMEOUT 5000 49 50 struct main_opts { 51 char host_name[40]; 52 unsigned long flags; 53 char *name; 54 uint32_t class; 55 uint16_t pageto; 56 uint32_t discovto; 57 uint32_t pairto; 58 uint16_t link_mode; 59 uint16_t link_policy; 60 gboolean remember_powered; 61 gboolean reverse_sdp; 62 gboolean name_resolv; 63 64 uint8_t scan; 65 uint8_t mode; 66 uint8_t discov_interval; 67 char deviceid[15]; /* FIXME: */ 68 69 int sock; 70 }; 71 72 enum { 73 HCID_SET_NAME, 74 HCID_SET_CLASS, 75 HCID_SET_PAGETO, 76 HCID_SET_DISCOVTO, 77 }; 78 79 extern struct main_opts main_opts; 80 81 char *expand_name(char *dst, int size, char *str, int dev_id); 82 83 void hci_req_queue_remove(int dev_id, bdaddr_t *dba); 84 85 void start_security_manager(int hdev); 86 void stop_security_manager(int hdev); 87 88 void btd_start_exit_timer(void); 89 void btd_stop_exit_timer(void); 90 91 void set_pin_length(bdaddr_t *sba, int length); 92 93 gboolean plugin_init(GKeyFile *config); 94 void plugin_cleanup(void); 95 96 void rfkill_init(void); 97 void rfkill_exit(void); 98 99 void __probe_servers(const char *adapter); 100 void __remove_servers(const char *adapter); 101