suricata
util-base64.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2012 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author David Abarbanel <david.abarbanel@baesystems.com>
22  *
23  */
24 
25 #ifndef __UTIL_BASE64_H_
26 #define __UTIL_BASE64_H_
27 
28 #include "suricata-common.h"
29 #include "threads.h"
30 #include "debug.h"
31 #include "decode.h"
32 
33 #include "detect.h"
34 #include "detect-parse.h"
35 
36 #include "detect-engine.h"
37 #include "detect-engine-mpm.h"
38 #include "detect-engine-state.h"
39 
40 #include "flow.h"
41 #include "flow-var.h"
42 #include "flow-util.h"
43 
44 #include "util-debug.h"
45 #include "util-spm-bm.h"
46 
47 /* Constants */
48 #define ASCII_BLOCK 3
49 #define B64_BLOCK 4
50 
51 typedef enum {
53  BASE64_MODE_RFC2045, /* SPs are allowed during transfer but must be skipped by Decoder */
55 } Base64Mode;
56 
57 typedef enum {
61 } Base64Ecode;
62 
63 /* Function prototypes */
64 Base64Ecode DecodeBase64(uint8_t *dest, uint32_t dest_size, const uint8_t *src, uint32_t len,
65  uint32_t *consumed_bytes, uint32_t *decoded_bytes, Base64Mode mode);
66 
67 #endif
68 
69 #ifdef UNITTESTS
70 void Base64RegisterTests(void);
71 #endif
BASE64_ECODE_BUF
@ BASE64_ECODE_BUF
Definition: util-base64.h:60
len
uint8_t len
Definition: app-layer-dnp3.h:2
detect-engine.h
flow-util.h
BASE64_ECODE_ERR
@ BASE64_ECODE_ERR
Definition: util-base64.h:58
threads.h
DecodeBase64
Base64Ecode DecodeBase64(uint8_t *dest, uint32_t dest_size, const uint8_t *src, uint32_t len, uint32_t *consumed_bytes, uint32_t *decoded_bytes, Base64Mode mode)
Decodes a base64-encoded string buffer into an ascii-encoded byte buffer.
Definition: util-base64.c:93
BASE64_MODE_RELAX
@ BASE64_MODE_RELAX
Definition: util-base64.h:52
BASE64_MODE_RFC2045
@ BASE64_MODE_RFC2045
Definition: util-base64.h:53
decode.h
util-debug.h
Base64RegisterTests
void Base64RegisterTests(void)
Definition: util-base64.c:280
detect-engine-mpm.h
detect.h
Base64Mode
Base64Mode
Definition: util-base64.h:51
BASE64_MODE_STRICT
@ BASE64_MODE_STRICT
Definition: util-base64.h:54
detect-engine-state.h
Data structures and function prototypes for keeping state for the detection engine.
suricata-common.h
BASE64_ECODE_OK
@ BASE64_ECODE_OK
Definition: util-base64.h:59
util-spm-bm.h
detect-parse.h
src
uint16_t src
Definition: app-layer-dnp3.h:5
flow.h
flow-var.h
Base64Ecode
Base64Ecode
Definition: util-base64.h:57
debug.h