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