Put the IP buffer queues into struct ipcp.

Forgotten by: me
This commit is contained in:
Brian Somers 1998-08-26 17:39:37 +00:00
parent 4a7a066106
commit 5a72b6eda3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=38557
14 changed files with 62 additions and 57 deletions

View File

@ -2,7 +2,7 @@
* The code in this file was written by Eivind Eklund <perhaps@yes.no>,
* who places it in the public domain without restriction.
*
* $Id: alias_cmd.c,v 1.15 1998/06/27 14:17:23 brian Exp $
* $Id: alias_cmd.c,v 1.16 1998/06/27 14:17:59 brian Exp $
*/
#include <sys/types.h>
@ -31,10 +31,10 @@
#include "slcompress.h"
#include "throughput.h"
#include "iplist.h"
#include "ipcp.h"
#include "mbuf.h"
#include "lqr.h"
#include "hdlc.h"
#include "mbuf.h"
#include "ipcp.h"
#include "lcp.h"
#include "ccp.h"
#include "link.h"

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: arp.c,v 1.28 1998/05/21 21:43:51 brian Exp $
* $Id: arp.c,v 1.29 1998/06/16 19:40:34 brian Exp $
*
*/
@ -53,11 +53,11 @@
#include "iplist.h"
#include "throughput.h"
#include "slcompress.h"
#include "lqr.h"
#include "hdlc.h"
#include "ipcp.h"
#include "filter.h"
#include "descriptor.h"
#include "lqr.h"
#include "hdlc.h"
#include "lcp.h"
#include "ccp.h"
#include "link.h"

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: auth.c,v 1.31 1998/07/19 21:07:24 brian Exp $
* $Id: auth.c,v 1.32 1998/08/07 18:42:47 brian Exp $
*
* TODO:
* o Implement check against with registered IP addresses.
@ -40,12 +40,12 @@
#include "iplist.h"
#include "throughput.h"
#include "slcompress.h"
#include "lqr.h"
#include "hdlc.h"
#include "ipcp.h"
#include "auth.h"
#include "systems.h"
#include "lcp.h"
#include "lqr.h"
#include "hdlc.h"
#include "ccp.h"
#include "link.h"
#include "descriptor.h"

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bundle.c,v 1.32 1998/08/09 15:34:11 brian Exp $
* $Id: bundle.c,v 1.33 1998/08/25 17:48:42 brian Exp $
*/
#include <sys/param.h>
@ -231,7 +231,7 @@ bundle_ClearQueues(void *v)
* dictionaries in use (causing the relevant RESET_REQ/RESET_ACK).
*/
ip_DeleteQueue();
ip_DeleteQueue(&bundle->ncp.ipcp);
mp_DeleteQueue(&bundle->ncp.mp);
for (dl = bundle->links; dl; dl = dl->next)
physical_DeleteQueue(dl->physical);
@ -555,7 +555,7 @@ bundle_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n)
nlinks++;
if (nlinks) {
queued = r ? bundle_FillQueues(bundle) : ip_QueueLen();
queued = r ? bundle_FillQueues(bundle) : ip_QueueLen(&bundle->ncp.ipcp);
if (bundle->autoload.running) {
if (queued < bundle->cfg.autoload.max.packets) {
if (queued > bundle->cfg.autoload.min.packets)
@ -710,7 +710,7 @@ bundle_DescriptorRead(struct descriptor *d, struct bundle *bundle,
n = ntohs(((struct ip *)tun.data)->ip_len);
}
#endif
ip_Enqueue(pri, tun.data, n);
ip_Enqueue(&bundle->ncp.ipcp, pri, tun.data, n);
}
}
}
@ -1202,7 +1202,7 @@ bundle_FillQueues(struct bundle *bundle)
}
}
return total + ip_QueueLen();
return total + ip_QueueLen(&bundle->ncp.ipcp);
}
int
@ -1257,7 +1257,7 @@ bundle_ShowStatus(struct cmdargs const *arg)
else
prompt_Printf(arg->prompt, " %srunning with %d"
" packets queued\n", arg->bundle->autoload.running ?
"" : "not ", ip_QueueLen());
"" : "not ", ip_QueueLen(&arg->bundle->ncp.ipcp));
prompt_Printf(arg->prompt, " Choked Timer: %ds\n",
arg->bundle->cfg.choked.timeout);

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ccp.c,v 1.37 1998/06/30 23:04:10 brian Exp $
* $Id: ccp.c,v 1.38 1998/08/07 18:42:47 brian Exp $
*
* TODO:
* o Support other compression protocols
@ -46,12 +46,12 @@
#include "throughput.h"
#include "iplist.h"
#include "slcompress.h"
#include "lqr.h"
#include "hdlc.h"
#include "ipcp.h"
#include "filter.h"
#include "descriptor.h"
#include "prompt.h"
#include "lqr.h"
#include "hdlc.h"
#include "link.h"
#include "mp.h"
#include "async.h"

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: command.c,v 1.159 1998/08/07 18:42:48 brian Exp $
* $Id: command.c,v 1.160 1998/08/25 17:48:42 brian Exp $
*
*/
#include <sys/types.h>
@ -53,13 +53,13 @@
#include "iplist.h"
#include "throughput.h"
#include "slcompress.h"
#include "lqr.h"
#include "hdlc.h"
#include "ipcp.h"
#include "modem.h"
#ifndef NOALIAS
#include "alias_cmd.h"
#endif
#include "lqr.h"
#include "hdlc.h"
#include "systems.h"
#include "filter.h"
#include "descriptor.h"
@ -126,7 +126,7 @@
#define NEG_DNS 50
const char Version[] = "2.0";
const char VersionDate[] = "$Date: 1998/08/07 18:42:48 $";
const char VersionDate[] = "$Date: 1998/08/25 17:48:42 $";
static int ShowCommand(struct cmdargs const *);
static int TerminalCommand(struct cmdargs const *);

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ip.c,v 1.50 1998/08/07 18:42:48 brian Exp $
* $Id: ip.c,v 1.51 1998/08/25 17:48:42 brian Exp $
*
* TODO:
* o Return ICMP message for filterd packet
@ -493,35 +493,37 @@ ip_Input(struct bundle *bundle, struct mbuf * bp)
mbuf_Free(bp);
}
static struct mqueue IpOutputQueues[PRI_FAST + 1];
void
ip_Enqueue(int pri, char *ptr, int count)
ip_Enqueue(struct ipcp *ipcp, int pri, char *ptr, int count)
{
struct mbuf *bp;
bp = mbuf_Alloc(count, MB_IPQ);
memcpy(MBUF_CTOP(bp), ptr, count);
mbuf_Enqueue(&IpOutputQueues[pri], bp);
if (pri < 0 || pri > sizeof ipcp->Queue / sizeof ipcp->Queue[0])
log_Printf(LogERROR, "Can't store in ip queue %d\n", pri);
else {
bp = mbuf_Alloc(count, MB_IPQ);
memcpy(MBUF_CTOP(bp), ptr, count);
mbuf_Enqueue(&ipcp->Queue[pri], bp);
}
}
void
ip_DeleteQueue()
ip_DeleteQueue(struct ipcp *ipcp)
{
struct mqueue *queue;
for (queue = IpOutputQueues; queue < IpOutputQueues + PRI_MAX; queue++)
for (queue = ipcp->Queue; queue < ipcp->Queue + PRI_MAX; queue++)
while (queue->top)
mbuf_Free(mbuf_Dequeue(queue));
}
int
ip_QueueLen()
ip_QueueLen(struct ipcp *ipcp)
{
struct mqueue *queue;
int result = 0;
for (queue = &IpOutputQueues[PRI_MAX]; queue >= IpOutputQueues; queue--)
for (queue = ipcp->Queue; queue < ipcp->Queue + PRI_MAX; queue++)
result += queue->qlen;
return result;
@ -530,14 +532,15 @@ ip_QueueLen()
int
ip_FlushPacket(struct link *l, struct bundle *bundle)
{
struct ipcp *ipcp = &bundle->ncp.ipcp;
struct mqueue *queue;
struct mbuf *bp;
int cnt;
if (bundle->ncp.ipcp.fsm.state != ST_OPENED)
if (ipcp->fsm.state != ST_OPENED)
return 0;
for (queue = &IpOutputQueues[PRI_FAST]; queue >= IpOutputQueues; queue--)
for (queue = &ipcp->Queue[PRI_FAST]; queue >= ipcp->Queue; queue--)
if (queue->top) {
bp = mbuf_Dequeue(queue);
if (bp) {
@ -547,7 +550,7 @@ ip_FlushPacket(struct link *l, struct bundle *bundle)
if (!(FilterCheck(pip, &bundle->filter.alive) & A_DENY))
bundle_StartIdleTimer(bundle);
vj_SendFrame(l, bp, bundle);
ipcp_AddOutOctets(&bundle->ncp.ipcp, cnt);
ipcp_AddOutOctets(ipcp, cnt);
return 1;
}
}

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ip.h,v 1.9 1998/05/21 21:45:40 brian Exp $
* $Id: ip.h,v 1.10 1998/08/25 17:48:42 brian Exp $
*
*/
@ -28,7 +28,7 @@ struct bundle;
extern int ip_FlushPacket(struct link *, struct bundle *);
extern int PacketCheck(struct bundle *, char *, int, struct filter *);
extern void ip_Enqueue(int, char *, int);
extern void ip_Enqueue(struct ipcp *, int, char *, int);
extern void ip_Input(struct bundle *, struct mbuf *);
extern void ip_DeleteQueue(void);
extern int ip_QueueLen(void);
extern void ip_DeleteQueue(struct ipcp *);
extern int ip_QueueLen(struct ipcp *);

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ipcp.c,v 1.62 1998/06/27 23:48:45 brian Exp $
* $Id: ipcp.c,v 1.63 1998/08/07 18:42:49 brian Exp $
*
* TODO:
* o More RFC1772 backward compatibility
@ -55,12 +55,12 @@
#include "iplist.h"
#include "throughput.h"
#include "slcompress.h"
#include "lqr.h"
#include "hdlc.h"
#include "ipcp.h"
#include "filter.h"
#include "descriptor.h"
#include "vjcomp.h"
#include "lqr.h"
#include "hdlc.h"
#include "async.h"
#include "ccp.h"
#include "link.h"
@ -375,6 +375,7 @@ ipcp_Init(struct ipcp *ipcp, struct bundle *bundle, struct link *l,
ipcp->peer_ifip.s_addr = INADDR_ANY;
throughput_init(&ipcp->throughput);
memset(ipcp->Queue, '\0', sizeof ipcp->Queue);
ipcp_Setup(ipcp);
}

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ipcp.h,v 1.18.2.28 1998/05/21 01:26:10 brian Exp $
* $Id: ipcp.h,v 1.19 1998/05/21 21:45:49 brian Exp $
*
* TODO:
*/
@ -91,6 +91,7 @@ struct ipcp {
struct in_addr peer_ifip; /* My congigured destination address */
struct pppThroughput throughput; /* throughput statistics */
struct mqueue Queue[PRI_FAST + 1]; /* Output packet queues */
};
#define fsm2ipcp(fp) (fp->proto == PROTO_IPCP ? (struct ipcp *)fp : NULL)

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mp.c,v 1.13 1998/08/07 18:42:50 brian Exp $
* $Id: mp.c,v 1.14 1998/08/25 17:48:42 brian Exp $
*/
#include <sys/types.h>
@ -53,11 +53,11 @@
#include "iplist.h"
#include "throughput.h"
#include "slcompress.h"
#include "lqr.h"
#include "hdlc.h"
#include "ipcp.h"
#include "auth.h"
#include "lcp.h"
#include "lqr.h"
#include "hdlc.h"
#include "async.h"
#include "ccp.h"
#include "link.h"

View File

@ -2,7 +2,7 @@
* The code in this file was written by Eivind Eklund <perhaps@yes.no>,
* who places it in the public domain without restriction.
*
* $Id: alias_cmd.c,v 1.15 1998/06/27 14:17:23 brian Exp $
* $Id: alias_cmd.c,v 1.16 1998/06/27 14:17:59 brian Exp $
*/
#include <sys/types.h>
@ -31,10 +31,10 @@
#include "slcompress.h"
#include "throughput.h"
#include "iplist.h"
#include "ipcp.h"
#include "mbuf.h"
#include "lqr.h"
#include "hdlc.h"
#include "mbuf.h"
#include "ipcp.h"
#include "lcp.h"
#include "ccp.h"
#include "link.h"

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: prompt.c,v 1.10 1998/08/07 18:42:50 brian Exp $
* $Id: prompt.c,v 1.11 1998/08/09 15:34:11 brian Exp $
*/
#include <sys/param.h>
@ -53,12 +53,12 @@
#include "iplist.h"
#include "throughput.h"
#include "slcompress.h"
#include "ipcp.h"
#include "filter.h"
#include "mbuf.h"
#include "lqr.h"
#include "hdlc.h"
#include "ipcp.h"
#include "filter.h"
#include "async.h"
#include "mbuf.h"
#include "ccp.h"
#include "link.h"
#include "physical.h"

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: slcompress.c,v 1.18 1998/06/15 19:06:24 brian Exp $
* $Id: slcompress.c,v 1.19 1998/06/27 12:03:50 brian Exp $
*
* Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:
* - Initial distribution.
@ -45,10 +45,10 @@
#include "fsm.h"
#include "throughput.h"
#include "iplist.h"
#include "ipcp.h"
#include "filter.h"
#include "lqr.h"
#include "hdlc.h"
#include "ipcp.h"
#include "filter.h"
#include "lcp.h"
#include "ccp.h"
#include "link.h"