python4yahdlc is a Python bindings for the yahdlc library.
To build and make the Python module work, you need the following elements :
- Python 3
- The setuptools package
yum install python3-setuptools
aptitude install python3-setuptools
pip3 install python4yahdlc
git clone https://github.com/SkypLabs/python4yahdlc.git cd python4yahdlc python3 setup.py install
To generate a new HDLC data frame :
from yahdlc import *
frame = frame_data('hello world!')
To generate a new HDLC ACK frame with a specific sequence number :
frame = frame_data('', FRAME_ACK, 3)
The highest sequence number is 7 and the following frame types are available :
- FRAME_DATA
- FRAME_ACK
- FRAME_NACK
Note that when you generate an ACK or NACK frame, the payload is useless.
To decode a received HDLC frame :
data, type, seq_no = get_data(frame)
For a more advanced use, take a look at the examples available in the examples folder.
This project is released under the GPL version 3 license. The yahdlc library is released under the MIT license.