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 SURICATA_UTIL_BASE64_H_
26 #define SURICATA_UTIL_BASE64_H_
27 
28 #include "suricata-common.h"
29 #include "rust.h"
30 
31 /* Constants */
32 #define ASCII_BLOCK 3
33 #define B64_BLOCK 4
34 
35 typedef enum {
39 } Base64Ecode;
40 
41 /* Function prototypes */
42 Base64Ecode DecodeBase64(uint8_t *dest, uint32_t dest_size, const uint8_t *src, uint32_t len,
43  uint32_t *consumed_bytes, uint32_t *decoded_bytes, DetectBase64Mode mode);
44 bool IsBase64Alphabet(uint8_t encoded_byte);
45 
46 #endif
47 
48 #ifdef UNITTESTS
49 void Base64RegisterTests(void);
50 #endif
BASE64_ECODE_BUF
@ BASE64_ECODE_BUF
Definition: util-base64.h:38
len
uint8_t len
Definition: app-layer-dnp3.h:2
BASE64_ECODE_ERR
@ BASE64_ECODE_ERR
Definition: util-base64.h:36
rust.h
IsBase64Alphabet
bool IsBase64Alphabet(uint8_t encoded_byte)
Checks if the given char in a byte array is Base64 alphabet.
Definition: util-base64.c:74
Base64RegisterTests
void Base64RegisterTests(void)
Definition: util-base64.c:495
suricata-common.h
BASE64_ECODE_OK
@ BASE64_ECODE_OK
Definition: util-base64.h:37
src
uint16_t src
Definition: app-layer-dnp3.h:5
Base64Ecode
Base64Ecode
Definition: util-base64.h:35
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, DetectBase64Mode mode)
Decodes a base64-encoded string buffer into an ascii-encoded byte buffer.
Definition: util-base64.c:276