first commit
This commit is contained in:
82
include/framework/ascii/ascii_encoder.h
Normal file
82
include/framework/ascii/ascii_encoder.h
Normal file
@ -0,0 +1,82 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef __NASCIIENC__
|
||||
#define __NASCIIENC__
|
||||
|
||||
|
||||
#include "ntypes.h"
|
||||
|
||||
|
||||
/*!
|
||||
@short ASCII encoding.
|
||||
|
||||
This class currently provide two commonly used encoding method:
|
||||
yEnc and UUEncode.
|
||||
|
||||
@author Emmanuel Julien (ejulien@gsworks.fr)
|
||||
*/
|
||||
namespace nAsciiEncoder
|
||||
{
|
||||
/*!
|
||||
@short Perform UUEncoding.
|
||||
|
||||
@param source Input binary stream.
|
||||
@param len Input binary stream length.
|
||||
@param uuenc Output buffer.
|
||||
@param max Output buffer length.
|
||||
@return The number of bytes written to the output buffer.
|
||||
|
||||
@note If yenc is NULL the function can be used to check the size
|
||||
of the encoded stream prior to allocating an output buffer.
|
||||
*/
|
||||
uint UUEncode(const uchar *source, size_t len, uchar *uuenc = 0, size_t max = 0);
|
||||
|
||||
/*!
|
||||
@short Perform UUDecoding.
|
||||
|
||||
@param source UUEncoded byte stream.
|
||||
@param len UUEncoded byte stream length.
|
||||
@param bin Output buffer.
|
||||
@param max Output buffer length.
|
||||
@return The number of bytes written to the output buffer.
|
||||
|
||||
@note If bin is NULL the function can be used to check the size
|
||||
of the decoded stream prior to allocating an output buffer.
|
||||
*/
|
||||
uint UUDecode(const uchar *source, size_t len, uchar *bin = 0, size_t max = 0);
|
||||
/*!
|
||||
@short Perform yEncoding.
|
||||
|
||||
@param source Input binary stream.
|
||||
@param len Input binary stream length.
|
||||
@param yenc Output buffer.
|
||||
@param max Output buffer length.
|
||||
@param line_len Number of character to output before a line-feed character is sent.
|
||||
@return The number of bytes written to the output buffer.
|
||||
|
||||
@note If yenc is NULL the function can be used to check the size
|
||||
of the encoded stream prior to allocating an output buffer.
|
||||
*/
|
||||
uint yEncode(const uchar *source, size_t len, uchar *yenc = 0, size_t max = 0, uint line_len = 64);
|
||||
|
||||
/*!
|
||||
@short Perform yDecoding.
|
||||
|
||||
@param source yEncoded byte stream.
|
||||
@param len yEncoded byte stream length.
|
||||
@param bin Output buffer.
|
||||
@param max Output buffer length.
|
||||
@return The number of bytes written to the output buffer.
|
||||
|
||||
@note If bin is NULL the function can be used to check the size
|
||||
of the decoded stream prior to allocating an output buffer.
|
||||
*/
|
||||
uint yDecode(const uchar *source, size_t len, uchar *bin = 0, size_t max = 0);
|
||||
};
|
||||
|
||||
|
||||
#endif // __NASCIIENC__
|
||||
Reference in New Issue
Block a user