~ubuntu-branches/ubuntu/utopic/clamav/utopic-security

« back to all changes in this revision

Viewing changes to libclamav/adc.h

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-02-01 11:06:17 UTC
  • mfrom: (0.35.37 sid)
  • Revision ID: package-import@ubuntu.com-20140201110617-33h2xxk09dep0ui4
Tags: 0.98.1+dfsg-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - Drop build-dep on electric-fence (in Universe)
  - Add apparmor profiles for clamd and freshclam along with maintainer
    script changes
  - Add autopkgtest

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (C) 2013 Sourcefire, Inc.
 
3
 *
 
4
 *  Authors: David Raynor <draynor@sourcefire.com>
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License version 2 as
 
8
 *  published by the Free Software Foundation.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
18
 *  MA 02110-1301, USA.
 
19
 */
 
20
 
 
21
#ifndef CLAM_ADC_H
 
22
#define CLAM_ADC_H
 
23
 
 
24
struct adc_stream {
 
25
    uint8_t *next_in;
 
26
    size_t avail_in;
 
27
    size_t total_in;
 
28
 
 
29
    uint8_t *next_out;
 
30
    size_t avail_out;
 
31
    size_t total_out;
 
32
 
 
33
    /* internals */
 
34
    uint8_t *buffer;
 
35
    uint8_t *curr;
 
36
 
 
37
    uint32_t buffered;
 
38
    uint16_t state;
 
39
    uint16_t length;
 
40
    uint32_t offset;
 
41
};
 
42
typedef struct adc_stream adc_stream;
 
43
 
 
44
#define ADC_BUFF_SIZE 65536
 
45
 
 
46
#define    ADC_MEM_ERROR -1
 
47
#define    ADC_DATA_ERROR -2
 
48
#define    ADC_IO_ERROR -3
 
49
#define    ADC_OK 0
 
50
#define    ADC_STREAM_END 1
 
51
 
 
52
enum adc_state {
 
53
    ADC_STATE_UNINIT = 0,
 
54
    ADC_STATE_GETTYPE = 1,
 
55
    ADC_STATE_RAWDATA = 2,
 
56
    ADC_STATE_SHORTOP = 3,
 
57
    ADC_STATE_LONGOP2 = 4,
 
58
    ADC_STATE_LONGOP1 = 5,
 
59
    ADC_STATE_SHORTLOOK = 6,
 
60
    ADC_STATE_LONGLOOK = 7
 
61
};
 
62
 
 
63
/* Compression phrases
 
64
 * store phrase - 1 byte header + data, first byte 0x80-0xFF, max length 0x80 (7 bits + 1), no offset
 
65
 * short phrase - 2 byte header + data, first byte 0x00-0x3F, max length 0x12 (4 bits + 3), max offset 0x3FF (10 bits)
 
66
 * long phrase  - 3 byte header + data, first byte 0x40-0x7F, max length 0x43 (6 bits + 4), max offset 0xFFFF (16 bits)
 
67
 */
 
68
 
 
69
int adc_decompressInit(adc_stream *strm);
 
70
int adc_decompress(adc_stream *strm);
 
71
int adc_decompressEnd(adc_stream *strm);
 
72
 
 
73
#endif