bthcid.h revision 1.1 1 /* $NetBSD: bthcid.h,v 1.1 2006/06/19 15:44:56 gdamore Exp $ */
2
3 /*-
4 * Copyright (c) 2006 Itronix Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of Itronix Inc. may not be used to endorse
16 * or promote products derived from this software without specific
17 * prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 #ifndef _BTHCID_H_
33 #define _BTHCID_H_ 1
34
35 /*
36 * Client PIN Request packet
37 */
38 typedef struct {
39 bdaddr_t laddr; /* local address */
40 bdaddr_t raddr; /* remote address */
41 uint8_t time; /* validity (seconds) */
42 } __attribute__ ((packed)) client_pin_request_t;
43
44 /*
45 * Client PIN Response packet
46 */
47 typedef struct {
48 bdaddr_t laddr; /* local address */
49 bdaddr_t raddr; /* remote address */
50 uint8_t pin[HCI_PIN_SIZE]; /* PIN */
51 } __attribute__ ((packed)) client_pin_response_t;
52
53 /*
54 * Default socket name
55 */
56 #define BTHCID_SOCKET_NAME "/var/run/bthcid"
57
58 /*
59 * The rest is bthcid daemon internals
60 */
61
62 #ifdef _BTHCID_
63
64 extern const char *key_file;
65 extern const char *config_file;
66
67 /* config.c */
68 uint8_t *lookup_pin (bdaddr_t *, bdaddr_t *);
69 uint8_t *lookup_key (bdaddr_t *, bdaddr_t *);
70 void save_key (bdaddr_t *, bdaddr_t *, uint8_t *);
71
72 /* client.c */
73 int init_control (const char *, mode_t);
74 int send_client_request (bdaddr_t *, bdaddr_t *, int);
75 uint8_t *lookup_item (bdaddr_t *, bdaddr_t *);
76
77 /* hci.c */
78 int init_hci (bdaddr_t *);
79 int send_pin_code_reply (int, struct sockaddr_bt *, bdaddr_t *, uint8_t *);
80
81 #endif /* _BTHCID_ */
82 #endif /* _BTHCID_H_ */
83