"Fossies" - the Fresh Open Source Software Archive

Member "bahamut-2.1.5/include/h.h" (28 May 2020, 13174 Bytes) of package /linux/privat/bahamut-2.1.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "h.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.1.4_vs_2.1.5.

    1 /************************************************************************
    2  *   IRC - Internet Relay Chat, include/h.h
    3  *   Copyright (C) 1992 Darren Reed
    4  *
    5  *   This program is free software; you can redistribute it and/or modify
    6  *   it under the terms of the GNU General Public License as published by
    7  *   the Free Software Foundation; either version 1, or (at your option)
    8  *   any later version.
    9  *
   10  *   This program is distributed in the hope that it will be useful,
   11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
   12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   13  *   GNU General Public License for more details.
   14  *
   15  *   You should have received a copy of the GNU General Public License
   16  *   along with this program; if not, write to the Free Software
   17  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   18  */
   19 /*
   20  * "h.h". - Headers file.
   21  * 
   22  * Most of the externs and prototypes thrown in here to 'cleanup' things.
   23  * -avalon
   24  * 
   25  * 
   26  */
   27 
   28 #ifndef H_H
   29 #define H_H
   30 
   31 #include "send.h"
   32 #include "ircsprintf.h"
   33 
   34 extern int  R_do_dns, R_fin_dns, R_fin_dnsc, R_fail_dns, R_do_id,
   35     R_fin_id, R_fail_id;
   36 
   37 extern aMotd *motd;
   38 extern struct tm *motd_tm;
   39 
   40 extern aMotd *shortmotd;
   41 extern aMotd *helpfile;     /* oper helpfile is a link list of aMotd */
   42 
   43 extern DLink *server_list;
   44 extern DLink *oper_list;
   45 extern DLink *listing_clients;
   46 extern DLink *recvq_clients;
   47 
   48 extern aConnect *connects;
   49 extern aAllow *allows;
   50 extern aPort *ports;
   51 extern Conf_Me *MeLine;
   52 extern aOper *opers;
   53 extern char  *uservers[];
   54 extern aClass *classes;
   55 
   56 extern char ProxyMonURL[TOPICLEN+1];
   57 extern char ProxyMonHost[HOSTLEN+1];
   58 extern char Network_Name[HOSTLEN+1];
   59 extern char Services_Name[HOSTLEN+1];
   60 extern char Stats_Name[HOSTLEN+1];
   61 extern char Staff_Address[HOSTLEN+1];
   62 extern char NS_Register_URL[TOPICLEN+1];
   63 extern char SpamFilter_URL[TOPICLEN+1];
   64 extern char Network_Kline_Address[HOSTLEN+1];
   65 extern char Local_Kline_Address[HOSTLEN+1];
   66 extern int  maxchannelsperuser, tsmaxdelta, tswarndelta;
   67 extern int  confopts, new_confopts;
   68 extern int  local_ip_limit, local_ip24_limit, global_ip_limit,
   69             global_ip24_limit;
   70 
   71 #ifndef PATH_MAX
   72 #define PATH_MAX 4096
   73 #endif
   74 extern char dpath[PATH_MAX], spath[PATH_MAX];
   75 
   76 #include "fdlist.h"
   77 extern fdlist    serv_fdlist;
   78 extern fdlist    busycli_fdlist;
   79 extern fdlist    default_fdlist;
   80 extern fdlist    oper_fdlist;
   81 extern int       MAXCLIENTS;
   82 extern struct Counter Count;
   83 
   84 extern time_t    NOW;
   85 extern time_t    last_stat_save;
   86 extern time_t    nextconnect, nextdnscheck, nextping, timeofday;
   87 extern aClient  *client, me, *local[];
   88 extern aChannel *channel;
   89 extern struct    stats *ircstp;
   90 extern int       bootopt;
   91 
   92 extern char     *canonize(char *);
   93 extern void      check_fdlists();
   94 extern aChannel *find_channel(char *, aChannel *);
   95 extern void flush_user_banserial(aClient *);
   96 extern aBan     *nick_is_banned(aChannel *, char *, aClient *);
   97 extern void      remove_matching_bans(aChannel *, aClient *, aClient *);
   98 #ifdef EXEMPT_LISTS
   99 extern void      remove_matching_exempts(aChannel *, aClient *, aClient *);
  100 #endif
  101 #ifdef INVITE_LISTS
  102 extern void      remove_matching_invites(aChannel *, aClient *, aClient *);
  103 #endif
  104 extern void      remove_user_from_channel(aClient *, aChannel *);
  105 extern void      del_invite(aClient *, aChannel *);
  106 extern void      send_user_joins(aClient *, aClient *);
  107 extern int       can_send(aClient *, aChannel *, char *);
  108 extern int       is_chan_op(aClient *, aChannel *);
  109 extern int       is_chan_halfop(aClient *, aChannel *);
  110 extern int       is_chan_opvoice(aClient *, aChannel *);
  111 extern int       has_voice(aClient *, aChannel *);
  112 extern int       count_channels(aClient *);
  113 extern char     *pretty_mask(char *);
  114 extern int       find_shared_chan(aClient *cptr1, aClient *cptr2);
  115 
  116 
  117 extern aClient  *find_chasing(aClient *, char *, int *);
  118 
  119 extern int        find_restrict(aClient *);
  120 extern int        rehash(aClient *, aClient *, int);
  121 extern int        initconf(char *);
  122 extern inline char *finishconf(void);
  123 extern void       merge_confs();
  124 extern int        lock_kline_file();
  125 
  126 extern void       clear_scache_hash_table(void);
  127 extern char      *find_or_add(char *);
  128 extern void       list_scache(aClient *, aClient *, int, char **);
  129 
  130 
  131 #ifdef MEMTRACE
  132 
  133 typedef struct MemTracer MemTracer;
  134 struct MemTracer {
  135     const char  *file;
  136     const int    line;
  137     int          initialized;
  138     int          objects;
  139     size_t       allocated;
  140     MemTracer   *next;
  141 };
  142 
  143 extern void      *MyMalloc_impl(MemTracer *, size_t);
  144 extern void      *MyRealloc_impl(MemTracer *, void *, size_t);
  145 extern void      MyFree_impl(void *);
  146 
  147 /* uses GNU C extension for statements in expressions */
  148 #define MyMalloc(s) ({ \
  149     static MemTracer mt = { __FILE__, __LINE__ }; \
  150     MyMalloc_impl(&mt, s); \
  151 })
  152 
  153 #define MyRealloc(x, s) ({ \
  154     static MemTracer mt = { __FILE__, __LINE__ }; \
  155     MyRealloc_impl(&mt, x, s); \
  156 })
  157 
  158 #define MyFree(x)       do { MyFree_impl(x); (x) = NULL; } while(0)
  159 
  160 #else
  161 
  162 extern void      *MyMalloc(size_t);
  163 extern void      *MyRealloc(void *, size_t);
  164 
  165 #define MyFree(x)       do { if (x) free(x); (x) = NULL; } while(0)
  166 
  167 #endif  /* MEMTRACE */
  168 
  169 extern u_long    channel_memreport(aClient *);
  170 extern u_long    hash_memreport(aClient *);
  171 extern u_long    hide_memreport(aClient *);
  172 extern u_long    parse_memreport(aClient *);
  173 extern u_long    s_bsd_memreport(aClient *);
  174 
  175 extern char      *debugmode, configfile[], *sbrk0;
  176 extern char      *klinefile;
  177 extern char      *zlinefile;
  178 extern char      *getfield(char *);
  179 extern void       get_sockhost(aClient *, char *);
  180 extern char      *rpl_str(int);
  181 extern char      *err_str(int);
  182 extern char      *getreply(int);
  183 extern char      *strerror(int);
  184 extern int        dgets(int, char *, size_t);
  185 extern char      *inetntoa(char *);
  186 extern char      *inet6ntoa(char *);
  187 extern char      *cipntoa(aClient *);
  188 extern int        dbufalloc, dbufblocks, debuglevel, errno;
  189 extern int        highest_fd, debuglevel, portnum,
  190     debugtty, maxusersperchannel;
  191 extern int        readcalls, udpfd, resfd;
  192 extern aClient   *add_connection(aListener *, int);
  193 extern int        add_listener(aPort *);
  194 extern void       add_local_domain(char *, int);
  195 extern int        check_client(aClient *);
  196 extern int        check_server_init(aClient *);
  197 extern void       close_connection(aClient *);
  198 extern void       close_listeners();
  199 extern void       open_listeners();
  200 extern int        connect_server(aConnect *, aClient *, struct hostent *);
  201 extern void       get_my_name(aClient *, char *, int);
  202 extern int        get_sockerr(aClient *);
  203 extern int        inetport(aClient *, char *, int, u_long);
  204 extern void       init_sys();
  205 extern int        read_message(time_t, fdlist *);
  206 extern void       report_error(char *, aClient *);
  207 extern void       set_non_blocking(int, aClient *);
  208 extern int        setup_ping(void);
  209 extern void       summon(aClient *, char *, char *, char *);
  210 extern int        unixport(aClient *, char *, int);
  211 
  212 extern void     do_dns_async(void);
  213 extern int  completed_connection(aClient *);
  214 extern void     accept_connection(aListener *);
  215 extern char *   irc_get_sockerr(aClient *);
  216 extern int  read_packet(aClient *);
  217 extern int  do_client_queue(aClient *);
  218 extern void     read_error_exit(aClient *, int, int);
  219 extern int  readwrite_client(aClient *, int, int);
  220 
  221 extern inline char *get_listener_name(aListener *);
  222 extern int        attach_Iline(aClient *, struct hostent *, char *);
  223 extern aConnect  *find_aConnect(char *);
  224 extern aOper     *find_oper(char *, char *, char *, char *);
  225 extern aConnect  *find_aConnect_match(char *, char *, char *);
  226 extern int        find_aUserver(char *);
  227 extern void       clear_conflinks(aClient *);
  228 
  229 extern void       start_auth(aClient *);
  230 extern void       read_authports(aClient *);
  231 extern void       send_authports(aClient *);
  232 
  233 extern void       restart(char *);
  234 extern void       send_channel_modes(aClient *, aChannel *);
  235 extern void       server_reboot(void);
  236 extern void       terminate(void), write_pidfile(void);
  237 
  238 extern int        match(char *, char *);
  239 extern char      *collapse(char *);
  240 
  241 extern int        writecalls, writeb[];
  242 #ifdef WRITEV_IOV
  243 extern int        deliver_it(aClient *, struct iovec *, int);
  244 #else
  245 extern int        deliver_it(aClient *, char *, int);
  246 #endif
  247 
  248 extern char      *get_client_name(aClient *, int);
  249 extern char      *my_name_for_link(char *, aConnect *);
  250 extern char      *myctime(time_t), *date(time_t);
  251 extern int        exit_client(aClient *, aClient *, aClient *, char *);
  252 extern void       initstats(void);
  253 extern char      *make_parv_copy(char *, int, char **);
  254 extern int        exit_banned_client(aClient *, int, char, char *, int);
  255 
  256 extern int        parse(aClient *, char *, char *);
  257 extern void       init_tree_parse(struct Message *);
  258 
  259 extern int        do_numeric(int, aClient *, aClient *, int, char **);
  260 extern int        hunt_server(aClient *, aClient *, char *, int, int, char **);
  261 extern aClient   *next_client(aClient *, char *);
  262 extern aClient   *next_client_double(aClient *, char *);
  263 
  264 extern int        m_umode(aClient *, aClient *, int, char **);
  265 extern int        m_names(aClient *, aClient *, int, char **);
  266 extern void       send_umode(aClient *, aClient *, long, long, char *, int);
  267 extern int    del_silence(aClient *, char *);
  268 
  269 
  270 extern void       free_client(aClient *);
  271 extern void       free_link(Link *);
  272 extern void       free_dlink(DLink *);
  273 extern void       free_chanmember(chanMember *);
  274 extern void       free_class(aClass *);
  275 extern void       free_user(anUser *, aClient *);
  276 extern void       free_channel(aChannel *);
  277 extern aChannel  *make_channel();
  278 extern Link      *make_link(void);
  279 extern DLink     *make_dlink(void);
  280 extern chanMember *make_chanmember(void);
  281 extern anUser    *make_user(aClient *);
  282 extern aClass    *make_class(void);
  283 extern aServer   *make_server(aClient *);
  284 extern aClient   *make_client(aClient *, aClient *);
  285 extern chanMember *find_user_member(chanMember *, aClient *);
  286 extern Link      *find_str_link(Link *, char *);
  287 extern DLink     *find_dlink(DLink *, void *);
  288 extern void       add_client_to_list(aClient *);
  289 extern void       checklist(void);
  290 extern void       remove_client_from_list(aClient *);
  291 extern void       initlists(void);
  292 extern void       block_garbage_collect(void);  /* list.c */
  293 extern void       block_destroy(void);          /* list.c */
  294 
  295 extern void     set_effective_class(aClient *);
  296 extern void     initclass();
  297 
  298 extern struct hostent *get_res(char *);
  299 extern struct hostent *gethost_byaddr(char *, Link *, int);
  300 extern struct hostent *gethost_byname(char *, Link *, int);
  301 extern void       flush_cache(void);
  302 extern int        init_resolver(int);
  303 extern time_t     timeout_query_list(time_t);
  304 extern time_t     expire_cache(time_t);
  305 extern void       del_queries(char *);
  306 
  307 extern void       clear_channel_hash_table(void);
  308 extern void       clear_client_hash_table(void);
  309 extern int        add_to_client_hash_table(char *, aClient *);
  310 extern int        del_from_client_hash_table(char *, aClient *);
  311 extern int        add_to_channel_hash_table(char *, aChannel *);
  312 extern int        del_from_channel_hash_table(char *, aChannel *);
  313 extern aChannel  *hash_find_channel(char *, aChannel *);
  314 extern aClient   *hash_find_client(char *, aClient *);
  315 extern aClient   *hash_find_nickserver(char *, aClient *);
  316 extern aClient   *hash_find_server(char *, aClient *);
  317 
  318 extern void       add_history(aClient *, int);
  319 extern aClient   *get_history(char *, time_t);
  320 extern void       initwhowas(void);
  321 extern void       off_history(aClient *);
  322 
  323 extern int        dopacket(aClient *, char *, int);
  324 extern int        client_dopacket(aClient *, char *, int);
  325 
  326 /* VARARGS2 */
  327 
  328 extern void       send_rplversion(aClient *);
  329 extern void       send_rplisupport(aClient *);
  330 extern void       send_rplisupportoper(aClient *);
  331 extern void       build_rplcache(void);
  332 
  333 extern void       debug(int level, char *pattern, ...);
  334 
  335 #ifdef DEBUGMODE
  336 extern void       send_listinfo(aClient *, char *);
  337 #endif
  338 
  339 extern void       send_list(aClient *, int);
  340 extern aChannel  *hash_get_chan_bucket(int);
  341 
  342 #ifdef DUMP_DEBUG
  343 extern FILE      *dumpfp;
  344 #endif
  345 
  346 #ifdef FLUD
  347 int               check_for_flood();
  348 void              free_fluders();
  349 void              free_fludees();
  350 #define MyFludConnect(x)    (((x)->fd >= 0) || ((x)->fd == -2))
  351 
  352 #endif /* FLUD */
  353 
  354 #ifdef ANTI_SPAMBOT
  355 #define MIN_SPAM_NUM 5
  356 #define MIN_SPAM_TIME 60
  357 #endif
  358 
  359 #define MAXKILLS 20
  360 extern void       clear_watch_hash_table(void);
  361 extern int        add_to_watch_hash_table(char *, aClient *);
  362 extern int        del_from_watch_hash_table(char *, aClient *);
  363 extern int        hash_check_watch(aClient *, int);
  364 extern int        hash_del_watch_list(aClient  *);
  365 extern aWatch    *hash_get_watch(char *);
  366 #define MAXWATCH       128
  367 
  368 DLink *add_to_list(DLink **, void *);
  369 void remove_from_list(DLink **, void *, DLink *);
  370 
  371 void probability_add(aClient *);
  372 void probability_remove(aClient *);
  373 void probability_change(char *, char *);
  374 void probability_init(void);
  375 int probability_loadsets(char *);
  376 void probability_fini(void);
  377 void get_probabilities(aClient *, int *, int *, int *);
  378 
  379 #ifdef USE_SSL
  380 int ssl_init();
  381 int ssl_rehash();
  382 int safe_ssl_read(aClient *, void *, int);
  383 int safe_ssl_write(aClient *, const void *, int);
  384 int safe_ssl_accept(aClient *, int);
  385 int ssl_smart_shutdown(SSL *);
  386 #endif
  387 
  388 
  389 #include "find.h"
  390 
  391 int bitncmp(const void *l, const void *r, size_t n);
  392 int inet_parse_cidr(int af, const char *src, void *dst, size_t size);
  393 
  394 #endif  /* H_H */