proto.c (47061) | proto.c (47695) |
---|---|
1/*- 2 * Copyright (c) 1999 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) 1999 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: proto.c,v 1.1 1999/05/08 11:07:32 brian Exp $ | 26 * $Id: proto.c,v 1.2 1999/05/12 09:49:01 brian Exp $ |
27 */ 28 29#include <sys/types.h> 30 31#include <stdio.h> 32#include <termios.h> 33 34#include "layer.h" --- 35 unchanged lines hidden (view full) --- 70 71static struct mbuf * 72proto_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp, 73 int pri, u_short *proto) 74{ 75 log_Printf(LogDEBUG, "proto_LayerPush: Using 0x%04x\n", *proto); 76 bp = proto_Prepend(bp, *proto, l->lcp.his_protocomp, 77 acf_WrapperOctets(&l->lcp, *proto)); | 27 */ 28 29#include <sys/types.h> 30 31#include <stdio.h> 32#include <termios.h> 33 34#include "layer.h" --- 35 unchanged lines hidden (view full) --- 70 71static struct mbuf * 72proto_LayerPush(struct bundle *b, struct link *l, struct mbuf *bp, 73 int pri, u_short *proto) 74{ 75 log_Printf(LogDEBUG, "proto_LayerPush: Using 0x%04x\n", *proto); 76 bp = proto_Prepend(bp, *proto, l->lcp.his_protocomp, 77 acf_WrapperOctets(&l->lcp, *proto)); |
78 mbuf_SetType(bp, MB_PROTOOUT); |
|
78 link_ProtocolRecord(l, *proto, PROTO_OUT); 79 80 return bp; 81} 82 83static struct mbuf * 84proto_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, 85 u_short *proto) --- 13 unchanged lines hidden (view full) --- 99 return NULL; 100 } 101 bp = mbuf_Read(bp, cp, 2); 102 *proto = (*proto << 8) | cp[1]; 103 } else 104 bp = mbuf_Read(bp, cp, 1); 105 106 log_Printf(LogDEBUG, "proto_LayerPull: unknown -> 0x%04x\n", *proto); | 79 link_ProtocolRecord(l, *proto, PROTO_OUT); 80 81 return bp; 82} 83 84static struct mbuf * 85proto_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, 86 u_short *proto) --- 13 unchanged lines hidden (view full) --- 100 return NULL; 101 } 102 bp = mbuf_Read(bp, cp, 2); 103 *proto = (*proto << 8) | cp[1]; 104 } else 105 bp = mbuf_Read(bp, cp, 1); 106 107 log_Printf(LogDEBUG, "proto_LayerPull: unknown -> 0x%04x\n", *proto); |
107 | 108 mbuf_SetType(bp, MB_PROTOIN); |
108 link_ProtocolRecord(l, *proto, PROTO_IN); 109 110 return bp; 111} 112 113struct layer protolayer = 114 { LAYER_PROTO, "proto", proto_LayerPush, proto_LayerPull }; | 109 link_ProtocolRecord(l, *proto, PROTO_IN); 110 111 return bp; 112} 113 114struct layer protolayer = 115 { LAYER_PROTO, "proto", proto_LayerPush, proto_LayerPull }; |