1 /*
2  *  Extract component parts of MS XML files (e.g. MS Office 2003 XML Documents)
3  *
4  *  Copyright (C) 2013-2022 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
5  *  Copyright (C) 2007-2013 Sourcefire, Inc.
6  *
7  *  Authors: Kevin Lin
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License version 2 as
11  *  published by the Free Software Foundation.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21  *  MA 02110-1301, USA.
22  */
23 
24 #ifndef __MSXML_H
25 #define __MSXML_H
26 
27 #if HAVE_CONFIG_H
28 #include "clamav-config.h"
29 #endif
30 
31 #include "others.h"
32 
33 enum msxml_state {
34     MSXML_STATE_NORMAL = 0,
35     MSXML_STATE_ENTITY_START_1,
36     MSXML_STATE_ENTITY_START_2,
37     MSXML_STATE_ENTITY_HEX,
38     MSXML_STATE_ENTITY_DEC,
39     MSXML_STATE_ENTITY_CLOSE,
40     MSXML_STATE_ENTITY_NONE
41 };
42 
43 struct msxml_cbdata {
44     enum msxml_state state;
45     fmap_t *map;
46     const unsigned char *window;
47     off_t winpos, mappos;
48     size_t winsize;
49 };
50 
51 int msxml_read_cb(void *ctx, char *buffer, int buffer_len);
52 cl_error_t cli_scanmsxml(cli_ctx *ctx);
53 
54 #endif /* __MSXML_H */
55