Deleted Added
sdiff udiff text old ( 114878 ) new ( 122634 )
full compact
1/*
2 * ng_h4_var.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_var.h,v 1.1 2002/11/24 19:46:55 max Exp $
29 * $FreeBSD: head/sys/netgraph/bluetooth/drivers/h4/ng_h4_var.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#ifndef _NETGRAPH_H4_VAR_H_
39#define _NETGRAPH_H4_VAR_H_ 1
40
41/*
42 * Malloc declaration
43 */
44
45#ifndef NG_SEPARATE_MALLOC
46MALLOC_DECLARE(M_NETGRAPH_H4);
47#else
48#define M_NETGRAPH_H4 M_NETGRAPH
49#endif /* NG_SEPARATE_MALLOC */
50
51/*
52 * Debug
53 */
54
55#define NG_H4_ALERT if (sc->debug >= NG_H4_ALERT_LEVEL) printf
56#define NG_H4_ERR if (sc->debug >= NG_H4_ERR_LEVEL) printf
57#define NG_H4_WARN if (sc->debug >= NG_H4_WARN_LEVEL) printf
58#define NG_H4_INFO if (sc->debug >= NG_H4_INFO_LEVEL) printf
59
60#define NG_H4_HIWATER 256 /* High water mark on output */
61
62/*
63 * Per-node private info
64 */
65
66typedef struct ng_h4_info {
67 struct tty *tp; /* Terminal device */
68 node_p node; /* Netgraph node */
69
70 u_int32_t flags; /* Flags */
71#define NG_H4_TIMEOUT (1 << 0) /* A timeout is pending */
72
73 ng_h4_node_debug_ep debug; /* Debug level */
74 ng_h4_node_state_ep state; /* State */
75
76 ng_h4_node_stat_ep stat;
77#define NG_H4_STAT_PCKTS_SENT(s) (s).pckts_sent ++
78#define NG_H4_STAT_BYTES_SENT(s, n) (s).bytes_sent += (n)
79#define NG_H4_STAT_PCKTS_RECV(s) (s).pckts_recv ++
80#define NG_H4_STAT_BYTES_RECV(s, n) (s).bytes_recv += (n)
81#define NG_H4_STAT_OERROR(s) (s).oerrors ++
82#define NG_H4_STAT_IERROR(s) (s).ierrors ++
83#define NG_H4_STAT_RESET(s) bzero(&(s), sizeof((s)))
84
85 ng_bt_mbufq_t outq; /* Queue of outgoing mbuf's */
86#define NG_H4_DEFAULTQLEN 12 /* XXX max number of mbuf's in outq */
87
88#define NG_H4_IBUF_SIZE 1024 /* XXX must be big enough to hold full
89 frame */
90 u_int8_t ibuf[NG_H4_IBUF_SIZE]; /* Incoming data */
91 u_int32_t got; /* Number of bytes we have received */
92 u_int32_t want; /* Number of bytes we want to receive */
93
94 hook_p hook; /* Upstream hook */
95 struct callout_handle timo; /* See man timeout(9) */
96} ng_h4_info_t;
97typedef ng_h4_info_t * ng_h4_info_p;
98
99#endif /* _NETGRAPH_H4_VAR_H_ */
100