summaryrefslogtreecommitdiff
path: root/sys/netbt/h4.h
blob: 224d9d085d0debf9c8887d39c4713af8ae348e0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*	$OpenBSD: h4.h,v 1.2 2005/01/17 18:12:49 mickey Exp $	*/

/*
 * ng_h4.h
 *
 * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_h4.h,v 1.4 2004/05/10 02:24:55 emax Exp $
 * 
 * Based on:
 * ---------
 *
 * FreeBSD: src/sys/netgraph/ng_tty.h
 * Author: Archie Cobbs <archie@freebsd.org>
 */

/*
 * This file contains everything that application needs to know about
 * Bluetooth HCI UART transport layer as per chapter H4 of the Bluetooth
 * Specification Book v1.1.
 *
 * This file can be included by both kernel and userland applications.
 */

#ifndef _NETGRAPH_H4_H_
#define _NETGRAPH_H4_H_

/**************************************************************************
 **************************************************************************
 **     Netgraph node hook name, type name and type cookie and commands
 **************************************************************************
 **************************************************************************/

/* Hook name */
#define NG_H4_HOOK		"hook"

/* Node type name and magic cookie */
#define NG_H4_NODE_TYPE		"h4"
#define NGM_H4_COOKIE		1013899512

/* Node states */
#define NG_H4_W4_PKT_IND	1	/* Waiting for packet indicator */
#define NG_H4_W4_PKT_HDR	2	/* Waiting for packet header */
#define NG_H4_W4_PKT_DATA	3	/* Waiting for packet data */

/* Debug levels */
#define NG_H4_ALERT_LEVEL	1
#define NG_H4_ERR_LEVEL		2
#define NG_H4_WARN_LEVEL	3
#define NG_H4_INFO_LEVEL	4

/**************************************************************************
 **************************************************************************
 **                    H4 node command/event parameters
 **************************************************************************
 **************************************************************************/

/* Reset node */
#define NGM_H4_NODE_RESET	1

/* Get node state (see states above) */
#define NGM_H4_NODE_GET_STATE	2
typedef u_int16_t	ng_h4_node_state_ep;

/* Get/Set node debug level (see levels above) */
#define NGM_H4_NODE_GET_DEBUG	3
#define NGM_H4_NODE_SET_DEBUG	4
typedef u_int16_t	ng_h4_node_debug_ep;

/* Get/Set max queue length for the node */
#define NGM_H4_NODE_GET_QLEN	5
#define NGM_H4_NODE_SET_QLEN	6
typedef int32_t		ng_h4_node_qlen_ep;

/* Get node statistic */
#define NGM_H4_NODE_GET_STAT	7
typedef struct {
	u_int32_t	pckts_recv; /* # of packets received */
	u_int32_t	bytes_recv; /* # of bytes received */
	u_int32_t	pckts_sent; /* # of packets sent */
	u_int32_t	bytes_sent; /* # of bytes sent */
	u_int32_t	oerrors;    /* # of output errors */
	u_int32_t	ierrors;    /* # of input errors */
} ng_h4_node_stat_ep;

/* Reset node statistic */
#define NGM_H4_NODE_RESET_STAT	8

#endif /* _NETGRAPH_H4_H_ */