求助HDLC源代码,各位仁兄谁有HDLC源代码阿,能否送小弟一份,不胜感激阿。我现在急着要用阿,如坐针毡。谢谢了。
[email protected]

解决方案 »

  1.   

    这里有个HDLC的分析软件
    http://www.gl.com/hdlc.html
      

  2.   

    HDLC的帧结构:
    The High Level Data Link Control (HDLC) protocol was developed by ISO and is based primarily on the pioneering work done by IBM on SDLC. The format of a standard HDLC frame is as follows:Flag 
     Address field 
     Control field 
     Information 
     FCS 
     Flag 
     
    HDLC frame structure Flag
    The value of the flag is always (0x7E). In order to ensure that the bit pattern of the frame delimiter flag does not appear in the data field of the frame (and therefore cause frame misalignment), a technique known as Bit Stuffing is used by both the transmitter and the receiver.Address field
    The first byte of the frame after the header flag is known as the Address Field. HDLC is used on multipoint lines and it can support as many as 256 terminal control units or secondary stations per line. The address field defines the address of the secondary station which is sending the frame or the destination of the frame sent by the primary station.Control field
    The field following the Address Field is called the Control Field and serves to identify the type of the frame. In addition, it includes sequence numbers, control features and error tracking according to the frame type.Every frame holds a one bit field called the Poll/Final bit. In the NRM mode of HDLC this bit signals which side is ‘talking’, and provides control over who will speak next and when. When a primary station has finished transmitting a series of frames, it sets the Poll bit, thus giving control to the secondary station. At this time the secondary station may reply to the primary station. When the secondary station finishes transmitting its frames, it sets the Final bit and control returns to the primary station.Modes of operation
    HDLC has 3 modes of operation according to the strength of the master/slave relationship. This is determined by a unique frame type specifier: Normal Response Mode (NRM): This mode is totally master/slave and is signified by the SNRM(E) frame. The primary station initiates the session and full polling is used for all frame transmissions. 
    Asynchronous Response Mode (ARM): This mode is similar to NRM and is signified by the SARM(E) frame. The difference, however, is that secondary stations can transmit freely without waiting for a poll. 
    Asynchronous Balanced Mode (ABM): This mode is totally balanced (i.e., no master/slave relationship) and is signified by the SABM(E) frame. Each station can initialize, supervise, recover from errors and send frames at any time. 
    FCS
    The Frame Check Sequence (FCS) enables a high level of physical error control by allowing the integrity of the transmitted frame data to be checked. The sequence is first calculated by the transmitter using an algorithm based on the values of all the bits in the frame. The receiver then performs the same calculation on the received frame and compares its value to the CRC.Window size
    HDLC supports an extended window size (modulo 128) where the number of possible outstanding frames for acknowledgement is raised from 8 to 128. This extension is generally used for satellite transmissions where the acknowledgement delay is significantly greater than the frame transmission times. The type of the link initialization frame determines the modulo of the session and an "E" is added to the basic frame type name (e.g., SABM becomes SABME).Extended address
    HDLC provides another type of extension to the basic format. The address field may be extended to more than one byte by agreement between the involved parties. When an address extension is used, the presence of a 1 bit in the first bit of an address byte indicates that the following byte is also an address byte. The last byte of the string of address bytes is signalled by a 0 bit in the first position of the byte.Frame types
    The following are the Supervisory Frame Types in HDLC: RR Information frame acknowledgement and indication to receive more. 
    REJ Request for retransmission of all frames after a given sequence number. 
    RNR  Indicates a state of temporary occupation of station (e.g., window full). 
    SREJ  Request for retransmission of one given frame sequence number. 
    The following are the Unnumbered Frame Types in HDLC: 
    DISC  Request disconnection. 
    UA  Acknowledgement frame. 
    DM  Response to DISC indicating disconnected mode. 
    FRMR Frame reject. 
    SABM Initiator for asynchronous balanced mode. No master/slave relationship. 
    SABME  SABM in extended mode. 
    SARM Initiator for asynchronous response mode. Semi master/slave relationship. 
    SARME  SAMR in extended mode. 
    REST  Reset sequence numbers. 
    CMDR  Command reject. 
    SNRM Initiator for normal response mode. Full master/slave relationship. 
    SNRME  SNRM in extended mode. 
    RD  Request disconnect. 
    RIM  Secondary station request for initialization after disconnection. 
    SIM  Set initialization mode. 
    UP Unnumbered poll. 
    UI  Unnumbered information. Sends state information/data. 
    XID Identification exchange command. 
    There is one Information Frame Type in HDLC: 
    Info Information frame.