void link_DeleteQueue(struct link *l) { struct mqueue *queue, *highest; highest = LINK_HIGHQ(l); for (queue = l->Queue; queue <= highest; queue++) while (queue->top) m_freem(m_dequeue(queue)); }
void link_SequenceQueue(struct link *l) { struct mqueue *queue, *highest; log_Printf(LogDEBUG, "link_SequenceQueue\n"); highest = LINK_HIGHQ(l); for (queue = l->Queue; queue < highest; queue++) while (queue->len) m_enqueue(highest, m_dequeue(queue)); }
/* * Ditch all queued packets. This is usually done after our choked timer * has fired - which happens because we couldn't send any traffic over * any links for some time. */ void ncp_DeleteQueues(struct ncp *ncp) { #ifndef NOINET6 struct ipv6cp *ipv6cp = &ncp->ipv6cp; #endif struct ipcp *ipcp = &ncp->ipcp; struct mp *mp = &ncp->mp; struct mqueue *q; for (q = ipcp->Queue; q < ipcp->Queue + IPCP_QUEUES(ipcp); q++) while (q->top) m_freem(m_dequeue(q)); #ifndef NOINET6 for (q = ipv6cp->Queue; q < ipv6cp->Queue + IPV6CP_QUEUES(ipv6cp); q++) while (q->top) m_freem(m_dequeue(q)); #endif link_DeleteQueue(&mp->link); /* Usually empty anyway */ }
struct mbuf * link_Dequeue(struct link *l) { int pri; struct mbuf *bp; for (bp = NULL, pri = LINK_QUEUES(l) - 1; pri >= 0; pri--) if (l->Queue[pri].len) { bp = m_dequeue(l->Queue + pri); log_Printf(LogDEBUG, "link_Dequeue: Dequeued from queue %d," " containing %lu more packets\n", pri, (u_long)l->Queue[pri].len); break; } return bp; }
int ipv6cp_PushPacket(struct ipv6cp *ipv6cp, struct link *l) { struct bundle *bundle = ipv6cp->fsm.bundle; struct mqueue *queue; struct mbuf *bp; int m_len; u_int32_t secs = 0; unsigned alivesecs = 0; if (ipv6cp->fsm.state != ST_OPENED) return 0; /* * If ccp is not open but is required, do nothing. */ if (l->ccp.fsm.state != ST_OPENED && ccp_Required(&l->ccp)) { log_Printf(LogPHASE, "%s: Not transmitting... waiting for CCP\n", l->name); return 0; } queue = ipv6cp->Queue + IPV6CP_QUEUES(ipv6cp) - 1; do { if (queue->top) { bp = m_dequeue(queue); bp = mbuf_Read(bp, &secs, sizeof secs); bp = m_pullup(bp); m_len = m_length(bp); if (!FilterCheck(MBUF_CTOP(bp), AF_INET6, &bundle->filter.alive, &alivesecs)) { if (secs == 0) secs = alivesecs; bundle_StartIdleTimer(bundle, secs); } link_PushPacket(l, bp, bundle, 0, PROTO_IPV6); ipv6cp_AddOutOctets(ipv6cp, m_len); return 1; } } while (queue-- != ipv6cp->Queue); return 0; }