1 /*
2 *
3 * Copyright (c) 2003 The Regents of the University of California. All
4 * rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * - Neither the name of the University nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
19 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 */
30
31 #include "link.h"
32 #include "link_pass.h"
33
34 #ifndef __LIBLINK_I_H__
35 #define __LIBLINK_I_H__
36
37 /*
38 * Private definitions of link provider/user context structs
39 */
40
41 /* default refresh rate for status from the root */
42 #define DEFAULT_ROOT_REFRESH 10000
43
44 /* link provider context */
45 struct _lp_context {
46 lp_opts_t opts; /* link opts */
47 pd_context_t *pdcp; /* packet device context of the
48 * <data> device provided */
49 status_context_t *scp; /* status device context of the
50 * <status> device provided */
51 status_context_t *ccp; /* command device context for the
52 * <command> device provided */
53 link_status_t status; /* status state info */
54 link_status_t orig_status; /* original status state info, before trace mod */
55 g_event_t *root_refresh; /* refresh timer */
56 int in_status_callback; /* flag, when in status callback */
57 int promisc_clients; /* current number of promisc clients */
58 struct _lp_context **ref; /* user reference */
59
60 uint rx_errors;
61 uint tx_errors;
62 };
63
64
65 /* link user context */
66 struct _lu_context {
67 lu_opts_t opts; /* link opts */
68 pd_client_context_t *pdc; /* <data> device client context */
69 status_client_context_t *scc; /* <status> device client context */
70 struct _lu_context **ref; /* user reference */
71 g_event_t *configure_delay; /* timer to schedule link configuration */
72
73 link_status_t last_status; /* last status struct */
74 int status_valid; /* true if status valid */
75 };
76
77
78 typedef struct packet {
79 QUEUE_ELEMENT_DECL(_, struct packet);
80 buf_t *buf;
81 } packet_t;
82
83
84 /* link pass-thru context */
85 struct link_pass_ctx {
86 link_pass_opts_t opts; /* link opts */
87
88 /* the user and provider contexts */
89 lu_context_t *lower;
90 lu_context_t *lower_receipts;
91 lp_context_t *upper;
92
93 /* queue of packets waiting to be sent down */
94 QUEUE_DECL(packets, packet_t);
95
96 /* true if the client has requested blocking */
97 int blocking_requested;
98 int withhold_unblock;
99
100 void *data; /* user's data */
101 struct link_pass_ctx **ref; /* user reference */
102 };
103
104 #endif
105
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.