| 35 |
|
#include "dbuf.h" |
| 36 |
|
#include "channel.h" |
| 37 |
|
|
| 38 |
– |
#define HOSTIPLEN 53 /* sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255.ipv6") */ |
| 39 |
– |
#define PASSWDLEN 20 |
| 40 |
– |
#define IDLEN 12 /* this is the maximum length, not the actual |
| 41 |
– |
generated length; DO NOT CHANGE! */ |
| 42 |
– |
|
| 43 |
– |
/* |
| 44 |
– |
* pre declare structs |
| 45 |
– |
*/ |
| 46 |
– |
struct AccessItem; |
| 47 |
– |
struct Listener; |
| 48 |
– |
struct Client; |
| 49 |
– |
struct LocalUser; |
| 50 |
– |
|
| 51 |
– |
|
| 38 |
|
|
| 39 |
|
/*! \brief addr_mask_type enumeration */ |
| 40 |
|
enum addr_mask_type |
| 49 |
|
{ |
| 50 |
|
dlink_list server_list; /**< Servers on this server */ |
| 51 |
|
dlink_list client_list; /**< Clients on this server */ |
| 52 |
< |
char by[NICKLEN]; /**< who activated this connection */ |
| 52 |
> |
char by[NICKLEN + 1]; /**< who activated this connection */ |
| 53 |
|
}; |
| 54 |
|
|
| 55 |
|
/*! \brief ListTask structure */ |
| 67 |
|
unsigned int topicts_max; |
| 68 |
|
}; |
| 69 |
|
|
| 84 |
– |
/*! \brief Client structure */ |
| 85 |
– |
struct Client |
| 86 |
– |
{ |
| 87 |
– |
dlink_node node; |
| 88 |
– |
dlink_node lnode; /**< Used for Server->servers/users */ |
| 89 |
– |
|
| 90 |
– |
struct LocalUser *localClient; |
| 91 |
– |
struct Client *hnext; /**< For client hash table lookups by name */ |
| 92 |
– |
struct Client *idhnext; /**< For SID hash table lookups by sid */ |
| 93 |
– |
struct Server *serv; /**< ...defined, if this is a server */ |
| 94 |
– |
struct Client *servptr; /**< Points to server this Client is on */ |
| 95 |
– |
struct Client *from; /**< == self, if Local Client, *NEVER* NULL! */ |
| 96 |
– |
char *away; /**< Client's AWAY message. Can be set/unset via AWAY command */ |
| 97 |
– |
|
| 98 |
– |
time_t tsinfo; /**< TS on the nick, SVINFO on server */ |
| 99 |
– |
time_t servicestamp; /**< Last time client has been identified for its nick */ |
| 100 |
– |
|
| 101 |
– |
unsigned int flags; /**< client flags */ |
| 102 |
– |
unsigned int umodes; /**< opers, normal users subset */ |
| 103 |
– |
unsigned int hopcount; /**< number of servers to this 0 = local */ |
| 104 |
– |
unsigned int status; /**< Client type */ |
| 105 |
– |
unsigned int handler; /**< Handler index */ |
| 106 |
– |
|
| 107 |
– |
dlink_list whowas; |
| 108 |
– |
dlink_list channel; /**< chain of channel pointer blocks */ |
| 109 |
– |
|
| 110 |
– |
char name[HOSTLEN + 1]; /**< unique name for a client nick or host */ |
| 111 |
– |
char id[IDLEN + 1]; /**< client ID, unique ID per client */ |
| 112 |
– |
|
| 113 |
– |
/* |
| 114 |
– |
* client->username is the username from ident or the USER message, |
| 115 |
– |
* If the client is idented the USER message is ignored, otherwise |
| 116 |
– |
* the username part of the USER message is put here prefixed with a |
| 117 |
– |
* tilde depending on the auth{} block. Once a client has registered, |
| 118 |
– |
* this field should be considered read-only. |
| 119 |
– |
*/ |
| 120 |
– |
char username[USERLEN + 1]; /* client's username */ |
| 121 |
– |
|
| 122 |
– |
/* |
| 123 |
– |
* client->host contains the resolved name or ip address |
| 124 |
– |
* as a string for the user, it may be fiddled with for oper spoofing etc. |
| 125 |
– |
* once it's changed the *real* address goes away. This should be |
| 126 |
– |
* considered a read-only field after the client has registered. |
| 127 |
– |
*/ |
| 128 |
– |
char host[HOSTLEN + 1]; /* client's hostname */ |
| 129 |
– |
|
| 130 |
– |
/* |
| 131 |
– |
* client->info for unix clients will normally contain the info from the |
| 132 |
– |
* gcos field in /etc/passwd but anything can go here. |
| 133 |
– |
*/ |
| 134 |
– |
char info[REALLEN + 1]; /* Free form additional client info */ |
| 135 |
– |
|
| 136 |
– |
/* |
| 137 |
– |
* client->sockhost contains the ip address gotten from the socket as a |
| 138 |
– |
* string, this field should be considered read-only once the connection |
| 139 |
– |
* has been made. (set in s_bsd.c only) |
| 140 |
– |
*/ |
| 141 |
– |
char sockhost[HOSTIPLEN + 1]; /* This is the host name from the |
| 142 |
– |
socket ip address as string */ |
| 143 |
– |
}; |
| 144 |
– |
|
| 70 |
|
/*! \brief LocalUser structure |
| 71 |
|
* |
| 72 |
|
* Allocated only for local clients, that are directly connected |
| 93 |
|
time_t firsttime; /**< time client was created */ |
| 94 |
|
time_t since; /**< last time we parsed something */ |
| 95 |
|
time_t last_knock; /**< time of last knock */ |
| 171 |
– |
time_t last_away; /**< Away since... */ |
| 96 |
|
time_t last_join_time; /**< when this client last |
| 97 |
|
joined a channel */ |
| 98 |
|
time_t last_leave_time; /**< when this client last |
| 101 |
|
MIN_JOIN_LEAVE_TIME seconds */ |
| 102 |
|
int oper_warn_count_down; /**< warn opers of this possible |
| 103 |
|
spambot every time this gets to 0 */ |
| 180 |
– |
time_t reject_delay; |
| 104 |
|
time_t last_caller_id_time; |
| 105 |
|
time_t first_received_message_time; |
| 106 |
|
time_t last_nick_change; |
| 107 |
|
time_t last_privmsg; /**< Last time we got a PRIVMSG */ |
| 108 |
+ |
time_t last_away; /**< Away since... */ |
| 109 |
|
|
| 110 |
|
int received_number_of_privmsgs; |
| 111 |
|
unsigned int number_of_nick_changes; |
| 144 |
|
char* auth_oper; /**< Operator to become if they supply the response.*/ |
| 145 |
|
}; |
| 146 |
|
|
| 147 |
+ |
/*! \brief Client structure */ |
| 148 |
+ |
struct Client |
| 149 |
+ |
{ |
| 150 |
+ |
dlink_node node; |
| 151 |
+ |
dlink_node lnode; /**< Used for Server->servers/users */ |
| 152 |
+ |
|
| 153 |
+ |
struct LocalUser *localClient; |
| 154 |
+ |
struct Client *hnext; /**< For client hash table lookups by name */ |
| 155 |
+ |
struct Client *idhnext; /**< For SID hash table lookups by sid */ |
| 156 |
+ |
struct Server *serv; /**< ...defined, if this is a server */ |
| 157 |
+ |
struct Client *servptr; /**< Points to server this Client is on */ |
| 158 |
+ |
struct Client *from; /**< == self, if Local Client, *NEVER* NULL! */ |
| 159 |
+ |
|
| 160 |
+ |
time_t tsinfo; /**< TS on the nick, SVINFO on server */ |
| 161 |
+ |
time_t servicestamp; /**< Last time client has been identified for its nick */ |
| 162 |
+ |
|
| 163 |
+ |
unsigned int flags; /**< client flags */ |
| 164 |
+ |
unsigned int umodes; /**< opers, normal users subset */ |
| 165 |
+ |
unsigned int hopcount; /**< number of servers to this 0 = local */ |
| 166 |
+ |
unsigned int status; /**< Client type */ |
| 167 |
+ |
unsigned int handler; /**< Handler index */ |
| 168 |
+ |
|
| 169 |
+ |
dlink_list whowas; |
| 170 |
+ |
dlink_list channel; /**< chain of channel pointer blocks */ |
| 171 |
+ |
|
| 172 |
+ |
char away[AWAYLEN + 1]; /**< Client's AWAY message. Can be set/unset via AWAY command */ |
| 173 |
+ |
char name[HOSTLEN + 1]; /**< unique name for a client nick or host */ |
| 174 |
+ |
char id[IDLEN + 1]; /**< client ID, unique ID per client */ |
| 175 |
+ |
|
| 176 |
+ |
/* |
| 177 |
+ |
* client->username is the username from ident or the USER message, |
| 178 |
+ |
* If the client is idented the USER message is ignored, otherwise |
| 179 |
+ |
* the username part of the USER message is put here prefixed with a |
| 180 |
+ |
* tilde depending on the auth{} block. Once a client has registered, |
| 181 |
+ |
* this field should be considered read-only. |
| 182 |
+ |
*/ |
| 183 |
+ |
char username[USERLEN + 1]; /* client's username */ |
| 184 |
+ |
|
| 185 |
+ |
/* |
| 186 |
+ |
* client->host contains the resolved name or ip address |
| 187 |
+ |
* as a string for the user, it may be fiddled with for oper spoofing etc. |
| 188 |
+ |
* once it's changed the *real* address goes away. This should be |
| 189 |
+ |
* considered a read-only field after the client has registered. |
| 190 |
+ |
*/ |
| 191 |
+ |
char host[HOSTLEN + 1]; /* client's hostname */ |
| 192 |
+ |
|
| 193 |
+ |
/* |
| 194 |
+ |
* client->info for unix clients will normally contain the info from the |
| 195 |
+ |
* gcos field in /etc/passwd but anything can go here. |
| 196 |
+ |
*/ |
| 197 |
+ |
char info[REALLEN + 1]; /* Free form additional client info */ |
| 198 |
+ |
|
| 199 |
+ |
/* |
| 200 |
+ |
* client->sockhost contains the ip address gotten from the socket as a |
| 201 |
+ |
* string, this field should be considered read-only once the connection |
| 202 |
+ |
* has been made. (set in s_bsd.c only) |
| 203 |
+ |
*/ |
| 204 |
+ |
char sockhost[HOSTIPLEN + 1]; /* This is the host name from the |
| 205 |
+ |
socket ip address as string */ |
| 206 |
+ |
}; |
| 207 |
+ |
|
| 208 |
|
/* |
| 209 |
|
* status macros. |
| 210 |
|
*/ |
| 335 |
|
#define AddUMode(x, y) ((x)->umodes |= (y)) |
| 336 |
|
#define DelUMode(x, y) ((x)->umodes &= ~(y)) |
| 337 |
|
|
| 338 |
< |
#define SEND_UMODES (UMODE_INVISIBLE | UMODE_OPER | UMODE_WALLOP | \ |
| 339 |
< |
UMODE_REGISTERED | UMODE_ADMIN | UMODE_HIDDEN) |
| 338 |
> |
#define SEND_UMODES (UMODE_INVISIBLE | UMODE_OPER | UMODE_WALLOP |\ |
| 339 |
> |
UMODE_REGONLY | UMODE_REGISTERED | UMODE_ADMIN |\ |
| 340 |
> |
UMODE_HIDDEN) |
| 341 |
|
|
| 342 |
|
|
| 343 |
|
|
| 360 |
|
#define OPER_FLAG_RESTART 0x00008000 /**< Oper can use RESTART command */ |
| 361 |
|
#define OPER_FLAG_DLINE 0x00010000 /**< Oper can use DLINE command */ |
| 362 |
|
#define OPER_FLAG_UNDLINE 0x00020000 /**< Oper can use UNDLINE command */ |
| 363 |
+ |
#define OPER_FLAG_SET 0x00040000 /**< Oper can use SET command */ |
| 364 |
|
|
| 365 |
|
#define HasOFlag(x, y) (MyConnect(x) ? (x)->localClient->operflags & (y) : 0) |
| 366 |
|
#define AddOFlag(x, y) ((x)->localClient->operflags |= (y)) |
| 437 |
|
#define SetSendqBlocked(x) ((x)->flags |= FLAGS_BLOCKED) |
| 438 |
|
#define ClearSendqBlocked(x) ((x)->flags &= ~FLAGS_BLOCKED) |
| 439 |
|
|
| 453 |
– |
#define IsCaptured(x) ((x)->handler == DUMMY_HANDLER) |
| 454 |
– |
#define SetCaptured(x) ((x)->handler = DUMMY_HANDLER) |
| 455 |
– |
#define ClearCaptured(x) ((x)->handler = CLIENT_HANDLER) |
| 456 |
– |
|
| 440 |
|
|
| 441 |
|
extern struct Client me; |
| 442 |
|
extern dlink_list listing_client_list; |