]>
Commit | Line | Data |
---|---|---|
189935b1 | 1 | #ifndef INCLUDED_jupe_h |
2 | #define INCLUDED_jupe_h | |
3 | /* | |
4 | * IRC - Internet Relay Chat, include/jupe.h | |
5 | * Copyright (C) 1990 Jarkko Oikarinen and | |
6 | * University of Oulu, Computing Center | |
7 | * Copyright (C) 2000 Kevin L. Mitchell <klmitch@mit.edu> | |
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, or (at your option) | |
12 | * 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., 675 Mass Ave, Cambridge, MA 02139, USA. | |
22 | */ | |
23 | /** @file | |
24 | * @brief Interface and declarations for juped server handling. | |
25 | * @version $Id: jupe.h,v 1.6 2004/10/03 14:12:35 entrope Exp $ | |
26 | */ | |
27 | #ifndef INCLUDED_sys_types_h | |
28 | #include <sys/types.h> | |
29 | #define INCLUDED_sys_types_h | |
30 | #endif | |
31 | ||
32 | ||
33 | struct Client; | |
34 | ||
35 | #define JUPE_MAX_EXPIRE 604800 /**< Maximum jupe expiration time (7 days). */ | |
36 | ||
37 | /** Describes a juped server. | |
38 | * A hub will not accept new connections from a juped server. | |
39 | */ | |
40 | struct Jupe { | |
41 | struct Jupe* ju_next; /**< Pointer to next Jupe. */ | |
42 | struct Jupe** ju_prev_p; /**< Pointer to previous next pointer. */ | |
43 | char* ju_server; /**< Name of server to jupe. */ | |
44 | char* ju_reason; /**< Reason for the jupe. */ | |
45 | time_t ju_expire; /**< Expiration time of the jupe. */ | |
46 | time_t ju_lastmod; /**< Last modification time (if any) for the jupe. */ | |
47 | unsigned int ju_flags; /**< Status flags for the jupe. */ | |
48 | }; | |
49 | ||
50 | #define JUPE_ACTIVE 0x0001 /**< Jupe is globally active. */ | |
51 | #define JUPE_LOCAL 0x0002 /**< Jupe only applies to this server. */ | |
52 | #define JUPE_LDEACT 0x0004 /**< Jupe is locally deactivated */ | |
53 | ||
54 | #define JUPE_MASK (JUPE_ACTIVE | JUPE_LOCAL) | |
55 | #define JUPE_ACTMASK (JUPE_ACTIVE | JUPE_LDEACT) | |
56 | ||
57 | /** Test whether \a j is active. */ | |
58 | #define JupeIsActive(j) (((j)->ju_flags & JUPE_ACTMASK) == JUPE_ACTIVE) | |
59 | /** Test whether \a j is globally (remotely) active. */ | |
60 | #define JupeIsRemActive(j) ((j)->ju_flags & JUPE_ACTIVE) | |
61 | /** Test whether \a j is local. */ | |
62 | #define JupeIsLocal(j) ((j)->ju_flags & JUPE_LOCAL) | |
63 | ||
64 | /** Get the server name for \a j. */ | |
65 | #define JupeServer(j) ((j)->ju_server) | |
66 | /** Get the reason fro \a j. */ | |
67 | #define JupeReason(j) ((j)->ju_reason) | |
68 | /** Get the last modification time for \a j. */ | |
69 | #define JupeLastMod(j) ((j)->ju_lastmod) | |
70 | ||
71 | extern int jupe_add(struct Client *cptr, struct Client *sptr, char *server, | |
72 | char *reason, time_t expire, time_t lastmod, | |
73 | unsigned int flags); | |
74 | extern int jupe_activate(struct Client *cptr, struct Client *sptr, | |
75 | struct Jupe *jupe, time_t lastmod, | |
76 | unsigned int flags); | |
77 | extern int jupe_deactivate(struct Client *cptr, struct Client *sptr, | |
78 | struct Jupe *jupe, time_t lastmod, | |
79 | unsigned int flags); | |
80 | extern struct Jupe* jupe_find(char *server); | |
81 | extern void jupe_free(struct Jupe *jupe); | |
82 | extern void jupe_burst(struct Client *cptr); | |
83 | extern int jupe_resend(struct Client *cptr, struct Jupe *jupe); | |
84 | extern int jupe_list(struct Client *sptr, char *server); | |
85 | extern int jupe_memory_count(size_t *ju_size); | |
86 | ||
87 | #endif /* INCLUDED_jupe_h */ |