]>
jfr.im git - irc/quakenet/snircd.git/blob - include/listener.h
1 /* - Internet Relay Chat, include/listener.h
2 * Copyright (C) 1999 Thomas Helvey <tomh@inxpress.net>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 1, or (at your option)
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 * @brief Interface and declarations for handling listening sockets.
20 * @version $Id: listener.h,v 1.6 2004/10/03 13:36:04 entrope Exp $
22 #ifndef INCLUDED_listener_h
23 #define INCLUDED_listener_h
24 #ifndef INCLUDED_ircd_defs_h
25 #include "ircd_defs.h" /* HOSTLEN */
27 #ifndef INCLUDED_ircd_events_h
28 #include "ircd_events.h"
30 #ifndef INCLUDED_res_h
33 #ifndef INCLUDED_sys_types_h
34 #include <sys/types.h> /* size_t, broken BSD system headers */
35 #define INCLUDED_sys_types_h
41 /** Describes a single listening port. */
43 struct Listener
* next
; /**< list node pointer */
44 int fd
; /**< file descriptor */
45 int ref_count
; /**< number of connection references */
46 unsigned char active
; /**< current state of listener */
47 unsigned char hidden
; /**< hidden in stats output for clients */
48 unsigned char server
; /**< 1 if port is a server listener */
49 unsigned char mask_bits
; /**< number of bits in mask address */
50 int index
; /**< index into poll array */
51 time_t last_accept
; /**< last time listener accepted */
52 struct irc_sockaddr addr
; /**< virtual address and port */
53 struct irc_in_addr mask
; /**< listener hostmask */
54 struct Socket socket
; /**< describe socket to event system */
57 extern void add_listener(int port
, const char* vaddr_ip
,
58 const char* mask
, int is_server
,
60 extern void close_listener(struct Listener
* listener
);
61 extern void close_listeners(void);
62 extern void count_listener_memory(int* count_out
, size_t* size_out
);
63 extern const char* get_listener_name(const struct Listener
* listener
);
64 extern void mark_listeners_closing(void);
65 extern void show_ports(struct Client
* client
, const struct StatDesc
* sd
,
67 extern void release_listener(struct Listener
* listener
);
69 #endif /* INCLUDED_listener_h */