/* * This routine purges all the queues of frames.
*/ void lapb_clear_queues(struct lapb_cb *lapb)
{
skb_queue_purge(&lapb->write_queue);
skb_queue_purge(&lapb->ack_queue);
}
/* * This routine purges the input queue of those frames that have been * acknowledged. This replaces the boxes labelled "V(a) <- N(r)" on the * SDL diagram.
*/ void lapb_frames_acked(struct lapb_cb *lapb, unsignedshort nr)
{ struct sk_buff *skb; int modulus;
/* * Requeue all the un-ack-ed frames on the output queue to be picked * up by lapb_kick called from the timer. This arrangement handles the * possibility of an empty output queue.
*/ while ((skb = skb_dequeue(&lapb->ack_queue)) != NULL) { if (!skb_prev)
skb_queue_head(&lapb->write_queue, skb); else
skb_append(skb_prev, skb, &lapb->write_queue);
skb_prev = skb;
}
}
/* * Validate that the value of nr is between va and vs. Return true or * false for testing.
*/ int lapb_validate_nr(struct lapb_cb *lapb, unsignedshort nr)
{ unsignedshort vc = lapb->va; int modulus;
while (vc != lapb->vs) { if (nr == vc) return 1;
vc = (vc + 1) % modulus;
}
return nr == lapb->vs;
}
/* * This routine is the centralised routine for parsing the control * information for the different frame formats.
*/ int lapb_decode(struct lapb_cb *lapb, struct sk_buff *skb, struct lapb_frame *frame)
{
frame->type = LAPB_ILLEGAL;
/* * This routine is called when the HDLC layer internally generates a * command or response for the remote machine ( eg. RR, UA etc. ). * Only supervisory or unnumbered frames are processed, FRMRs are handled * by lapb_transmit_frmr below.
*/ void lapb_send_control(struct lapb_cb *lapb, int frametype, int poll_bit, int type)
{ struct sk_buff *skb; unsignedchar *dptr;
if ((skb = alloc_skb(LAPB_HEADER_LEN + 3, GFP_ATOMIC)) == NULL) return;
/* * This routine generates FRMRs based on information previously stored in * the LAPB control block.
*/ void lapb_transmit_frmr(struct lapb_cb *lapb)
{ struct sk_buff *skb; unsignedchar *dptr;
if ((skb = alloc_skb(LAPB_HEADER_LEN + 7, GFP_ATOMIC)) == NULL) return;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.