Deleted Added
full compact
link.c (46686) link.c (47061)
1/*-
2 * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: link.c,v 1.8 1999/03/31 14:21:45 brian Exp $
26 * $Id: link.c,v 1.9 1999/05/08 11:06:58 brian Exp $
27 *
28 */
29
30#include <sys/types.h>
31#include <netinet/in_systm.h>
32#include <netdb.h>
33#include <sys/un.h>
34#include <netinet/in.h>

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

211 if(pri < 0 || pri >= LINK_QUEUES)
212 pri = 0;
213
214 for (layer = l->nlayers; layer && bp; layer--)
215 if (l->layer[layer - 1]->push != NULL)
216 bp = (*l->layer[layer - 1]->push)(b, l, bp, pri, &proto);
217
218 if (bp) {
27 *
28 */
29
30#include <sys/types.h>
31#include <netinet/in_systm.h>
32#include <netdb.h>
33#include <sys/un.h>
34#include <netinet/in.h>

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

211 if(pri < 0 || pri >= LINK_QUEUES)
212 pri = 0;
213
214 for (layer = l->nlayers; layer && bp; layer--)
215 if (l->layer[layer - 1]->push != NULL)
216 bp = (*l->layer[layer - 1]->push)(b, l, bp, pri, &proto);
217
218 if (bp) {
219 log_Printf(LogDEBUG, "link_PushPacket: proto = 0x%04x\n", proto);
220 link_AddOutOctets(l, mbuf_Length(bp));
219 link_AddOutOctets(l, mbuf_Length(bp));
220 log_Printf(LogDEBUG, "link_PushPacket: Transmit proto 0x%04x\n", proto);
221 mbuf_Enqueue(l->Queue + pri, mbuf_Contiguous(bp));
222 }
223}
224
225void
226link_PullPacket(struct link *l, char *buf, size_t len, struct bundle *b)
227{
228 struct mbuf *bp, *lbp[LAYER_MAX], *next;

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

262 if (l->layer[layer]->pull != NULL)
263 bp = (*l->layer[layer]->pull)(b, l, bp, &proto);
264
265 if (layer == l->nlayers - 1) {
266 /* We've just done the top layer, despatch the packet(s) */
267 while (bp) {
268 next = bp->pnext;
269 bp->pnext = NULL;
221 mbuf_Enqueue(l->Queue + pri, mbuf_Contiguous(bp));
222 }
223}
224
225void
226link_PullPacket(struct link *l, char *buf, size_t len, struct bundle *b)
227{
228 struct mbuf *bp, *lbp[LAYER_MAX], *next;

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

262 if (l->layer[layer]->pull != NULL)
263 bp = (*l->layer[layer]->pull)(b, l, bp, &proto);
264
265 if (layer == l->nlayers - 1) {
266 /* We've just done the top layer, despatch the packet(s) */
267 while (bp) {
268 next = bp->pnext;
269 bp->pnext = NULL;
270 log_Printf(LogDEBUG, "link_PullPacket: Despatch proto 0x%04x\n", proto);
270 Despatch(b, l, bp, proto);
271 bp = next;
272 }
273 } else {
274 lbp[++layer] = bp;
275 lproto[layer] = proto;
276 }
277 }

--- 63 unchanged lines hidden ---
271 Despatch(b, l, bp, proto);
272 bp = next;
273 }
274 } else {
275 lbp[++layer] = bp;
276 lproto[layer] = proto;
277 }
278 }

--- 63 unchanged lines hidden ---