/*-------------------------------------------------------------*/ /*************************************************************** * A mixed string permits to represent data as a clear form * * using hexadecimal and text. * * Hexadecimal is used without "0x" or "0h" * * Text is included between apostrophes "'" * * The character ' is '' * * For example : * * 'hello' : data "hello" * * 'a' 'b' : data "ab" * * 41 'b' : data "Ab" (because 'A'==0x41) * * 'man'00 : data "man" ending with 0x00 * * 'a''b' : data "a'b" * * Real examples : * * 'hello' 0D 0A 'this is after a newline' * * 'one' 09 'two' 0D 0A * ***************************************************************/ /*-------------------------------------------------------------*/ typedef enum { NETWIB_DECODETYPE_DATA = 1, /* exact data */ NETWIB_DECODETYPE_HEXA, /* hexadecimal */ NETWIB_DECODETYPE_MIXED, /* mixed */ NETWIB_DECODETYPE_BASE64 /* base64 */ } netwib_decodetype; /*-------------------------------------------------------------*/ /* Name : netwib_buf_decode Description : Append a decoded buffer. Input parameter(s) : *pbuftodecode : buffer to decode decodetype : decoding type Input/output parameter(s) : *pbuf : netwib_buf updated Output parameter(s) : Normal return values : NETWIB_ERR_OK : ok */ netwib_err netwib_buf_decode(netwib_constbuf *pbuftodecode, netwib_decodetype decodetype, netwib_buf *pbuf);