81131381 |
/* |
086eab5c |
* Copyright (C) 2007-2009 Sourcefire, Inc.
*
* Authors: Tomasz Kojm, Török Edvin |
81131381 |
*
* This program is free software; you can redistribute it and/or modify |
bb34cb31 |
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. |
81131381 |
*
* 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 |
48b7b4a7 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA. |
81131381 |
*/
#ifndef __SESSION_H
#define __SESSION_H
|
7708ddfc |
#define CMD1 "SCAN" |
6f6fc585 |
/* #define CMD2 "RAWSCAN" */ |
7708ddfc |
#define CMD3 "QUIT" /* deprecated */
#define CMD4 "RELOAD"
#define CMD5 "PING"
#define CMD6 "CONTSCAN"
#define CMD7 "VERSION"
#define CMD8 "STREAM" |
949c6fe5 |
/*#define CMD9 "SESSION"*/ |
7708ddfc |
#define CMD10 "END"
#define CMD11 "SHUTDOWN" |
df599e74 |
/* #define CMD12 "FD" */ |
8765287e |
#define CMD13 "MULTISCAN" |
725a2969 |
#define CMD14 "FILDES" |
aa22174b |
#define CMD15 "STATS" |
949c6fe5 |
#define CMD16 "IDSESSION"
#define CMD17 "INSTREAM" |
39b84970 |
#define CMD18 "VERSIONCOMMANDS" |
49f8de22 |
#define CMD19 "DETSTATSCLEAR"
#define CMD20 "DETSTATS" |
7708ddfc |
|
fb0a54dd |
#define CMD21 "ALLMATCHSCAN"
|
bd8603aa |
#include "libclamav/clamav.h" |
064b4a0c |
#include "shared/optparser.h" |
949c6fe5 |
#include "server.h"
#include "others.h" |
81131381 |
|
949c6fe5 |
enum commands {
COMMAND_UNKNOWN = 0,
COMMAND_SHUTDOWN = 1,
COMMAND_RELOAD,
COMMAND_END,
COMMAND_SESSION,
COMMAND_SCAN,
COMMAND_PING,
COMMAND_CONTSCAN,
COMMAND_VERSION,
COMMAND_STREAM,
COMMAND_MULTISCAN,
COMMAND_FILDES,
COMMAND_STATS,
/* new proto commands */
COMMAND_IDSESSION,
COMMAND_INSTREAM, |
39b84970 |
COMMAND_COMMANDS, |
49f8de22 |
COMMAND_DETSTATSCLEAR,
COMMAND_DETSTATS, |
949c6fe5 |
/* internal commands */
COMMAND_MULTISCANFILE, |
fb0a54dd |
COMMAND_INSTREAMSCAN,
COMMAND_ALLMATCHSCAN |
949c6fe5 |
}; |
81131381 |
|
949c6fe5 |
typedef struct client_conn_tag {
enum commands cmdtype;
char *filename;
int scanfd;
int sd;
unsigned int options;
const struct optstruct *opts;
struct cl_engine *engine;
time_t engine_timestamp;
char term;
threadpool_t *thrpool;
int id;
long quota;
jobgroup_t *group;
enum mode mode;
} client_conn_t;
int command(client_conn_t *conn, int *virus); |
537292a7 |
enum commands parse_command(const char *cmd, const char **argument, int oldstyle); |
949c6fe5 |
int execute_or_dispatch_command(client_conn_t *conn, enum commands command, const char *argument);
int conn_reply(const client_conn_t *conn, const char *path, const char *msg, const char *status);
int conn_reply_single(const client_conn_t *conn, const char *path, const char *status); |
b8981032 |
int conn_reply_virus(const client_conn_t *conn, const char *file, const char *virname); |
949c6fe5 |
int conn_reply_error(const client_conn_t *conn, const char *msg);
int conn_reply_errno(const client_conn_t *conn, const char *path, const char *msg); |
81131381 |
#endif |