1 /*
2  *  Copyright (C) 2013-2022 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
3  *  Copyright (C) 2013 Sourcefire, Inc.
4  *
5  *  Authors: David Raynor <draynor@sourcefire.com>
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  *  MA 02110-1301, USA.
20  */
21 
22 #ifndef __XAR_H
23 #define __XAR_H
24 
25 #if HAVE_CONFIG_H
26 #include "clamav-config.h"
27 #endif
28 
29 #include "clamav-types.h"
30 #include "others.h"
31 
32 #ifndef HAVE_ATTRIB_PACKED
33 #define __attribute__(x)
34 #endif
35 
36 #ifdef HAVE_PRAGMA_PACK
37 #pragma pack(1)
38 #endif
39 
40 #ifdef HAVE_PRAGMA_PACK_HPPA
41 #pragma pack 1
42 #endif
43 
44 struct xar_header {
45     uint32_t magic;
46     uint16_t size;
47     uint16_t version;
48     uint64_t toc_length_compressed;
49     uint64_t toc_length_decompressed;
50     uint32_t chksum_alg; /* 0 = none */
51 };
52 
53 // clang-format off
54 #define XAR_HEADER_MAGIC    0x78617221
55 #define XAR_HEADER_VERSION  0
56 
57 #define XAR_CKSUM_NONE   0
58 #define XAR_CKSUM_SHA1   1
59 #define XAR_CKSUM_MD5    2
60 #define XAR_CKSUM_OTHER  3
61 // clang-format on
62 
63 #ifdef HAVE_PRAGMA_PACK
64 #pragma pack()
65 #endif
66 
67 #ifdef HAVE_PRAGMA_PACK_HPPA
68 #pragma pack
69 #endif
70 
71 int cli_scanxar(cli_ctx *ctx);
72 
73 #endif
74