13b0f8d2eSBrian Somers /*- 23b0f8d2eSBrian Somers * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org> 33b0f8d2eSBrian Somers * All rights reserved. 43b0f8d2eSBrian Somers * 53b0f8d2eSBrian Somers * Redistribution and use in source and binary forms, with or without 63b0f8d2eSBrian Somers * modification, are permitted provided that the following conditions 73b0f8d2eSBrian Somers * are met: 83b0f8d2eSBrian Somers * 1. Redistributions of source code must retain the above copyright 93b0f8d2eSBrian Somers * notice, this list of conditions and the following disclaimer. 103b0f8d2eSBrian Somers * 2. Redistributions in binary form must reproduce the above copyright 113b0f8d2eSBrian Somers * notice, this list of conditions and the following disclaimer in the 123b0f8d2eSBrian Somers * documentation and/or other materials provided with the distribution. 133b0f8d2eSBrian Somers * 143b0f8d2eSBrian Somers * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 153b0f8d2eSBrian Somers * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 163b0f8d2eSBrian Somers * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 173b0f8d2eSBrian Somers * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 183b0f8d2eSBrian Somers * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 193b0f8d2eSBrian Somers * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 203b0f8d2eSBrian Somers * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 213b0f8d2eSBrian Somers * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 223b0f8d2eSBrian Somers * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 233b0f8d2eSBrian Somers * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 243b0f8d2eSBrian Somers * SUCH DAMAGE. 253b0f8d2eSBrian Somers * 262764b86aSBrian Somers * $Id: mp.h,v 1.1.2.1 1998/04/03 19:21:46 brian Exp $ 273b0f8d2eSBrian Somers */ 283b0f8d2eSBrian Somers 292764b86aSBrian Somers struct mbuf; 302764b86aSBrian Somers struct physical; 312764b86aSBrian Somers struct bundle; 322764b86aSBrian Somers struct cmdargs; 332764b86aSBrian Somers 343b0f8d2eSBrian Somers struct mp { 353b0f8d2eSBrian Somers struct link link; 363b0f8d2eSBrian Somers 373b0f8d2eSBrian Somers unsigned active : 1; 383b0f8d2eSBrian Somers unsigned is12bit : 1; /* 12 / 24bit seq nos */ 393b0f8d2eSBrian Somers 403b0f8d2eSBrian Somers struct { 413b0f8d2eSBrian Somers u_int32_t out; /* next outgoing seq */ 423b0f8d2eSBrian Somers u_int32_t min_in; /* minimum received incoming seq */ 433b0f8d2eSBrian Somers u_int32_t next_in; /* next incoming seq to process */ 443b0f8d2eSBrian Somers } seq; 453b0f8d2eSBrian Somers struct mbuf *inbufs; /* Received fragments */ 463b0f8d2eSBrian Somers 473b0f8d2eSBrian Somers struct fsm_parent fsmp; /* Our callback functions */ 483b0f8d2eSBrian Somers 493b0f8d2eSBrian Somers struct bundle *bundle; 503b0f8d2eSBrian Somers }; 513b0f8d2eSBrian Somers 523b0f8d2eSBrian Somers struct mp_link { 533b0f8d2eSBrian Somers u_int32_t seq; /* 12 or 24 bit incoming seq */ 543b0f8d2eSBrian Somers int weight; /* bytes to send with each write */ 553b0f8d2eSBrian Somers }; 563b0f8d2eSBrian Somers 573b0f8d2eSBrian Somers struct mp_header { 583b0f8d2eSBrian Somers unsigned begin : 1; 593b0f8d2eSBrian Somers unsigned end : 1; 603b0f8d2eSBrian Somers u_int32_t seq; 613b0f8d2eSBrian Somers }; 623b0f8d2eSBrian Somers 633b0f8d2eSBrian Somers extern void mp_Init(struct mp *, struct bundle *); 643b0f8d2eSBrian Somers extern void mp_linkInit(struct mp_link *); 653b0f8d2eSBrian Somers extern void mp_Input(struct mp *, struct mbuf *, struct physical *); 663b0f8d2eSBrian Somers extern int mp_FillQueues(struct bundle *); 673b0f8d2eSBrian Somers extern int mp_SetDatalinkWeight(struct cmdargs const *); 68