ng_h4.h revision 107120
185587Sobrien/*
285587Sobrien * ng_h4.h
385587Sobrien *
485587Sobrien * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
585587Sobrien * All rights reserved.
685587Sobrien *
785587Sobrien * Redistribution and use in source and binary forms, with or without
885587Sobrien * modification, are permitted provided that the following conditions
985587Sobrien * are met:
1085587Sobrien * 1. Redistributions of source code must retain the above copyright
1185587Sobrien *    notice, this list of conditions and the following disclaimer.
1285587Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1385587Sobrien *    notice, this list of conditions and the following disclaimer in the
1485587Sobrien *    documentation and/or other materials provided with the distribution.
1585587Sobrien *
1685587Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1785587Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1885587Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1985587Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2085587Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2185587Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2285587Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2385587Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2485587Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2585587Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2685587Sobrien * SUCH DAMAGE.
2785587Sobrien *
2885587Sobrien * $Id: ng_h4.h,v 1.5 2002/06/27 09:50:18 max Exp $
2985587Sobrien * $FreeBSD: head/sys/netgraph/bluetooth/include/ng_h4.h 107120 2002-11-20 23:01:59Z julian $
3085587Sobrien *
3185587Sobrien * Based on:
32221381Sru * ---------
3385587Sobrien *
3485587Sobrien * FreeBSD: src/sys/netgraph/ng_tty.h
3585587Sobrien * Author: Archie Cobbs <archie@freebsd.org>
3685587Sobrien */
3785587Sobrien
3885587Sobrien/*
3985587Sobrien * This file contains everything that application needs to know about
4085587Sobrien * Bluetooth HCI UART transport layer as per chapter H4 of the Bluetooth
4185587Sobrien * Specification Book v1.1.
4285587Sobrien *
43107806Sobrien * This file can be included by both kernel and userland applications.
44107806Sobrien */
45107806Sobrien
46107806Sobrien#ifndef _NETGRAPH_H4_H_
47107806Sobrien#define _NETGRAPH_H4_H_ 1
4885587Sobrien
49107806Sobrien/*
50107806Sobrien * H4 line discipline
51107806Sobrien * XXX FIXME: does not belong here. Move to "ttycom.h" later
52107806Sobrien */
53107806Sobrien
54107806Sobrien#define H4DISC			7
5585587Sobrien
5685587Sobrien/**************************************************************************
5785587Sobrien **************************************************************************
5885587Sobrien **     Netgraph node hook name, type name and type cookie and commands
59146299Sru **************************************************************************
6085587Sobrien **************************************************************************/
6185587Sobrien
6285587Sobrien/* Hook name */
6385587Sobrien#define NG_H4_HOOK		"hook"
6485587Sobrien
6585587Sobrien/* Node type name and magic cookie */
6685587Sobrien#define NG_H4_NODE_TYPE		"h4"
6785587Sobrien#define NGM_H4_COOKIE		1013899512
6885587Sobrien
6985587Sobrien/* Node states */
7085587Sobrien#define NG_H4_W4_PKT_IND	1	/* Waiting for packet indicator */
7190902Sdes#define NG_H4_W4_PKT_HDR	2	/* Waiting for packet header */
7285587Sobrien#define NG_H4_W4_PKT_DATA	3	/* Waiting for packet data */
7385587Sobrien
7485587Sobrien/* Debug levels */
75112336Sobrien#define NG_H4_ALERT_LEVEL	1
76112336Sobrien#define NG_H4_ERR_LEVEL		2
77112336Sobrien#define NG_H4_WARN_LEVEL	3
78112336Sobrien#define NG_H4_INFO_LEVEL	4
79112336Sobrien
80112336Sobrien/**************************************************************************
81112336Sobrien **************************************************************************
82112336Sobrien **                    H4 node command/event parameters
8385587Sobrien **************************************************************************
84107806Sobrien **************************************************************************/
85107806Sobrien
86107806Sobrien/* Reset node */
87107806Sobrien#define NGM_H4_NODE_RESET	1
8885587Sobrien
8990902Sdes/* Get node state (see states above) */
9085587Sobrien#define NGM_H4_NODE_GET_STATE	2
9185587Sobrientypedef u_int16_t	ng_h4_node_state_ep;
9285587Sobrien
93107806Sobrien/* Get/Set node debug level (see levels above) */
94107806Sobrien#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