Deleted Added
full compact
ng_sample.c (129823) ng_sample.c (131155)
1
2/*
3 * ng_sample.c
4 *
5 * Copyright (c) 1996-1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

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

31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Author: Julian Elischer <julian@freebsd.org>
38 *
1
2/*
3 * ng_sample.c
4 *
5 * Copyright (c) 1996-1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

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

31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Author: Julian Elischer <julian@freebsd.org>
38 *
39 * $FreeBSD: head/sys/netgraph/ng_sample.c 129823 2004-05-29 00:51:19Z julian $
39 * $FreeBSD: head/sys/netgraph/ng_sample.c 131155 2004-06-26 22:24:16Z julian $
40 * $Whistle: ng_sample.c,v 1.13 1999/11/01 09:24:52 julian Exp $
41 */
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/kernel.h>
46#include <sys/mbuf.h>
47#include <sys/malloc.h>

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

305 /* Free the message and return */
306 NG_FREE_MSG(msg);
307 return(error);
308}
309
310/*
311 * Receive data, and do something with it.
312 * Actually we receive a queue item which holds the data.
40 * $Whistle: ng_sample.c,v 1.13 1999/11/01 09:24:52 julian Exp $
41 */
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/kernel.h>
46#include <sys/mbuf.h>
47#include <sys/malloc.h>

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

305 /* Free the message and return */
306 NG_FREE_MSG(msg);
307 return(error);
308}
309
310/*
311 * Receive data, and do something with it.
312 * Actually we receive a queue item which holds the data.
313 * If we free the item it wil also froo the data and metadata unless
314 * we have previously disassociated them using the NGI_GET_xxx() macros.
313 * If we free the item it will also free the data unless we have
314 * previously disassociated it using the NGI_GET_M() macro.
315 * Possibly send it out on another link after processing.
316 * Possibly do something different if it comes from different
315 * Possibly send it out on another link after processing.
316 * Possibly do something different if it comes from different
317 * hooks. the caller will never free m or meta, so
318 * if we use up this data or abort we must free BOTH of these.
317 * hooks. The caller will never free m, so if we use up this data or
318 * abort we must free it.
319 *
320 * If we want, we may decide to force this data to be queued and reprocessed
321 * at the netgraph NETISR time.
322 * We would do that by setting the HK_QUEUE flag on our hook. We would do that
323 * in the connect() method.
324 */
325static int
326ng_xxx_rcvdata(hook_p hook, item_p item )

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

353 if (xxxp->channel[chan].dlci == dlci)
354 break;
355 if (chan == XXX_NUM_DLCIS) {
356 NG_FREE_ITEM(item);
357 NG_FREE_M(m);
358 return (ENETUNREACH);
359 }
360 /* If we were called at splnet, use the following:
319 *
320 * If we want, we may decide to force this data to be queued and reprocessed
321 * at the netgraph NETISR time.
322 * We would do that by setting the HK_QUEUE flag on our hook. We would do that
323 * in the connect() method.
324 */
325static int
326ng_xxx_rcvdata(hook_p hook, item_p item )

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

353 if (xxxp->channel[chan].dlci == dlci)
354 break;
355 if (chan == XXX_NUM_DLCIS) {
356 NG_FREE_ITEM(item);
357 NG_FREE_M(m);
358 return (ENETUNREACH);
359 }
360 /* If we were called at splnet, use the following:
361 * NG_SEND_DATA(error, otherhook, m, meta); if this
361 * NG_SEND_DATA_ONLY(error, otherhook, m); if this
362 * node is running at some SPL other than SPLNET
363 * then you should use instead: error =
362 * node is running at some SPL other than SPLNET
363 * then you should use instead: error =
364 * ng_queueit(otherhook, m, meta); m = NULL: meta =
365 * NULL; this queues the data using the standard
366 * NETISR system and schedules the data to be picked
364 * ng_queueit(otherhook, m, NULL); m = NULL;
365 * This queues the data using the standard NETISR
366 * system and schedules the data to be picked
367 * up again once the system has moved to SPLNET and
367 * up again once the system has moved to SPLNET and
368 * the processing of the data can continue. after
369 * these are run 'm' and 'meta' should be considered
368 * the processing of the data can continue. After
369 * these are run 'm' should be considered
370 * as invalid and NG_SEND_DATA actually zaps them. */
371 NG_FWD_NEW_DATA(error, item,
372 xxxp->channel[chan].hook, m);
373 xxxp->packets_in++;
374 }
375 } else {
376 /* It's the debug hook, throw it away.. */
377 if (hook == xxxp->downstream_hook.hook) {

--- 121 unchanged lines hidden ---
370 * as invalid and NG_SEND_DATA actually zaps them. */
371 NG_FWD_NEW_DATA(error, item,
372 xxxp->channel[chan].hook, m);
373 xxxp->packets_in++;
374 }
375 } else {
376 /* It's the debug hook, throw it away.. */
377 if (hook == xxxp->downstream_hook.hook) {

--- 121 unchanged lines hidden ---