xref: /freebsd/usr.sbin/bluetooth/hcsecd/hcsecd.h (revision 42b388439bd3795e09258c57a74ce9eec3651c7b)
11de7b4b8SPedro F. Giffuni /*-
21a63eb31SJulian Elischer  * hcsecd.h
31a63eb31SJulian Elischer  *
4*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
51de7b4b8SPedro F. Giffuni  *
61a63eb31SJulian Elischer  * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
71a63eb31SJulian Elischer  * All rights reserved.
81a63eb31SJulian Elischer  *
91a63eb31SJulian Elischer  * Redistribution and use in source and binary forms, with or without
101a63eb31SJulian Elischer  * modification, are permitted provided that the following conditions
111a63eb31SJulian Elischer  * are met:
121a63eb31SJulian Elischer  * 1. Redistributions of source code must retain the above copyright
131a63eb31SJulian Elischer  *    notice, this list of conditions and the following disclaimer.
141a63eb31SJulian Elischer  * 2. Redistributions in binary form must reproduce the above copyright
151a63eb31SJulian Elischer  *    notice, this list of conditions and the following disclaimer in the
161a63eb31SJulian Elischer  *    documentation and/or other materials provided with the distribution.
171a63eb31SJulian Elischer  *
181a63eb31SJulian Elischer  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
191a63eb31SJulian Elischer  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
201a63eb31SJulian Elischer  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
211a63eb31SJulian Elischer  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
221a63eb31SJulian Elischer  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
231a63eb31SJulian Elischer  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
241a63eb31SJulian Elischer  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
251a63eb31SJulian Elischer  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
261a63eb31SJulian Elischer  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
271a63eb31SJulian Elischer  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
281a63eb31SJulian Elischer  * SUCH DAMAGE.
291a63eb31SJulian Elischer  *
300986ab12SMaksim Yevmenkin  * $Id: hcsecd.h,v 1.3 2003/09/08 18:54:21 max Exp $
311a63eb31SJulian Elischer  */
321a63eb31SJulian Elischer 
331a63eb31SJulian Elischer #ifndef _HCSECD_H_
341a63eb31SJulian Elischer #define _HCSECD_H_ 1
351a63eb31SJulian Elischer 
360986ab12SMaksim Yevmenkin #define HCSECD_BUFFER_SIZE	512
370986ab12SMaksim Yevmenkin #define HCSECD_IDENT		"hcsecd"
380986ab12SMaksim Yevmenkin #define HCSECD_PIDFILE		"/var/run/" HCSECD_IDENT ".pid"
390986ab12SMaksim Yevmenkin #define HCSECD_KEYSFILE		"/var/db/"  HCSECD_IDENT ".keys"
400986ab12SMaksim Yevmenkin 
411a63eb31SJulian Elischer struct link_key
421a63eb31SJulian Elischer {
431a63eb31SJulian Elischer 	bdaddr_t		 bdaddr; /* remote device BDADDR */
441a63eb31SJulian Elischer 	char			*name;   /* remote device name */
45079a8a3eSMaksim Yevmenkin 	uint8_t			*key;    /* link key (or NULL if no key) */
461a63eb31SJulian Elischer 	char			*pin;    /* pin (or NULL if no pin) */
471a63eb31SJulian Elischer 	LIST_ENTRY(link_key)	 next;   /* link to the next */
481a63eb31SJulian Elischer };
491a63eb31SJulian Elischer typedef struct link_key		link_key_t;
501a63eb31SJulian Elischer typedef struct link_key *	link_key_p;
511a63eb31SJulian Elischer 
521a63eb31SJulian Elischer extern char	*config_file;
531a63eb31SJulian Elischer 
541a63eb31SJulian Elischer #if __config_debug__
551a63eb31SJulian Elischer void		dump_config	(void);
561a63eb31SJulian Elischer #endif
571a63eb31SJulian Elischer 
580986ab12SMaksim Yevmenkin void		read_config_file(void);
591a63eb31SJulian Elischer void		clean_config	(void);
601a63eb31SJulian Elischer link_key_p	get_key		(bdaddr_p bdaddr, int exact_match);
611a63eb31SJulian Elischer 
620986ab12SMaksim Yevmenkin int		read_keys_file  (void);
630986ab12SMaksim Yevmenkin int		dump_keys_file  (void);
640986ab12SMaksim Yevmenkin 
651a63eb31SJulian Elischer #endif /* ndef _HCSECD_H_ */
661a63eb31SJulian Elischer 
67