b151ef55 |
/* |
eedd6182 |
* Copyright (C) 1999 - 2005 Tomasz Kojm <tkojm@clamav.net> |
b151ef55 |
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
|
f91f55e0 |
#ifndef __OTHERS_H_LC
#define __OTHERS_H_LC |
b151ef55 |
|
183ee7e7 |
#include <stdio.h> |
b151ef55 |
#include <stdlib.h> |
fbbf7cd2 |
#include "cltypes.h" |
b151ef55 |
|
d99b1840 |
#define CLI_ISCONTAINED(bb, bb_size, sb, sb_size) \
(bb_size > 0 && sb_size > 0 && sb_size <= bb_size \
&& sb >= bb && sb + sb_size <= bb + bb_size && sb + sb_size > bb)
|
e82a5185 |
#define CLI_ISCONTAINED2(bb, bb_size, sb, sb_size) \
(bb_size > 0 && sb_size >= 0 && sb_size <= bb_size \
&& sb >= bb && sb + sb_size <= bb + bb_size && sb + sb_size >= bb)
#define CLI_MAX_ALLOCATION 134217728
|
55b1a5f8 |
typedef struct bitset_tag {
unsigned char *bitset;
unsigned long length;
} bitset_t;
|
b151ef55 |
void cli_warnmsg(const char *str, ...);
void cli_errmsg(const char *str, ...);
void cli_dbgmsg(const char *str, ...);
void *cli_malloc(size_t nmemb);
void *cli_calloc(size_t nmemb, size_t size); |
4cd4319e |
void *cli_realloc(void *ptr, size_t size); |
b151ef55 |
int cli_rmdirs(const char *dirname); |
3f66a5af |
unsigned char *cli_md5digest(int desc); |
d2a12ffd |
char *cli_md5stream(FILE *fs, unsigned char *digcpy);
char *cli_md5file(const char *filename); |
66fcd9f8 |
int cli_readn(int fd, void *buff, unsigned int count);
int cli_writen(int fd, void *buff, unsigned int count); |
fbbf7cd2 |
int32_t cli_readint32(const char *buff); |
b3171bcd |
void cli_writeint32(char *offset, uint32_t value); |
f91f55e0 |
char *cli_gentemp(const char *dir);
unsigned int cli_rndnum(unsigned int max); |
ed4b4196 |
int cli_filecopy(const char *src, const char *dest); |
55b1a5f8 |
bitset_t *cli_bitset_init();
void cli_bitset_free(bitset_t *bs);
int cli_bitset_set(bitset_t *bs, unsigned long bit_offset);
int cli_bitset_test(bitset_t *bs, unsigned long bit_offset); |
b151ef55 |
#endif |