-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodec.h
executable file
·50 lines (42 loc) · 1.47 KB
/
codec.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* @file
* Codec module header.
*
* The Codec module defines a set of functions for encoding and decoding application level encoding schemes,
* such as OS Command Shell escape encoding and Database interpreter escape encoding. Codecs are used in output
* encoding and canonicalization. Individual encoding schemes are implemented in separate modules and are
* accessed though function pointers in the global codec definition variables. The design of these codecs
* allows for character-by-character decoding, which is necessary to detect double-encoding and the use of
* multiple encoding schemes, both of which are techniques used by attackers to bypass validation and bury
* encoded attacks in data.
*
* @since June 1, 2007
* @see esapi_canonicalize()
*/
#include <stdlib.h>
#include <stdbool.h>
#ifndef _CODEC_H
#define _CODEC_H
#include "unix_codec.h"
#include "windows_codec.h"
/**
* A codec definition that includes the codec name and its encoder and decoder function pointers.
*/
typedef struct {
char name[50];
char *(*encode_char)(char *, char);
char (*decode_char)(const char *, int *, char *);
} codec;
/**
* A pointer to the global UNIX command shell codec definition.
*/
extern codec *pcodec_unix;
/**
* A pointer to the global Windows command shell codec definition.
*/
extern codec *pcodec_windows;
extern bool hasNext(char *, int, char);
extern char next(const char *, int *, char *);
extern char *nonatohex(char c);
extern void codec_init();
#endif