2
* Copyright (C) 2007-2009 Sourcefire, Inc.
4
* Authors: Tomasz Kojm, Török Edvin
2
* Copyright (C) 2002 - 2004 Tomasz Kojm <tkojm@clamav.net>
6
4
* 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.
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
10
9
* This program is distributed in the hope that it will be useful,
11
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
20
#ifndef __SESSION_H
22
21
#define __SESSION_H
23
#define COMMAND_SHUTDOWN 1
24
#define COMMAND_RELOAD 2
26
#define COMMAND_SESSION 4
25
28
#define CMD1 "SCAN"
26
/* #define CMD2 "RAWSCAN" */
29
#define CMD2 "RAWSCAN"
27
30
#define CMD3 "QUIT" /* deprecated */
28
31
#define CMD4 "RELOAD"
29
32
#define CMD5 "PING"
30
33
#define CMD6 "CONTSCAN"
31
34
#define CMD7 "VERSION"
32
35
#define CMD8 "STREAM"
33
/*#define CMD9 "SESSION"*/
36
#define CMD9 "SESSION"
34
37
#define CMD10 "END"
35
38
#define CMD11 "SHUTDOWN"
36
/* #define CMD12 "FD" */
37
40
#define CMD13 "MULTISCAN"
38
#define CMD14 "FILDES"
40
#define CMD16 "IDSESSION"
41
#define CMD17 "INSTREAM"
42
#define CMD18 "VERSIONCOMMANDS"
43
#define CMD19 "DETSTATSCLEAR"
44
#define CMD20 "DETSTATS"
46
42
#include "libclamav/clamav.h"
47
#include "shared/optparser.h"
65
/* new proto commands */
69
COMMAND_DETSTATSCLEAR,
71
/* internal commands */
72
COMMAND_MULTISCANFILE,
76
typedef struct client_conn_tag {
77
enum commands cmdtype;
82
const struct optstruct *opts;
83
struct cl_engine *engine;
84
time_t engine_timestamp;
86
threadpool_t *thrpool;
93
int command(client_conn_t *conn, int *virus);
94
enum commands parse_command(const char *cmd, const char **argument, int oldstyle);
95
int execute_or_dispatch_command(client_conn_t *conn, enum commands command, const char *argument);
97
int conn_reply(const client_conn_t *conn, const char *path, const char *msg, const char *status);
98
int conn_reply_single(const client_conn_t *conn, const char *path, const char *status);
99
int conn_reply_virus(const client_conn_t *conn, const char *file, const char *virname);
100
int conn_reply_error(const client_conn_t *conn, const char *msg);
101
int conn_reply_errno(const client_conn_t *conn, const char *path, const char *msg);
43
#include "shared/cfgparser.h"
45
int command(int desc, const struct cl_engine *engine, const struct cl_limits *limits, unsigned int options, const struct cfgstruct *copt, int timeout);