~ubuntu-branches/ubuntu/feisty/clamav/feisty

« back to all changes in this revision

Viewing changes to clamd/session.h

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2007-02-20 10:33:44 UTC
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20070220103344-zgcu2psnx9d98fpa
Tags: upstream-0.90
Import upstream version 0.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright (C) 2007-2009 Sourcefire, Inc.
3
 
 *
4
 
 *  Authors: Tomasz Kojm, Török Edvin
 
2
 *  Copyright (C) 2002 - 2004 Tomasz Kojm <tkojm@clamav.net>
5
3
 *
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.
9
8
 *
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
22
 
 
23
#define COMMAND_SHUTDOWN 1
 
24
#define COMMAND_RELOAD 2
 
25
#define COMMAND_END 3
 
26
#define COMMAND_SESSION 4
24
27
 
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" */
 
39
#define CMD12 "FD"
37
40
#define CMD13 "MULTISCAN"
38
 
#define CMD14 "FILDES"
39
 
#define CMD15 "STATS"
40
 
#define CMD16 "IDSESSION"
41
 
#define CMD17 "INSTREAM"
42
 
#define CMD18 "VERSIONCOMMANDS"
43
 
#define CMD19 "DETSTATSCLEAR"
44
 
#define CMD20 "DETSTATS"
45
41
 
46
42
#include "libclamav/clamav.h"
47
 
#include "shared/optparser.h"
48
 
#include "server.h"
49
 
#include "others.h"
50
 
 
51
 
enum commands {
52
 
    COMMAND_UNKNOWN = 0,
53
 
    COMMAND_SHUTDOWN = 1,
54
 
    COMMAND_RELOAD,
55
 
    COMMAND_END,
56
 
    COMMAND_SESSION,
57
 
    COMMAND_SCAN,
58
 
    COMMAND_PING,
59
 
    COMMAND_CONTSCAN,
60
 
    COMMAND_VERSION,
61
 
    COMMAND_STREAM,
62
 
    COMMAND_MULTISCAN,
63
 
    COMMAND_FILDES,
64
 
    COMMAND_STATS,
65
 
    /* new proto commands */
66
 
    COMMAND_IDSESSION,
67
 
    COMMAND_INSTREAM,
68
 
    COMMAND_COMMANDS,
69
 
    COMMAND_DETSTATSCLEAR,
70
 
    COMMAND_DETSTATS,
71
 
    /* internal commands */
72
 
    COMMAND_MULTISCANFILE,
73
 
    COMMAND_INSTREAMSCAN
74
 
};
75
 
 
76
 
typedef struct client_conn_tag {
77
 
    enum commands cmdtype;
78
 
    char *filename;
79
 
    int scanfd;
80
 
    int sd;
81
 
    unsigned int options;
82
 
    const struct optstruct *opts;
83
 
    struct cl_engine *engine;
84
 
    time_t engine_timestamp;
85
 
    char term;
86
 
    threadpool_t *thrpool;
87
 
    int id;
88
 
    long quota;
89
 
    jobgroup_t *group;
90
 
    enum mode mode;
91
 
} client_conn_t;
92
 
 
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);
96
 
 
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"
 
44
 
 
45
int command(int desc, const struct cl_engine *engine, const struct cl_limits *limits, unsigned int options, const struct cfgstruct *copt, int timeout);
 
46
 
102
47
#endif