~ubuntu-branches/ubuntu/trusty/charybdis/trusty-proposed

« back to all changes in this revision

Viewing changes to include/whowas.h

  • Committer: Package Import Robot
  • Author(s): Antoine Beaupré
  • Date: 2011-11-10 23:07:37 UTC
  • Revision ID: package-import@ubuntu.com-20111110230737-kqo6qsglp5oh02hr
Tags: upstream-3.3.0
Import upstream version 3.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  ircd-ratbox: A slightly useful ircd.
 
3
 *  whowas.h: Header for the whowas functions.
 
4
 *
 
5
 *  Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
 
6
 *  Copyright (C) 1996-2002 Hybrid Development Team
 
7
 *  Copyright (C) 2002-2004 ircd-ratbox development team
 
8
 *
 
9
 *  This program is free software; you can redistribute it and/or modify
 
10
 *  it under the terms of the GNU General Public License as published by
 
11
 *  the Free Software Foundation; either version 2 of the License, or
 
12
 *  (at your option) any later version.
 
13
 *
 
14
 *  This program is distributed in the hope that it will be useful,
 
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 *  GNU General Public License for more details.
 
18
 *
 
19
 *  You should have received a copy of the GNU General Public License
 
20
 *  along with this program; if not, write to the Free Software
 
21
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 
22
 *  USA
 
23
 *
 
24
 *  $Id: whowas.h 1717 2006-07-04 14:41:11Z jilles $
 
25
 */
 
26
#ifndef INCLUDED_whowas_h
 
27
#define INCLUDED_whowas_h
 
28
 
 
29
#include "ircd_defs.h"
 
30
#include "client.h"
 
31
 
 
32
#include "setup.h"
 
33
 
 
34
/*
 
35
 * Whowas hash table size
 
36
 *
 
37
 */
 
38
#define WW_MAX_BITS 16
 
39
#define WW_MAX 65536
 
40
 
 
41
struct User;
 
42
struct Client;
 
43
 
 
44
/*
 
45
  lets speed this up...
 
46
  also removed away information. *tough*
 
47
  - Dianora
 
48
 */
 
49
struct Whowas
 
50
{
 
51
        int hashv;
 
52
        char name[NICKLEN + 1];
 
53
        char username[USERLEN + 1];
 
54
        char hostname[HOSTLEN + 1];
 
55
        char sockhost[HOSTIPLEN + 1];
 
56
        char realname[REALLEN + 1];
 
57
        char suser[NICKLEN + 1];
 
58
        const char *servername;
 
59
        time_t logoff;
 
60
        struct Client *online;  /* Pointer to new nickname for chasing or NULL */
 
61
        struct Whowas *next;    /* for hash table... */
 
62
        struct Whowas *prev;    /* for hash table... */
 
63
        struct Whowas *cnext;   /* for client struct linked list */
 
64
        struct Whowas *cprev;   /* for client struct linked list */
 
65
};
 
66
 
 
67
/*
 
68
** initwhowas
 
69
*/
 
70
extern void initwhowas(void);
 
71
 
 
72
/*
 
73
** add_history
 
74
**      Add the currently defined name of the client to history.
 
75
**      usually called before changing to a new name (nick).
 
76
**      Client must be a fully registered user (specifically,
 
77
**      the user structure must have been allocated).
 
78
*/
 
79
void add_history(struct Client *, int);
 
80
 
 
81
/*
 
82
** off_history
 
83
**      This must be called when the client structure is about to
 
84
**      be released. History mechanism keeps pointers to client
 
85
**      structures and it must know when they cease to exist. This
 
86
**      also implicitly calls AddHistory.
 
87
*/
 
88
void off_history(struct Client *);
 
89
 
 
90
/*
 
91
** get_history
 
92
**      Return the current client that was using the given
 
93
**      nickname within the timelimit. Returns NULL, if no
 
94
**      one found...
 
95
*/
 
96
struct Client *get_history(const char *, time_t);
 
97
                                        /* Nick name */
 
98
                                        /* Time limit in seconds */
 
99
 
 
100
/*
 
101
** for debugging...counts related structures stored in whowas array.
 
102
*/
 
103
void count_whowas_memory(size_t *, size_t *);
 
104
 
 
105
/* XXX m_whowas.c in modules needs these */
 
106
extern struct Whowas WHOWAS[];
 
107
extern struct Whowas *WHOWASHASH[];
 
108
extern unsigned int hash_whowas_name(const char *name);
 
109
 
 
110
#endif /* INCLUDED_whowas_h */