debug.c (9d2ab4a62d6733c45958627ac113bdbd818d1e2a) debug.c (78a786f909374eac718be84a7161381cfd489ce5)
1/*
2 * debug.c
3 *
4 * Copyright (c) 1996-1999 Whistle Communications, Inc.
5 * All rights reserved.
6 *
7 * Subject to the following obligations and disclaimer of warranty, use and
8 * redistribution of this software, in source or object code forms, with or

--- 48 unchanged lines hidden (view full) ---

57#include "netgraph.h"
58#include "internal.h"
59
60#include <netgraph/ng_UI.h>
61#include <netgraph/ng_async.h>
62#include <netgraph/ng_atmllc.h>
63#include <netgraph/ng_bpf.h>
64#include <netgraph/ng_bridge.h>
1/*
2 * debug.c
3 *
4 * Copyright (c) 1996-1999 Whistle Communications, Inc.
5 * All rights reserved.
6 *
7 * Subject to the following obligations and disclaimer of warranty, use and
8 * redistribution of this software, in source or object code forms, with or

--- 48 unchanged lines hidden (view full) ---

57#include "netgraph.h"
58#include "internal.h"
59
60#include <netgraph/ng_UI.h>
61#include <netgraph/ng_async.h>
62#include <netgraph/ng_atmllc.h>
63#include <netgraph/ng_bpf.h>
64#include <netgraph/ng_bridge.h>
65#include <netgraph/ng_car.h>
65#include <netgraph/ng_cisco.h>
66#include <netgraph/ng_cisco.h>
67#include <netgraph/ng_deflate.h>
66#include <netgraph/ng_device.h>
67#include <netgraph/ng_echo.h>
68#include <netgraph/ng_eiface.h>
69#include <netgraph/ng_etf.h>
70#include <netgraph/ng_ether.h>
68#include <netgraph/ng_device.h>
69#include <netgraph/ng_echo.h>
70#include <netgraph/ng_eiface.h>
71#include <netgraph/ng_etf.h>
72#include <netgraph/ng_ether.h>
73#include <netgraph/ng_ether_echo.h>
71#include <netgraph/ng_frame_relay.h>
72#include <netgraph/ng_gif.h>
73#include <netgraph/ng_gif_demux.h>
74#include <netgraph/ng_hole.h>
75#include <netgraph/ng_hub.h>
76#include <netgraph/ng_iface.h>
77#include <netgraph/ng_ip_input.h>
78#include <netgraph/ng_ipfw.h>
79#include <netgraph/ng_ksocket.h>
80#include <netgraph/ng_l2tp.h>
81#include <netgraph/ng_lmi.h>
82#include <netgraph/ng_mppc.h>
83#include <netgraph/ng_nat.h>
74#include <netgraph/ng_frame_relay.h>
75#include <netgraph/ng_gif.h>
76#include <netgraph/ng_gif_demux.h>
77#include <netgraph/ng_hole.h>
78#include <netgraph/ng_hub.h>
79#include <netgraph/ng_iface.h>
80#include <netgraph/ng_ip_input.h>
81#include <netgraph/ng_ipfw.h>
82#include <netgraph/ng_ksocket.h>
83#include <netgraph/ng_l2tp.h>
84#include <netgraph/ng_lmi.h>
85#include <netgraph/ng_mppc.h>
86#include <netgraph/ng_nat.h>
87#include <netgraph/netflow/ng_netflow.h>
84#include <netgraph/ng_one2many.h>
88#include <netgraph/ng_one2many.h>
89#include <netgraph/ng_patch.h>
90#include <netgraph/ng_pipe.h>
85#include <netgraph/ng_ppp.h>
86#include <netgraph/ng_pppoe.h>
87#include <netgraph/ng_pptpgre.h>
91#include <netgraph/ng_ppp.h>
92#include <netgraph/ng_pppoe.h>
93#include <netgraph/ng_pptpgre.h>
94#include <netgraph/ng_pred1.h>
88#include <netgraph/ng_rfc1490.h>
89#include <netgraph/ng_socket.h>
90#include <netgraph/ng_source.h>
91#include <netgraph/ng_split.h>
92#include <netgraph/ng_sppp.h>
95#include <netgraph/ng_rfc1490.h>
96#include <netgraph/ng_socket.h>
97#include <netgraph/ng_source.h>
98#include <netgraph/ng_split.h>
99#include <netgraph/ng_sppp.h>
100#include <netgraph/ng_tag.h>
93#include <netgraph/ng_tcpmss.h>
94#include <netgraph/ng_tee.h>
95#include <netgraph/ng_tty.h>
96#include <netgraph/ng_vjc.h>
97#include <netgraph/ng_vlan.h>
98#ifdef WHISTLE
99#include <machine/../isa/df_def.h>
100#include <machine/../isa/if_wfra.h>

--- 23 unchanged lines hidden (view full) ---

124
125/* List of known cookies */
126static const struct ng_cookie cookies[] = {
127 COOKIE(UI),
128 COOKIE(ASYNC),
129 COOKIE(ATMLLC),
130 COOKIE(BPF),
131 COOKIE(BRIDGE),
101#include <netgraph/ng_tcpmss.h>
102#include <netgraph/ng_tee.h>
103#include <netgraph/ng_tty.h>
104#include <netgraph/ng_vjc.h>
105#include <netgraph/ng_vlan.h>
106#ifdef WHISTLE
107#include <machine/../isa/df_def.h>
108#include <machine/../isa/if_wfra.h>

--- 23 unchanged lines hidden (view full) ---

132
133/* List of known cookies */
134static const struct ng_cookie cookies[] = {
135 COOKIE(UI),
136 COOKIE(ASYNC),
137 COOKIE(ATMLLC),
138 COOKIE(BPF),
139 COOKIE(BRIDGE),
140 COOKIE(CAR),
132 COOKIE(CISCO),
141 COOKIE(CISCO),
142 COOKIE(DEFLATE),
133 COOKIE(DEVICE),
134 COOKIE(ECHO),
135 COOKIE(EIFACE),
136 COOKIE(ETF),
137 COOKIE(ETHER),
143 COOKIE(DEVICE),
144 COOKIE(ECHO),
145 COOKIE(EIFACE),
146 COOKIE(ETF),
147 COOKIE(ETHER),
148 COOKIE(ETHER_ECHO),
138 COOKIE(FRAMERELAY),
139 COOKIE(GIF),
140 COOKIE(GIF_DEMUX),
141 COOKIE(GENERIC),
142 COOKIE(HOLE),
143 COOKIE(HUB),
144 COOKIE(IFACE),
145 COOKIE(IP_INPUT),
146 COOKIE(IPFW),
147 COOKIE(KSOCKET),
148 COOKIE(L2TP),
149 COOKIE(LMI),
150 COOKIE(MPPC),
151 COOKIE(NAT),
149 COOKIE(FRAMERELAY),
150 COOKIE(GIF),
151 COOKIE(GIF_DEMUX),
152 COOKIE(GENERIC),
153 COOKIE(HOLE),
154 COOKIE(HUB),
155 COOKIE(IFACE),
156 COOKIE(IP_INPUT),
157 COOKIE(IPFW),
158 COOKIE(KSOCKET),
159 COOKIE(L2TP),
160 COOKIE(LMI),
161 COOKIE(MPPC),
162 COOKIE(NAT),
163 COOKIE(NETFLOW),
152 COOKIE(ONE2MANY),
164 COOKIE(ONE2MANY),
165 COOKIE(PATCH),
166 COOKIE(PIPE),
153 COOKIE(PPP),
154 COOKIE(PPPOE),
155 COOKIE(PPTPGRE),
167 COOKIE(PPP),
168 COOKIE(PPPOE),
169 COOKIE(PPTPGRE),
170 COOKIE(PRED1),
156 COOKIE(RFC1490),
157 COOKIE(SOCKET),
158 COOKIE(SOURCE),
159 COOKIE(SPLIT),
160 COOKIE(SPPP),
171 COOKIE(RFC1490),
172 COOKIE(SOCKET),
173 COOKIE(SOURCE),
174 COOKIE(SPLIT),
175 COOKIE(SPPP),
176 COOKIE(TAG),
161 COOKIE(TCPMSS),
162 COOKIE(TEE),
163 COOKIE(TTY),
164 COOKIE(VJC),
165 COOKIE(VLAN),
166#ifdef WHISTLE
167 COOKIE(DF),
168 COOKIE(IPAC),

--- 7 unchanged lines hidden (view full) ---

176 * Set debug level, ie, verbosity, if "level" is non-negative.
177 * Returns old debug level.
178 */
179int
180NgSetDebug(int level)
181{
182 int old = _gNgDebugLevel;
183
177 COOKIE(TCPMSS),
178 COOKIE(TEE),
179 COOKIE(TTY),
180 COOKIE(VJC),
181 COOKIE(VLAN),
182#ifdef WHISTLE
183 COOKIE(DF),
184 COOKIE(IPAC),

--- 7 unchanged lines hidden (view full) ---

192 * Set debug level, ie, verbosity, if "level" is non-negative.
193 * Returns old debug level.
194 */
195int
196NgSetDebug(int level)
197{
198 int old = _gNgDebugLevel;
199
184 if (level < 0)
185 level = old;
186 _gNgDebugLevel = level;
200 if (level >= 0)
201 _gNgDebugLevel = level;
187 return (old);
188}
189
190/*
191 * Set debug logging functions.
192 */
193void
194NgSetErrLog(void (*log) (const char *fmt,...),

--- 25 unchanged lines hidden (view full) ---

220 u_char buf[2 * sizeof(struct ng_mesg) + ARGS_BUFSIZE];
221 struct ng_mesg *const req = (struct ng_mesg *)buf;
222 struct ng_mesg *const bin = (struct ng_mesg *)req->data;
223 int arglen, csock = -1;
224
225 /* Display header stuff */
226 NGLOGX("NG_MESG :");
227 NGLOGX(" vers %d", msg->header.version);
202 return (old);
203}
204
205/*
206 * Set debug logging functions.
207 */
208void
209NgSetErrLog(void (*log) (const char *fmt,...),

--- 25 unchanged lines hidden (view full) ---

235 u_char buf[2 * sizeof(struct ng_mesg) + ARGS_BUFSIZE];
236 struct ng_mesg *const req = (struct ng_mesg *)buf;
237 struct ng_mesg *const bin = (struct ng_mesg *)req->data;
238 int arglen, csock = -1;
239
240 /* Display header stuff */
241 NGLOGX("NG_MESG :");
242 NGLOGX(" vers %d", msg->header.version);
228 NGLOGX(" arglen %d", msg->header.arglen);
229 NGLOGX(" flags %ld", msg->header.flags);
230 NGLOGX(" token %lu", (u_long)msg->header.token);
231 NGLOGX(" cookie %s (%d)",
243 NGLOGX(" arglen %u", msg->header.arglen);
244 NGLOGX(" flags %x", msg->header.flags);
245 NGLOGX(" token %u", msg->header.token);
246 NGLOGX(" cookie %s (%u)",
232 NgCookie(msg->header.typecookie), msg->header.typecookie);
233
234 /* At lower debugging levels, skip ASCII translation */
235 if (_gNgDebugLevel <= 2)
236 goto fail2;
237
238 /* If path is not absolute, don't bother trying to use relative
239 address on a different socket for the ASCII translation */

--- 105 unchanged lines hidden ---
247 NgCookie(msg->header.typecookie), msg->header.typecookie);
248
249 /* At lower debugging levels, skip ASCII translation */
250 if (_gNgDebugLevel <= 2)
251 goto fail2;
252
253 /* If path is not absolute, don't bother trying to use relative
254 address on a different socket for the ASCII translation */

--- 105 unchanged lines hidden ---