forked from unrealircd/unrealircd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstruct.h
1854 lines (1638 loc) · 59 KB
/
struct.h
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/************************************************************************
* Unreal Internet Relay Chat Daemon, include/struct.h
* Copyright (C) 1990 Jarkko Oikarinen and
* University of Oulu, Computing Center
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id$
*/
#ifndef __struct_include__
#define __struct_include__
#include "config.h"
#include "sys.h"
/* need to include ssl stuff here coz otherwise you get
* conflicting types with isalnum/isalpha/etc @ redhat. -- Syzop
*/
#if defined(USE_SSL)
#define OPENSSL_NO_KRB5
#include <openssl/rsa.h> /* SSL stuff */
#include <openssl/crypto.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
#include <openssl/md5.h>
#include <openssl/ripemd.h>
#endif
#include "common.h"
#include "sys.h"
#include "hash.h"
#include <stdio.h>
#include <sys/types.h>
#ifndef _WIN32
#include <netinet/in.h>
#include <netdb.h>
#endif
#ifdef STDDEFH
# include <stddef.h>
#endif
#include "md5.h"
#ifdef HAVE_SYSLOG
# include <syslog.h>
# ifdef SYSSYSLOGH
# include <sys/syslog.h>
# endif
#endif
#include "auth.h"
#include "tre/regex.h"
#include "channel.h"
#if defined(_MSC_VER)
/* needed to workaround a warning / prototype/dll inconsistency crap */
#define vsnprintf unrl_vsnprintf
#endif
extern MODVAR int sendanyways;
typedef struct aloopStruct LoopStruct;
typedef struct ConfItem aConfItem;
typedef struct t_kline aTKline;
typedef struct _spamfilter Spamfilter;
typedef struct _spamexcept SpamExcept;
/* New Config Stuff */
typedef struct _configentry ConfigEntry;
typedef struct _configfile ConfigFile;
typedef struct _configflag ConfigFlag;
typedef struct _configflag_except ConfigFlag_except;
typedef struct _configflag_ban ConfigFlag_ban;
typedef struct _configflag_tld ConfigFlag_tld;
typedef struct _configitem ConfigItem;
typedef struct _configitem_me ConfigItem_me;
typedef struct _configitem_files ConfigItem_files;
typedef struct _configitem_admin ConfigItem_admin;
typedef struct _configitem_class ConfigItem_class;
typedef struct _configitem_oper ConfigItem_oper;
typedef struct _configitem_oper_from ConfigItem_oper_from;
typedef struct _configitem_drpass ConfigItem_drpass;
typedef struct _configitem_ulines ConfigItem_ulines;
typedef struct _configitem_tld ConfigItem_tld;
typedef struct _configitem_listen ConfigItem_listen;
typedef struct _configitem_allow ConfigItem_allow;
typedef struct _configflag_allow ConfigFlag_allow;
typedef struct _configitem_allow_channel ConfigItem_allow_channel;
typedef struct _configitem_allow_dcc ConfigItem_allow_dcc;
typedef struct _configitem_vhost ConfigItem_vhost;
typedef struct _configitem_except ConfigItem_except;
typedef struct _configitem_link ConfigItem_link;
typedef struct _configitem_cgiirc ConfigItem_cgiirc;
typedef struct _configitem_ban ConfigItem_ban;
typedef struct _configitem_deny_dcc ConfigItem_deny_dcc;
typedef struct _configitem_deny_link ConfigItem_deny_link;
typedef struct _configitem_deny_channel ConfigItem_deny_channel;
typedef struct _configitem_deny_version ConfigItem_deny_version;
typedef struct _configitem_log ConfigItem_log;
typedef struct _configitem_unknown ConfigItem_unknown;
typedef struct _configitem_unknown_ext ConfigItem_unknown_ext;
typedef struct _configitem_alias ConfigItem_alias;
typedef struct _configitem_alias_format ConfigItem_alias_format;
typedef struct _configitem_include ConfigItem_include;
typedef struct _configitem_help ConfigItem_help;
typedef struct _configitem_offchans ConfigItem_offchans;
typedef struct liststruct ListStruct;
#define CFG_TIME 0x0001
#define CFG_SIZE 0x0002
#define CFG_YESNO 0x0004
typedef struct Watch aWatch;
typedef struct Client aClient;
typedef struct Channel aChannel;
typedef struct User anUser;
typedef struct Server aServer;
typedef struct SLink Link;
typedef struct SBan Ban;
typedef struct SMode Mode;
typedef struct ListOptions LOpts;
typedef struct Motd aMotdFile; /* represents a whole MOTD, including remote MOTD support info */
typedef struct MotdItem aMotdLine; /* one line of a MOTD stored as a linked list */
#ifdef USE_LIBCURL
typedef struct MotdDownload aMotdDownload; /* used to coordinate download of a remote MOTD */
#endif
typedef struct trecord aTrecord;
typedef struct Command aCommand;
typedef struct _cmdoverride Cmdoverride;
typedef struct SMember Member;
typedef struct SMembership Membership;
typedef struct SMembershipL MembershipL;
typedef struct JFlood aJFlood;
typedef struct PendingNet aPendingNet;
#ifdef NEED_U_INT32_T
typedef unsigned int u_int32_t; /* XXX Hope this works! */
#endif
#ifndef VMSP
#include "class.h"
#include "dbuf.h" /* THIS REALLY SHOULDN'T BE HERE!!! --msa */
#endif
#define HOSTLEN 63 /* Length of hostname. Updated to */
/* comply with RFC1123 */
#define NICKLEN 30
#define USERLEN 10
#define REALLEN 50
#define SVIDLEN 30
#define TOPICLEN 307
#define CHANNELLEN 32
#define PASSWDLEN 48 /* was 20, then 32, now 48. */
#define KEYLEN 23
#define LINKLEN 32
#define BUFSIZE 512 /* WARNING: *DONT* CHANGE THIS!!!! */
#define MAXRECIPIENTS 20
#define MAXKILLS 20
#define MAXSILELENGTH NICKLEN+USERLEN+HOSTLEN+10
#define IDLEN 10
#define UMODETABLESZ (sizeof(long) * 8)
/*
* Watch it - Don't change this unless you also change the ERR_TOOMANYWATCH
* and PROTOCOL_SUPPORTED settings.
*/
#define MAXWATCH 128
#define USERHOST_REPLYLEN (NICKLEN+HOSTLEN+USERLEN+5)
/* NOTE: this must be down here so the stuff from struct.h IT uses works */
#include "whowas.h"
/* Logging types */
#define LOG_ERROR 0x0001
#define LOG_KILL 0x0002
#define LOG_TKL 0x0004
#define LOG_KLINE 0x0008
#define LOG_CLIENT 0x0010
#define LOG_SERVER 0x0020
#define LOG_OPER 0x0040
#define LOG_SACMDS 0x0080
#define LOG_CHGCMDS 0x0100
#define LOG_OVERRIDE 0x0200
#define LOG_SPAMFILTER 0x0400
#define LOG_DBG 0x0800 /* fixme */
/*
** 'offsetof' is defined in ANSI-C. The following definition
** is not absolutely portable (I have been told), but so far
** it has worked on all machines I have needed it. The type
** should be size_t but... --msa
*/
#ifndef offsetof
#define offsetof(t,m) (int)((&((t *)0L)->m))
#endif
#define elementsof(x) (sizeof(x)/sizeof(x[0]))
/*
** flags for bootup options (command line flags)
*/
#define BOOT_CONSOLE 1
#define BOOT_QUICK 2
#define BOOT_DEBUG 4
#define BOOT_INETD 8
#define BOOT_TTY 16
#define BOOT_OPER 32
#define BOOT_AUTODIE 64
#define BOOT_NOFORK 128
#define STAT_LOG -7 /* logfile for -x */
#define STAT_CONNECTING -6
#define STAT_SSL_STARTTLS_HANDSHAKE -8
#define STAT_SSL_CONNECT_HANDSHAKE -5
#define STAT_SSL_ACCEPT_HANDSHAKE -4
#define STAT_HANDSHAKE -3
#define STAT_ME -2
#define STAT_UNKNOWN -1
#define STAT_SERVER 0
#define STAT_CLIENT 1
/*
* status macros.
*/
#define IsRegisteredUser(x) ((x)->status == STAT_CLIENT)
#define IsRegistered(x) ((x)->status >= STAT_SERVER)
#define IsConnecting(x) ((x)->status == STAT_CONNECTING)
#define IsHandshake(x) ((x)->status == STAT_HANDSHAKE)
#define IsMe(x) ((x)->status == STAT_ME)
#define IsUnknown(x) ((x)->status == STAT_UNKNOWN)
#define IsServer(x) ((x)->status == STAT_SERVER)
#define IsClient(x) ((x)->status == STAT_CLIENT)
#define IsLog(x) ((x)->status == STAT_LOG)
#ifdef USE_SSL
#define IsSSLStartTLSHandshake(x) ((x)->status == STAT_SSL_STARTTLS_HANDSHAKE)
#define IsSSLAcceptHandshake(x) ((x)->status == STAT_SSL_ACCEPT_HANDSHAKE)
#define IsSSLConnectHandshake(x) ((x)->status == STAT_SSL_CONNECT_HANDSHAKE)
#define IsSSLHandshake(x) (IsSSLAcceptHandshake(x) || IsSSLConnectHandshake(x) | IsSSLStartTLSHandshake(x))
#define SetSSLStartTLSHandshake(x) ((x)->status = STAT_SSL_STARTTLS_HANDSHAKE)
#define SetSSLAcceptHandshake(x) ((x)->status = STAT_SSL_ACCEPT_HANDSHAKE)
#define SetSSLConnectHandshake(x) ((x)->status = STAT_SSL_CONNECT_HANDSHAKE)
#endif
#define SetConnecting(x) ((x)->status = STAT_CONNECTING)
#define SetHandshake(x) ((x)->status = STAT_HANDSHAKE)
#define SetMe(x) ((x)->status = STAT_ME)
#define SetUnknown(x) ((x)->status = STAT_UNKNOWN)
#define SetServer(x) ((x)->status = STAT_SERVER)
#define SetClient(x) ((x)->status = STAT_CLIENT)
#define SetLog(x) ((x)->status = STAT_LOG)
#define IsSynched(x) (x->serv->flags.synced)
#define IsServerSent(x) (x->serv && x->serv->flags.server_sent)
/* client->flags (32 bits): 28 used, 4 free */
#define FLAGS_PINGSENT 0x0001 /* Unreplied ping sent */
#define FLAGS_DEADSOCKET 0x0002 /* Local socket is dead--Exiting soon */
#define FLAGS_KILLED 0x0004 /* Prevents "QUIT" from being sent for this */
#define FLAGS_OUTGOING 0x0010 /* outgoing connection, do not touch cptr->listener->clients */
#define FLAGS_CLOSING 0x0020 /* set when closing to suppress errors */
#define FLAGS_LISTEN 0x0040 /* used to mark clients which we listen() on */
#define FLAGS_CHKACCESS 0x0080 /* ok to check clients access if set */
#define FLAGS_DOINGDNS 0x0100 /* client is waiting for a DNS response */
#define FLAGS_AUTH 0x0200 /* client is waiting on rfc931 response */
#define FLAGS_WRAUTH 0x0400 /* set if we havent writen to ident server */
#define FLAGS_LOCAL 0x0800 /* set for local clients */
#define FLAGS_GOTID 0x1000 /* successful ident lookup achieved */
#define FLAGS_DOID 0x2000 /* I-lines say must use ident return */
#define FLAGS_NONL 0x4000 /* No \n in buffer */
#define FLAGS_CGIIRC 0x8000 /* CGI IRC host: flag set = ip/host data has been filled in already */
#define FLAGS_ULINE 0x10000 /* User/server is considered U-lined */
#define FLAGS_SQUIT 0x20000 /* Server has been /squit by an oper */
#define FLAGS_PROTOCTL 0x40000 /* Received a PROTOCTL message */
#define FLAGS_PING 0x80000
#define FLAGS_EAUTH 0x100000
#define FLAGS_NETINFO 0x200000
#define FLAGS_HYBNOTICE 0x400000
#define FLAGS_QUARANTINE 0x800000
//0x1000000 unused (was ziplinks)
#define FLAGS_DCCNOTICE 0x2000000 /* Has the user seen a notice on how to use DCCALLOW already? */
#define FLAGS_SHUNNED 0x4000000
#define FLAGS_VIRUS 0x8000000 /* tagged by spamfilter */
#ifdef USE_SSL
#define FLAGS_SSL 0x10000000
#endif
#define FLAGS_NOFAKELAG 0x20000000 /* Exception from fake lag */
#define FLAGS_DCCBLOCK 0x40000000 /* Block all DCC send requests */
#define FLAGS_MAP 0x80000000 /* Show this entry in /map */
/* Dec 26th, 1997 - added flags2 when I ran out of room in flags -DuffJ */
/* Dec 26th, 1997 - having a go at
* splitting flags into flags and umodes
* -DuffJ
*/
#define SNO_DEFOPER "+kscfvGqo"
#define SNO_DEFUSER "+ks"
#define SEND_UMODES (SendUmodes)
#define ALL_UMODES (AllUmodes)
/* SEND_UMODES and ALL_UMODES are now handled by umode_get/umode_lget/umode_gget -- Syzop. */
#define FLAGS_ID (FLAGS_DOID|FLAGS_GOTID)
#define PROTO_NOQUIT 0x0001 /* Negotiated NOQUIT protocol */
#define PROTO_SJOIN 0x0004 /* Negotiated SJOIN protocol */
#define PROTO_NICKv2 0x0008 /* Negotiated NICKv2 protocol */
#define PROTO_SJOIN2 0x0010 /* Negotiated SJOIN2 protocol */
#define PROTO_UMODE2 0x0020 /* Negotiated UMODE2 protocol */
#define PROTO_INVITENOTIFY 0x0080 /* client supports invite-notify */
#define PROTO_VL 0x0100 /* Negotiated VL protocol */
#define PROTO_SJ3 0x0200 /* Negotiated SJ3 protocol */
#define PROTO_VHP 0x0400 /* Send hostnames in NICKv2 even if not sethosted */
#define PROTO_SID 0x0800 /* SID/UID mode */
#define PROTO_TKLEXT 0x1000 /* TKL extension: 10 parameters instead of 8 (3.2RC2) */
#define PROTO_NICKIP 0x2000 /* Send IP addresses in the NICK command */
#define PROTO_NAMESX 0x4000 /* Send all rights in NAMES output */
#define PROTO_CLK 0x8000 /* Send cloaked host in the NICK command (regardless of +x/-x) */
#define PROTO_UHNAMES 0x10000 /* Send n!u@h in NAMES */
#define PROTO_CLICAP 0x20000 /* client capability negotiation in process */
#define PROTO_STARTTLS 0x40000 /* client supports STARTTLS */
#define PROTO_SASL 0x80000 /* client is doing SASL */
#define PROTO_AWAY_NOTIFY 0x100000 /* client supports away-notify */
#define PROTO_ACCOUNT_NOTIFY 0x200000 /* client supports account-notify */
#define PROTO_MLOCK 0x400000 /* server supports MLOCK */
/*
* flags macros.
*/
#define IsVictim(x) ((x)->umodes & UMODE_VICTIM)
#define IsDeaf(x) ((x)->umodes & UMODE_DEAF)
#define IsKillsF(x) ((x)->user->snomask & SNO_KILLS)
#define IsClientF(x) ((x)->user->snomask & SNO_CLIENT)
#define IsFloodF(x) ((x)->user->snomask & SNO_FLOOD)
#define IsEyes(x) ((x)->user->snomask & SNO_EYES)
#define IsWhois(x) ((x)->umodes & UMODE_WHOIS)
#define IsKix(x) ((x)->umodes & UMODE_KIX)
#define IsHelpOp(x) ((x)->umodes & UMODE_HELPOP)
#define IsAdmin(x) ((x)->umodes & UMODE_ADMIN)
#define IsNetAdmin(x) ((x)->umodes & UMODE_NETADMIN)
#define IsCoAdmin(x) ((x)->umodes & UMODE_COADMIN)
#define IsSAdmin(x) ((x)->umodes & UMODE_SADMIN)
#define SendFailops(x) ((x)->umodes & UMODE_FAILOP)
#define IsOper(x) ((x)->umodes & UMODE_OPER)
#define IsLocOp(x) ((x)->umodes & UMODE_LOCOP)
#define IsInvisible(x) ((x)->umodes & UMODE_INVISIBLE)
#define IsServices(x) ((x)->umodes & UMODE_SERVICES)
#define IsAnOper(x) ((x)->umodes & (UMODE_OPER|UMODE_LOCOP))
#define IsARegNick(x) ((x)->umodes & (UMODE_REGNICK))
#define IsRegNick(x) ((x)->umodes & UMODE_REGNICK)
#define IsRegNickMsg(x) ((x)->umodes & UMODE_RGSTRONLY)
#define IsPerson(x) ((x)->user && IsClient(x))
#define IsPrivileged(x) (IsAnOper(x) || IsServer(x))
#define SendWallops(x) (!IsMe(x) && IsPerson(x) && ((x)->umodes & UMODE_WALLOP))
#define SendServNotice(x) (((x)->user) && ((x)->user->snomask & SNO_SNOTICE))
#define IsListening(x) ((x)->flags & FLAGS_LISTEN)
// #define DoAccess(x) ((x)->flags & FLAGS_CHKACCESS)
#define IsLocal(x) ((x)->flags & FLAGS_LOCAL)
#define IsDead(x) ((x)->flags & FLAGS_DEADSOCKET)
#define GotProtoctl(x) ((x)->flags & FLAGS_PROTOCTL)
#define IsOutgoing(x) ((x)->flags & FLAGS_OUTGOING)
#define GotNetInfo(x) ((x)->flags & FLAGS_NETINFO)
#define SetNetInfo(x) ((x)->flags |= FLAGS_NETINFO)
#define IsCGIIRC(x) ((x)->flags & FLAGS_CGIIRC)
#define SetEAuth(x) ((x)->flags |= FLAGS_EAUTH)
#define IsEAuth(x) ((x)->flags & FLAGS_EAUTH)
#define IsShunned(x) ((x)->flags & FLAGS_SHUNNED)
#define SetShunned(x) ((x)->flags |= FLAGS_SHUNNED)
#define ClearShunned(x) ((x)->flags &= ~FLAGS_SHUNNED)
#define IsVirus(x) ((x)->flags & FLAGS_VIRUS)
#define SetVirus(x) ((x)->flags |= FLAGS_VIRUS)
#define ClearVirus(x) ((x)->flags &= ~FLAGS_VIRUS)
#ifdef USE_SSL
#define IsSecure(x) ((x)->flags & FLAGS_SSL)
#else
#define IsSecure(x) (0)
#endif
/* Fake lag exception */
#define IsNoFakeLag(x) ((x)->flags & FLAGS_NOFAKELAG)
#define SetNoFakeLag(x) ((x)->flags |= FLAGS_NOFAKELAG)
#define ClearNoFakeLag(x) ((x)->flags &= ~FLAGS_NOFAKELAG)
#define IsHybNotice(x) ((x)->flags & FLAGS_HYBNOTICE)
#define SetHybNotice(x) ((x)->flags |= FLAGS_HYBNOTICE)
#define ClearHybNotice(x) ((x)->flags &= ~FLAGS_HYBNOTICE)
#define IsHidden(x) ((x)->umodes & UMODE_HIDE)
#define IsSetHost(x) ((x)->umodes & UMODE_SETHOST)
#define IsHideOper(x) ((x)->umodes & UMODE_HIDEOPER)
#ifdef USE_SSL
#define IsSSL(x) IsSecure(x)
#endif
#define IsNotSpoof(x) ((x)->nospoof == 0)
#define GetHost(x) (IsHidden(x) ? (x)->user->virthost : (x)->user->realhost)
#define GetIP(x) ((x->user && x->user->ip_str) ? x->user->ip_str : (MyConnect(x) ? Inet_ia2p(&x->ip) : "255.255.255.255"))
#define SetKillsF(x) ((x)->user->snomask |= SNO_KILLS)
#define SetClientF(x) ((x)->user->snomask |= SNO_CLIENT)
#define SetFloodF(x) ((x)->user->snomask |= SNO_FLOOD)
#define SetHelpOp(x) ((x)->umodes |= UMODE_HELPOP)
#define SetOper(x) ((x)->umodes |= UMODE_OPER)
#define SetLocOp(x) ((x)->umodes |= UMODE_LOCOP)
#define SetAdmin(x) ((x)->umodes |= UMODE_ADMIN)
#define SetSAdmin(x) ((x)->umodes |= UMODE_SADMIN)
#define SetNetAdmin(x) ((x)->umodes |= UMODE_NETADMIN)
#define SetCoAdmin(x) ((x)->umodes |= UMODE_COADMIN)
#define SetInvisible(x) ((x)->umodes |= UMODE_INVISIBLE)
#define SetEyes(x) ((x)->user->snomask |= SNO_EYES)
#define SetWallops(x) ((x)->umodes |= UMODE_WALLOP)
#define SetDNS(x) ((x)->flags |= FLAGS_DOINGDNS)
#define DoingDNS(x) ((x)->flags & FLAGS_DOINGDNS)
#define SetAccess(x) ((x)->flags |= FLAGS_CHKACCESS); Debug((DEBUG_DEBUG, "SetAccess(%s)", (x)->name))
#define SetOutgoing(x) do { x->flags |= FLAGS_OUTGOING; } while(0)
#define SetCGIIRC(x) do { x->flags |= FLAGS_CGIIRC; } while(0)
#define DoingAuth(x) ((x)->flags & FLAGS_AUTH)
#define NoNewLine(x) ((x)->flags & FLAGS_NONL)
#define IsDCCNotice(x) ((x)->flags & FLAGS_DCCNOTICE)
#define SetDCCNotice(x) do { x->flags |= FLAGS_DCCNOTICE; } while(0)
#define SetRegNick(x) ((x)->umodes & UMODE_REGNICK)
#define SetHidden(x) ((x)->umodes |= UMODE_HIDE)
#define SetHideOper(x) ((x)->umodes |= UMODE_HIDEOPER)
#define IsSecureConnect(x) ((x)->umodes & UMODE_SECURE)
#define ClearAdmin(x) ((x)->umodes &= ~UMODE_ADMIN)
#define ClearNetAdmin(x) ((x)->umodes &= ~UMODE_NETADMIN)
#define ClearCoAdmin(x) ((x)->umodes &= ~UMODE_COADMIN)
#define ClearSAdmin(x) ((x)->umodes &= ~UMODE_SADMIN)
#define ClearKillsF(x) ((x)->user->snomask &= ~SNO_KILLS)
#define ClearClientF(x) ((x)->user->snomask &= ~SNO_CLIENT)
#define ClearFloodF(x) ((x)->user->snomask &= ~SNO_FLOOD)
#define ClearEyes(x) ((x)->user->snomask &= ~SNO_EYES)
#define ClearHelpOp(x) ((x)->umodes &= ~UMODE_HELPOP)
#define ClearFailops(x) ((x)->umodes &= ~UMODE_FAILOP)
#define ClearOper(x) ((x)->umodes &= ~UMODE_OPER)
#define ClearInvisible(x) ((x)->umodes &= ~UMODE_INVISIBLE)
#define ClearServices(x) ((x)->umodes &= ~UMODE_SERVICES)
#define ClearWallops(x) ((x)->umodes &= ~UMODE_WALLOP)
#define ClearDNS(x) ((x)->flags &= ~FLAGS_DOINGDNS)
#define ClearAuth(x) ((x)->flags &= ~FLAGS_AUTH)
#define ClearAccess(x) ((x)->flags &= ~FLAGS_CHKACCESS)
#define ClearHidden(x) ((x)->umodes &= ~UMODE_HIDE)
#define ClearHideOper(x) ((x)->umodes &= ~UMODE_HIDEOPER)
/*
* ProtoCtl options
*/
#ifndef DEBUGMODE
#define CHECKPROTO(x,y) ((x)->proto & y)
#else
#define CHECKPROTO(x,y) (checkprotoflags(x, y, __FILE__, __LINE__))
#endif
#define DontSendQuit(x) (CHECKPROTO(x, PROTO_NOQUIT))
#define SupportSJOIN(x) (CHECKPROTO(x, PROTO_SJOIN))
#define SupportNICKv2(x) (CHECKPROTO(x, PROTO_NICKv2))
#define SupportNICKIP(x) (CHECKPROTO(x, PROTO_NICKIP))
#define SupportSJOIN2(x) (CHECKPROTO(x, PROTO_SJOIN2))
#define SupportUMODE2(x) (CHECKPROTO(x, PROTO_UMODE2))
#define SupportVL(x) (CHECKPROTO(x, PROTO_VL))
#define SupportSJ3(x) (CHECKPROTO(x, PROTO_SJ3))
#define SupportVHP(x) (CHECKPROTO(x, PROTO_VHP))
#define SupportTKLEXT(x) (CHECKPROTO(x, PROTO_TKLEXT))
#define SupportNAMESX(x) (CHECKPROTO(x, PROTO_NAMESX))
#define SupportCLK(x) (CHECKPROTO(x, PROTO_CLK))
#define SupportUHNAMES(x) (CHECKPROTO(x, PROTO_UHNAMES))
#define SupportSID(x) (CHECKPROTO(x, PROTO_SID))
#define SetSJOIN(x) ((x)->proto |= PROTO_SJOIN)
#define SetNoQuit(x) ((x)->proto |= PROTO_NOQUIT)
#define SetNICKv2(x) ((x)->proto |= PROTO_NICKv2)
#define SetSJOIN2(x) ((x)->proto |= PROTO_SJOIN2)
#define SetUMODE2(x) ((x)->proto |= PROTO_UMODE2)
#define SetVL(x) ((x)->proto |= PROTO_VL)
#define SetSJ3(x) ((x)->proto |= PROTO_SJ3)
#define SetVHP(x) ((x)->proto |= PROTO_VHP)
#define SetTKLEXT(x) ((x)->proto |= PROTO_TKLEXT)
#define SetNAMESX(x) ((x)->proto |= PROTO_NAMESX)
#define SetCLK(x) ((x)->proto |= PROTO_CLK)
#define SetUHNAMES(x) ((x)->proto |= PROTO_UHNAMES)
#define ClearSJOIN(x) ((x)->proto &= ~PROTO_SJOIN)
#define ClearNoQuit(x) ((x)->proto &= ~PROTO_NOQUIT)
#define ClearNICKv2(x) ((x)->proto &= ~PROTO_NICKv2)
#define ClearSJOIN2(x) ((x)->proto &= ~PROTO_SJOIN2)
#define ClearUMODE2(x) ((x)->proto &= ~PROTO_UMODE2)
#define ClearVL(x) ((x)->proto &= ~PROTO_VL)
#define ClearVHP(x) ((x)->proto &= ~PROTO_VHP)
#define ClearSJ3(x) ((x)->proto &= ~PROTO_SJ3)
/*
* defined operator access levels
*/
#define OFLAG_REHASH 0x00000001 /* Oper can /rehash server */
#define OFLAG_DIE 0x00000002 /* Oper can /die the server */
#define OFLAG_RESTART 0x00000004 /* Oper can /restart the server */
#define OFLAG_DCCDENY 0x00000008 /* Oper can use /dccdeny and /undccdeny */
#define OFLAG_HELPOP 0x00000010 /* Oper can send /HelpOps */
#define OFLAG_GLOBOP 0x00000020 /* Oper can send /GlobOps */
#define OFLAG_WALLOP 0x00000040 /* Oper can send /WallOps */
#define OFLAG_LOCOP 0x00000080 /* Oper can send /LocOps */
#define OFLAG_LROUTE 0x00000100 /* Oper can do local routing */
#define OFLAG_GROUTE 0x00000200 /* Oper can do global routing */
#define OFLAG_LKILL 0x00000400 /* Oper can do local kills */
#define OFLAG_GKILL 0x00000800 /* Oper can do global kills */
#define OFLAG_KLINE 0x00001000 /* Oper can /kline users */
#define OFLAG_UNKLINE 0x00002000 /* Oper can /unkline users */
#define OFLAG_LNOTICE 0x00004000 /* Oper can send local serv notices */
#define OFLAG_GNOTICE 0x00008000 /* Oper can send global notices */
#define OFLAG_ADMIN 0x00010000 /* Admin */
#define OFLAG_ADDLINE 0x00020000 /* Oper can use /addline */
#define OFLAG_TSCTL 0x00040000 /* Oper can use /tsctl */
#define OFLAG_ZLINE 0x00080000 /* Oper can use /zline and /unzline */
#define OFLAG_NETADMIN 0x00200000 /* netadmin gets +N */
#define OFLAG_COADMIN 0x00800000 /* co admin gets +C */
#define OFLAG_SADMIN 0x01000000 /* services admin gets +a */
#define OFLAG_WHOIS 0x02000000 /* gets auto +W on oper up */
#define OFLAG_HIDE 0x04000000 /* gets auto +x on oper up */
#define OFLAG_TKL 0x10000000 /* can use G:lines and shuns */
#define OFLAG_GZL 0x20000000 /* can use global Z:lines */
#define OFLAG_OVERRIDE 0x40000000 /* can use oper-override */
#define OFLAG_UMODEQ 0x80000000 /* can set +q */
#define OFLAG_LOCAL (OFLAG_REHASH|OFLAG_HELPOP|OFLAG_GLOBOP|OFLAG_WALLOP|OFLAG_LOCOP|OFLAG_LROUTE|OFLAG_LKILL|OFLAG_KLINE|OFLAG_UNKLINE|OFLAG_LNOTICE)
#define OFLAG_GLOBAL (OFLAG_LOCAL|OFLAG_GROUTE|OFLAG_GKILL|OFLAG_GNOTICE)
#define OFLAG_ISGLOBAL (OFLAG_GROUTE|OFLAG_GKILL|OFLAG_GNOTICE|OFLAG_TKL|OFLAG_GZL|OFLAG_OVERRIDE)
#define OFLAG_NADMIN (OFLAG_NETADMIN | OFLAG_SADMIN | OFLAG_ADMIN | OFLAG_GLOBAL | OFLAG_UMODEQ | OFLAG_DCCDENY)
#define OFLAG_ADMIN_ (OFLAG_ADMIN | OFLAG_GLOBAL | OFLAG_DCCDENY)
#define OFLAG_COADMIN_ (OFLAG_COADMIN | OFLAG_GLOBAL | OFLAG_DCCDENY)
#define OFLAG_SADMIN_ (OFLAG_SADMIN | OFLAG_GLOBAL | OFLAG_UMODEQ | OFLAG_DCCDENY)
#define OPCanOverride(x) ((x)->oflag & OFLAG_OVERRIDE)
#define OPCanUmodeq(x) ((x)->oflag & OFLAG_UMODEQ)
#define OPCanDCCDeny(x) ((x)->oflag & OFLAG_DCCDENY)
#define OPCanTKL(x) ((x)->oflag & OFLAG_TKL)
#define OPCanGZL(x) ((x)->oflag & OFLAG_GZL)
#define OPCanAddline(x) ((x)->oflag & OFLAG_ADDLINE)
#define OPCanZline(x) ((x)->oflag & OFLAG_ZLINE)
#define OPCanRehash(x) ((x)->oflag & OFLAG_REHASH)
#define OPCanDie(x) ((x)->oflag & OFLAG_DIE)
#define OPCanTSCtl(x) ((x)->oflag & OFLAG_TSCTL)
#define OPCanRestart(x) ((x)->oflag & OFLAG_RESTART)
#define OPCanHelpOp(x) ((x)->oflag & OFLAG_HELPOP)
#define OPCanGlobOps(x) ((x)->oflag & OFLAG_GLOBOP)
#define OPCanWallOps(x) ((x)->oflag & OFLAG_WALLOP)
#define OPCanLocOps(x) ((x)->oflag & OFLAG_LOCOP)
#define OPCanLRoute(x) ((x)->oflag & OFLAG_LROUTE)
#define OPCanGRoute(x) ((x)->oflag & OFLAG_GROUTE)
#define OPCanLKill(x) ((x)->oflag & OFLAG_LKILL)
#define OPCanGKill(x) ((x)->oflag & OFLAG_GKILL)
#define OPCanKline(x) ((x)->oflag & OFLAG_KLINE)
#define OPCanUnKline(x) ((x)->oflag & OFLAG_UNKLINE)
#define OPCanLNotice(x) ((x)->oflag & OFLAG_LNOTICE)
#define OPCanGNotice(x) ((x)->oflag & OFLAG_GNOTICE)
#define OPIsAdmin(x) ((x)->oflag & OFLAG_ADMIN)
#define OPIsSAdmin(x) ((x)->oflag & OFLAG_SADMIN)
#define OPIsNetAdmin(x) ((x)->oflag & OFLAG_NETADMIN)
#define OPIsCoAdmin(x) ((x)->oflag & OFLAG_COADMIN)
#define OPIsWhois(x) ((x)->oflag & OFLAG_WHOIS)
#ifdef SHOW_SECRET
#define OPCanSeeSecret(x) IsAnOper(x)
#else
#define OPCanSeeSecret(x) IsNetAdmin(x)
#endif
#define OPSetRehash(x) ((x)->oflag |= OFLAG_REHASH)
#define OPSetDie(x) ((x)->oflag |= OFLAG_DIE)
#define OPSetTSCtl(x) ((x)->oflag |= OFLAG_TSCTL)
#define OPSetRestart(x) ((x)->oflag |= OFLAG_RESTART)
#define OPSetHelpOp(x) ((x)->oflag |= OFLAG_HELPOP)
#define OPSetGlobOps(x) ((x)->oflag |= OFLAG_GLOBOP)
#define OPSetWallOps(x) ((x)->oflag |= OFLAG_WALLOP)
#define OPSetLocOps(x) ((x)->oflag |= OFLAG_LOCOP)
#define OPSetLRoute(x) ((x)->oflag |= OFLAG_LROUTE)
#define OPSetGRoute(x) ((x)->oflag |= OFLAG_GROUTE)
#define OPSetLKill(x) ((x)->oflag |= OFLAG_LKILL)
#define OPSetGKill(x) ((x)->oflag |= OFLAG_GKILL)
#define OPSetKline(x) ((x)->oflag |= OFLAG_KLINE)
#define OPSetUnKline(x) ((x)->oflag |= OFLAG_UNKLINE)
#define OPSetLNotice(x) ((x)->oflag |= OFLAG_LNOTICE)
#define OPSetGNotice(x) ((x)->oflag |= OFLAG_GNOTICE)
#define OPSSetAdmin(x) ((x)->oflag |= OFLAG_ADMIN)
#define OPSSetSAdmin(x) ((x)->oflag |= OFLAG_SADMIN)
#define OPSSetNetAdmin(x) ((x)->oflag |= OFLAG_NETADMIN)
#define OPSSetCoAdmin(x) ((x)->oflag |= OFLAG_COADMIN)
#define OPSetZLine(x) ((x)->oflag |= OFLAG_ZLINE)
#define OPSetWhois(x) ((x)->oflag |= OFLAG_WHOIS)
#define OPClearRehash(x) ((x)->oflag &= ~OFLAG_REHASH)
#define OPClearDie(x) ((x)->oflag &= ~OFLAG_DIE)
#define OPClearTSCtl(x) ((x)->oflag &= ~OFLAG_TSCTL)
#define OPClearRestart(x) ((x)->oflag &= ~OFLAG_RESTART)
#define OPClearHelpOp(x) ((x)->oflag &= ~OFLAG_HELPOP)
#define OPClearGlobOps(x) ((x)->oflag &= ~OFLAG_GLOBOP)
#define OPClearWallOps(x) ((x)->oflag &= ~OFLAG_WALLOP)
#define OPClearLocOps(x) ((x)->oflag &= ~OFLAG_LOCOP)
#define OPClearLRoute(x) ((x)->oflag &= ~OFLAG_LROUTE)
#define OPClearGRoute(x) ((x)->oflag &= ~OFLAG_GROUTE)
#define OPClearLKill(x) ((x)->oflag &= ~OFLAG_LKILL)
#define OPClearGKill(x) ((x)->oflag &= ~OFLAG_GKILL)
#define OPClearKline(x) ((x)->oflag &= ~OFLAG_KLINE)
#define OPClearUnKline(x) ((x)->oflag &= ~OFLAG_UNKLINE)
#define OPClearLNotice(x) ((x)->oflag &= ~OFLAG_LNOTICE)
#define OPClearGNotice(x) ((x)->oflag &= ~OFLAG_GNOTICE)
#define OPClearAdmin(x) ((x)->oflag &= ~OFLAG_ADMIN)
#define OPClearSAdmin(x) ((x)->oflag &= ~OFLAG_SADMIN)
#define OPClearNetAdmin(x) ((x)->oflag &= ~OFLAG_NETADMIN)
#define OPClearCoAdmin(x) ((x)->oflag &= ~OFLAG_COADMIN)
#define OPClearZLine(x) ((x)->oflag &= ~OFLAG_ZLINE)
#define OPClearWhois(x) ((x)->oflag &= ~OFLAG_WHOIS)
/*
* defined debugging levels
*/
#define DEBUG_FATAL 0
#define DEBUG_ERROR 1 /* report_error() and other errors that are found */
#define DEBUG_NOTICE 3
#define DEBUG_DNS 4 /* used by all DNS related routines - a *lot* */
#define DEBUG_INFO 5 /* general usful info */
#define DEBUG_NUM 6 /* numerics */
#define DEBUG_SEND 7 /* everything that is sent out */
#define DEBUG_DEBUG 8 /* anything to do with debugging, ie unimportant :) */
#define DEBUG_MALLOC 9 /* malloc/free calls */
#define DEBUG_LIST 10 /* debug list use */
/* blah */
#define IsSkoAdmin(sptr) (IsAdmin(sptr) || IsNetAdmin(sptr) || IsSAdmin(sptr))
/*
* defines for curses in client
*/
#define DUMMY_TERM 0
#define CURSES_TERM 1
#define TERMCAP_TERM 2
/* Dcc deny types (see src/s_extra.c) */
#define DCCDENY_HARD 0
#define DCCDENY_SOFT 1
/* Linked list dcc flags */
#define DCC_LINK_ME 1 /* My dcc allow */
#define DCC_LINK_REMOTE 2 /* I need to remove dccallows from these clients when I die */
#define ID(sptr) (*sptr->id ? sptr->id : sptr->name)
/* Maximum number of moddata objects that may be attached to an object -- maybe move to config.h? */
#define MODDATA_MAX_CLIENT 8
#define MODDATA_MAX_CHANNEL 8
#define MODDATA_MAX_MEMBER 4
#define MODDATA_MAX_MEMBERSHIP 4
/** Union for moddata objects */
typedef union _moddata ModData;
union _moddata
{
int i;
long l;
char *str;
void *ptr;
};
struct irc_netmask
{
short int type;
struct IN_ADDR mask;
short int bits;
};
#ifdef USE_LIBCURL
struct Motd;
struct MotdDownload
{
struct Motd *themotd;
};
#endif /* USE_LIBCURL */
struct Motd
{
struct MotdItem *lines;
struct tm last_modified; /* store the last modification time */
#ifdef USE_LIBCURL
/*
This pointer is used to communicate with an asynchronous MOTD
download. The problem is that a download may take 10 seconds or
more to complete and, in that time, the IRCd could be rehashed.
This would mean that TLD blocks are reallocated and thus the
aMotd structs would be free()d in the meantime.
To prevent such a situation from leading to a segfault, we
introduce this remote control pointer. It works like this:
1. read_motd() is called with a URL. A new MotdDownload is
allocated and the pointer is placed here. This pointer is
also passed to the asynchrnous download handler.
2.a. The download is completed and read_motd_asynch_downloaded()
is called with the same pointer. From this function, this pointer
if free()d. No other code may free() the pointer. Not even free_motd().
OR
2.b. The user rehashes the IRCd before the download is completed.
free_motd() is called, which sets motd_download->themotd to NULL
to signal to read_motd_asynch_downloaded() that it should ignore
the download. read_motd_asynch_downloaded() is eventually called
and frees motd_download.
*/
struct MotdDownload *motd_download;
#endif /* USE_LIBCURL */
};
struct MotdItem {
char *line;
struct MotdItem *next;
};
struct aloopStruct {
unsigned do_garbage_collect : 1;
unsigned ircd_booted : 1;
unsigned do_bancheck : 1; /* perform *line bancheck? */
unsigned do_bancheck_spamf_user : 1; /* perform 'user' spamfilter bancheck */
unsigned do_bancheck_spamf_away : 1; /* perform 'away' spamfilter bancheck */
unsigned ircd_rehashing : 1;
unsigned tainted : 1;
aClient *rehash_save_cptr, *rehash_save_sptr;
int rehash_save_sig;
};
typedef struct Whowas {
int hashv;
char *name;
char *username;
char *hostname;
char *virthost;
char *servername;
char *realname;
long umodes;
TS logoff;
struct Client *online; /* Pointer to new nickname for chasing or NULL */
struct Whowas *next; /* for hash table... */
struct Whowas *prev; /* for hash table... */
struct Whowas *cnext; /* for client struct linked list */
struct Whowas *cprev; /* for client struct linked list */
} aWhowas;
/*
* Client structures
*/
struct User {
Membership *channel; /* chain of channel pointer blocks */
Link *invited; /* chain of invite pointer blocks */
Link *silence; /* chain of silence pointer blocks */
Link *dccallow; /* chain of dccallowed entries */
char *away; /* pointer to away message */
/*
* svid: a value that is assigned by services to this user record.
* in previous versions of Unreal, this was strictly a timestamp value,
* which is less useful in the modern world of IRC where nicks are grouped to
* accounts, so it is now a string.
*/
char svid[SVIDLEN + 1];
signed char refcnt; /* Number of times this block is referenced */
unsigned short joined; /* number of channels joined */
char username[USERLEN + 1];
char realhost[HOSTLEN + 1];
char cloakedhost[HOSTLEN + 1]; /* cloaked host (masked host for caching). NOT NECESSARILY THE SAME AS virthost. */
char *virthost;
char *server;
char *swhois; /* special whois thing */
LOpts *lopt; /* Saved /list options */
aWhowas *whowas;
int snomask;
#ifdef LIST_DEBUG
aClient *bcptr;
#endif
char *ip_str; /* The IP in string form */
char *operlogin; /* Only used if person is/was opered, used for oper::maxlogins */
struct {
time_t nick_t;
unsigned char nick_c;
#ifdef NO_FLOOD_AWAY
time_t away_t; /* last time the user set away */
unsigned char away_c; /* number of times away has been set */
#endif
} flood;
aJFlood *jflood; /* TODO: move to dynamic modular storage */
TS lastaway;
};
struct Server {
struct Server *nexts;
anUser *user; /* who activated this connection */
char *up; /* uplink for this server */
char by[NICKLEN + 1];
ConfigItem_link *conf;
TS timestamp; /* Remotely determined connect try time */
long users;
#ifdef LIST_DEBUG
aClient *bcptr;
#endif
struct {
unsigned synced:1; /* Server linked? (3.2beta18+) */
unsigned server_sent:1; /* SERVER message sent to this link? (for outgoing links) */
} flags;
};
#define M_UNREGISTERED 0x0001
#define M_USER 0x0002
#define M_SERVER 0x0004
#define M_SHUN 0x0008
#define M_NOLAG 0x0010
#define M_ALIAS 0x0020
#define M_RESETIDLE 0x0040
#define M_VIRUS 0x0080
#define M_ANNOUNCE 0x0100
#define M_OPER 0x0200
/* tkl:
* TKL_KILL|TKL_GLOBAL = Global K:Line (G:Line)
* TKL_ZAP|TKL_GLOBAL = Global Z:Line (ZLINE)
* TKL_KILL = Timed local K:Line
* TKL_ZAP = Local Z:Line
*/
#define TKL_KILL 0x0001
#define TKL_ZAP 0x0002
#define TKL_GLOBAL 0x0004
#define TKL_SHUN 0x0008
#define TKL_QUIET 0x0010
#define TKL_SPAMF 0x0020
#define TKL_NICK 0x0040
#define SPAMF_CHANMSG 0x0001 /* c */
#define SPAMF_USERMSG 0x0002 /* p */
#define SPAMF_USERNOTICE 0x0004 /* n */
#define SPAMF_CHANNOTICE 0x0008 /* N */
#define SPAMF_PART 0x0010 /* P */
#define SPAMF_QUIT 0x0020 /* q */
#define SPAMF_DCC 0x0040 /* d */
#define SPAMF_USER 0x0080 /* u */
#define SPAMF_AWAY 0x0100 /* a */
#define SPAMF_TOPIC 0x0200 /* t */
/* Other flags only for function calls: */
#define SPAMFLAG_NOWARN 0x0001
struct _spamfilter {
unsigned short action; /* see BAN_ACT* */
regex_t expr;
char *tkl_reason; /* spamfilter reason field [escaped by unreal_encodespace()!] */
TS tkl_duration;
};
struct t_kline {
aTKline *prev, *next;
int type;
unsigned short subtype; /* subtype (currently spamfilter only), see SPAMF_* */
union {
Spamfilter *spamf;
struct irc_netmask *netmask;
} ptr;
char usermask[USERLEN + 3];
char *hostmask, *reason, *setby;
TS expire_at, set_at;
};
struct _spamexcept {
SpamExcept *prev, *next;
char name[1];
};
typedef struct ircstatsx {
int clients; /* total */
int invisible; /* invisible */
unsigned short servers; /* servers */
int operators; /* operators */
int unknown; /* unknown local connections */
int channels; /* channels */
int me_clients; /* my clients */
unsigned short me_servers; /* my servers */
int me_max; /* local max */
int global_max; /* global max */
} ircstats;
extern MODVAR ircstats IRCstats;
#include "modules.h"
extern MODVAR Umode *Usermode_Table;
extern MODVAR short Usermode_highest;
extern MODVAR Snomask *Snomask_Table;
extern MODVAR short Snomask_highest;
extern MODVAR Cmode *Channelmode_Table;
extern MODVAR unsigned short Channelmode_highest;
extern Umode *UmodeAdd(Module *module, char ch, int options, int (*allowed)(aClient *sptr, int what), long *mode);
extern void UmodeDel(Umode *umode);
extern Snomask *SnomaskAdd(Module *module, char ch, int (*allowed)(aClient *sptr, int what), long *mode);
extern void SnomaskDel(Snomask *sno);
extern Cmode *CmodeAdd(Module *reserved, CmodeInfo req, Cmode_t *mode);
extern void CmodeDel(Cmode *cmode);
extern void moddata_init(void);
extern ModDataInfo *ModDataAdd(Module *module, ModDataInfo req);
extern void ModDataDel(ModDataInfo *md);
extern void unload_all_unused_moddata(void);
#define LISTENER_NORMAL 0x000001
#define LISTENER_CLIENTSONLY 0x000002
#define LISTENER_SERVERSONLY 0x000004
#define LISTENER_SSL 0x000010
#define LISTENER_BOUND 0x000020
#define LISTENER_DEFER_ACCEPT 0x000040
#define IsServersOnlyListener(x) ((x) && ((x)->options & LISTENER_SERVERSONLY))
#define CONNECT_SSL 0x000001
//0x000002 unused (was ziplinks)
#define CONNECT_AUTO 0x000004
#define CONNECT_QUARANTINE 0x000008
#define CONNECT_NODNSCACHE 0x000010
#define CONNECT_NOHOSTCHECK 0x000020
#define SSLFLAG_FAILIFNOCERT 0x1
#define SSLFLAG_VERIFYCERT 0x2
#define SSLFLAG_DONOTACCEPTSELFSIGNED 0x4
#define SSLFLAG_NOSTARTTLS 0x8
struct Client {
struct list_head client_node; /* for global client list (client_list) */
struct list_head client_hash; /* for clientTable */
struct list_head id_hash; /* for idTable */
anUser *user; /* ...defined, if this is a User */
aServer *serv; /* ...defined, if this is a server */
TS lastnick; /* TimeStamp on nick */
long flags; /* client flags */
long umodes; /* client usermodes */
aClient *from; /* == &me, if Local Client, *NEVER* NULL! */
int fd; /* >= 0, for local clients */
unsigned char hopcount; /* number of servers to this 0 = local */
char name[HOSTLEN + 1]; /* Unique name of the client, nick or host */
char username[USERLEN + 1]; /* username here now for auth stuff */
char info[REALLEN + 1]; /* Free form additional client information */
char id[IDLEN + 1]; /* SID or UID */
aClient *srvptr; /* Server introducing this. May be &me */
short status; /* client type */
ModData moddata[MODDATA_MAX_CLIENT]; /* for modules */
/*
** The following fields are allocated only for local clients
** (directly connected to *this* server with a socket.
** The first of them *MUST* be the "count"--it is the field
** to which the allocation is tied to! *Never* refer to
** these fields, if (from != self).
*/
int count; /* Amount of data in buffer */
struct list_head lclient_node; /* for local client list (lclient_list) */
struct list_head special_node; /* for special lists (server || unknown || oper) */
#if 1
int oflag; /* oper access flags (removed from anUser for mem considerations) */
TS since; /* time they will next be allowed to send something */
TS firsttime; /* Time it was created */
TS lasttime; /* last time any message was received */
TS last; /* last time a RESETIDLE message was received */
TS nexttarget; /* next time that a new target will be allowed (msg/notice/invite) */
TS nextnick; /* Time the next nick change will be allowed */
u_char targets[MAXTARGETS]; /* hash values of targets */
#endif
char buffer[BUFSIZE]; /* Incoming message buffer */
short lastsq; /* # of 2k blocks when sendqueued called last */
dbuf sendQ; /* Outgoing message queue--if socket full */
dbuf recvQ; /* Hold for data incoming yet to be parsed */
u_int32_t nospoof; /* Anti-spoofing random number */
int proto; /* ProtoCtl options */
long sendM; /* Statistics: protocol messages send */
long sendK; /* Statistics: total k-bytes send */
long receiveM; /* Statistics: protocol messages received */
#ifdef USE_SSL
SSL *ssl;
#elif defined(_WIN32)
void *ssl_NOTUSED; /* (win32 binary compatability) */