summaryrefslogtreecommitdiffstats
path: root/innbbsd/daemon.h
blob: 36384a206501d609d69221cc331e60340be8c483 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef DAEMON_H
#define DAEMON_H

#include <stdio.h>
#include <time.h>

#ifndef ARG
#ifdef __STDC__
#define ARG(x) x
#else
#define ARG(x) ()
#endif
#endif


struct Argv_t {
    FILE           *in, *out;
    int             argc;
    char          **argv;
    char           *inputline;
    struct Daemoncmd *dc;
};

typedef struct Argv_t argv_t;

typedef struct Buffer_t {
    char           *data;
    int             used, left, lastread;
}               buffer_t;

typedef struct ClientType {
    char            hostname[1024];
    char            username[32];
    char            buffer[4096];
    int             mode;
    argv_t          Argv;
    int             fd, access, lastread, midcheck;
    buffer_t        in, out;
    int             ihavecount, ihavesize, ihaveduplicate, ihavefail;
    int             statcount, statfail;
    time_t          begin;
}               ClientType;

typedef struct Daemoncmd {
    char           *name;
    char           *usage;
    int             argc, argno, errorcode, normalcode;
    int             (*main) ARG((ClientType *));
}               daemoncmd_t;

extern void installdaemon ARG((daemoncmd_t *, int, char *));
extern ClientType *Channel;

#endif