~ubuntu-branches/ubuntu/breezy/clamav/breezy-backports

« back to all changes in this revision

Viewing changes to libclamav/blob.h

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Gran
  • Date: 2005-09-19 09:05:59 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050919090559-hikpqduq8yx5qxo2
Tags: 0.87-1
* New upstream version
  - Fixes CAN-2005-2920 and CAN-2005-2919 (closes: #328660)
* New logcheck line for clamav-daemon (closes: #323132)
* relibtoolize and apply kfreebsd patch (closes: #327707)
* Make sure init.d script starts freshclam up again after upgrade when run
  from if-up.d (closes: #328912)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * $LOG$
19
19
 */
20
20
 
 
21
#ifndef __BLOB_H
 
22
#define __BLOB_H
 
23
 
 
24
/*
 
25
 * Resizable chunk of memory
 
26
 */
21
27
typedef struct blob {
22
28
        char    *name;  /* filename */
23
29
        unsigned        char    *data;  /* the stuff itself */
32
38
blob    *blobCreate(void);
33
39
void    blobDestroy(blob *b);
34
40
void    blobArrayDestroy(blob *b[], int n);
35
 
void    blobSetFilename(blob *b, const char *filename);
 
41
void    blobSetFilename(blob *b, const char *dir, const char *filename);
36
42
const   char    *blobGetFilename(const blob *b);
37
 
void    blobAddData(blob *b, const unsigned char *data, size_t len);
 
43
int     blobAddData(blob *b, const unsigned char *data, size_t len);
38
44
unsigned char *blobGetData(const blob *b);
39
45
unsigned        long    blobGetDataSize(const blob *b);
40
46
void    blobClose(blob *b);
41
47
int     blobcmp(const blob *b1, const blob *b2);
42
48
void    blobGrow(blob *b, size_t len);
 
49
 
 
50
/*
 
51
 * Like a blob, but associated with a file
 
52
 */
 
53
typedef struct fileblob {
 
54
        FILE    *fp;
 
55
        blob    b;
 
56
        int     isNotEmpty;
 
57
} fileblob;
 
58
 
 
59
fileblob        *fileblobCreate(void);
 
60
void    fileblobDestroy(fileblob *fb);
 
61
void    fileblobSetFilename(fileblob *fb, const char *dir, const char *filename);
 
62
const   char    *fileblobGetFilename(const fileblob *fb);
 
63
int     fileblobAddData(fileblob *fb, const unsigned char *data, size_t len);
 
64
void    sanitiseName(char *name);
 
65
 
 
66
/* Maximum filenames under various systems */
 
67
#ifndef NAME_MAX        /* e.g. Linux */
 
68
# ifdef MAXNAMELEN      /* e.g. Solaris */
 
69
#   define      NAME_MAX        MAXNAMELEN
 
70
# else
 
71
#   ifdef       FILENAME_MAX    /* e.g. SCO */
 
72
#     define    NAME_MAX        FILENAME_MAX
 
73
#   else
 
74
#     define    NAME_MAX        256
 
75
#   endif
 
76
# endif
 
77
#endif
 
78
 
 
79
#endif /*_BLOB_H*/