xref: /dflybsd-src/sys/netgraph7/bluetooth/include/ng_h4.h (revision e85b99abf6da4a83a7dc495b0ef37ce19864149f)
1b06ebda0SMatthew Dillon /*
2b06ebda0SMatthew Dillon  * ng_h4.h
3b06ebda0SMatthew Dillon  */
4b06ebda0SMatthew Dillon 
5b06ebda0SMatthew Dillon /*-
6b06ebda0SMatthew Dillon  * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
7b06ebda0SMatthew Dillon  * All rights reserved.
8b06ebda0SMatthew Dillon  *
9b06ebda0SMatthew Dillon  * Redistribution and use in source and binary forms, with or without
10b06ebda0SMatthew Dillon  * modification, are permitted provided that the following conditions
11b06ebda0SMatthew Dillon  * are met:
12b06ebda0SMatthew Dillon  * 1. Redistributions of source code must retain the above copyright
13b06ebda0SMatthew Dillon  *    notice, this list of conditions and the following disclaimer.
14b06ebda0SMatthew Dillon  * 2. Redistributions in binary form must reproduce the above copyright
15b06ebda0SMatthew Dillon  *    notice, this list of conditions and the following disclaimer in the
16b06ebda0SMatthew Dillon  *    documentation and/or other materials provided with the distribution.
17b06ebda0SMatthew Dillon  *
18b06ebda0SMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19b06ebda0SMatthew Dillon  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20b06ebda0SMatthew Dillon  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21b06ebda0SMatthew Dillon  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22b06ebda0SMatthew Dillon  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23b06ebda0SMatthew Dillon  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24b06ebda0SMatthew Dillon  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25b06ebda0SMatthew Dillon  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26b06ebda0SMatthew Dillon  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27b06ebda0SMatthew Dillon  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28b06ebda0SMatthew Dillon  * SUCH DAMAGE.
29b06ebda0SMatthew Dillon  *
30b06ebda0SMatthew Dillon  * $Id: ng_h4.h,v 1.1 2002/11/24 19:47:05 max Exp $
31*e85b99abSSascha Wildner  * $FreeBSD: head/sys/netgraph/bluetooth/include/ng_h4.h 139823 2005-01-07 01:45:51Z imp $
32b06ebda0SMatthew Dillon  *
33b06ebda0SMatthew Dillon  * Based on:
34b06ebda0SMatthew Dillon  * ---------
35b06ebda0SMatthew Dillon  *
36b06ebda0SMatthew Dillon  * FreeBSD: src/sys/netgraph/ng_tty.h
37b06ebda0SMatthew Dillon  * Author: Archie Cobbs <archie@freebsd.org>
38b06ebda0SMatthew Dillon  */
39b06ebda0SMatthew Dillon 
40b06ebda0SMatthew Dillon /*
41b06ebda0SMatthew Dillon  * This file contains everything that application needs to know about
42b06ebda0SMatthew Dillon  * Bluetooth HCI UART transport layer as per chapter H4 of the Bluetooth
43b06ebda0SMatthew Dillon  * Specification Book v1.1.
44b06ebda0SMatthew Dillon  *
45b06ebda0SMatthew Dillon  * This file can be included by both kernel and userland applications.
46b06ebda0SMatthew Dillon  */
47b06ebda0SMatthew Dillon 
48b06ebda0SMatthew Dillon #ifndef _NETGRAPH_H4_H_
49b06ebda0SMatthew Dillon #define _NETGRAPH_H4_H_
50b06ebda0SMatthew Dillon 
51b06ebda0SMatthew Dillon /**************************************************************************
52b06ebda0SMatthew Dillon  **************************************************************************
53b06ebda0SMatthew Dillon  **     Netgraph node hook name, type name and type cookie and commands
54b06ebda0SMatthew Dillon  **************************************************************************
55b06ebda0SMatthew Dillon  **************************************************************************/
56b06ebda0SMatthew Dillon 
57b06ebda0SMatthew Dillon /* Hook name */
58b06ebda0SMatthew Dillon #define NG_H4_HOOK		"hook"
59b06ebda0SMatthew Dillon 
60b06ebda0SMatthew Dillon /* Node type name and magic cookie */
61b06ebda0SMatthew Dillon #define NG_H4_NODE_TYPE		"h4"
62b06ebda0SMatthew Dillon #define NGM_H4_COOKIE		1013899512
63b06ebda0SMatthew Dillon 
64b06ebda0SMatthew Dillon /* Node states */
65b06ebda0SMatthew Dillon #define NG_H4_W4_PKT_IND	1	/* Waiting for packet indicator */
66b06ebda0SMatthew Dillon #define NG_H4_W4_PKT_HDR	2	/* Waiting for packet header */
67b06ebda0SMatthew Dillon #define NG_H4_W4_PKT_DATA	3	/* Waiting for packet data */
68b06ebda0SMatthew Dillon 
69b06ebda0SMatthew Dillon /* Debug levels */
70b06ebda0SMatthew Dillon #define NG_H4_ALERT_LEVEL	1
71b06ebda0SMatthew Dillon #define NG_H4_ERR_LEVEL		2
72b06ebda0SMatthew Dillon #define NG_H4_WARN_LEVEL	3
73b06ebda0SMatthew Dillon #define NG_H4_INFO_LEVEL	4
74b06ebda0SMatthew Dillon 
75b06ebda0SMatthew Dillon /**************************************************************************
76b06ebda0SMatthew Dillon  **************************************************************************
77b06ebda0SMatthew Dillon  **                    H4 node command/event parameters
78b06ebda0SMatthew Dillon  **************************************************************************
79b06ebda0SMatthew Dillon  **************************************************************************/
80b06ebda0SMatthew Dillon 
81b06ebda0SMatthew Dillon /* Reset node */
82b06ebda0SMatthew Dillon #define NGM_H4_NODE_RESET	1
83b06ebda0SMatthew Dillon 
84b06ebda0SMatthew Dillon /* Get node state (see states above) */
85b06ebda0SMatthew Dillon #define NGM_H4_NODE_GET_STATE	2
86b06ebda0SMatthew Dillon typedef u_int16_t	ng_h4_node_state_ep;
87b06ebda0SMatthew Dillon 
88b06ebda0SMatthew Dillon /* Get/Set node debug level (see levels above) */
89b06ebda0SMatthew Dillon #define NGM_H4_NODE_GET_DEBUG	3
90b06ebda0SMatthew Dillon #define NGM_H4_NODE_SET_DEBUG	4
91b06ebda0SMatthew Dillon typedef u_int16_t	ng_h4_node_debug_ep;
92b06ebda0SMatthew Dillon 
93b06ebda0SMatthew Dillon /* Get/Set max queue length for the node */
94b06ebda0SMatthew Dillon #define NGM_H4_NODE_GET_QLEN	5
95b06ebda0SMatthew Dillon #define NGM_H4_NODE_SET_QLEN	6
96b06ebda0SMatthew Dillon typedef int32_t		ng_h4_node_qlen_ep;
97b06ebda0SMatthew Dillon 
98b06ebda0SMatthew Dillon /* Get node statistic */
99b06ebda0SMatthew Dillon #define NGM_H4_NODE_GET_STAT	7
100b06ebda0SMatthew Dillon typedef struct {
101b06ebda0SMatthew Dillon 	u_int32_t	pckts_recv; /* # of packets received */
102b06ebda0SMatthew Dillon 	u_int32_t	bytes_recv; /* # of bytes received */
103b06ebda0SMatthew Dillon 	u_int32_t	pckts_sent; /* # of packets sent */
104b06ebda0SMatthew Dillon 	u_int32_t	bytes_sent; /* # of bytes sent */
105b06ebda0SMatthew Dillon 	u_int32_t	oerrors;    /* # of output errors */
106b06ebda0SMatthew Dillon 	u_int32_t	ierrors;    /* # of input errors */
107b06ebda0SMatthew Dillon } ng_h4_node_stat_ep;
108b06ebda0SMatthew Dillon 
109b06ebda0SMatthew Dillon /* Reset node statistic */
110b06ebda0SMatthew Dillon #define NGM_H4_NODE_RESET_STAT	8
111b06ebda0SMatthew Dillon 
112b06ebda0SMatthew Dillon #endif /* _NETGRAPH_H4_H_ */
113b06ebda0SMatthew Dillon 
114