/* * 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 nr_frames_acked(struct sock *sk, unsignedshort nr)
{ struct nr_sock *nrom = nr_sk(sk); struct sk_buff *skb;
/* * Remove all the ack-ed frames from the ack queue.
*/ if (nrom->va != nr) { while (skb_peek(&nrom->ack_queue) != NULL && nrom->va != nr) {
skb = skb_dequeue(&nrom->ack_queue);
kfree_skb(skb);
nrom->va = (nrom->va + 1) % NR_MODULUS;
}
}
}
/* * Requeue all the un-ack-ed frames on the output queue to be picked * up by nr_kick called from the timer. This arrangement handles the * possibility of an empty output queue.
*/ void nr_requeue_frames(struct sock *sk)
{ struct sk_buff *skb, *skb_prev = NULL;
/* * Validate that the value of nr is between va and vs. Return true or * false for testing.
*/ int nr_validate_nr(struct sock *sk, unsignedshort nr)
{ struct nr_sock *nrom = nr_sk(sk); unsignedshort vc = nrom->va;
while (vc != nrom->vs) { if (nr == vc) return 1;
vc = (vc + 1) % NR_MODULUS;
}
return nr == nrom->vs;
}
/* * Check that ns is within the receive window.
*/ int nr_in_rx_window(struct sock *sk, unsignedshort ns)
{ struct nr_sock *nr = nr_sk(sk); unsignedshort vc = nr->vr; unsignedshort vt = (nr->vl + nr->window) % NR_MODULUS;
while (vc != vt) { if (ns == vc) return 1;
vc = (vc + 1) % NR_MODULUS;
}
return 0;
}
/* * This routine is called when the HDLC layer internally generates a * control frame.
*/ void nr_write_internal(struct sock *sk, int frametype)
{ struct nr_sock *nr = nr_sk(sk); struct sk_buff *skb; unsignedchar *dptr; int len, timeout;
len = NR_TRANSPORT_LEN;
switch (frametype & 0x0F) { case NR_CONNREQ:
len += 17; break; case NR_CONNACK:
len += (nr->bpqext) ? 2 : 1; break; case NR_DISCREQ: case NR_DISCACK: case NR_INFOACK: break; default:
printk(KERN_ERR "NET/ROM: nr_write_internal - invalid frame type %d\n", frametype); return;
}
skb = alloc_skb(NR_NETWORK_LEN + len, GFP_ATOMIC); if (!skb) return;
/* * Space for AX.25 and NET/ROM network header
*/
skb_reserve(skb, NR_NETWORK_LEN);
/* * This routine is called to send an error reply.
*/ void __nr_transmit_reply(struct sk_buff *skb, int mine, unsignedchar cmdflags)
{ struct sk_buff *skbn; unsignedchar *dptr; int len;
len = NR_NETWORK_LEN + NR_TRANSPORT_LEN + 1;
if ((skbn = alloc_skb(len, 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.