Commit Graph

62 Commits

Author SHA1 Message Date
Alexander Barton cf93881dfb New function Conn_CloseAllSockets() to close all open sockets
This is useful in forked child processes, for example, to make sure that
they don't hold connections open that the main process wants to close.
2010-07-14 10:27:55 +02:00
Alexander Barton bf8b646304 New function Conn_GetProcStat()
Get PROC_STAT sub-process structure of a given connection.
2010-07-11 15:15:23 +02:00
Alexander Barton 3d49fa5bff New function Conn_GetFromProc() to get CONN_ID of a subprocess
Get CONN_ID from file descriptor associated to a subprocess structure.
2010-06-29 23:38:39 +02:00
Alexander Barton 89e73ad4b4 Refactoring: Rename CONNECTION.res_stat to .proc_stat
We want to use this process status variable not only for the
resolver subprocesses but other asynchronous tasks as well;
so let's name it more generic.
2010-06-29 22:55:27 +02:00
Alexander Barton 54e67ea9ee New "module" proc.c/proc.h for generic process handling
The new "module" proc.c is used for functions dealing with child
processes. At the moment, it is only used by the asynchronous resolver.

All the functions already implemented habe been migrated from the
resolver code base, and the rest of the ngIRCd source code has been
adepted to the new namespace and calling conventions.

The goal is to develop "generic" process handling functions that can
be used for other purposes as well, e.g. running processes on client
connects etc.
2010-06-29 22:55:27 +02:00
Alexander Barton ae55d4f500 Fix redundant redeclaration of Conn_Count*() functions
The wrongly placed #endif lead to the following compiler warnings:

conn.h:125: warning: redundant redeclaration of ‘Conn_Count’
conn.h:125: warning: previous declaration of ‘Conn_Count’ was here
conn.h:126: warning: redundant redeclaration of ‘Conn_CountMax’
conn.h:126: warning: previous declaration of ‘Conn_CountMax’ was here
conn.h:127: warning: redundant redeclaration of ‘Conn_CountAccepted’
conn.h:127: warning: previous declaration of ‘Conn_CountAccepted’ was here
2010-06-26 00:45:11 +02:00
Alexander Barton edfa215481 const'ify Conn_WriteStr() function 2010-06-26 00:44:37 +02:00
Alexander Barton 1338ade650 Enhace connection statistics counters
This patch enables ngIRCd to count the highest maximum simultaneous
connections and all the connections accepted since startup.

New functions:
- Conn_Count(): get current connections
- Conn_CountMax(): maximum simultaneous connections
- Conn_CountAccepted(): number of connections accepted
2010-04-23 23:25:34 +02:00
Alexander Barton cb6faed61c Clean up conn.{c|h} a little bit 2009-12-30 23:32:47 +01:00
Alexander Barton 8fd0e29d46 Fix "implicit conversion shortens 64-bit value" warning
This patch fixes the following gcc warning in our sources:
"implicit conversion shortens 64-bit value into a 32-bit value"
2009-09-11 22:52:12 +02:00
Florian Westphal 643ae1b48b enforce upper limit on maximum number of handled commands
reported on #ngircd: pasting lots of lines into a channel can kill off
many people on the channel if the read buffer is drained quickly enough
and the client-side TCP can't keep up with the incoming data.

This implements a throttling scheme:
- an irc client may send up to 3 commands per second before a one second
pause is enforced.
- an irc client may send up to 256 bytes per second before a one second
pause is enforced.

After discussion with Alexander Barton, server <-> server links are
treated specially: There is no artificial limit on the number of bytes
sent per second, and up to 10 commands are processed per second before
a pause is enforced.

It may be neccessary to make those limits tuneable to accomondate larger
networks, but for now they are compile time values.
2009-05-25 22:25:18 +02:00
Florian Westphal ea041b8838 add const qualifier to pointers where possible 2009-04-21 20:58:23 +02:00
Florian Westphal 2fce4667a8 SSL/TLS: clear all ssl realted flags on shutdown
one ssl related flags was not cleared on ssl shutdown.
introduce and use CONN_SSL_FLAGS_ALL to zap them all.
2009-02-04 23:23:12 +01:00
Florian Westphal c6a43fbaf0 TLS/SSL: fix memory leak when using compressed server links with ssl
commit 6bc2d3d06e
(New connection option CONN_RFC1459) forgot to adjust the ssl bitmasks.

The result is that when a compressed AND encrypted server link goes down
the memory allocated by zlib and the r/w buffers are no longer
free'd as the previous ConnSSL_Free() would then also remove the CONN_ZIP flag
from the flag mask.
2009-02-04 23:01:53 +01:00
Alexander Barton 6bc2d3d06e New connection option CONN_RFC1459.
This new connection option CONN_RFC1459 indicates that the peer on this
link only supports the IRC protocol as defined in RFC 1459 and that the
compatibility mode (e. g. for outgoing commands like NICK) should be used.
2008-09-23 11:47:17 +02:00
Florian Westphal ef3327d372 TLS/SSL support: code changes.
This adds the required code to enable ssl/tls support
during compile and run time, respectively.
2008-09-13 15:10:32 +02:00
Florian Westphal feb31e4200 IPv6 support.
all references to struct sockaddr/in_addr have been
removed from src/ngircd.
libngipaddr (in src/ipaddr/) hides all the gory details.
See src/ipaddr/ng_ipaddr.h for API description.
2008-02-26 23:50:35 +01:00
Alexander Barton d4ed056147 Numeric 317: implemented "signon time" (displayed in WHOIS result). 2007-10-04 15:03:55 +00:00
Florian Westphal 63e89ceb21 make needlesly global function Conn_Write static. 2007-05-09 13:21:11 +00:00
Florian Westphal 09deb857ce - change return type of Conn_InitListeners to unsigned
- remove minor whitespace damage
2007-04-04 21:52:12 +00:00
Alexander Barton dd3a3bc603 Use some more specific data types (e. g. pid_t vs. int), make "SPLint" happy :-) 2006-05-10 21:24:01 +00:00
Florian Westphal 87f4b1c6f6 Client_GetFromConn() removed and replaced with new function Conn_GetClient() 2006-04-23 10:37:27 +00:00
Florian Westphal 1249acfdba removed obsolete "int Conn_MaxFD" 2006-02-02 21:00:21 +00:00
Florian Westphal 5b2364b236 merge new resolver code 2005-09-12 19:10:20 +00:00
Alexander Barton b61407713d Removed "U" unsignet suffix: caused problems with older compilers and is
not necessary for this constants.
2005-07-30 22:53:16 +00:00
Florian Westphal 4715b17106 make Conn_NewListener local to conn.c 2005-07-11 14:56:38 +00:00
Florian Westphal 2bf77fb0c3 use dynamic io buffers 2005-07-07 18:45:33 +00:00
Alexander Barton 5195555c5a Removed CONNECTION[].starttime, now saved in CLIENT structure. 2005-06-12 16:28:55 +00:00
Florian Westphal c4bc2114c9 conn.h: option filed in CONNECTION struct is now UINT16.
conn-func.h: add accessor Macros

Conn_OPTION_ADD( conn, CONN_OPTION )
Conn_OPTION_DEL( conn, CONN_OPTION )
Conn_OPTION_ISSET( conn, CONN_OPTION )

To add, remove or test for a certain option field attribute (e.g. CONN_ISCLOSING)
These Macros should be used instead of accessing conn->options directly.
2005-04-18 21:08:31 +00:00
Florian Westphal 8adff59223 Remove INT, LONG, BOOLEAN, STATIC, CONST, CHAR datatypes.
use stdbool.h / inttypes.h if available.
2005-03-19 18:43:48 +00:00
Alexander Barton c40592d2ce Removed "USE_" prefixes of configuration #defines. 2003-12-26 15:55:07 +00:00
Alexander Barton 59a0fb8cd9 New function Conn_SyncServerStruct(). 2003-03-27 01:20:22 +00:00
Alexander Barton 2a3f8cc57d - new link "option" constant: CONN_ISCLOSING 2003-02-21 19:18:48 +00:00
Alexander Barton b77dae3499 - Reorganized code for new modules "conn-func.c" and "conn-func.h". 2002-12-30 17:14:59 +00:00
Alexander Barton e68cdf304f - New source files "conn-zip.c" and "conn-zip.h". 2002-12-30 16:07:23 +00:00
Alexander Barton a2544e496c - Cleaned up handling of server configuration structures. 2002-12-30 00:01:42 +00:00
Alexander Barton a02bf31d50 - new functions Conn_ResetWCounter() and Conn_WCounter(). 2002-12-18 13:50:22 +00:00
Alexander Barton c7f075236b - new file header format (in english). 2002-12-12 12:23:43 +00:00
Alexander Barton 39219230b2 - neue Befehle: Conn_StartTime(), Conn_SendQ(), Conn_RecvQ(), Conn_SendMsg(),
Conn_RecvMsg(), Conn_SendBytes[Zip](), Conn_RecvBytes[Zip]().
2002-12-02 13:19:37 +00:00
Alexander Barton ecde730ec4 - neue Funktionen: Conn_SetOption(), Conn_UnsetOption(), Conn_Options().
- wenn mit zlib-Support: Conn_InitZip().
2002-11-26 23:06:51 +00:00
Alexander Barton a0c032b2ff - neue Funktionen Conn_InitListeners() und Conn_ExitListeners(). 2002-11-22 17:58:19 +00:00
Alexander Barton 3102c550ff - neue Funktion Conn_SetServer(). 2002-11-05 14:18:13 +00:00
Alexander Barton a29e37a4c1 - Semantik der Conn_xxxFlag()-Funktionen geaendert. 2002-11-04 12:31:27 +00:00
Alexander Barton 05839597bf Neue Funktionen: Conn_First(), Conn_Next(), Conn_ClearFlags(), Conn_SetFlag() und Conn_Flag(). 2002-11-02 22:58:19 +00:00
Alexander Barton df0eb17172 - neue Funktion Conn_ResetPenalty(). 2002-10-10 15:00:33 +00:00
Alexander Barton 7b6cfc17c4 - neue Funktion Conn_SetPenalty() zum Setzen von sog. "Penalty Zeiten";
wird bisher nur beim Connect verwendet (eine Sekunde).
2002-08-26 00:03:15 +00:00
Alexander Barton b966b2108d - Syntax von Conn_Handler() geaendert: kein Timeout mehr. 2002-06-02 17:02:34 +00:00
Alexander Barton c2f60abe55 - Anpassungen an pre-ANSI-Compiler,
- Includes aufgeraumt: Header includieren keine anderen mehr.
2002-05-27 13:09:26 +00:00
Alexander Barton 95d55c56c6 - Conn_NewListener() erwartet den Port nun als "unsigned int". 2002-03-29 22:54:35 +00:00
Alexander Barton ca33cbda05 - externe portab-Header werden nicht mehr benoetigt/benutzt, dadurch
einige Aenderungen an diversen Source-Dateien und Headern.
- Dateien enthalten keine CVS-History mehr.
2002-03-12 14:37:51 +00:00