1 | |
---|
2 | /* |
---|
3 | * ====================================================================== |
---|
4 | * Rappture::encoding |
---|
5 | * |
---|
6 | * AUTHOR: Derrick Kearney, Purdue University |
---|
7 | * |
---|
8 | * Copyright (c) 2004-2007 Purdue Research Foundation |
---|
9 | * ---------------------------------------------------------------------- |
---|
10 | * See the file "license.terms" for information on usage and |
---|
11 | * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
12 | * ====================================================================== |
---|
13 | */ |
---|
14 | |
---|
15 | #ifndef RP_ENCODE_H |
---|
16 | #define RP_ENCODE_H |
---|
17 | |
---|
18 | #include <RpOutcome.h> |
---|
19 | #include <RpBuffer.h> |
---|
20 | |
---|
21 | namespace Rappture { |
---|
22 | namespace encoding { |
---|
23 | |
---|
24 | enum RapptureEncodingFlags { |
---|
25 | RPENC_Z =(1<<0), /* Compress/Decompress the string. */ |
---|
26 | RPENC_B64=(1<<1), /* Base64 encode/decode the string. */ |
---|
27 | RPENC_HDR=(1<<2), /* Placebo. Header is by default added. */ |
---|
28 | RPENC_RAW=(1<<3) /* Treat the string as raw input. |
---|
29 | * Decode: ignore the header. |
---|
30 | * Encode: don't add a header. |
---|
31 | */ |
---|
32 | }; |
---|
33 | |
---|
34 | bool isBinary(const char* buf, int size); |
---|
35 | bool isBase64(const char* buf, int size); |
---|
36 | bool isGzipped(const char* buf, int size); |
---|
37 | unsigned int headerFlags(const char* buf, int size); |
---|
38 | bool encode(Rappture::Outcome &err, Rappture::Buffer& buf, unsigned int flags); |
---|
39 | bool decode(Rappture::Outcome &err, Rappture::Buffer& buf, unsigned int flags); |
---|
40 | |
---|
41 | } |
---|
42 | } |
---|
43 | #endif /*RP_ENCODE_H*/ |
---|