sys/netccitt/llc_subr.c
/*
 * llc_seq2slot() --- We only allocate enough memory to hold the window. This
 * introduces the necessity to keep track of two ``pointers''
 *
 *        o llcl_freeslot     the next free slot to be used
 *                            this one advances modulo llcl_window
 *        o llcl_projvs       the V(S) associated with the next frame
 *                            to be set via llcl_freeslot
 *                            this one advances modulo LLC_MAX_SEQUENCE
 *
 * A new frame is inserted at llcl_output_buffers[llcl_freeslot], after
 * which both llcl_freeslot and llcl_projvs are incremented.
 *
 * The slot sl(sn) for any given sequence number sn is given by
 *
 *        sl(sn) = (llcl_freeslot + llcl_window - 1 - (llcl_projvs +
 *                  LLC_MAX_SEQUENCE- sn) % LLC_MAX_SEQUENCE) % 
 *                  llcl_window 
 *
 * i.e. we first calculate the number of frames we need to ``go back''
 * from the current one (really the next one, but that doesn't matter as
 * llcl_projvs is likewise of by plus one) and subtract that from the
 * pointer to the most recently taken frame (llcl_freeslot - 1).
 */
We only allocate enough memory to hold the window. This
introduces the necessity to keep track of two ``pointers''

o llcl_freeslot     the next free slot to be used
this one advances modulo llcl_window
o llcl_projvs       the V(S) associated with the next frame
to be set via llcl_freeslot
this one advances modulo LLC_MAX_SEQUENCE

A new frame is inserted at llcl_output_buffers[llcl_freeslot], after
which both llcl_freeslot and llcl_projvs are incremented.

The slot sl(sn) for any given sequence number sn is given by




We only allocate enough memory to hold the window . This introduces the necessity to keep track of two ` ` pointers ' ' o llcl_freeslot the next free slot to be used this one advances modulo llcl_window o llcl_projvs the V ( S ) associated with the next frame to be set via llcl_freeslot this one advances modulo LLC_MAX_SEQUENCE A new frame is inserted at llcl_output_buffers [ llcl_freeslot ] after which both llcl_freeslot and llcl_projvs are incremented . The slot sl ( sn ) for any given sequence number sn is given by
short
llc_seq2slot(struct llc_linkcb *linkp, short seqn)
{
	register sn = 0;
	sn = (linkp->llcl_freeslot + linkp->llcl_window - 
	      (linkp->llcl_projvs + LLC_MAX_SEQUENCE - seqn) % 
	      LLC_MAX_SEQUENCE) % linkp->llcl_window;
	return sn;
}
short llc_seq2slot ( struct llc_linkcb * linkp , short seqn ) { register sn = 0 ; sn = ( linkp -> llcl_freeslot + linkp -> llcl_window - ( linkp -> llcl_projvs + LLC_MAX_SEQUENCE - seqn ) % LLC_MAX_SEQUENCE ) % linkp -> llcl_window ; return sn ; }
llc_seq2slot() --- We only allocate enough memory to hold the window.
llc_seq2slot () --- We only allocate enough memory to hold the window .