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