
SUMMARY OF HDLC
---------------

	In HDLC procedures, the normal cycle of the code transparent data
communication between two data stations consists of the transfer of frames
containing information from the data source to data link, acknowledged by
a fram in the opposite direction. Until the data terminal equipment (DTE)
comprising the data source receives the reply, it must hold the original
information in memory in case the need should arise for retransmissions.
	For the transfer of data, two cases of data link control are considered
: In the first case, the DTE comprising the data source performs a primary data
link control function and controls the DTE comprising the data sink that is 
associated with a secondary data link control function, by select type commands.
In the second case, the DTE comprising the data sink performs a primary data
link control function and controls the DTE comprising the data source that is
associated with a secondary data link control function, by poll-type commands.

OPERATIONAL MODES :
	There are two operational modes are defined for secondary stations;
normal response mode (NRM) and asynchronous response mode (ARM). NRM is an
operational mode in which the secondary may initiate transmission only as the
result of receiving explicit permission to do so from the primary. ARM is an
operational mode in which the secondary may initiate transmission without 
receiving explicit permission from the primary. Such an asynchronous 
transmission may contain single or multiple frames and is used for information
field transfer and/or indicate status changes in yhe secondary.

CONTROL FIELDS :
	There are three control field formats : information transfer format
(I-format), supervisory format (S-format) and Unnumbered format (U-format).
	The I-format is used to perform an information transfer. Bit "0" of
the I-frame is always a 0; the next three bits is the transmitting send
sequence number (N(S) = 000 through 111); the next bit is P/F (Poll bit : 
primary transmissions, Final bit : secondary transmissions), which is the same
for the other two formats; the last three bits is the transmitting receive
sequence number (N(R) = 000 through 111).
	The S-format is used to perform link supervisory control function such
as acknowlege I-frames, request retransmission of I-frames, and to request a
temporary suspension of transmission of I-frames. Bits "0" and "1" of the 
S-frame are always a 1 and a 0; the next two bits is the supervisory function
bits (S = 00 through 11); the last three bits is N(R) and is the same as in
the I-frame.
	The U-format is used to provide additional link control functions, and
this format contains no sequence number. Bits "0" and "1" of the U-frame are
always a 1 and a 1; the next two bits and the last three bits is the modifier
function bits (M). 

PARAMETERS :
	There are various parameters associated with the control field formats,
and are describing in the following sub-clauses.
	Modulus : Each I-frame is sequentially numbered and may have value 0
through MODULUS minus ONE (where MODULUS is the modulus of the sequence number).
	Frame variables and sequence numbers : In HDLC operation, each data 
station maintains an independent send sequence number N(S) and receive sequence
number N(R) on the I-frame it sends and receives.
	Send state variables V(S) : V(S) denotes the sequence number of the
next in sequence I-frame to be transmitted and may have value 0 through MODULUS
minus ONE (where MODULUS is the modulus of the sequence numbering scheme and
the number cycle through the entire range).
	Send sequence number N(S) : Only I-frames contain N(S), the send
sequence number of the transmitted frames. Prior to transmission of an 
in-sequence I-frame, N(S) is updated to equals to V(S).
	Receive state variables V(R) : V(R) denotes the sequence number of the
next in-sequence I-frame to be received.
	Poll/Final bit (P/F) : The poll bit is used by primary to solicit (poll)
a response or sequence of responses from secondaries. The final bit is used by
a secondary in two cases; in NRM to indicate the final frame transmitted as the
result of a previous soliciting (poll) command; in ARM to indicate the response
frame transmitted as the result of a soliciting (poll) command.

DATA LINK CHANNEL STATES :
	The data link channel states are classified as active channel state and
idle channel state. Active channel state is when a channel is in an ACTIVE
condition; in this state, aborting a frame is accomplished by transmitting at
least seven contigous one bits (with non-inserted zeroes); interframe time fill
is accomplished by transmitting continuous flags between frames. Idle channel
state is when a channel is in an IDLE condition.

FUNCTIONS OF P/F BIT :
	The P/F bit serves a function in both command frames and response
frames. In command frames, the P/F bit is refered to as P bit. In response
frames it is refered to as the F bit.
	In NRM, the P bit is set to "1" to solicit response frames from the
secondary. In ARM, I-frames can be transmitted by the secondary on an
asynchronous basis; the P bit zero set to "1" is used to solicit response, at
the eariest opportunity, with the F bit set to "1".
	In NRM, the secondary must set F bit to "1" in the last frame of its
response. In ARM, the secondary will transmit a response frame with the F bit
set to "1" only in response to a received command frame with the P bit set to
"1".
	The P/F bit can also be used to assist in error recovery.

COMMANDS AND RESPONSES :
	The set of commands and responses for each of the control field formats
are listed below. (assume that left bit is low and right bit is high)

	Supervisory format commands (when P/F is poll) :
		RR - Receive Ready (when S = 00).
		RNR - Receive Not Ready (when S = 01).
		REJ - Reject (when S = 10).
		SREJ - Selective Reject (when S = 11).

	Unnumbered format commands :
		SNRM - Set Normal Response Mode (1111P000).
		SARM - Set Asynchronous Response Mode (1100P001).
		DISC - Disconnect (1100P010).
		SNRME - Set Normal Response Mode Extended (1111P010).
		SARME - Set Asynchronous Response Mode Extended (1111P011).

	Supervisory format responses (when P/F bit is final) :
		RR - Receive Ready (when S = 00).
		RNR - Receive Not Ready (when S = 01).
		REJ - Reject (when S = 10).
		SREJ - Selective Reject (when S = 11).

	Unnumbered format responses :
		UA - Unnumbered Acknowledge (1100F110).
		CMDR - Command Reject (1110F001).
