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