| GMime Library Reference Manual | |||
|---|---|---|---|
| <<< Previous Page | Home | Up | Next Page >>> |
|
Performs a 'decode step' on a chunk of yEncoded data of length inlen pointed to by in and writes to out. Assumes the =ybegin and =ypart lines have already been stripped off.
To get the crc32 value of the part, use GMIME_YENCODE_CRC_FINAL (pcrc). If there are more parts, you should reuse crc without re-initializing. Once all parts have been decoded, you may get the combined crc32 value of all the parts using GMIME_YENCODE_CRC_FINAL (crc).
| in : | input buffer |
| inlen : | input buffer length |
| out : | output buffer |
| state : | ydecode state |
| pcrc : | part crc state |
| crc : | crc state |
| Returns : | the number of bytes decoded. |
|
Performs an yEncode 'encode step' on a chunk of raw data of length inlen pointed to by in and writes to out.
state should be initialized to GMIME_YENCODE_STATE_INIT before beginning making the first call to this function. Subsequent calls should reuse state.
Along the same lines, pcrc and crc should be initialized to GMIME_YENCODE_CRC_INIT before using.
| in : | input buffer |
| inlen : | input buffer length |
| out : | output buffer |
| state : | yencode state |
| pcrc : | part crc state |
| crc : | crc state |
| Returns : | the number of bytes encoded. |
|
Call this function when finished encoding data with g_mime_yencode_step to flush off the remaining state.
GMIME_YENCODE_CRC_FINAL (pcrc) will give you the crc32 of the encoded "part". If there are more "parts" to encode, you should re-use crc when encoding the next "parts" and then use GMIME_YENCODE_CRC_FINAL (crc) to get the combined crc32 value of all the parts.
| in : | input buffer |
| inlen : | input buffer length |
| out : | output buffer |
| state : | yencode state |
| pcrc : | part crc state |
| crc : | crc state |
| Returns : | the number of bytes encoded. |
struct GMimeFilterYenc {
GMimeFilter parent_object;
GMimeFilterYencDirection direction;
int part;
int state;
guint32 pcrc;
guint32 crc;
}; |
typedef enum {
GMIME_FILTER_YENC_DIRECTION_ENCODE,
GMIME_FILTER_YENC_DIRECTION_DECODE,
} GMimeFilterYencDirection; |
GMimeFilter* g_mime_filter_yenc_new (GMimeFilterYencDirection direction); |
Creates a new yEnc filter.
| direction : | encode direction |
| Returns : | a new yEnc filter. |
void g_mime_filter_yenc_set_state (GMimeFilterYenc *yenc, int state); |
Sets the current state of the yencoder/ydecoder
| yenc : | yEnc filter |
| state : | encode/decode state |
void g_mime_filter_yenc_set_crc (GMimeFilterYenc *yenc, |
Sets the current crc32 value on the yEnc filter yenc to crc.
| yenc : | yEnc filter |
| crc : | crc32 |
|
Get the computed crc or (guint32) -1 on fail.
| yenc : | yEnc filter |
| Returns : | the computed crc or (guint32) -1 on fail. |
|
Get the computed part crc or (guint32) -1 on fail.
| yenc : | yEnc filter |
| Returns : | the computed part crc or (guint32) -1 on fail. |