summaryrefslogtreecommitdiff
path: root/client_db.h
blob: 936f95e457ff95c83c9c989831bf7511b9b62c98 (plain)
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
/*
 * LOKI
 *
 * client_db header file
 *
 *  1996/7 Guild Corporation Productions    [daemon9]
 */


/*
 *  Client info list.
 *  MAX_CLIENT of these will be kept in a server-side array
 */
struct client_list {
    uint16_t client_id;                    /* client loki_id                   */
    uint32_t client_ip;                    /* client IP address                */
    time_t  touchtime;                     /* last time entry was hit          */
    uint32_t packets_sent;                 /* Packets sent to this client      */
    uint32_t bytes_sent;                   /* Bytes sent to this client        */
    unsigned int hits;                     /* Number of queries from client    */
};

#define IS_GOOD_CLIENT(ldg)\
\
(c_id           == client[i].client_id   &&  \
 ldg.iph.ip_src == client[i].client_ip)  >   \
                             (0) ? (1) : (0) \

void update_client(int, int, uint32_t);    /* Update a client entry            */
                                           /* client info into supplied buffer */
int stat_client(int, uint8_t *, int, time_t);
int add_client(uint8_t *);                 /* add a client entry               */
int locate_client(int);                    /* find a client entry              */
void age_client(void);                     /* age a client from the list       */
uint16_t update_client_salt(int);          /* update and return salt           */
uint32_t check_client_ip(int, uint16_t *); /* return ip and id of target       */