Produce a C module to encode and decode HDLC packets.
Note: Sometimes I am very busy or travelling for a few days, so I may not respond straightaway. Usually I respond within 24 hours. I am based in England.
NOTES
An item marked MUST: is a definite requirement of this project.
An item marked 'INFO:' is to give you some background information.
An item marked 'WISH:' means that an item would be good but not essential.
An item marked 'MAY:' means its optional.
THE PROJECT
INFO: To provide a hdlc link over rs232. Both ends will run the same encode/decode C code. No other equipment is connected. This protocol will only run within my machines
MUST: Write in C. C++ is NOT acceptable.
MUST: The HDLC must use Asynchronous framing (to be able to send over RS232).
MAY: You may use open source.
MUST: Addressing: Destination addresses should be 32 bit minimum.
WISH: If possible source addressing should be provided. Preferably 32 bit min. Prefeably an option.
WISH: To be able to change adressing length eg 16 24 or 32 bit
MUST: Only one frame type is needed. (I think its the I-frame)
INFO: This is to send application data from one machine to another, over RS232.
MUST: The code must be lightweight and easy to use. There should be a small number of source files.
WISH: Total size less than 5000 lines of source.
MUST: The code must be commented OR at least a simple wrapper or API must be commented.
MUST: I want to test the code on a PC. I prefer Borland CPPB. MS VS is ok.
MUST: You should deliver a PC IDE project to demonstrate the encode / decode. Various examples of decode/encode should be provided.
MUST: The code must be able to run on an 8 bit micro with small memory , eg 30K ROMflash and 20K RAM.
MUST: There should be no mallocs apart from at init time.
MUST: I need a simple API to the code.
MUST: Testing shall be be sending one byte at a time from one function to another.
MUST: Random data should be generated to test the receiver
MORE INFO ATTACHED - SEE OTHER FILE
## Deliverables
FULL VERSION
Produce a C module to encode and decode HDLC packets.
Note: Sometimes I am very busy or travelling for a few days, so I may not respond straightaway. Usually I respond within 24 hours. I am based in England.
NOTES
An item marked MUST: is a definite requirement of this project.
An item marked 'INFO:' is to give you some background information.
An item marked 'WISH:' means that an item would be good but not essential.
An item marked 'MAY:' means its optional.
THE PROJECT
INFO: To provide a hdlc link over rs232. Both ends will run the same encode/decode C code. No other equipment is connected. This protocol will only run within my machines
MUST: Write in C. C++ is NOT acceptable.
MUST: The HDLC must use Asynchronous framing (to be able to send over RS232).
MAY: You may use open source.
MUST: Addressing: Destination addresses should be 32 bit minimum.
WISH: If possible source addressing should be provided. Preferably 32 bit min. Prefeably an option.
WISH: To be able to change adressing length eg 16 24 or 32 bit
MUST: Only one frame type is needed. (I think its the I-frame)
INFO: This is to send application data from one machine to another, over RS232.
MUST: The code must be lightweight and easy to use. There should be a small number of source files.
WISH: Total size less than 5000 lines of source.
MUST: The code must be commented OR at least a simple wrapper or API must be commented.
MUST: I want to test the code on a PC. I prefer Borland CPPB. MS VS is ok.
MUST: You should deliver a PC IDE project to demonstrate the encode / decode. Various examples of decode/encode should be provided.
MUST: The code must be able to run on an 8 bit micro with small memory , eg 30K ROMflash and 20K RAM.
MUST: There should be no mallocs apart from at init time.
MUST: I need a simple API to the code.
MUST: Testing shall be be sending one byte at a time from one function to another.
MUST: The test should encode frames then send them one byte at a time to a receiver function which handleds one byte at a time. The receiver should handle the bytes received one at a time and decode the hdlc data correctly.
MUST: Random data should be generated to test the receiver
e.g.
int x=0;
for (int i=0; i < N; i++)
{
x = rand() & 0xFF;
HdlcReceiveChar(x);
}
MUST: The project will include a test.c file which does something like this:
1. Init
2 good frames
Create test frame
send test frame
receive test frame
repeat 2 with different test data
3. currupt a frame and test error checking
INFO: This is the sort of API I need. This is just an example.
byte HdlcInit(void);
typedef byte THdlcAddress;
typedef unsigned char THdlcFrame ;
unsigned int HdlcCalcCRC(THdlcFrame *Frame);
int HdlcFrameEncode(THdlcFrame *Frame, byte Type, THdlcAddress *Source, THdlcAddress *Dest, byte *Data, int Length);
int HdlcFrameGetLength(THdlcFrame *Frame);
byte HdlcFrameValidate(THdlcFrame *Frame);
byte HdlcFrameIsValid(THdlcFrame *Frame) ;
char *HdlcAddrToStr(byte *Addr, char *s) ;
char *DecodeFrameToStr(THdlcFrame *Frame);
int HdlcTestFrame( char *msg );
int Hdlctest(void);
// RECEIVER
byte HdlcReceiveByte(int c);
// RECEIVER CALLS THIS WHEN A VALID FRAME IS RECEIVED
void HdlcHandoffFrame(TOspFrame *Frame)
int HdlcGetErrors(void);
int HdlcGetFrameStarts(void);
int HdlcGetGoodFrameCount(void);
int HdlcGetBadLengths(void);