Transmission over LAPD

           The basic unit of transmission in LAPD is called a Frame. A Frame consists of the following fields:

                         _____________________________
                        |                   F L A G                                 OCTET
                        |   0    1     1     1     1      1     1     0                  1
                        |             A D D R E S S                                   2
                        |...........................................................
                        |
                        |               C O NT R O L                                 3
                        |...........................................................
                        |
                        |            I N F O R M A T I O N                   N-2
                        |...........................................................
                        |        F R A M E     C H E C K                     N-1
                        |      S E Q U E N C E   [ FCS ]          
                        |                 F L A G                                         N
                        |     0     1      1     1     1     1      1    0  
 
 
    (i) FLAG  Flag is a constant bit pattern 01111110 (hex 7E).  The flag marks the beginning and the ending of any LAPD frame
.                 By having the flag field as a sequence of bits [1 octet] with combinations of 1's and 0's there could occur a unrecoverable problem when this same pattern occurs in the data part of the frame, it could be in either the address field, control filed or in the information field. This situation could be avoided by ensuring that a bit pattern resembling the flag does not occur in any other fields of the frame. The used in the LAPD is called the Zero-bit insertion and removal (also known as bit stuffing and destuffing).

              Zero-bit insertion is quite simple. while the transmitter is sending a frame,  it counts the number of contiguous 1 bits that it has transmitted. After every fifth contiguous 1, it transmits a 0 bit. Thus, no more than five contiguous 1 bits can ever occur in a frame.
 

     (ii)  CONTROL FIELD :   The control field specifies the type of frame being transmitted. Three kinds of frames are specified by LAPD, indicated by the first 1 or 2 bits in the control field.

            _________________________________________________
           | INFORMATION    |                  N(S)                              |  0   |
           |                                  |                  N(R)                              |  P  |
           | SUPERVISORY  |     X      X      X      X   |   S     S    0   | 1  |
           |                               |                    N(R)                              | P/F|
           | UNNUMBERED|     M      M     M  |P/F|  M    M   |  1     1  |

       * Information (I) frames.  carry  data from higher layers (signaling or user data).  The two octet control field contains the sequence number of this I-frame [N(S)] and the sequence number of the next expected I-frame      from the other station on the link [N(R)].
       * Supervisory (S) frames.  Control the exchange of I-frames. S-frames are used to send acknowledgments, flow control indications, and receipt of out-of-sequence I-frames. The two-octet control field also carries the sequence number of the next expected I-frame N(R). The supervisory function (SS)      bits specify the type of S-frame.
       * Unnumbered (U) frames.  used to establish and terminate a logical link connection, exchange non sequenced information, negotiate data link layer parameters, and indicate certain error conditions that cannot be corrected by retransmission. There is no sequencing associated with the U-frames and the control field is a single octet. The modifier function (MMMMM) bits specify the type of U frame.

     (iii)  ADDRESS  FIELD    The address, called the Data link Connection identifier (DLCI), is 13 bits in length and comprises two sub fields, the> Terminal endpoint identifier (TEI) and the Service access point identifier (SAPI).
 
                    8         7        6        5       4        3       2         1
                _______________________________________      octet
               |              S A P I                                  |  c/r  |  ea0 |      2
               |              T E I                                               |  ea1 |      3

      ea   -    address field extension bit  (0 or 1)
      c/r  -    command/response bit
 
                 The  Service access point (SAP) is the conceptual interface between  two adjacent protocol layers. Primitives exchanged across a SAP are instructions that allow a higher protocol layer to access services provided by its adjacent lower layer.
Any ISDN TE is capable of supporting more than one layer 3 process, like the process to send ISDN signaling messages, the process to service ISDN operations, administration, and maintenance (OAM) messages, and the process to send packet-mode user data. Each of  these layer 3 process at the TE must communicate with a peer process at the LE.
               Each layer 3 process at the TE will maintain a separate logical link over the D-channel to its peer process in the LE. To distinguish between different layer 3 processes, each is addressed by a service access point identifier.
               Services available in one TE may be the same as services available at nother TE; thus, the SAPI alone cannot differentiate one logical link form another. The terminal endpoint identifier is assigned to a TE inorder to differentiate one from the other. So the SAPI and TEI form a unique address
     identifying a specific logical link to a specific process and terminal.