- Anpassungen an pre-ANSI-Compiler,

- Includes aufgeraumt: Header includieren keine anderen mehr.
This commit is contained in:
Alexander Barton 2002-05-27 13:09:26 +00:00
parent be7683c79b
commit c2f60abe55
29 changed files with 743 additions and 725 deletions

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: channel.c,v 1.22 2002/05/21 00:10:16 alex Exp $
* $Id: channel.c,v 1.23 2002/05/27 13:09:26 alex Exp $
*
* channel.c: Management der Channels
*/
@ -25,31 +25,38 @@
#include <stdlib.h>
#include <string.h>
#include "conn.h"
#include "client.h"
#include "exp.h"
#include "channel.h"
#include "imp.h"
#include "irc-write.h"
#include "resolve.h"
#include "conf.h"
#include "hash.h"
#include "irc-write.h"
#include "log.h"
#include "messages.h"
#include "exp.h"
#include "channel.h"
LOCAL CHANNEL *My_Channels;
LOCAL CL2CHAN *My_Cl2Chan;
LOCAL CHANNEL *New_Chan( CHAR *Name );
LOCAL CL2CHAN *Get_Cl2Chan( CHANNEL *Chan, CLIENT *Client );
LOCAL CL2CHAN *Add_Client( CHANNEL *Chan, CLIENT *Client );
LOCAL BOOLEAN Remove_Client( CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, CHAR *Reason, BOOLEAN ServerPART );
LOCAL CL2CHAN *Get_First_Cl2Chan( CLIENT *Client, CHANNEL *Chan );
LOCAL CL2CHAN *Get_Next_Cl2Chan( CL2CHAN *Start, CLIENT *Client, CHANNEL *Chan );
LOCAL BOOLEAN Delete_Channel( CHANNEL *Chan );
LOCAL CHANNEL *New_Chan PARAMS(( CHAR *Name ));
LOCAL CL2CHAN *Get_Cl2Chan PARAMS(( CHANNEL *Chan, CLIENT *Client ));
LOCAL CL2CHAN *Add_Client PARAMS(( CHANNEL *Chan, CLIENT *Client ));
LOCAL BOOLEAN Remove_Client PARAMS(( CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, CHAR *Reason, BOOLEAN ServerPART ));
LOCAL CL2CHAN *Get_First_Cl2Chan PARAMS(( CLIENT *Client, CHANNEL *Chan ));
LOCAL CL2CHAN *Get_Next_Cl2Chan PARAMS(( CL2CHAN *Start, CLIENT *Client, CHANNEL *Chan ));
LOCAL BOOLEAN Delete_Channel PARAMS(( CHANNEL *Chan ));
GLOBAL VOID Channel_Init( VOID )
GLOBAL VOID
Channel_Init( VOID )
{
CHANNEL *chan;
CHAR *c;
@ -89,7 +96,8 @@ GLOBAL VOID Channel_Init( VOID )
} /* Channel_Init */
GLOBAL VOID Channel_Exit( VOID )
GLOBAL VOID
Channel_Exit( VOID )
{
CHANNEL *c, *c_next;
CL2CHAN *cl2chan, *cl2chan_next;
@ -114,7 +122,8 @@ GLOBAL VOID Channel_Exit( VOID )
} /* Channel_Exit */
GLOBAL BOOLEAN Channel_Join( CLIENT *Client, CHAR *Name )
GLOBAL BOOLEAN
Channel_Join( CLIENT *Client, CHAR *Name )
{
CHANNEL *chan;
@ -152,7 +161,8 @@ GLOBAL BOOLEAN Channel_Join( CLIENT *Client, CHAR *Name )
} /* Channel_Join */
GLOBAL BOOLEAN Channel_Part( CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason )
GLOBAL BOOLEAN
Channel_Part( CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason )
{
CHANNEL *chan;
@ -173,7 +183,8 @@ GLOBAL BOOLEAN Channel_Part( CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *R
} /* Channel_Part */
GLOBAL VOID Channel_RemoveClient( CLIENT *Client, CHAR *Reason )
GLOBAL VOID
Channel_RemoveClient( CLIENT *Client, CHAR *Reason )
{
CHANNEL *c, *next_c;
@ -189,7 +200,8 @@ GLOBAL VOID Channel_RemoveClient( CLIENT *Client, CHAR *Reason )
} /* Channel_RemoveClient */
GLOBAL INT Channel_Count( VOID )
GLOBAL INT
Channel_Count( VOID )
{
CHANNEL *c;
INT count;
@ -205,7 +217,8 @@ GLOBAL INT Channel_Count( VOID )
} /* Channel_Count */
GLOBAL INT Channel_MemberCount( CHANNEL *Chan )
GLOBAL INT
Channel_MemberCount( CHANNEL *Chan )
{
CL2CHAN *cl2chan;
INT count;
@ -223,34 +236,39 @@ GLOBAL INT Channel_MemberCount( CHANNEL *Chan )
} /* Channel_MemberCount */
GLOBAL CHAR *Channel_Name( CHANNEL *Chan )
GLOBAL CHAR *
Channel_Name( CHANNEL *Chan )
{
assert( Chan != NULL );
return Chan->name;
} /* Channel_Name */
GLOBAL CHAR *Channel_Modes( CHANNEL *Chan )
GLOBAL CHAR *
Channel_Modes( CHANNEL *Chan )
{
assert( Chan != NULL );
return Chan->modes;
} /* Channel_Modes */
GLOBAL CHANNEL *Channel_First( VOID )
GLOBAL CHANNEL *
Channel_First( VOID )
{
return My_Channels;
} /* Channel_First */
GLOBAL CHANNEL *Channel_Next( CHANNEL *Chan )
GLOBAL CHANNEL *
Channel_Next( CHANNEL *Chan )
{
assert( Chan != NULL );
return Chan->next;
} /* Channel_Next */
GLOBAL CHANNEL *Channel_Search( CHAR *Name )
GLOBAL CHANNEL *
Channel_Search( CHAR *Name )
{
/* Channel-Struktur suchen */
@ -274,14 +292,16 @@ GLOBAL CHANNEL *Channel_Search( CHAR *Name )
} /* Channel_Search */
GLOBAL CL2CHAN *Channel_FirstMember( CHANNEL *Chan )
GLOBAL CL2CHAN *
Channel_FirstMember( CHANNEL *Chan )
{
assert( Chan != NULL );
return Get_First_Cl2Chan( NULL, Chan );
} /* Channel_FirstMember */
GLOBAL CL2CHAN *Channel_NextMember( CHANNEL *Chan, CL2CHAN *Cl2Chan )
GLOBAL CL2CHAN *
Channel_NextMember( CHANNEL *Chan, CL2CHAN *Cl2Chan )
{
assert( Chan != NULL );
assert( Cl2Chan != NULL );
@ -289,14 +309,16 @@ GLOBAL CL2CHAN *Channel_NextMember( CHANNEL *Chan, CL2CHAN *Cl2Chan )
} /* Channel_NextMember */
GLOBAL CL2CHAN *Channel_FirstChannelOf( CLIENT *Client )
GLOBAL CL2CHAN *
Channel_FirstChannelOf( CLIENT *Client )
{
assert( Client != NULL );
return Get_First_Cl2Chan( Client, NULL );
} /* Channel_FirstChannelOf */
GLOBAL CL2CHAN *Channel_NextChannelOf( CLIENT *Client, CL2CHAN *Cl2Chan )
GLOBAL CL2CHAN *
Channel_NextChannelOf( CLIENT *Client, CL2CHAN *Cl2Chan )
{
assert( Client != NULL );
assert( Cl2Chan != NULL );
@ -304,21 +326,24 @@ GLOBAL CL2CHAN *Channel_NextChannelOf( CLIENT *Client, CL2CHAN *Cl2Chan )
} /* Channel_NextChannelOf */
GLOBAL CLIENT *Channel_GetClient( CL2CHAN *Cl2Chan )
GLOBAL CLIENT *
Channel_GetClient( CL2CHAN *Cl2Chan )
{
assert( Cl2Chan != NULL );
return Cl2Chan->client;
} /* Channel_GetClient */
GLOBAL CHANNEL *Channel_GetChannel( CL2CHAN *Cl2Chan )
GLOBAL CHANNEL *
Channel_GetChannel( CL2CHAN *Cl2Chan )
{
assert( Cl2Chan != NULL );
return Cl2Chan->channel;
} /* Channel_GetChannel */
GLOBAL BOOLEAN Channel_IsValidName( CHAR *Name )
GLOBAL BOOLEAN
Channel_IsValidName( CHAR *Name )
{
/* PrŸfen, ob Name als Channelname gueltig */
@ -339,7 +364,8 @@ GLOBAL BOOLEAN Channel_IsValidName( CHAR *Name )
} /* Channel_IsValidName */
GLOBAL BOOLEAN Channel_ModeAdd( CHANNEL *Chan, CHAR Mode )
GLOBAL BOOLEAN
Channel_ModeAdd( CHANNEL *Chan, CHAR Mode )
{
/* Mode soll gesetzt werden. TRUE wird geliefert, wenn der
* Mode neu gesetzt wurde, FALSE, wenn der Channel den Mode
@ -360,7 +386,8 @@ GLOBAL BOOLEAN Channel_ModeAdd( CHANNEL *Chan, CHAR Mode )
} /* Channel_ModeAdd */
GLOBAL BOOLEAN Channel_ModeDel( CHANNEL *Chan, CHAR Mode )
GLOBAL BOOLEAN
Channel_ModeDel( CHANNEL *Chan, CHAR Mode )
{
/* Mode soll geloescht werden. TRUE wird geliefert, wenn der
* Mode entfernt wurde, FALSE, wenn der Channel den Mode
@ -385,7 +412,8 @@ GLOBAL BOOLEAN Channel_ModeDel( CHANNEL *Chan, CHAR Mode )
} /* Channel_ModeDel */
GLOBAL BOOLEAN Channel_UserModeAdd( CHANNEL *Chan, CLIENT *Client, CHAR Mode )
GLOBAL BOOLEAN
Channel_UserModeAdd( CHANNEL *Chan, CLIENT *Client, CHAR Mode )
{
/* Channel-User-Mode soll gesetzt werden. TRUE wird geliefert,
* wenn der Mode neu gesetzt wurde, FALSE, wenn der User den
@ -411,7 +439,8 @@ GLOBAL BOOLEAN Channel_UserModeAdd( CHANNEL *Chan, CLIENT *Client, CHAR Mode )
} /* Channel_UserModeAdd */
GLOBAL BOOLEAN Channel_UserModeDel( CHANNEL *Chan, CLIENT *Client, CHAR Mode )
GLOBAL BOOLEAN
Channel_UserModeDel( CHANNEL *Chan, CLIENT *Client, CHAR Mode )
{
/* Channel-User-Mode soll geloescht werden. TRUE wird geliefert,
* wenn der Mode entfernt wurde, FALSE, wenn der User den Channel-Mode
@ -441,7 +470,8 @@ GLOBAL BOOLEAN Channel_UserModeDel( CHANNEL *Chan, CLIENT *Client, CHAR Mode )
} /* Channel_UserModeDel */
GLOBAL CHAR *Channel_UserModes( CHANNEL *Chan, CLIENT *Client )
GLOBAL CHAR *
Channel_UserModes( CHANNEL *Chan, CLIENT *Client )
{
/* Channel-Modes eines Users liefern */
@ -457,7 +487,8 @@ GLOBAL CHAR *Channel_UserModes( CHANNEL *Chan, CLIENT *Client )
} /* Channel_UserModes */
GLOBAL BOOLEAN Channel_IsMemberOf( CHANNEL *Chan, CLIENT *Client )
GLOBAL BOOLEAN
Channel_IsMemberOf( CHANNEL *Chan, CLIENT *Client )
{
/* Pruefen, ob Client Mitglied in Channel ist */
@ -469,14 +500,16 @@ GLOBAL BOOLEAN Channel_IsMemberOf( CHANNEL *Chan, CLIENT *Client )
} /* Channel_IsMemberOf */
GLOBAL CHAR *Channel_Topic( CHANNEL *Chan )
GLOBAL CHAR *
Channel_Topic( CHANNEL *Chan )
{
assert( Chan != NULL );
return Chan->topic;
} /* Channel_Topic */
GLOBAL VOID Channel_SetTopic( CHANNEL *Chan, CHAR *Topic )
GLOBAL VOID
Channel_SetTopic( CHANNEL *Chan, CHAR *Topic )
{
assert( Chan != NULL );
assert( Topic != NULL );
@ -486,7 +519,8 @@ GLOBAL VOID Channel_SetTopic( CHANNEL *Chan, CHAR *Topic )
} /* Channel_SetTopic */
GLOBAL BOOLEAN Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text )
GLOBAL BOOLEAN
Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text )
{
BOOLEAN is_member, has_voice, is_op, ok;
@ -513,7 +547,8 @@ GLOBAL BOOLEAN Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR
LOCAL CHANNEL *New_Chan( CHAR *Name )
LOCAL CHANNEL *
New_Chan( CHAR *Name )
{
/* Neue Channel-Struktur anlegen */
@ -540,7 +575,8 @@ LOCAL CHANNEL *New_Chan( CHAR *Name )
} /* New_Chan */
LOCAL CL2CHAN *Get_Cl2Chan( CHANNEL *Chan, CLIENT *Client )
LOCAL CL2CHAN *
Get_Cl2Chan( CHANNEL *Chan, CLIENT *Client )
{
CL2CHAN *cl2chan;
@ -557,7 +593,8 @@ LOCAL CL2CHAN *Get_Cl2Chan( CHANNEL *Chan, CLIENT *Client )
} /* Get_Cl2Chan */
LOCAL CL2CHAN *Add_Client( CHANNEL *Chan, CLIENT *Client )
LOCAL CL2CHAN *
Add_Client( CHANNEL *Chan, CLIENT *Client )
{
CL2CHAN *cl2chan;
@ -585,7 +622,8 @@ LOCAL CL2CHAN *Add_Client( CHANNEL *Chan, CLIENT *Client )
} /* Add_Client */
LOCAL BOOLEAN Remove_Client( CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, CHAR *Reason, BOOLEAN ServerPART )
LOCAL BOOLEAN
Remove_Client( CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, CHAR *Reason, BOOLEAN ServerPART )
{
CL2CHAN *cl2chan, *last_cl2chan;
CHANNEL *c;
@ -629,13 +667,15 @@ LOCAL BOOLEAN Remove_Client( CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, CHAR
} /* Remove_Client */
LOCAL CL2CHAN *Get_First_Cl2Chan( CLIENT *Client, CHANNEL *Chan )
LOCAL CL2CHAN *
Get_First_Cl2Chan( CLIENT *Client, CHANNEL *Chan )
{
return Get_Next_Cl2Chan( My_Cl2Chan, Client, Chan );
} /* Get_First_Cl2Chan */
LOCAL CL2CHAN *Get_Next_Cl2Chan( CL2CHAN *Start, CLIENT *Client, CHANNEL *Channel )
LOCAL CL2CHAN *
Get_Next_Cl2Chan( CL2CHAN *Start, CLIENT *Client, CHANNEL *Channel )
{
CL2CHAN *cl2chan;
@ -652,7 +692,8 @@ LOCAL CL2CHAN *Get_Next_Cl2Chan( CL2CHAN *Start, CLIENT *Client, CHANNEL *Channe
} /* Get_Next_Cl2Chan */
LOCAL BOOLEAN Delete_Channel( CHANNEL *Chan )
LOCAL BOOLEAN
Delete_Channel( CHANNEL *Chan )
{
/* Channel-Struktur loeschen */

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: channel.h,v 1.17 2002/04/23 19:51:31 alex Exp $
* $Id: channel.h,v 1.18 2002/05/27 13:09:26 alex Exp $
*
* channel.h: Management der Channels (Header)
*/
@ -18,8 +18,6 @@
#ifndef __channel_h__
#define __channel_h__
#include "client.h"
#if defined(__channel_c__) | defined(S_SPLINT_S)
@ -50,48 +48,48 @@ typedef POINTER CL2CHAN;
#endif
GLOBAL VOID Channel_Init( VOID );
GLOBAL VOID Channel_Exit( VOID );
GLOBAL VOID Channel_Init PARAMS((VOID ));
GLOBAL VOID Channel_Exit PARAMS((VOID ));
GLOBAL BOOLEAN Channel_Join( CLIENT *Client, CHAR *Name );
GLOBAL BOOLEAN Channel_Part( CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason );
GLOBAL BOOLEAN Channel_Join PARAMS((CLIENT *Client, CHAR *Name ));
GLOBAL BOOLEAN Channel_Part PARAMS((CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason ));
GLOBAL VOID Channel_RemoveClient( CLIENT *Client, CHAR *Reason );
GLOBAL VOID Channel_RemoveClient PARAMS((CLIENT *Client, CHAR *Reason ));
GLOBAL INT Channel_Count( VOID );
GLOBAL INT Channel_MemberCount( CHANNEL *Chan );
GLOBAL INT Channel_Count PARAMS((VOID ));
GLOBAL INT Channel_MemberCount PARAMS((CHANNEL *Chan ));
GLOBAL CHAR *Channel_Name( CHANNEL *Chan );
GLOBAL CHAR *Channel_Modes( CHANNEL *Chan );
GLOBAL CHAR *Channel_Topic( CHANNEL *Chan );
GLOBAL CHAR *Channel_Name PARAMS((CHANNEL *Chan ));
GLOBAL CHAR *Channel_Modes PARAMS((CHANNEL *Chan ));
GLOBAL CHAR *Channel_Topic PARAMS((CHANNEL *Chan ));
GLOBAL VOID Channel_SetTopic( CHANNEL *Chan, CHAR *Topic );
GLOBAL VOID Channel_SetTopic PARAMS((CHANNEL *Chan, CHAR *Topic ));
GLOBAL CHANNEL *Channel_Search( CHAR *Name );
GLOBAL CHANNEL *Channel_Search PARAMS((CHAR *Name ));
GLOBAL CHANNEL *Channel_First( VOID );
GLOBAL CHANNEL *Channel_Next( CHANNEL *Chan );
GLOBAL CHANNEL *Channel_First PARAMS((VOID ));
GLOBAL CHANNEL *Channel_Next PARAMS((CHANNEL *Chan ));
GLOBAL CL2CHAN *Channel_FirstMember( CHANNEL *Chan );
GLOBAL CL2CHAN *Channel_NextMember( CHANNEL *Chan, CL2CHAN *Cl2Chan );
GLOBAL CL2CHAN *Channel_FirstChannelOf( CLIENT *Client );
GLOBAL CL2CHAN *Channel_NextChannelOf( CLIENT *Client, CL2CHAN *Cl2Chan );
GLOBAL CL2CHAN *Channel_FirstMember PARAMS((CHANNEL *Chan ));
GLOBAL CL2CHAN *Channel_NextMember PARAMS((CHANNEL *Chan, CL2CHAN *Cl2Chan ));
GLOBAL CL2CHAN *Channel_FirstChannelOf PARAMS((CLIENT *Client ));
GLOBAL CL2CHAN *Channel_NextChannelOf PARAMS((CLIENT *Client, CL2CHAN *Cl2Chan ));
GLOBAL CLIENT *Channel_GetClient( CL2CHAN *Cl2Chan );
GLOBAL CHANNEL *Channel_GetChannel( CL2CHAN *Cl2Chan );
GLOBAL CLIENT *Channel_GetClient PARAMS((CL2CHAN *Cl2Chan ));
GLOBAL CHANNEL *Channel_GetChannel PARAMS((CL2CHAN *Cl2Chan ));
GLOBAL BOOLEAN Channel_IsValidName( CHAR *Name );
GLOBAL BOOLEAN Channel_IsValidName PARAMS((CHAR *Name ));
GLOBAL BOOLEAN Channel_ModeAdd( CHANNEL *Chan, CHAR Mode );
GLOBAL BOOLEAN Channel_ModeDel( CHANNEL *Chan, CHAR Mode );
GLOBAL BOOLEAN Channel_ModeAdd PARAMS((CHANNEL *Chan, CHAR Mode ));
GLOBAL BOOLEAN Channel_ModeDel PARAMS((CHANNEL *Chan, CHAR Mode ));
GLOBAL BOOLEAN Channel_UserModeAdd( CHANNEL *Chan, CLIENT *Client, CHAR Mode );
GLOBAL BOOLEAN Channel_UserModeDel( CHANNEL *Chan, CLIENT *Client, CHAR Mode );
GLOBAL CHAR *Channel_UserModes( CHANNEL *Chan, CLIENT *Client );
GLOBAL BOOLEAN Channel_UserModeAdd PARAMS((CHANNEL *Chan, CLIENT *Client, CHAR Mode ));
GLOBAL BOOLEAN Channel_UserModeDel PARAMS((CHANNEL *Chan, CLIENT *Client, CHAR Mode ));
GLOBAL CHAR *Channel_UserModes PARAMS((CHANNEL *Chan, CLIENT *Client ));
GLOBAL BOOLEAN Channel_IsMemberOf( CHANNEL *Chan, CLIENT *Client );
GLOBAL BOOLEAN Channel_IsMemberOf PARAMS((CHANNEL *Chan, CLIENT *Client ));
GLOBAL BOOLEAN Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text );
GLOBAL BOOLEAN Channel_Write PARAMS((CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text ));
#endif

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: client.c,v 1.54 2002/04/14 13:54:51 alex Exp $
* $Id: client.c,v 1.55 2002/05/27 13:09:26 alex Exp $
*
* client.c: Management aller Clients
*
@ -35,14 +35,16 @@
#include <string.h>
#include <netdb.h>
#include "conn.h"
#include "exp.h"
#include "client.h"
#include <imp.h>
#include "ngircd.h"
#include "channel.h"
#include "resolve.h"
#include "conf.h"
#include "conn.h"
#include "hash.h"
#include "irc-write.h"
#include "log.h"
@ -55,14 +57,15 @@ LOCAL CLIENT *This_Server, *My_Clients;
LOCAL CHAR GetID_Buffer[CLIENT_ID_LEN];
LOCAL INT Count( CLIENT_TYPE Type );
LOCAL INT MyCount( CLIENT_TYPE Type );
LOCAL INT Count PARAMS(( CLIENT_TYPE Type ));
LOCAL INT MyCount PARAMS(( CLIENT_TYPE Type ));
LOCAL CLIENT *New_Client_Struct( VOID );
LOCAL VOID Generate_MyToken( CLIENT *Client );
LOCAL CLIENT *New_Client_Struct PARAMS(( VOID ));
LOCAL VOID Generate_MyToken PARAMS(( CLIENT *Client ));
GLOBAL VOID Client_Init( VOID )
GLOBAL VOID
Client_Init( VOID )
{
struct hostent *h;
@ -93,7 +96,8 @@ GLOBAL VOID Client_Init( VOID )
} /* Client_Init */
GLOBAL VOID Client_Exit( VOID )
GLOBAL VOID
Client_Exit( VOID )
{
CLIENT *c, *next;
INT cnt;
@ -113,34 +117,39 @@ GLOBAL VOID Client_Exit( VOID )
} /* Client_Exit */
GLOBAL CLIENT *Client_ThisServer( VOID )
GLOBAL CLIENT *
Client_ThisServer( VOID )
{
return This_Server;
} /* Client_ThisServer */
GLOBAL CLIENT *Client_NewLocal( CONN_ID Idx, CHAR *Hostname, INT Type, BOOLEAN Idented )
GLOBAL CLIENT *
Client_NewLocal( CONN_ID Idx, CHAR *Hostname, INT Type, BOOLEAN Idented )
{
/* Neuen lokalen Client erzeugen: Wrapper-Funktion fuer Client_New(). */
return Client_New( Idx, This_Server, NULL, Type, NULL, NULL, Hostname, NULL, 0, 0, NULL, Idented );
} /* Client_NewLocal */
GLOBAL CLIENT *Client_NewRemoteServer( CLIENT *Introducer, CHAR *Hostname, CLIENT *TopServer, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented )
GLOBAL CLIENT *
Client_NewRemoteServer( CLIENT *Introducer, CHAR *Hostname, CLIENT *TopServer, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented )
{
/* Neuen Remote-Client erzeugen: Wrapper-Funktion fuer Client_New (). */
return Client_New( NONE, Introducer, TopServer, CLIENT_SERVER, Hostname, NULL, Hostname, Info, Hops, Token, NULL, Idented );
} /* Client_NewRemoteServer */
GLOBAL CLIENT *Client_NewRemoteUser( CLIENT *Introducer, CHAR *Nick, INT Hops, CHAR *User, CHAR *Hostname, INT Token, CHAR *Modes, CHAR *Info, BOOLEAN Idented )
GLOBAL CLIENT *
Client_NewRemoteUser( CLIENT *Introducer, CHAR *Nick, INT Hops, CHAR *User, CHAR *Hostname, INT Token, CHAR *Modes, CHAR *Info, BOOLEAN Idented )
{
/* Neuen Remote-Client erzeugen: Wrapper-Funktion fuer Client_New (). */
return Client_New( NONE, Introducer, NULL, CLIENT_USER, Nick, User, Hostname, Info, Hops, Token, Modes, Idented );
} /* Client_NewRemoteUser */
GLOBAL CLIENT *Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *ID, CHAR *User, CHAR *Hostname, CHAR *Info, INT Hops, INT Token, CHAR *Modes, BOOLEAN Idented )
GLOBAL CLIENT *
Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *ID, CHAR *User, CHAR *Hostname, CHAR *Info, INT Hops, INT Token, CHAR *Modes, BOOLEAN Idented )
{
CLIENT *client;
@ -176,7 +185,8 @@ GLOBAL CLIENT *Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, I
} /* Client_New */
GLOBAL VOID Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit )
GLOBAL VOID
Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit )
{
/* Client entfernen. */
@ -279,7 +289,8 @@ GLOBAL VOID Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN
} /* Client_Destroy */
GLOBAL VOID Client_SetHostname( CLIENT *Client, CHAR *Hostname )
GLOBAL VOID
Client_SetHostname( CLIENT *Client, CHAR *Hostname )
{
/* Hostname eines Clients setzen */
@ -291,7 +302,8 @@ GLOBAL VOID Client_SetHostname( CLIENT *Client, CHAR *Hostname )
} /* Client_SetHostname */
GLOBAL VOID Client_SetID( CLIENT *Client, CHAR *ID )
GLOBAL VOID
Client_SetID( CLIENT *Client, CHAR *ID )
{
/* Hostname eines Clients setzen, Hash-Wert berechnen */
@ -306,7 +318,8 @@ GLOBAL VOID Client_SetID( CLIENT *Client, CHAR *ID )
} /* Client_SetID */
GLOBAL VOID Client_SetUser( CLIENT *Client, CHAR *User, BOOLEAN Idented )
GLOBAL VOID
Client_SetUser( CLIENT *Client, CHAR *User, BOOLEAN Idented )
{
/* Username eines Clients setzen */
@ -323,7 +336,8 @@ GLOBAL VOID Client_SetUser( CLIENT *Client, CHAR *User, BOOLEAN Idented )
} /* Client_SetUser */
GLOBAL VOID Client_SetInfo( CLIENT *Client, CHAR *Info )
GLOBAL VOID
Client_SetInfo( CLIENT *Client, CHAR *Info )
{
/* Hostname eines Clients setzen */
@ -335,7 +349,8 @@ GLOBAL VOID Client_SetInfo( CLIENT *Client, CHAR *Info )
} /* Client_SetInfo */
GLOBAL VOID Client_SetModes( CLIENT *Client, CHAR *Modes )
GLOBAL VOID
Client_SetModes( CLIENT *Client, CHAR *Modes )
{
/* Hostname eines Clients setzen */
@ -347,7 +362,8 @@ GLOBAL VOID Client_SetModes( CLIENT *Client, CHAR *Modes )
} /* Client_SetModes */
GLOBAL VOID Client_SetPassword( CLIENT *Client, CHAR *Pwd )
GLOBAL VOID
Client_SetPassword( CLIENT *Client, CHAR *Pwd )
{
/* Von einem Client geliefertes Passwort */
@ -359,7 +375,8 @@ GLOBAL VOID Client_SetPassword( CLIENT *Client, CHAR *Pwd )
} /* Client_SetPassword */
GLOBAL VOID Client_SetAway( CLIENT *Client, CHAR *Txt )
GLOBAL VOID
Client_SetAway( CLIENT *Client, CHAR *Txt )
{
/* Von einem Client gelieferte AWAY-Nachricht */
@ -382,7 +399,8 @@ GLOBAL VOID Client_SetAway( CLIENT *Client, CHAR *Txt )
} /* Client_SetAway */
GLOBAL VOID Client_SetType( CLIENT *Client, INT Type )
GLOBAL VOID
Client_SetType( CLIENT *Client, INT Type )
{
assert( Client != NULL );
Client->type = Type;
@ -390,21 +408,24 @@ GLOBAL VOID Client_SetType( CLIENT *Client, INT Type )
} /* Client_SetType */
GLOBAL VOID Client_SetHops( CLIENT *Client, INT Hops )
GLOBAL VOID
Client_SetHops( CLIENT *Client, INT Hops )
{
assert( Client != NULL );
Client->hops = Hops;
} /* Client_SetHops */
GLOBAL VOID Client_SetToken( CLIENT *Client, INT Token )
GLOBAL VOID
Client_SetToken( CLIENT *Client, INT Token )
{
assert( Client != NULL );
Client->token = Token;
} /* Client_SetToken */
GLOBAL VOID Client_SetIntroducer( CLIENT *Client, CLIENT *Introducer )
GLOBAL VOID
Client_SetIntroducer( CLIENT *Client, CLIENT *Introducer )
{
assert( Client != NULL );
assert( Introducer != NULL );
@ -412,14 +433,16 @@ GLOBAL VOID Client_SetIntroducer( CLIENT *Client, CLIENT *Introducer )
} /* Client_SetIntroducer */
GLOBAL VOID Client_SetOperByMe( CLIENT *Client, BOOLEAN OperByMe )
GLOBAL VOID
Client_SetOperByMe( CLIENT *Client, BOOLEAN OperByMe )
{
assert( Client != NULL );
Client->oper_by_me = OperByMe;
} /* Client_SetOperByMe */
GLOBAL BOOLEAN Client_ModeAdd( CLIENT *Client, CHAR Mode )
GLOBAL BOOLEAN
Client_ModeAdd( CLIENT *Client, CHAR Mode )
{
/* Mode soll gesetzt werden. TRUE wird geliefert, wenn der
* Mode neu gesetzt wurde, FALSE, wenn der Client den Mode
@ -440,7 +463,8 @@ GLOBAL BOOLEAN Client_ModeAdd( CLIENT *Client, CHAR Mode )
} /* Client_ModeAdd */
GLOBAL BOOLEAN Client_ModeDel( CLIENT *Client, CHAR Mode )
GLOBAL BOOLEAN
Client_ModeDel( CLIENT *Client, CHAR Mode )
{
/* Mode soll geloescht werden. TRUE wird geliefert, wenn der
* Mode entfernt wurde, FALSE, wenn der Client den Mode
@ -465,7 +489,8 @@ GLOBAL BOOLEAN Client_ModeDel( CLIENT *Client, CHAR Mode )
} /* Client_ModeDel */
GLOBAL CLIENT *Client_GetFromConn( CONN_ID Idx )
GLOBAL CLIENT *
Client_GetFromConn( CONN_ID Idx )
{
/* Client-Struktur, die zur lokalen Verbindung Idx gehoert,
* liefern. Wird keine gefunden, so wird NULL geliefert. */
@ -484,7 +509,8 @@ GLOBAL CLIENT *Client_GetFromConn( CONN_ID Idx )
} /* Client_GetFromConn */
GLOBAL CLIENT *Client_Search( CHAR *Nick )
GLOBAL CLIENT *
Client_Search( CHAR *Nick )
{
/* Client-Struktur, die den entsprechenden Nick hat, liefern.
* Wird keine gefunden, so wird NULL geliefert. */
@ -517,7 +543,8 @@ GLOBAL CLIENT *Client_Search( CHAR *Nick )
} /* Client_Search */
GLOBAL CLIENT *Client_GetFromToken( CLIENT *Client, INT Token )
GLOBAL CLIENT *
Client_GetFromToken( CLIENT *Client, INT Token )
{
/* Client-Struktur, die den entsprechenden Introducer (=Client)
* und das gegebene Token hat, liefern. Wird keine gefunden,
@ -538,21 +565,24 @@ GLOBAL CLIENT *Client_GetFromToken( CLIENT *Client, INT Token )
} /* Client_GetFromToken */
GLOBAL INT Client_Type( CLIENT *Client )
GLOBAL INT
Client_Type( CLIENT *Client )
{
assert( Client != NULL );
return Client->type;
} /* Client_Type */
GLOBAL CONN_ID Client_Conn( CLIENT *Client )
GLOBAL CONN_ID
Client_Conn( CLIENT *Client )
{
assert( Client != NULL );
return Client->conn_id;
} /* Client_Conn */
GLOBAL CHAR *Client_ID( CLIENT *Client )
GLOBAL CHAR *
Client_ID( CLIENT *Client )
{
assert( Client != NULL );
@ -565,14 +595,16 @@ GLOBAL CHAR *Client_ID( CLIENT *Client )
} /* Client_ID */
GLOBAL CHAR *Client_Info( CLIENT *Client )
GLOBAL CHAR *
Client_Info( CLIENT *Client )
{
assert( Client != NULL );
return Client->info;
} /* Client_Info */
GLOBAL CHAR *Client_User( CLIENT *Client )
GLOBAL CHAR *
Client_User( CLIENT *Client )
{
assert( Client != NULL );
if( Client->user[0] ) return Client->user;
@ -580,56 +612,64 @@ GLOBAL CHAR *Client_User( CLIENT *Client )
} /* Client_User */
GLOBAL CHAR *Client_Hostname( CLIENT *Client )
GLOBAL CHAR *
Client_Hostname( CLIENT *Client )
{
assert( Client != NULL );
return Client->host;
} /* Client_Hostname */
GLOBAL CHAR *Client_Password( CLIENT *Client )
GLOBAL CHAR *
Client_Password( CLIENT *Client )
{
assert( Client != NULL );
return Client->pwd;
} /* Client_Password */
GLOBAL CHAR *Client_Modes( CLIENT *Client )
GLOBAL CHAR *
Client_Modes( CLIENT *Client )
{
assert( Client != NULL );
return Client->modes;
} /* Client_Modes */
GLOBAL BOOLEAN Client_OperByMe( CLIENT *Client )
GLOBAL BOOLEAN
Client_OperByMe( CLIENT *Client )
{
assert( Client != NULL );
return Client->oper_by_me;
} /* Client_OperByMe */
GLOBAL INT Client_Hops( CLIENT *Client )
GLOBAL INT
Client_Hops( CLIENT *Client )
{
assert( Client != NULL );
return Client->hops;
} /* Client_Hops */
GLOBAL INT Client_Token( CLIENT *Client )
GLOBAL INT
Client_Token( CLIENT *Client )
{
assert( Client != NULL );
return Client->token;
} /* Client_Token */
GLOBAL INT Client_MyToken( CLIENT *Client )
GLOBAL INT
Client_MyToken( CLIENT *Client )
{
assert( Client != NULL );
return Client->mytoken;
} /* Client_MyToken */
GLOBAL CLIENT *Client_NextHop( CLIENT *Client )
GLOBAL CLIENT *
Client_NextHop( CLIENT *Client )
{
CLIENT *c;
@ -641,7 +681,8 @@ GLOBAL CLIENT *Client_NextHop( CLIENT *Client )
} /* Client_NextHop */
GLOBAL CHAR *Client_Mask( CLIENT *Client )
GLOBAL CHAR *
Client_Mask( CLIENT *Client )
{
/* Client-"ID" liefern, wie sie z.B. fuer
* Prefixe benoetigt wird. */
@ -655,28 +696,32 @@ GLOBAL CHAR *Client_Mask( CLIENT *Client )
} /* Client_Mask */
GLOBAL CLIENT *Client_Introducer( CLIENT *Client )
GLOBAL CLIENT *
Client_Introducer( CLIENT *Client )
{
assert( Client != NULL );
return Client->introducer;
} /* Client_Introducer */
GLOBAL CLIENT *Client_TopServer( CLIENT *Client )
GLOBAL CLIENT *
Client_TopServer( CLIENT *Client )
{
assert( Client != NULL );
return Client->topserver;
} /* Client_TopServer */
GLOBAL BOOLEAN Client_HasMode( CLIENT *Client, CHAR Mode )
GLOBAL BOOLEAN
Client_HasMode( CLIENT *Client, CHAR Mode )
{
assert( Client != NULL );
return strchr( Client->modes, Mode ) != NULL;
} /* Client_HasMode */
GLOBAL CHAR *Client_Away( CLIENT *Client )
GLOBAL CHAR *
Client_Away( CLIENT *Client )
{
/* AWAY-Text liefern */
@ -685,7 +730,8 @@ GLOBAL CHAR *Client_Away( CLIENT *Client )
} /* Client_Away */
GLOBAL BOOLEAN Client_CheckNick( CLIENT *Client, CHAR *Nick )
GLOBAL BOOLEAN
Client_CheckNick( CLIENT *Client, CHAR *Nick )
{
/* Nick ueberpruefen */
@ -711,7 +757,8 @@ GLOBAL BOOLEAN Client_CheckNick( CLIENT *Client, CHAR *Nick )
} /* Client_CheckNick */
GLOBAL BOOLEAN Client_CheckID( CLIENT *Client, CHAR *ID )
GLOBAL BOOLEAN
Client_CheckID( CLIENT *Client, CHAR *ID )
{
/* Nick ueberpruefen */
@ -748,7 +795,8 @@ GLOBAL BOOLEAN Client_CheckID( CLIENT *Client, CHAR *ID )
} /* Client_CheckID */
GLOBAL CLIENT *Client_First( VOID )
GLOBAL CLIENT *
Client_First( VOID )
{
/* Ersten Client liefern. */
@ -756,7 +804,8 @@ GLOBAL CLIENT *Client_First( VOID )
} /* Client_First */
GLOBAL CLIENT *Client_Next( CLIENT *c )
GLOBAL CLIENT *
Client_Next( CLIENT *c )
{
/* Naechsten Client liefern. Existiert keiner,
* so wird NULL geliefert. */
@ -766,37 +815,43 @@ GLOBAL CLIENT *Client_Next( CLIENT *c )
} /* Client_Next */
GLOBAL INT Client_UserCount( VOID )
GLOBAL INT
Client_UserCount( VOID )
{
return Count( CLIENT_USER );
} /* Client_UserCount */
GLOBAL INT Client_ServiceCount( VOID )
GLOBAL INT
Client_ServiceCount( VOID )
{
return Count( CLIENT_SERVICE );;
} /* Client_ServiceCount */
GLOBAL INT Client_ServerCount( VOID )
GLOBAL INT
Client_ServerCount( VOID )
{
return Count( CLIENT_SERVER );
} /* Client_ServerCount */
GLOBAL INT Client_MyUserCount( VOID )
GLOBAL INT
Client_MyUserCount( VOID )
{
return MyCount( CLIENT_USER );
} /* Client_MyUserCount */
GLOBAL INT Client_MyServiceCount( VOID )
GLOBAL INT
Client_MyServiceCount( VOID )
{
return MyCount( CLIENT_SERVICE );
} /* Client_MyServiceCount */
GLOBAL INT Client_MyServerCount( VOID )
GLOBAL INT
Client_MyServerCount( VOID )
{
CLIENT *c;
INT cnt;
@ -812,7 +867,8 @@ GLOBAL INT Client_MyServerCount( VOID )
} /* Client_MyServerCount */
GLOBAL INT Client_OperCount( VOID )
GLOBAL INT
Client_OperCount( VOID )
{
CLIENT *c;
INT cnt;
@ -828,7 +884,8 @@ GLOBAL INT Client_OperCount( VOID )
} /* Client_OperCount */
GLOBAL INT Client_UnknownCount( VOID )
GLOBAL INT
Client_UnknownCount( VOID )
{
CLIENT *c;
INT cnt;
@ -844,7 +901,8 @@ GLOBAL INT Client_UnknownCount( VOID )
} /* Client_UnknownCount */
GLOBAL BOOLEAN Client_IsValidNick( CHAR *Nick )
GLOBAL BOOLEAN
Client_IsValidNick( CHAR *Nick )
{
/* Ist der Nick gueltig? */
@ -868,7 +926,8 @@ GLOBAL BOOLEAN Client_IsValidNick( CHAR *Nick )
} /* Client_IsValidNick */
LOCAL INT Count( CLIENT_TYPE Type )
LOCAL INT
Count( CLIENT_TYPE Type )
{
CLIENT *c;
INT cnt;
@ -884,7 +943,8 @@ LOCAL INT Count( CLIENT_TYPE Type )
} /* Count */
LOCAL INT MyCount( CLIENT_TYPE Type )
LOCAL INT
MyCount( CLIENT_TYPE Type )
{
CLIENT *c;
INT cnt;
@ -900,7 +960,8 @@ LOCAL INT MyCount( CLIENT_TYPE Type )
} /* MyCount */
LOCAL CLIENT *New_Client_Struct( VOID )
LOCAL CLIENT *
New_Client_Struct( VOID )
{
/* Neue CLIENT-Struktur pre-initialisieren */
@ -935,7 +996,8 @@ LOCAL CLIENT *New_Client_Struct( VOID )
} /* New_Client */
LOCAL VOID Generate_MyToken( CLIENT *Client )
LOCAL VOID
Generate_MyToken( CLIENT *Client )
{
CLIENT *c;
INT token;

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: client.h,v 1.27 2002/03/25 19:11:01 alex Exp $
* $Id: client.h,v 1.28 2002/05/27 13:09:26 alex Exp $
*
* client.h: Konfiguration des ngircd (Header)
*/
@ -18,8 +18,6 @@
#ifndef __client_h__
#define __client_h__
#include "conn.h"
typedef enum
{
@ -65,74 +63,74 @@ typedef POINTER CLIENT;
#endif
GLOBAL VOID Client_Init( VOID );
GLOBAL VOID Client_Exit( VOID );
GLOBAL VOID Client_Init PARAMS((VOID ));
GLOBAL VOID Client_Exit PARAMS((VOID ));
GLOBAL CLIENT *Client_NewLocal( CONN_ID Idx, CHAR *Hostname, INT Type, BOOLEAN Idented );
GLOBAL CLIENT *Client_NewRemoteServer( CLIENT *Introducer, CHAR *Hostname, CLIENT *TopServer, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented );
GLOBAL CLIENT *Client_NewRemoteUser( CLIENT *Introducer, CHAR *Nick, INT Hops, CHAR *User, CHAR *Hostname, INT Token, CHAR *Modes, CHAR *Info, BOOLEAN Idented );
GLOBAL CLIENT *Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *ID, CHAR *User, CHAR *Hostname, CHAR *Info, INT Hops, INT Token, CHAR *Modes, BOOLEAN Idented );
GLOBAL CLIENT *Client_NewLocal PARAMS((CONN_ID Idx, CHAR *Hostname, INT Type, BOOLEAN Idented ));
GLOBAL CLIENT *Client_NewRemoteServer PARAMS((CLIENT *Introducer, CHAR *Hostname, CLIENT *TopServer, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented ));
GLOBAL CLIENT *Client_NewRemoteUser PARAMS((CLIENT *Introducer, CHAR *Nick, INT Hops, CHAR *User, CHAR *Hostname, INT Token, CHAR *Modes, CHAR *Info, BOOLEAN Idented ));
GLOBAL CLIENT *Client_New PARAMS((CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *ID, CHAR *User, CHAR *Hostname, CHAR *Info, INT Hops, INT Token, CHAR *Modes, BOOLEAN Idented ));
GLOBAL VOID Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit );
GLOBAL VOID Client_Destroy PARAMS((CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit ));
GLOBAL CLIENT *Client_ThisServer( VOID );
GLOBAL CLIENT *Client_ThisServer PARAMS((VOID ));
GLOBAL CLIENT *Client_GetFromConn( CONN_ID Idx );
GLOBAL CLIENT *Client_GetFromToken( CLIENT *Client, INT Token );
GLOBAL CLIENT *Client_GetFromConn PARAMS((CONN_ID Idx ));
GLOBAL CLIENT *Client_GetFromToken PARAMS((CLIENT *Client, INT Token ));
GLOBAL CLIENT *Client_Search( CHAR *ID );
GLOBAL CLIENT *Client_First( VOID );
GLOBAL CLIENT *Client_Next( CLIENT *c );
GLOBAL CLIENT *Client_Search PARAMS((CHAR *ID ));
GLOBAL CLIENT *Client_First PARAMS((VOID ));
GLOBAL CLIENT *Client_Next PARAMS((CLIENT *c ));
GLOBAL INT Client_Type( CLIENT *Client );
GLOBAL CONN_ID Client_Conn( CLIENT *Client );
GLOBAL CHAR *Client_ID( CLIENT *Client );
GLOBAL CHAR *Client_Mask( CLIENT *Client );
GLOBAL CHAR *Client_Info( CLIENT *Client );
GLOBAL CHAR *Client_User( CLIENT *Client );
GLOBAL CHAR *Client_Hostname( CLIENT *Client );
GLOBAL CHAR *Client_Password( CLIENT *Client );
GLOBAL CHAR *Client_Modes( CLIENT *Client );
GLOBAL CLIENT *Client_Introducer( CLIENT *Client );
GLOBAL BOOLEAN Client_OperByMe( CLIENT *Client );
GLOBAL INT Client_Hops( CLIENT *Client );
GLOBAL INT Client_Token( CLIENT *Client );
GLOBAL INT Client_MyToken( CLIENT *Client );
GLOBAL CLIENT *Client_TopServer( CLIENT *Client );
GLOBAL CLIENT *Client_NextHop( CLIENT *Client );
GLOBAL CHAR *Client_Away( CLIENT *Client );
GLOBAL INT Client_Type PARAMS((CLIENT *Client ));
GLOBAL CONN_ID Client_Conn PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_ID PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Mask PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Info PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_User PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Hostname PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Password PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Modes PARAMS((CLIENT *Client ));
GLOBAL CLIENT *Client_Introducer PARAMS((CLIENT *Client ));
GLOBAL BOOLEAN Client_OperByMe PARAMS((CLIENT *Client ));
GLOBAL INT Client_Hops PARAMS((CLIENT *Client ));
GLOBAL INT Client_Token PARAMS((CLIENT *Client ));
GLOBAL INT Client_MyToken PARAMS((CLIENT *Client ));
GLOBAL CLIENT *Client_TopServer PARAMS((CLIENT *Client ));
GLOBAL CLIENT *Client_NextHop PARAMS((CLIENT *Client ));
GLOBAL CHAR *Client_Away PARAMS((CLIENT *Client ));
GLOBAL BOOLEAN Client_HasMode( CLIENT *Client, CHAR Mode );
GLOBAL BOOLEAN Client_HasMode PARAMS((CLIENT *Client, CHAR Mode ));
GLOBAL VOID Client_SetHostname( CLIENT *Client, CHAR *Hostname );
GLOBAL VOID Client_SetID( CLIENT *Client, CHAR *Nick );
GLOBAL VOID Client_SetUser( CLIENT *Client, CHAR *User, BOOLEAN Idented );
GLOBAL VOID Client_SetInfo( CLIENT *Client, CHAR *Info );
GLOBAL VOID Client_SetPassword( CLIENT *Client, CHAR *Pwd );
GLOBAL VOID Client_SetType( CLIENT *Client, INT Type );
GLOBAL VOID Client_SetHops( CLIENT *Client, INT Hops );
GLOBAL VOID Client_SetToken( CLIENT *Client, INT Token );
GLOBAL VOID Client_SetOperByMe( CLIENT *Client, BOOLEAN OperByMe );
GLOBAL VOID Client_SetModes( CLIENT *Client, CHAR *Modes );
GLOBAL VOID Client_SetIntroducer( CLIENT *Client, CLIENT *Introducer );
GLOBAL VOID Client_SetAway( CLIENT *Client, CHAR *Txt );
GLOBAL VOID Client_SetHostname PARAMS((CLIENT *Client, CHAR *Hostname ));
GLOBAL VOID Client_SetID PARAMS((CLIENT *Client, CHAR *Nick ));
GLOBAL VOID Client_SetUser PARAMS((CLIENT *Client, CHAR *User, BOOLEAN Idented ));
GLOBAL VOID Client_SetInfo PARAMS((CLIENT *Client, CHAR *Info ));
GLOBAL VOID Client_SetPassword PARAMS((CLIENT *Client, CHAR *Pwd ));
GLOBAL VOID Client_SetType PARAMS((CLIENT *Client, INT Type ));
GLOBAL VOID Client_SetHops PARAMS((CLIENT *Client, INT Hops ));
GLOBAL VOID Client_SetToken PARAMS((CLIENT *Client, INT Token ));
GLOBAL VOID Client_SetOperByMe PARAMS((CLIENT *Client, BOOLEAN OperByMe ));
GLOBAL VOID Client_SetModes PARAMS((CLIENT *Client, CHAR *Modes ));
GLOBAL VOID Client_SetIntroducer PARAMS((CLIENT *Client, CLIENT *Introducer ));
GLOBAL VOID Client_SetAway PARAMS((CLIENT *Client, CHAR *Txt ));
GLOBAL BOOLEAN Client_ModeAdd( CLIENT *Client, CHAR Mode );
GLOBAL BOOLEAN Client_ModeDel( CLIENT *Client, CHAR Mode );
GLOBAL BOOLEAN Client_ModeAdd PARAMS((CLIENT *Client, CHAR Mode ));
GLOBAL BOOLEAN Client_ModeDel PARAMS((CLIENT *Client, CHAR Mode ));
GLOBAL BOOLEAN Client_CheckNick( CLIENT *Client, CHAR *Nick );
GLOBAL BOOLEAN Client_CheckID( CLIENT *Client, CHAR *ID );
GLOBAL BOOLEAN Client_CheckNick PARAMS((CLIENT *Client, CHAR *Nick ));
GLOBAL BOOLEAN Client_CheckID PARAMS((CLIENT *Client, CHAR *ID ));
GLOBAL INT Client_UserCount( VOID );
GLOBAL INT Client_ServiceCount( VOID );
GLOBAL INT Client_ServerCount( VOID );
GLOBAL INT Client_OperCount( VOID );
GLOBAL INT Client_UnknownCount( VOID );
GLOBAL INT Client_MyUserCount( VOID );
GLOBAL INT Client_MyServiceCount( VOID );
GLOBAL INT Client_MyServerCount( VOID );
GLOBAL INT Client_UserCount PARAMS((VOID ));
GLOBAL INT Client_ServiceCount PARAMS((VOID ));
GLOBAL INT Client_ServerCount PARAMS((VOID ));
GLOBAL INT Client_OperCount PARAMS((VOID ));
GLOBAL INT Client_UnknownCount PARAMS((VOID ));
GLOBAL INT Client_MyUserCount PARAMS((VOID ));
GLOBAL INT Client_MyServiceCount PARAMS((VOID ));
GLOBAL INT Client_MyServerCount PARAMS((VOID ));
GLOBAL BOOLEAN Client_IsValidNick( CHAR *Nick );
GLOBAL BOOLEAN Client_IsValidNick PARAMS((CHAR *Nick ));
#endif

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: conf.c,v 1.25 2002/05/22 11:14:36 alex Exp $
* $Id: conf.c,v 1.26 2002/05/27 13:09:26 alex Exp $
*
* conf.h: Konfiguration des ngircd
*/
@ -27,9 +27,11 @@
#include <unistd.h>
#include "ngircd.h"
#include "conn.h"
#include "client.h"
#include "defines.h"
#include "log.h"
#include "resolve.h"
#include "tool.h"
#include "exp.h"
@ -39,19 +41,20 @@
LOCAL BOOLEAN Use_Log = TRUE;
LOCAL VOID Set_Defaults( VOID );
LOCAL VOID Read_Config( VOID );
LOCAL VOID Validate_Config( VOID );
LOCAL VOID Set_Defaults PARAMS(( VOID ));
LOCAL VOID Read_Config PARAMS(( VOID ));
LOCAL VOID Validate_Config PARAMS(( VOID ));
GLOBAL VOID Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg );
GLOBAL VOID Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg );
GLOBAL VOID Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg );
GLOBAL VOID Handle_CHANNEL( INT Line, CHAR *Var, CHAR *Arg );
LOCAL VOID Handle_GLOBAL PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
LOCAL VOID Handle_OPERATOR PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
LOCAL VOID Handle_SERVER PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
LOCAL VOID Handle_CHANNEL PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
LOCAL VOID Config_Error( CONST INT Level, CONST CHAR *Format, ... );
LOCAL VOID Config_Error PARAMS(( CONST INT Level, CONST CHAR *Format, ... ));
GLOBAL VOID Conf_Init( VOID )
GLOBAL VOID
Conf_Init( VOID )
{
Set_Defaults( );
Read_Config( );
@ -59,7 +62,8 @@ GLOBAL VOID Conf_Init( VOID )
} /* Config_Init */
GLOBAL INT Conf_Test( VOID )
GLOBAL INT
Conf_Test( VOID )
{
/* Konfiguration einlesen, ueberpruefen und ausgeben. */
@ -140,13 +144,8 @@ GLOBAL INT Conf_Test( VOID )
} /* Conf_Test */
GLOBAL VOID Conf_Exit( VOID )
{
/* ... */
} /* Config_Exit */
LOCAL VOID Set_Defaults( VOID )
LOCAL VOID
Set_Defaults( VOID )
{
/* Konfigurationsvariablen initialisieren, d.h. auf Default-Werte setzen. */
@ -171,7 +170,8 @@ LOCAL VOID Set_Defaults( VOID )
} /* Set_Defaults */
LOCAL VOID Read_Config( VOID )
LOCAL VOID
Read_Config( VOID )
{
/* Konfigurationsdatei einlesen. */
@ -281,7 +281,8 @@ LOCAL VOID Read_Config( VOID )
} /* Read_Config */
GLOBAL VOID Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
LOCAL VOID
Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
{
CHAR *ptr;
INT32 port;
@ -375,7 +376,8 @@ GLOBAL VOID Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
} /* Handle_GLOBAL */
GLOBAL VOID Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg )
LOCAL VOID
Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg )
{
assert( Line > 0 );
assert( Var != NULL );
@ -401,7 +403,8 @@ GLOBAL VOID Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg )
} /* Handle_OPERATOR */
GLOBAL VOID Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
LOCAL VOID
Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
{
INT32 port;
@ -449,7 +452,8 @@ GLOBAL VOID Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
} /* Handle_SERVER */
GLOBAL VOID Handle_CHANNEL( INT Line, CHAR *Var, CHAR *Arg )
LOCAL VOID
Handle_CHANNEL( INT Line, CHAR *Var, CHAR *Arg )
{
assert( Line > 0 );
assert( Var != NULL );
@ -481,7 +485,8 @@ GLOBAL VOID Handle_CHANNEL( INT Line, CHAR *Var, CHAR *Arg )
} /* Handle_CHANNEL */
LOCAL VOID Validate_Config( VOID )
LOCAL VOID
Validate_Config( VOID )
{
/* Konfiguration ueberpruefen */
@ -495,7 +500,8 @@ LOCAL VOID Validate_Config( VOID )
} /* Validate_Config */
LOCAL VOID Config_Error( CONST INT Level, CONST CHAR *Format, ... )
LOCAL VOID
Config_Error( CONST INT Level, CONST CHAR *Format, ... )
{
/* Fehler! Auf Console und/oder ins Log schreiben */

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: conf.h,v 1.16 2002/05/21 00:10:16 alex Exp $
* $Id: conf.h,v 1.17 2002/05/27 13:09:26 alex Exp $
*
* conf.h: Konfiguration des ngircd (Header)
*/
@ -20,7 +20,6 @@
#include <time.h>
#include "conn.h"
#include "defines.h"
@ -90,9 +89,8 @@ GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS];
GLOBAL INT Conf_Channel_Count;
GLOBAL VOID Conf_Init( VOID );
GLOBAL INT Conf_Test( VOID );
GLOBAL VOID Conf_Exit( VOID );
GLOBAL VOID Conf_Init PARAMS((VOID ));
GLOBAL INT Conf_Test PARAMS((VOID ));
#endif

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: conn.c,v 1.64 2002/05/19 13:05:22 alex Exp $
* $Id: conn.c,v 1.65 2002/05/27 13:09:26 alex Exp $
*
* connect.h: Verwaltung aller Netz-Verbindungen ("connections")
*/
@ -31,7 +31,6 @@
#include <sys/types.h>
#include <time.h>
#include <netinet/in.h>
#include <netdb.h>
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
@ -43,15 +42,19 @@
#include <stdint.h> /* u.a. fuer Mac OS X */
#endif
#include "exp.h"
#include "conn.h"
#include "imp.h"
#include "ngircd.h"
#include "client.h"
#include "resolve.h"
#include "conf.h"
#include "log.h"
#include "parse.h"
#include "tool.h"
#include "exp.h"
#include "conn.h"
#define SERVER_WAIT (NONE - 1)
@ -74,41 +77,30 @@ typedef struct _Connection
} CONNECTION;
LOCAL VOID Handle_Read( INT sock );
LOCAL BOOLEAN Handle_Write( CONN_ID Idx );
LOCAL VOID New_Connection( INT Sock );
LOCAL CONN_ID Socket2Index( INT Sock );
LOCAL VOID Read_Request( CONN_ID Idx );
LOCAL BOOLEAN Try_Write( CONN_ID Idx );
LOCAL VOID Handle_Buffer( CONN_ID Idx );
LOCAL VOID Check_Connections( VOID );
LOCAL VOID Check_Servers( VOID );
LOCAL VOID Init_Conn_Struct( INT Idx );
LOCAL BOOLEAN Init_Socket( INT Sock );
LOCAL VOID New_Server( INT Server, CONN_ID Idx );
LOCAL RES_STAT *ResolveAddr( struct sockaddr_in *Addr );
LOCAL RES_STAT *ResolveName( CHAR *Host );
LOCAL VOID Do_ResolveAddr( struct sockaddr_in *Addr, INT w_fd );
LOCAL VOID Do_ResolveName( CHAR *Host, INT w_fd );
LOCAL VOID Read_Resolver_Result( INT r_fd );
#ifdef h_errno
LOCAL CHAR *Resolv_Error( INT H_Error );
#endif
LOCAL VOID Handle_Read PARAMS(( INT sock ));
LOCAL BOOLEAN Handle_Write PARAMS(( CONN_ID Idx ));
LOCAL VOID New_Connection PARAMS(( INT Sock ));
LOCAL CONN_ID Socket2Index PARAMS(( INT Sock ));
LOCAL VOID Read_Request PARAMS(( CONN_ID Idx ));
LOCAL BOOLEAN Try_Write PARAMS(( CONN_ID Idx ));
LOCAL VOID Handle_Buffer PARAMS(( CONN_ID Idx ));
LOCAL VOID Check_Connections PARAMS(( VOID ));
LOCAL VOID Check_Servers PARAMS(( VOID ));
LOCAL VOID Init_Conn_Struct PARAMS(( INT Idx ));
LOCAL BOOLEAN Init_Socket PARAMS(( INT Sock ));
LOCAL VOID New_Server PARAMS(( INT Server, CONN_ID Idx ));
LOCAL VOID Read_Resolver_Result PARAMS(( INT r_fd ));
LOCAL fd_set My_Listeners;
LOCAL fd_set My_Sockets;
LOCAL fd_set My_Resolvers;
LOCAL fd_set My_Connects;
LOCAL INT My_Max_Fd;
LOCAL CONNECTION My_Connections[MAX_CONNECTIONS];
GLOBAL VOID Conn_Init( VOID )
GLOBAL VOID
Conn_Init( VOID )
{
/* Modul initialisieren: statische Strukturen "ausnullen". */
@ -117,17 +109,17 @@ GLOBAL VOID Conn_Init( VOID )
/* zu Beginn haben wir keine Verbindungen */
FD_ZERO( &My_Listeners );
FD_ZERO( &My_Sockets );
FD_ZERO( &My_Resolvers );
FD_ZERO( &My_Connects );
My_Max_Fd = 0;
Conn_MaxFD = 0;
/* Connection-Struktur initialisieren */
for( i = 0; i < MAX_CONNECTIONS; i++ ) Init_Conn_Struct( i );
} /* Conn_Init */
GLOBAL VOID Conn_Exit( VOID )
GLOBAL VOID
Conn_Exit( VOID )
{
/* Modul abmelden: alle noch offenen Connections
* schliessen und freigeben. */
@ -137,7 +129,7 @@ GLOBAL VOID Conn_Exit( VOID )
/* Sockets schliessen */
Log( LOG_DEBUG, "Shutting down all connections ..." );
for( i = 0; i < My_Max_Fd + 1; i++ )
for( i = 0; i < Conn_MaxFD + 1; i++ )
{
if( FD_ISSET( i, &My_Sockets ))
{
@ -166,7 +158,8 @@ GLOBAL VOID Conn_Exit( VOID )
} /* Conn_Exit */
GLOBAL BOOLEAN Conn_NewListener( CONST UINT Port )
GLOBAL BOOLEAN
Conn_NewListener( CONST UINT Port )
{
/* Neuen Listen-Socket erzeugen: der Server wartet dann auf
* dem angegebenen Port auf Verbindungen. Kann der Listen-
@ -211,7 +204,7 @@ GLOBAL BOOLEAN Conn_NewListener( CONST UINT Port )
FD_SET( sock, &My_Listeners );
FD_SET( sock, &My_Sockets );
if( sock > My_Max_Fd ) My_Max_Fd = sock;
if( sock > Conn_MaxFD ) Conn_MaxFD = sock;
Log( LOG_INFO, "Now listening on port %d (socket %d).", Port, sock );
@ -219,7 +212,8 @@ GLOBAL BOOLEAN Conn_NewListener( CONST UINT Port )
} /* Conn_NewListener */
GLOBAL VOID Conn_Handler( INT Timeout )
GLOBAL VOID
Conn_Handler( INT Timeout )
{
/* Aktive Verbindungen ueberwachen. Mindestens alle "Timeout"
* Sekunden wird die Funktion verlassen. Folgende Aktionen
@ -289,17 +283,17 @@ GLOBAL VOID Conn_Handler( INT Timeout )
FD_CLR( My_Connections[i].sock, &read_sockets );
}
}
for( i = 0; i < My_Max_Fd + 1; i++ )
for( i = 0; i < Conn_MaxFD + 1; i++ )
{
/* Pipes von Resolver Sub-Prozessen aufnehmen */
if( FD_ISSET( i, &My_Resolvers ))
if( FD_ISSET( i, &Resolver_FDs ))
{
FD_SET( i, &read_sockets );
}
}
/* Auf Aktivitaet warten */
if( select( My_Max_Fd + 1, &read_sockets, &write_sockets, NULL, &tv ) == -1 )
if( select( Conn_MaxFD + 1, &read_sockets, &write_sockets, NULL, &tv ) == -1 )
{
if( errno != EINTR )
{
@ -311,13 +305,13 @@ GLOBAL VOID Conn_Handler( INT Timeout )
}
/* Koennen Daten geschrieben werden? */
for( i = 0; i < My_Max_Fd + 1; i++ )
for( i = 0; i < Conn_MaxFD + 1; i++ )
{
if( FD_ISSET( i, &write_sockets )) Handle_Write( Socket2Index( i ));
}
/* Daten zum Lesen vorhanden? */
for( i = 0; i < My_Max_Fd + 1; i++ )
for( i = 0; i < Conn_MaxFD + 1; i++ )
{
if( FD_ISSET( i, &read_sockets )) Handle_Read( i );
}
@ -325,7 +319,8 @@ GLOBAL VOID Conn_Handler( INT Timeout )
} /* Conn_Handler */
GLOBAL BOOLEAN Conn_WriteStr( CONN_ID Idx, CHAR *Format, ... )
GLOBAL BOOLEAN
Conn_WriteStr( CONN_ID Idx, CHAR *Format, ... )
{
/* String in Socket schreiben. CR+LF wird von dieser Funktion
* automatisch angehaengt. Im Fehlerfall wird dir Verbindung
@ -359,7 +354,8 @@ GLOBAL BOOLEAN Conn_WriteStr( CONN_ID Idx, CHAR *Format, ... )
} /* Conn_WriteStr */
GLOBAL BOOLEAN Conn_Write( CONN_ID Idx, CHAR *Data, INT Len )
GLOBAL BOOLEAN
Conn_Write( CONN_ID Idx, CHAR *Data, INT Len )
{
/* Daten in Socket schreiben. Bei "fatalen" Fehlern wird
* der Client disconnectiert und FALSE geliefert. */
@ -399,7 +395,8 @@ GLOBAL BOOLEAN Conn_Write( CONN_ID Idx, CHAR *Data, INT Len )
} /* Conn_Write */
GLOBAL VOID Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient )
GLOBAL VOID
Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient )
{
/* Verbindung schliessen. Evtl. noch von Resolver
* Sub-Prozessen offene Pipes werden geschlossen. */
@ -431,7 +428,7 @@ GLOBAL VOID Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformC
if( My_Connections[Idx].res_stat )
{
/* Resolver-Strukturen freigeben, wenn noch nicht geschehen */
FD_CLR( My_Connections[Idx].res_stat->pipe[0], &My_Resolvers );
FD_CLR( My_Connections[Idx].res_stat->pipe[0], &Resolver_FDs );
close( My_Connections[Idx].res_stat->pipe[0] );
close( My_Connections[Idx].res_stat->pipe[1] );
free( My_Connections[Idx].res_stat );
@ -452,7 +449,8 @@ GLOBAL VOID Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformC
} /* Conn_Close */
GLOBAL VOID Conn_UpdateIdle( CONN_ID Idx )
GLOBAL VOID
Conn_UpdateIdle( CONN_ID Idx )
{
/* Idle-Timer zuruecksetzen */
@ -461,7 +459,8 @@ GLOBAL VOID Conn_UpdateIdle( CONN_ID Idx )
}
GLOBAL time_t Conn_GetIdle( CONN_ID Idx )
GLOBAL time_t
Conn_GetIdle( CONN_ID Idx )
{
/* Idle-Time einer Verbindung liefern (in Sekunden) */
@ -470,7 +469,8 @@ GLOBAL time_t Conn_GetIdle( CONN_ID Idx )
} /* Conn_GetIdle */
GLOBAL time_t Conn_LastPing( CONN_ID Idx )
GLOBAL time_t
Conn_LastPing( CONN_ID Idx )
{
/* Zeitpunkt des letzten PING liefern */
@ -479,7 +479,8 @@ GLOBAL time_t Conn_LastPing( CONN_ID Idx )
} /* Conn_LastPing */
LOCAL BOOLEAN Try_Write( CONN_ID Idx )
LOCAL BOOLEAN
Try_Write( CONN_ID Idx )
{
/* Versuchen, Daten aus dem Schreib-Puffer in den
* Socket zu schreiben. */
@ -508,7 +509,8 @@ LOCAL BOOLEAN Try_Write( CONN_ID Idx )
} /* Try_Write */
LOCAL VOID Handle_Read( INT Sock )
LOCAL VOID
Handle_Read( INT Sock )
{
/* Aktivitaet auf einem Socket verarbeiten:
* - neue Clients annehmen,
@ -526,7 +528,7 @@ LOCAL VOID Handle_Read( INT Sock )
New_Connection( Sock );
}
else if( FD_ISSET( Sock, &My_Resolvers ))
else if( FD_ISSET( Sock, &Resolver_FDs ))
{
/* Rueckmeldung von einem Resolver Sub-Prozess */
@ -542,7 +544,8 @@ LOCAL VOID Handle_Read( INT Sock )
} /* Handle_Read */
LOCAL BOOLEAN Handle_Write( CONN_ID Idx )
LOCAL BOOLEAN
Handle_Write( CONN_ID Idx )
{
/* Daten aus Schreibpuffer versenden bzw. Connection aufbauen */
@ -609,7 +612,8 @@ LOCAL BOOLEAN Handle_Write( CONN_ID Idx )
} /* Handle_Write */
LOCAL VOID New_Connection( INT Sock )
LOCAL VOID
New_Connection( INT Sock )
{
/* Neue Client-Verbindung von Listen-Socket annehmen und
* CLIENT-Struktur anlegen. */
@ -655,12 +659,12 @@ LOCAL VOID New_Connection( INT Sock )
/* Neuen Socket registrieren */
FD_SET( new_sock, &My_Sockets );
if( new_sock > My_Max_Fd ) My_Max_Fd = new_sock;
if( new_sock > Conn_MaxFD ) Conn_MaxFD = new_sock;
Log( LOG_INFO, "Accepted connection %d from %s:%d on socket %d.", idx, inet_ntoa( new_addr.sin_addr ), ntohs( new_addr.sin_port), Sock );
/* Hostnamen ermitteln */
s = ResolveAddr( &new_addr );
s = Resolve_Addr( &new_addr );
if( s )
{
/* Sub-Prozess wurde asyncron gestartet */
@ -675,7 +679,8 @@ LOCAL VOID New_Connection( INT Sock )
} /* New_Connection */
LOCAL CONN_ID Socket2Index( INT Sock )
LOCAL CONN_ID
Socket2Index( INT Sock )
{
/* zum Socket passende Connection suchen */
@ -690,7 +695,8 @@ LOCAL CONN_ID Socket2Index( INT Sock )
} /* Socket2Index */
LOCAL VOID Read_Request( CONN_ID Idx )
LOCAL VOID
Read_Request( CONN_ID Idx )
{
/* Daten von Socket einlesen und entsprechend behandeln.
* Tritt ein Fehler auf, so wird der Socket geschlossen. */
@ -738,7 +744,8 @@ LOCAL VOID Read_Request( CONN_ID Idx )
} /* Read_Request */
LOCAL VOID Handle_Buffer( CONN_ID Idx )
LOCAL VOID
Handle_Buffer( CONN_ID Idx )
{
/* Daten im Lese-Puffer einer Verbindung verarbeiten. */
@ -769,7 +776,7 @@ LOCAL VOID Handle_Buffer( CONN_ID Idx )
/* Ende der Anfrage wurde gefunden */
*ptr = '\0';
len = ( ptr - My_Connections[Idx].rbuf ) + delta;
if( len > COMMAND_LEN )
if( len > ( COMMAND_LEN - 1 ))
{
/* Eine Anfrage darf(!) nicht laenger als 512 Zeichen
* (incl. CR+LF!) werden; vgl. RFC 2812. Wenn soetwas
@ -792,7 +799,8 @@ LOCAL VOID Handle_Buffer( CONN_ID Idx )
} /* Handle_Buffer */
LOCAL VOID Check_Connections( VOID )
LOCAL VOID
Check_Connections( VOID )
{
/* Pruefen, ob Verbindungen noch "alive" sind. Ist dies
* nicht der Fall, zunaechst PING-PONG spielen und, wenn
@ -841,7 +849,8 @@ LOCAL VOID Check_Connections( VOID )
} /* Check_Connections */
LOCAL VOID Check_Servers( VOID )
LOCAL VOID
Check_Servers( VOID )
{
/* Pruefen, ob Server-Verbindungen aufgebaut werden
* muessen bzw. koennen */
@ -901,7 +910,7 @@ LOCAL VOID Check_Servers( VOID )
My_Connections[idx].our_server = i;
/* Hostnamen in IP aufloesen */
s = ResolveName( Conf_Server[i].host );
s = Resolve_Name( Conf_Server[i].host );
if( s )
{
/* Sub-Prozess wurde asyncron gestartet */
@ -917,7 +926,8 @@ LOCAL VOID Check_Servers( VOID )
} /* Check_Servers */
LOCAL VOID New_Server( INT Server, CONN_ID Idx )
LOCAL VOID
New_Server( INT Server, CONN_ID Idx )
{
/* Neue Server-Verbindung aufbauen */
@ -999,11 +1009,12 @@ LOCAL VOID New_Server( INT Server, CONN_ID Idx )
/* Neuen Socket registrieren */
FD_SET( new_sock, &My_Sockets );
FD_SET( new_sock, &My_Connects );
if( new_sock > My_Max_Fd ) My_Max_Fd = new_sock;
if( new_sock > Conn_MaxFD ) Conn_MaxFD = new_sock;
} /* New_Server */
LOCAL VOID Init_Conn_Struct( INT Idx )
LOCAL VOID
Init_Conn_Struct( INT Idx )
{
/* Connection-Struktur initialisieren */
@ -1021,7 +1032,8 @@ LOCAL VOID Init_Conn_Struct( INT Idx )
} /* Init_Conn_Struct */
LOCAL BOOLEAN Init_Socket( INT Sock )
LOCAL BOOLEAN
Init_Socket( INT Sock )
{
/* Socket-Optionen setzen */
@ -1045,197 +1057,17 @@ LOCAL BOOLEAN Init_Socket( INT Sock )
} /* Init_Socket */
LOCAL RES_STAT *ResolveAddr( struct sockaddr_in *Addr )
{
/* IP (asyncron!) aufloesen. Bei Fehler, z.B. wenn der
* Child-Prozess nicht erzeugt werden kann, wird NULL geliefert.
* Der Host kann dann nicht aufgeloest werden. */
RES_STAT *s;
INT pid;
/* Speicher anfordern */
s = malloc( sizeof( RES_STAT ));
if( ! s )
{
Log( LOG_EMERG, "Resolver: Can't allocate memory!" );
return NULL;
}
/* Pipe fuer Antwort initialisieren */
if( pipe( s->pipe ) != 0 )
{
free( s );
Log( LOG_ALERT, "Resolver: Can't create output pipe: %s!", strerror( errno ));
return NULL;
}
/* Sub-Prozess erzeugen */
pid = fork( );
if( pid > 0 )
{
/* Haupt-Prozess */
Log( LOG_DEBUG, "Resolver for %s created (PID %d).", inet_ntoa( Addr->sin_addr ), pid );
FD_SET( s->pipe[0], &My_Resolvers );
if( s->pipe[0] > My_Max_Fd ) My_Max_Fd = s->pipe[0];
s->pid = pid;
return s;
}
else if( pid == 0 )
{
/* Sub-Prozess */
Log_Init_Resolver( );
Do_ResolveAddr( Addr, s->pipe[1] );
Log_Exit_Resolver( );
exit( 0 );
}
else
{
/* Fehler */
free( s );
Log( LOG_CRIT, "Resolver: Can't fork: %s!", strerror( errno ));
return NULL;
}
} /* ResolveAddr */
LOCAL RES_STAT *ResolveName( CHAR *Host )
{
/* Hostnamen (asyncron!) aufloesen. Bei Fehler, z.B. wenn der
* Child-Prozess nicht erzeugt werden kann, wird NULL geliefert.
* Der Host kann dann nicht aufgeloest werden. */
RES_STAT *s;
INT pid;
/* Speicher anfordern */
s = malloc( sizeof( RES_STAT ));
if( ! s )
{
Log( LOG_EMERG, "Resolver: Can't allocate memory!" );
return NULL;
}
/* Pipe fuer Antwort initialisieren */
if( pipe( s->pipe ) != 0 )
{
free( s );
Log( LOG_ALERT, "Resolver: Can't create output pipe: %s!", strerror( errno ));
return NULL;
}
/* Sub-Prozess erzeugen */
pid = fork( );
if( pid > 0 )
{
/* Haupt-Prozess */
Log( LOG_DEBUG, "Resolver for \"%s\" created (PID %d).", Host, pid );
FD_SET( s->pipe[0], &My_Resolvers );
if( s->pipe[0] > My_Max_Fd ) My_Max_Fd = s->pipe[0];
s->pid = pid;
return s;
}
else if( pid == 0 )
{
/* Sub-Prozess */
Log_Init_Resolver( );
Do_ResolveName( Host, s->pipe[1] );
Log_Exit_Resolver( );
exit( 0 );
}
else
{
/* Fehler */
free( s );
Log( LOG_CRIT, "Resolver: Can't fork: %s!", strerror( errno ));
return NULL;
}
} /* ResolveName */
LOCAL VOID Do_ResolveAddr( struct sockaddr_in *Addr, INT w_fd )
{
/* Resolver Sub-Prozess: IP aufloesen und Ergebnis in Pipe schreiben. */
CHAR hostname[HOST_LEN];
struct hostent *h;
Log_Resolver( LOG_DEBUG, "Now resolving %s ...", inet_ntoa( Addr->sin_addr ));
/* Namen aufloesen */
h = gethostbyaddr( (CHAR *)&Addr->sin_addr, sizeof( Addr->sin_addr ), AF_INET );
if( h ) strcpy( hostname, h->h_name );
else
{
#ifdef h_errno
Log_Resolver( LOG_WARNING, "Can't resolve address \"%s\": %s!", inet_ntoa( Addr->sin_addr ), Resolv_Error( h_errno ));
#else
Log_Resolver( LOG_WARNING, "Can't resolve address \"%s\"!", inet_ntoa( Addr->sin_addr ));
#endif
strcpy( hostname, inet_ntoa( Addr->sin_addr ));
}
/* Antwort an Parent schreiben */
if( write( w_fd, hostname, strlen( hostname ) + 1 ) != ( strlen( hostname ) + 1 ))
{
Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno ));
close( w_fd );
return;
}
Log_Resolver( LOG_DEBUG, "Ok, translated %s to \"%s\".", inet_ntoa( Addr->sin_addr ), hostname );
} /* Do_ResolveAddr */
LOCAL VOID Do_ResolveName( CHAR *Host, INT w_fd )
{
/* Resolver Sub-Prozess: Name aufloesen und Ergebnis in Pipe schreiben. */
CHAR ip[16];
struct hostent *h;
struct in_addr *addr;
Log_Resolver( LOG_DEBUG, "Now resolving \"%s\" ...", Host );
/* Namen aufloesen */
h = gethostbyname( Host );
if( h )
{
addr = (struct in_addr *)h->h_addr;
strcpy( ip, inet_ntoa( *addr ));
}
else
{
#ifdef h_errno
Log_Resolver( LOG_WARNING, "Can't resolve \"%s\": %s!", Host, Resolv_Error( h_errno ));
#else
Log_Resolver( LOG_WARNING, "Can't resolve \"%s\"!", Host );
#endif
strcpy( ip, "" );
}
/* Antwort an Parent schreiben */
if( write( w_fd, ip, strlen( ip ) + 1 ) != ( strlen( ip ) + 1 ))
{
Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno ));
close( w_fd );
return;
}
if( ip[0] ) Log_Resolver( LOG_DEBUG, "Ok, translated \"%s\" to %s.", Host, ip );
} /* Do_ResolveName */
LOCAL VOID Read_Resolver_Result( INT r_fd )
LOCAL VOID
Read_Resolver_Result( INT r_fd )
{
/* Ergebnis von Resolver Sub-Prozess aus Pipe lesen
* und entsprechende Connection aktualisieren */
* und entsprechende Connection aktualisieren */
CHAR result[HOST_LEN];
CLIENT *c;
INT len, i;
FD_CLR( r_fd, &My_Resolvers );
FD_CLR( r_fd, &Resolver_FDs );
/* Anfrage vom Parent lesen */
len = read( r_fd, result, HOST_LEN);
@ -1256,7 +1088,7 @@ LOCAL VOID Read_Resolver_Result( INT r_fd )
if( i >= MAX_CONNECTIONS )
{
/* Opsa! Keine passende Connection gefunden!? Vermutlich
* wurde sie schon wieder geschlossen. */
* wurde sie schon wieder geschlossen. */
close( r_fd );
Log( LOG_DEBUG, "Resolver: Got result for unknown connection!?" );
return;
@ -1285,29 +1117,4 @@ LOCAL VOID Read_Resolver_Result( INT r_fd )
} /* Read_Resolver_Result */
#ifdef h_errno
LOCAL CHAR *Resolv_Error( INT H_Error )
{
/* Fehlerbeschreibung fuer H_Error liefern */
switch( H_Error )
{
case HOST_NOT_FOUND:
return "host not found";
case NO_DATA:
return "name valid but no IP address defined";
case NO_RECOVERY:
return "name server error";
case TRY_AGAIN:
return "name server temporary not available";
default:
return "unknown error";
}
} /* Resolv_Error */
#endif
/* -eof- */

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: conn.h,v 1.14 2002/03/29 22:54:35 alex Exp $
* $Id: conn.h,v 1.15 2002/05/27 13:09:26 alex Exp $
*
* conn.h: Verwaltung aller Netz-Verbindungen ("connections") (Header)
*/
@ -24,28 +24,25 @@
typedef INT CONN_ID;
typedef struct _Res_Stat
{
INT pid; /* PID des Child-Prozess */
INT pipe[2]; /* Pipe fuer IPC */
} RES_STAT;
GLOBAL VOID Conn_Init PARAMS((VOID ));
GLOBAL VOID Conn_Exit PARAMS(( VOID ));
GLOBAL BOOLEAN Conn_NewListener PARAMS(( CONST UINT Port ));
GLOBAL VOID Conn_Handler PARAMS(( INT Timeout ));
GLOBAL BOOLEAN Conn_Write PARAMS(( CONN_ID Idx, CHAR *Data, INT Len ));
GLOBAL BOOLEAN Conn_WriteStr PARAMS(( CONN_ID Idx, CHAR *Format, ... ));
GLOBAL VOID Conn_Close PARAMS(( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient ));
GLOBAL VOID Conn_UpdateIdle PARAMS(( CONN_ID Idx ));
GLOBAL time_t Conn_GetIdle PARAMS(( CONN_ID Idx ));
GLOBAL time_t Conn_LastPing PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conn_Init( VOID );
GLOBAL VOID Conn_Exit( VOID );
GLOBAL BOOLEAN Conn_NewListener( CONST UINT Port );
GLOBAL VOID Conn_Handler( INT Timeout );
GLOBAL BOOLEAN Conn_Write( CONN_ID Idx, CHAR *Data, INT Len );
GLOBAL BOOLEAN Conn_WriteStr( CONN_ID Idx, CHAR *Format, ... );
GLOBAL VOID Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient );
GLOBAL VOID Conn_UpdateIdle( CONN_ID Idx );
GLOBAL time_t Conn_GetIdle( CONN_ID Idx );
GLOBAL time_t Conn_LastPing( CONN_ID Idx );
GLOBAL INT Conn_MaxFD;
#endif

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-channel.c,v 1.5 2002/05/21 00:10:16 alex Exp $
* $Id: irc-channel.c,v 1.6 2002/05/27 13:09:26 alex Exp $
*
* irc-channel.c: IRC-Channel-Befehle
*/
@ -22,16 +22,22 @@
#include <string.h>
#include "defines.h"
#include "irc.h"
#include "irc-write.h"
#include "conn.h"
#include "client.h"
#include "channel.h"
#include "lists.h"
#include "log.h"
#include "messages.h"
#include "parse.h"
#include "irc.h"
#include "irc-write.h"
#include "exp.h"
#include "irc-channel.h"
GLOBAL BOOLEAN IRC_JOIN( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_JOIN( CLIENT *Client, REQUEST *Req )
{
CHAR *channame, *flags, *topic, modes[8];
BOOLEAN is_new_chan;
@ -52,6 +58,7 @@ GLOBAL BOOLEAN IRC_JOIN( CLIENT *Client, REQUEST *Req )
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* Channel-Namen durchgehen */
chan = NULL;
channame = strtok( Req->argv[0], "," );
while( channame )
{
@ -69,11 +76,37 @@ GLOBAL BOOLEAN IRC_JOIN( CLIENT *Client, REQUEST *Req )
if( flags ) *flags++ = '\0';
}
/* neuer Channel udn lokaler Client? */
if( is_new_chan && ( Client_Type( Client ) == CLIENT_USER ))
/* Lokaler Client? */
if( Client_Type( Client ) == CLIENT_USER )
{
/* Dann soll der Client Channel-Operator werden! */
flags = "o";
/* Existiert der Channel bereits, oder wird er im Moment neu erzeugt? */
if( is_new_chan )
{
/* Erster User im Channel: Operator-Flag setzen */
flags = "o";
}
else
{
/* Existierenden Channel suchen */
chan = Channel_Search( channame );
assert( chan != NULL );
/* Testen, ob Client gebanned ist */
if( Lists_CheckBanned( target, chan ))
{
/* Client ist gebanned: */
}
/* Ist der Channel "invite-only"? */
if( strchr( Channel_Modes( chan ), 'i' ))
{
/* Wurde der Client invited? */
if( ! Lists_CheckInvited( target, chan ))
{
/* Client wurde nicht invited: */
}
}
}
}
/* Channel joinen (und ggf. anlegen) */
@ -83,7 +116,7 @@ GLOBAL BOOLEAN IRC_JOIN( CLIENT *Client, REQUEST *Req )
channame = strtok( NULL, "," );
continue;
}
chan = Channel_Search( channame );
if( ! chan ) chan = Channel_Search( channame );
assert( chan != NULL );
/* Modes setzen (wenn vorhanden) */
@ -133,7 +166,8 @@ GLOBAL BOOLEAN IRC_JOIN( CLIENT *Client, REQUEST *Req )
} /* IRC_JOIN */
GLOBAL BOOLEAN IRC_PART( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_PART( CLIENT *Client, REQUEST *Req )
{
CLIENT *target;
CHAR *chan;
@ -169,7 +203,8 @@ GLOBAL BOOLEAN IRC_PART( CLIENT *Client, REQUEST *Req )
} /* IRC_PART */
GLOBAL BOOLEAN IRC_TOPIC( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_TOPIC( CLIENT *Client, REQUEST *Req )
{
CHANNEL *chan;
CLIENT *from;
@ -221,7 +256,8 @@ GLOBAL BOOLEAN IRC_TOPIC( CLIENT *Client, REQUEST *Req )
} /* IRC_TOPIC */
GLOBAL BOOLEAN IRC_LIST( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_LIST( CLIENT *Client, REQUEST *Req )
{
CHAR *pattern;
CHANNEL *chan;

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-channel.h,v 1.3 2002/04/23 19:51:14 alex Exp $
* $Id: irc-channel.h,v 1.4 2002/05/27 13:09:26 alex Exp $
*
* irc-channel.h: IRC-Channel-Befehle (Header)
*/
@ -18,15 +18,13 @@
#ifndef __irc_channel_h__
#define __irc_channel_h__
#include "parse.h"
#include "client.h"
GLOBAL BOOLEAN IRC_JOIN PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_PART PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_TOPIC PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_JOIN( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_PART( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_TOPIC( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_LIST PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_LIST( CLIENT *Client, REQUEST *Req );
#endif

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-login.c,v 1.13 2002/04/14 14:02:35 alex Exp $
* $Id: irc-login.c,v 1.14 2002/05/27 13:09:26 alex Exp $
*
* irc-login.c: Anmeldung und Abmeldung im IRC
*/
@ -24,21 +24,27 @@
#include <string.h>
#include "ngircd.h"
#include "resolve.h"
#include "conf.h"
#include "irc.h"
#include "irc-write.h"
#include "conn.h"
#include "client.h"
#include "channel.h"
#include "log.h"
#include "messages.h"
#include "parse.h"
#include "irc.h"
#include "irc-write.h"
#include "exp.h"
#include "irc-login.h"
LOCAL BOOLEAN Hello_User( CLIENT *Client );
LOCAL VOID Kill_Nick( CHAR *Nick, CHAR *Reason );
LOCAL BOOLEAN Hello_User PARAMS(( CLIENT *Client ));
LOCAL VOID Kill_Nick PARAMS(( CHAR *Nick, CHAR *Reason ));
GLOBAL BOOLEAN IRC_PASS( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_PASS( CLIENT *Client, REQUEST *Req )
{
assert( Client != NULL );
assert( Req != NULL );
@ -77,7 +83,8 @@ GLOBAL BOOLEAN IRC_PASS( CLIENT *Client, REQUEST *Req )
} /* IRC_PASS */
GLOBAL BOOLEAN IRC_NICK( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_NICK( CLIENT *Client, REQUEST *Req )
{
CLIENT *intr_c, *target, *c;
CHAR *modes;
@ -215,7 +222,8 @@ GLOBAL BOOLEAN IRC_NICK( CLIENT *Client, REQUEST *Req )
} /* IRC_NICK */
GLOBAL BOOLEAN IRC_USER( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_USER( CLIENT *Client, REQUEST *Req )
{
assert( Client != NULL );
assert( Req != NULL );
@ -245,7 +253,8 @@ GLOBAL BOOLEAN IRC_USER( CLIENT *Client, REQUEST *Req )
} /* IRC_USER */
GLOBAL BOOLEAN IRC_QUIT( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_QUIT( CLIENT *Client, REQUEST *Req )
{
CLIENT *target;
@ -287,7 +296,8 @@ GLOBAL BOOLEAN IRC_QUIT( CLIENT *Client, REQUEST *Req )
} /* IRC_QUIT */
GLOBAL BOOLEAN IRC_PING( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_PING( CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *from;
@ -322,7 +332,8 @@ GLOBAL BOOLEAN IRC_PING( CLIENT *Client, REQUEST *Req )
} /* IRC_PING */
GLOBAL BOOLEAN IRC_PONG( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_PONG( CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *from;
@ -360,7 +371,8 @@ GLOBAL BOOLEAN IRC_PONG( CLIENT *Client, REQUEST *Req )
} /* IRC_PONG */
LOCAL BOOLEAN Hello_User( CLIENT *Client )
LOCAL BOOLEAN
Hello_User( CLIENT *Client )
{
assert( Client != NULL );
@ -392,7 +404,8 @@ LOCAL BOOLEAN Hello_User( CLIENT *Client )
} /* Hello_User */
LOCAL VOID Kill_Nick( CHAR *Nick, CHAR *Reason )
LOCAL VOID
Kill_Nick( CHAR *Nick, CHAR *Reason )
{
CLIENT *c;

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-login.h,v 1.3 2002/03/12 14:37:52 alex Exp $
* $Id: irc-login.h,v 1.4 2002/05/27 13:09:27 alex Exp $
*
* irc-login.h: Anmeldung und Abmeldung im IRC (Header)
*/
@ -18,16 +18,13 @@
#ifndef __irc_login_h__
#define __irc_login_h__
#include "parse.h"
#include "client.h"
GLOBAL BOOLEAN IRC_PASS( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_NICK( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_USER( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_PING( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_PONG( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_QUIT( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_PASS PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_NICK PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_USER PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_PING PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_PONG PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_QUIT PARAMS((CLIENT *Client, REQUEST *Req ));
#endif

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-mode.c,v 1.5 2002/05/21 00:10:16 alex Exp $
* $Id: irc-mode.c,v 1.6 2002/05/27 13:09:27 alex Exp $
*
* irc-mode.c: IRC-Befehle zur Mode-Aenderung (MODE, AWAY, ...)
*/
@ -21,17 +21,21 @@
#include <assert.h>
#include <string.h>
#include "conn.h"
#include "client.h"
#include "channel.h"
#include "defines.h"
#include "irc-write.h"
#include "log.h"
#include "parse.h"
#include "messages.h"
#include "exp.h"
#include "irc-mode.h"
GLOBAL BOOLEAN IRC_MODE( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_MODE( CLIENT *Client, REQUEST *Req )
{
CHAR *mode_ptr, the_modes[CLIENT_MODE_LEN], x[2];
CLIENT *cl, *chan_cl, *prefix;
@ -140,11 +144,6 @@ GLOBAL BOOLEAN IRC_MODE( CLIENT *Client, REQUEST *Req )
/* invisible */
x[0] = 'i';
break;
case 'r':
/* restricted (kann nur gesetzt werden) */
if( set ) x[0] = 'r';
else ok = IRC_WriteStrClient( Client, ERR_RESTRICTED_MSG, Client_ID( Client ));
break;
case 'o':
/* operator (kann nur geloescht werden) */
if( ! set )
@ -154,6 +153,11 @@ GLOBAL BOOLEAN IRC_MODE( CLIENT *Client, REQUEST *Req )
}
else ok = IRC_WriteStrClient( Client, ERR_UMODEUNKNOWNFLAG_MSG, Client_ID( Client ));
break;
case 'r':
/* restricted (kann nur gesetzt werden) */
if( set ) x[0] = 'r';
else ok = IRC_WriteStrClient( Client, ERR_RESTRICTED_MSG, Client_ID( Client ));
break;
case 's':
/* server messages */
x[0] = 's';
@ -203,6 +207,10 @@ GLOBAL BOOLEAN IRC_MODE( CLIENT *Client, REQUEST *Req )
/* Anonymous */
x[0] = 'a';
break;
case 'i':
/* Invite-Only */
x[0] = 'i';
break;
case 'm':
/* Moderated */
x[0] = 'm';
@ -367,7 +375,8 @@ GLOBAL BOOLEAN IRC_MODE( CLIENT *Client, REQUEST *Req )
} /* IRC_MODE */
GLOBAL BOOLEAN IRC_AWAY( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_AWAY( CLIENT *Client, REQUEST *Req )
{
assert( Client != NULL );
assert( Req != NULL );

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-mode.h,v 1.3 2002/04/04 13:03:11 alex Exp $
* $Id: irc-mode.h,v 1.4 2002/05/27 13:09:27 alex Exp $
*
* irc-mode.h: IRC-Befehle zur Mode-Aenderung (MODE, AWAY, ...) (Header)
*/
@ -18,12 +18,9 @@
#ifndef __irc_mode_h__
#define __irc_mode_h__
#include "parse.h"
#include "client.h"
GLOBAL BOOLEAN IRC_MODE( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_AWAY( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_MODE PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_AWAY PARAMS((CLIENT *Client, REQUEST *Req ));
#endif

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-oper.c,v 1.4 2002/04/04 13:03:39 alex Exp $
* $Id: irc-oper.c,v 1.5 2002/05/27 13:09:27 alex Exp $
*
* irc-oper.c: IRC-Operator-Befehle
*/
@ -22,16 +22,22 @@
#include <string.h>
#include "ngircd.h"
#include "resolve.h"
#include "conf.h"
#include "conn.h"
#include "client.h"
#include "channel.h"
#include "irc-write.h"
#include "log.h"
#include "messages.h"
#include "parse.h"
#include <exp.h>
#include "irc-oper.h"
GLOBAL BOOLEAN IRC_OPER( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_OPER( CLIENT *Client, REQUEST *Req )
{
INT i;
@ -76,7 +82,8 @@ GLOBAL BOOLEAN IRC_OPER( CLIENT *Client, REQUEST *Req )
} /* IRC_OPER */
GLOBAL BOOLEAN IRC_DIE( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_DIE( CLIENT *Client, REQUEST *Req )
{
assert( Client != NULL );
assert( Req != NULL );
@ -94,7 +101,8 @@ GLOBAL BOOLEAN IRC_DIE( CLIENT *Client, REQUEST *Req )
} /* IRC_DIE */
GLOBAL BOOLEAN IRC_RESTART( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_RESTART( CLIENT *Client, REQUEST *Req )
{
assert( Client != NULL );
assert( Req != NULL );

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-oper.h,v 1.2 2002/03/12 14:37:52 alex Exp $
* $Id: irc-oper.h,v 1.3 2002/05/27 13:09:27 alex Exp $
*
* irc-oper.h: IRC-Operator-Befehle (Header)
*/
@ -18,13 +18,10 @@
#ifndef __irc_oper_h__
#define __irc_oper_h__
#include "parse.h"
#include "client.h"
GLOBAL BOOLEAN IRC_OPER( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_DIE( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_RESTART( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_OPER PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_DIE PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_RESTART PARAMS((CLIENT *Client, REQUEST *Req ));
#endif

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-server.c,v 1.9 2002/04/08 01:20:14 alex Exp $
* $Id: irc-server.c,v 1.10 2002/05/27 13:09:27 alex Exp $
*
* irc-server.c: IRC-Befehle fuer Server-Links
*/
@ -23,16 +23,22 @@
#include <stdlib.h>
#include <string.h>
#include "resolve.h"
#include "conf.h"
#include "conn.h"
#include "client.h"
#include "channel.h"
#include "irc-write.h"
#include "log.h"
#include "messages.h"
#include "parse.h"
#include "exp.h"
#include "irc-server.h"
GLOBAL BOOLEAN IRC_SERVER( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_SERVER( CLIENT *Client, REQUEST *Req )
{
CHAR str[LINE_LEN], *ptr;
CLIENT *from, *c, *cl;
@ -239,7 +245,8 @@ GLOBAL BOOLEAN IRC_SERVER( CLIENT *Client, REQUEST *Req )
} /* IRC_SERVER */
GLOBAL BOOLEAN IRC_NJOIN( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_NJOIN( CLIENT *Client, REQUEST *Req )
{
CHAR *channame, *ptr, modes[8];
BOOLEAN is_op, is_voiced;
@ -302,7 +309,8 @@ GLOBAL BOOLEAN IRC_NJOIN( CLIENT *Client, REQUEST *Req )
} /* IRC_NJOIN */
GLOBAL BOOLEAN IRC_SQUIT( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_SQUIT( CLIENT *Client, REQUEST *Req )
{
CLIENT *target;
CHAR msg[LINE_LEN + 64];

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-server.h,v 1.2 2002/03/12 14:37:52 alex Exp $
* $Id: irc-server.h,v 1.3 2002/05/27 13:09:27 alex Exp $
*
* irc-server.h: IRC-Befehle fuer Server-Links (Header)
*/
@ -18,13 +18,10 @@
#ifndef __irc_server_h__
#define __irc_server_h__
#include "parse.h"
#include "client.h"
GLOBAL BOOLEAN IRC_SERVER( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_NJOIN( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_SQUIT( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_SERVER PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_NJOIN PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_SQUIT PARAMS((CLIENT *Client, REQUEST *Req ));
#endif

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-write.c,v 1.3 2002/03/25 17:13:07 alex Exp $
* $Id: irc-write.c,v 1.4 2002/05/27 13:09:27 alex Exp $
*
* irc-write.c: IRC-Texte und Befehle ueber Netzwerk versenden
*/
@ -22,16 +22,20 @@
#include <stdarg.h>
#include <stdio.h>
#include "conn.h"
#include "client.h"
#include "channel.h"
#include "defines.h"
#include "exp.h"
#include "irc-write.h"
LOCAL CHAR *Get_Prefix( CLIENT *Target, CLIENT *Client );
LOCAL CHAR *Get_Prefix PARAMS(( CLIENT *Target, CLIENT *Client ));
GLOBAL BOOLEAN IRC_WriteStrClient( CLIENT *Client, CHAR *Format, ... )
GLOBAL BOOLEAN
IRC_WriteStrClient( CLIENT *Client, CHAR *Format, ... )
{
CHAR buffer[1000];
BOOLEAN ok = CONNECTED;
@ -51,7 +55,8 @@ GLOBAL BOOLEAN IRC_WriteStrClient( CLIENT *Client, CHAR *Format, ... )
} /* IRC_WriteStrClient */
GLOBAL BOOLEAN IRC_WriteStrClientPrefix( CLIENT *Client, CLIENT *Prefix, CHAR *Format, ... )
GLOBAL BOOLEAN
IRC_WriteStrClientPrefix( CLIENT *Client, CLIENT *Prefix, CHAR *Format, ... )
{
/* Text an Clients, lokal bzw. remote, senden. */
@ -70,7 +75,8 @@ GLOBAL BOOLEAN IRC_WriteStrClientPrefix( CLIENT *Client, CLIENT *Prefix, CHAR *F
} /* IRC_WriteStrClientPrefix */
GLOBAL BOOLEAN IRC_WriteStrChannel( CLIENT *Client, CHANNEL *Chan, BOOLEAN Remote, CHAR *Format, ... )
GLOBAL BOOLEAN
IRC_WriteStrChannel( CLIENT *Client, CHANNEL *Chan, BOOLEAN Remote, CHAR *Format, ... )
{
CHAR buffer[1000];
va_list ap;
@ -86,7 +92,8 @@ GLOBAL BOOLEAN IRC_WriteStrChannel( CLIENT *Client, CHANNEL *Chan, BOOLEAN Remot
} /* IRC_WriteStrChannel */
GLOBAL BOOLEAN IRC_WriteStrChannelPrefix( CLIENT *Client, CHANNEL *Chan, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... )
GLOBAL BOOLEAN
IRC_WriteStrChannelPrefix( CLIENT *Client, CHANNEL *Chan, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... )
{
BOOLEAN sock[MAX_CONNECTIONS], is_server[MAX_CONNECTIONS], ok = CONNECTED;
CHAR buffer[1000];
@ -146,7 +153,8 @@ GLOBAL BOOLEAN IRC_WriteStrChannelPrefix( CLIENT *Client, CHANNEL *Chan, CLIENT
} /* IRC_WriteStrChannelPrefix */
GLOBAL VOID IRC_WriteStrServers( CLIENT *ExceptOf, CHAR *Format, ... )
GLOBAL VOID
IRC_WriteStrServers( CLIENT *ExceptOf, CHAR *Format, ... )
{
CHAR buffer[1000];
va_list ap;
@ -162,7 +170,8 @@ GLOBAL VOID IRC_WriteStrServers( CLIENT *ExceptOf, CHAR *Format, ... )
} /* IRC_WriteStrServers */
GLOBAL VOID IRC_WriteStrServersPrefix( CLIENT *ExceptOf, CLIENT *Prefix, CHAR *Format, ... )
GLOBAL VOID
IRC_WriteStrServersPrefix( CLIENT *ExceptOf, CLIENT *Prefix, CHAR *Format, ... )
{
CHAR buffer[1000];
CLIENT *c;
@ -188,7 +197,8 @@ GLOBAL VOID IRC_WriteStrServersPrefix( CLIENT *ExceptOf, CLIENT *Prefix, CHAR *F
} /* IRC_WriteStrServersPrefix */
GLOBAL BOOLEAN IRC_WriteStrRelatedPrefix( CLIENT *Client, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... )
GLOBAL BOOLEAN
IRC_WriteStrRelatedPrefix( CLIENT *Client, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... )
{
BOOLEAN sock[MAX_CONNECTIONS], is_server[MAX_CONNECTIONS], ok = CONNECTED;
CL2CHAN *chan_cl2chan, *cl2chan;
@ -258,7 +268,8 @@ GLOBAL BOOLEAN IRC_WriteStrRelatedPrefix( CLIENT *Client, CLIENT *Prefix, BOOLEA
} /* IRC_WriteStrRelatedPrefix */
LOCAL CHAR *Get_Prefix( CLIENT *Target, CLIENT *Client )
LOCAL CHAR *
Get_Prefix( CLIENT *Target, CLIENT *Client )
{
assert( Target != NULL );
assert( Client != NULL );

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc-write.h,v 1.2 2002/03/12 14:37:52 alex Exp $
* $Id: irc-write.h,v 1.3 2002/05/27 13:09:27 alex Exp $
*
* irc-write.h: IRC-Texte und Befehle ueber Netzwerk versenden (Header)
*/
@ -18,19 +18,17 @@
#ifndef __irc_write_h__
#define __irc_write_h__
#include "channel.h"
GLOBAL BOOLEAN IRC_WriteStrClient PARAMS((CLIENT *Client, CHAR *Format, ... ));
GLOBAL BOOLEAN IRC_WriteStrClientPrefix PARAMS((CLIENT *Client, CLIENT *Prefix, CHAR *Format, ... ));
GLOBAL BOOLEAN IRC_WriteStrClient( CLIENT *Client, CHAR *Format, ... );
GLOBAL BOOLEAN IRC_WriteStrClientPrefix( CLIENT *Client, CLIENT *Prefix, CHAR *Format, ... );
GLOBAL BOOLEAN IRC_WriteStrChannel PARAMS((CLIENT *Client, CHANNEL *Chan, BOOLEAN Remote, CHAR *Format, ... ));
GLOBAL BOOLEAN IRC_WriteStrChannelPrefix PARAMS((CLIENT *Client, CHANNEL *Chan, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... ));
GLOBAL BOOLEAN IRC_WriteStrChannel( CLIENT *Client, CHANNEL *Chan, BOOLEAN Remote, CHAR *Format, ... );
GLOBAL BOOLEAN IRC_WriteStrChannelPrefix( CLIENT *Client, CHANNEL *Chan, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... );
GLOBAL VOID IRC_WriteStrServers PARAMS((CLIENT *ExceptOf, CHAR *Format, ... ));
GLOBAL VOID IRC_WriteStrServersPrefix PARAMS((CLIENT *ExceptOf, CLIENT *Prefix, CHAR *Format, ... ));
GLOBAL VOID IRC_WriteStrServers( CLIENT *ExceptOf, CHAR *Format, ... );
GLOBAL VOID IRC_WriteStrServersPrefix( CLIENT *ExceptOf, CLIENT *Prefix, CHAR *Format, ... );
GLOBAL BOOLEAN IRC_WriteStrRelatedPrefix( CLIENT *Client, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... );
GLOBAL BOOLEAN IRC_WriteStrRelatedPrefix PARAMS((CLIENT *Client, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... ));
#endif

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc.c,v 1.89 2002/03/25 17:04:02 alex Exp $
* $Id: irc.c,v 1.90 2002/05/27 13:09:27 alex Exp $
*
* irc.c: IRC-Befehle
*/
@ -25,20 +25,24 @@
#include <string.h>
#include "ngircd.h"
#include "channel.h"
#include "conn.h"
#include "client.h"
#include "channel.h"
#include "resolve.h"
#include "conf.h"
#include "conn.h"
#include "irc-write.h"
#include "log.h"
#include "messages.h"
#include "parse.h"
#include "tool.h"
#include "exp.h"
#include "irc.h"
GLOBAL BOOLEAN IRC_MOTD( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_MOTD( CLIENT *Client, REQUEST *Req )
{
assert( Client != NULL );
assert( Req != NULL );
@ -52,7 +56,8 @@ GLOBAL BOOLEAN IRC_MOTD( CLIENT *Client, REQUEST *Req )
} /* IRC_MOTD */
GLOBAL BOOLEAN IRC_PRIVMSG( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_PRIVMSG( CLIENT *Client, REQUEST *Req )
{
CLIENT *cl, *from;
CHANNEL *chan;
@ -93,7 +98,8 @@ GLOBAL BOOLEAN IRC_PRIVMSG( CLIENT *Client, REQUEST *Req )
} /* IRC_PRIVMSG */
GLOBAL BOOLEAN IRC_NOTICE( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_NOTICE( CLIENT *Client, REQUEST *Req )
{
CLIENT *to, *from;
@ -119,7 +125,8 @@ GLOBAL BOOLEAN IRC_NOTICE( CLIENT *Client, REQUEST *Req )
} /* IRC_NOTICE */
GLOBAL BOOLEAN IRC_NAMES( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_NAMES( CLIENT *Client, REQUEST *Req )
{
CHAR rpl[COMMAND_LEN], *ptr;
CLIENT *target, *from, *c;
@ -214,7 +221,8 @@ GLOBAL BOOLEAN IRC_NAMES( CLIENT *Client, REQUEST *Req )
} /* IRC_NAMES */
GLOBAL BOOLEAN IRC_ISON( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_ISON( CLIENT *Client, REQUEST *Req )
{
CHAR rpl[COMMAND_LEN];
CLIENT *c;
@ -252,7 +260,8 @@ GLOBAL BOOLEAN IRC_ISON( CLIENT *Client, REQUEST *Req )
} /* IRC_ISON */
GLOBAL BOOLEAN IRC_WHOIS( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_WHOIS( CLIENT *Client, REQUEST *Req )
{
CLIENT *from, *target, *c;
CHAR str[LINE_LEN + 1], *ptr = NULL;
@ -349,7 +358,8 @@ GLOBAL BOOLEAN IRC_WHOIS( CLIENT *Client, REQUEST *Req )
} /* IRC_WHOIS */
GLOBAL BOOLEAN IRC_WHO( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_WHO( CLIENT *Client, REQUEST *Req )
{
BOOLEAN ok, only_ops;
CHAR flags[8], *ptr;
@ -426,7 +436,8 @@ GLOBAL BOOLEAN IRC_WHO( CLIENT *Client, REQUEST *Req )
} /* IRC_WHO */
GLOBAL BOOLEAN IRC_USERHOST( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_USERHOST( CLIENT *Client, REQUEST *Req )
{
CHAR rpl[COMMAND_LEN];
CLIENT *c;
@ -467,7 +478,8 @@ GLOBAL BOOLEAN IRC_USERHOST( CLIENT *Client, REQUEST *Req )
} /* IRC_USERHOST */
GLOBAL BOOLEAN IRC_ERROR( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_ERROR( CLIENT *Client, REQUEST *Req )
{
assert( Client != NULL );
assert( Req != NULL );
@ -479,7 +491,8 @@ GLOBAL BOOLEAN IRC_ERROR( CLIENT *Client, REQUEST *Req )
} /* IRC_ERROR */
GLOBAL BOOLEAN IRC_LUSERS( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_LUSERS( CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *from;
@ -515,7 +528,8 @@ GLOBAL BOOLEAN IRC_LUSERS( CLIENT *Client, REQUEST *Req )
} /* IRC_LUSERS */
GLOBAL BOOLEAN IRC_LINKS( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_LINKS( CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *from, *c;
CHAR *mask;
@ -564,7 +578,8 @@ GLOBAL BOOLEAN IRC_LINKS( CLIENT *Client, REQUEST *Req )
} /* IRC_LINKS */
GLOBAL BOOLEAN IRC_VERSION( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_VERSION( CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *prefix;
@ -598,7 +613,8 @@ GLOBAL BOOLEAN IRC_VERSION( CLIENT *Client, REQUEST *Req )
} /* IRC_VERSION */
GLOBAL BOOLEAN IRC_KILL( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_KILL( CLIENT *Client, REQUEST *Req )
{
CLIENT *prefix, *c;
@ -630,7 +646,8 @@ GLOBAL BOOLEAN IRC_KILL( CLIENT *Client, REQUEST *Req )
} /* IRC_KILL */
GLOBAL BOOLEAN IRC_Show_MOTD( CLIENT *Client )
GLOBAL BOOLEAN
IRC_Show_MOTD( CLIENT *Client )
{
BOOLEAN ok;
CHAR line[127];
@ -664,7 +681,8 @@ GLOBAL BOOLEAN IRC_Show_MOTD( CLIENT *Client )
} /* IRC_Show_MOTD */
GLOBAL BOOLEAN IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan )
GLOBAL BOOLEAN
IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan )
{
BOOLEAN is_visible, is_member;
CHAR str[LINE_LEN + 1];
@ -716,7 +734,8 @@ GLOBAL BOOLEAN IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan )
} /* IRC_Send_NAMES */
GLOBAL BOOLEAN IRC_Send_WHO( CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps )
GLOBAL BOOLEAN
IRC_Send_WHO( CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps )
{
BOOLEAN is_visible, is_member;
CL2CHAN *cl2chan;
@ -760,7 +779,8 @@ GLOBAL BOOLEAN IRC_Send_WHO( CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps )
} /* IRC_Send_WHO */
GLOBAL BOOLEAN IRC_Send_LUSERS( CLIENT *Client )
GLOBAL BOOLEAN
IRC_Send_LUSERS( CLIENT *Client )
{
INT cnt;

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: irc.h,v 1.30 2002/03/12 14:37:52 alex Exp $
* $Id: irc.h,v 1.31 2002/05/27 13:09:27 alex Exp $
*
* irc.h: IRC-Befehle (Header)
*/
@ -18,32 +18,28 @@
#ifndef __irc_h__
#define __irc_h__
#include "parse.h"
#include "client.h"
#include "channel.h"
GLOBAL BOOLEAN IRC_MOTD PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_LUSERS PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_LINKS PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_VERSION PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_MOTD( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_LUSERS( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_LINKS( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_VERSION( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_PRIVMSG PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_NOTICE PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_PRIVMSG( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_NOTICE( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_NAMES PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_ISON PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_WHOIS PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_USERHOST PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_WHO PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_NAMES( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_ISON( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_WHOIS( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_USERHOST( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_WHO( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_ERROR PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_KILL PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_ERROR( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_KILL( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan );
GLOBAL BOOLEAN IRC_Send_LUSERS( CLIENT *Client );
GLOBAL BOOLEAN IRC_Show_MOTD( CLIENT *Client );
GLOBAL BOOLEAN IRC_Send_WHO( CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps );
GLOBAL BOOLEAN IRC_Send_NAMES PARAMS((CLIENT *Client, CHANNEL *Chan ));
GLOBAL BOOLEAN IRC_Send_LUSERS PARAMS((CLIENT *Client ));
GLOBAL BOOLEAN IRC_Show_MOTD PARAMS((CLIENT *Client ));
GLOBAL BOOLEAN IRC_Send_WHO PARAMS((CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps ));
#endif

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: log.c,v 1.32 2002/03/31 16:46:15 alex Exp $
* $Id: log.c,v 1.33 2002/05/27 13:09:27 alex Exp $
*
* log.c: Logging-Funktionen
*/
@ -31,8 +31,10 @@
#endif
#include "ngircd.h"
#include "client.h"
#include "defines.h"
#include "conn.h"
#include "client.h"
#include "channel.h"
#include "irc-write.h"
#include "exp.h"
@ -43,10 +45,11 @@ LOCAL CHAR Error_File[FNAME_LEN];
LOCAL CHAR Init_Txt[127];
LOCAL VOID Wall_ServerNotice( CHAR *Msg );
LOCAL VOID Wall_ServerNotice PARAMS(( CHAR *Msg ));
GLOBAL VOID Log_Init( VOID )
GLOBAL VOID
Log_Init( VOID )
{
#ifdef USE_SYSLOG
/* Syslog initialisieren */
@ -86,7 +89,8 @@ GLOBAL VOID Log_Init( VOID )
} /* Log_Init */
GLOBAL VOID Log_InitErrorfile( VOID )
GLOBAL VOID
Log_InitErrorfile( VOID )
{
/* "Error-Log" initialisieren: stderr in Datei umlenken. Dort
* landen z.B. alle Ausgaben von assert()-Aufrufen. */
@ -112,7 +116,8 @@ GLOBAL VOID Log_InitErrorfile( VOID )
} /* Log_InitErrfile */
GLOBAL VOID Log_Exit( VOID )
GLOBAL VOID
Log_Exit( VOID )
{
/* Good Bye! */
Log( LOG_NOTICE, PACKAGE" done.");
@ -127,7 +132,8 @@ GLOBAL VOID Log_Exit( VOID )
} /* Log_Exit */
GLOBAL VOID Log( INT Level, CONST CHAR *Format, ... )
GLOBAL VOID
Log( INT Level, CONST CHAR *Format, ... )
{
/* Eintrag in Logfile(s) schreiben */
@ -182,7 +188,8 @@ GLOBAL VOID Log( INT Level, CONST CHAR *Format, ... )
} /* Log */
GLOBAL VOID Log_Init_Resolver( VOID )
GLOBAL VOID
Log_Init_Resolver( VOID )
{
#ifdef USE_SYSLOG
openlog( PACKAGE, LOG_CONS|LOG_PID, LOG_LOCAL5 );
@ -190,7 +197,8 @@ GLOBAL VOID Log_Init_Resolver( VOID )
} /* Log_Init_Resolver */
GLOBAL VOID Log_Exit_Resolver( VOID )
GLOBAL VOID
Log_Exit_Resolver( VOID )
{
#ifdef USE_SYSLOG
closelog( );
@ -198,7 +206,8 @@ GLOBAL VOID Log_Exit_Resolver( VOID )
} /* Log_Exit_Resolver */
GLOBAL VOID Log_Resolver( CONST INT Level, CONST CHAR *Format, ... )
GLOBAL VOID
Log_Resolver( CONST INT Level, CONST CHAR *Format, ... )
{
/* Eintrag des Resolver in Logfile(s) schreiben */
@ -229,7 +238,8 @@ GLOBAL VOID Log_Resolver( CONST INT Level, CONST CHAR *Format, ... )
} /* Log_Resolver */
LOCAL VOID Wall_ServerNotice( CHAR *Msg )
LOCAL VOID
Wall_ServerNotice( CHAR *Msg )
{
/* Server-Notice an entsprechende User verschicken */

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: log.h,v 1.11 2002/03/29 23:33:42 alex Exp $
* $Id: log.h,v 1.12 2002/05/27 13:09:27 alex Exp $
*
* log.h: Logging-Funktionen (Header)
*/
@ -36,16 +36,16 @@
#define LOG_snotice 1024
GLOBAL VOID Log_Init( VOID );
GLOBAL VOID Log_Exit( VOID );
GLOBAL VOID Log_Init PARAMS((VOID ));
GLOBAL VOID Log_Exit PARAMS((VOID ));
GLOBAL VOID Log_InitErrorfile( VOID );
GLOBAL VOID Log( INT Level, CONST CHAR *Format, ... );
GLOBAL VOID Log_InitErrorfile PARAMS((VOID ));
GLOBAL VOID Log PARAMS((INT Level, CONST CHAR *Format, ... ));
GLOBAL VOID Log_Init_Resolver( VOID );
GLOBAL VOID Log_Exit_Resolver( VOID );
GLOBAL VOID Log_Init_Resolver PARAMS((VOID ));
GLOBAL VOID Log_Exit_Resolver PARAMS((VOID ));
GLOBAL VOID Log_Resolver( CONST INT Level, CONST CHAR *Format, ... );
GLOBAL VOID Log_Resolver PARAMS((CONST INT Level, CONST CHAR *Format, ... ));
#endif

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: ngircd.h,v 1.12 2002/03/27 16:40:31 alex Exp $
* $Id: ngircd.h,v 1.13 2002/05/27 13:09:27 alex Exp $
*
* ngircd.h: Prototypen aus dem "Haupt-Modul"
*/
@ -45,8 +45,8 @@ GLOBAL CHAR NGIRCd_DebugLevel[2]; /* Debug-Level fuer IRC_VERSION() */
GLOBAL CHAR NGIRCd_ConfFile[FNAME_LEN]; /* Konfigurationsdatei */
GLOBAL CHAR *NGIRCd_Version( VOID );
GLOBAL CHAR *NGIRCd_VersionAddition( VOID );
GLOBAL CHAR *NGIRCd_Version PARAMS((VOID ));
GLOBAL CHAR *NGIRCd_VersionAddition PARAMS((VOID ));
#endif

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: parse.c,v 1.32 2002/04/23 19:50:27 alex Exp $
* $Id: parse.c,v 1.33 2002/05/27 13:09:27 alex Exp $
*
* parse.c: Parsen der Client-Anfragen
*/
@ -24,16 +24,10 @@
#include <string.h>
#include "ngircd.h"
#include "client.h"
#include "conn.h"
#include "defines.h"
#include "irc.h"
#include "irc-channel.h"
#include "irc-login.h"
#include "irc-mode.h"
#include "irc-oper.h"
#include "irc-server.h"
#include "irc-write.h"
#include "conn.h"
#include "client.h"
#include "channel.h"
#include "log.h"
#include "messages.h"
#include "tool.h"
@ -41,19 +35,32 @@
#include "exp.h"
#include "parse.h"
#include "imp.h"
#include "irc.h"
#include "irc-channel.h"
#include "irc-login.h"
#include "irc-mode.h"
#include "irc-op.h"
#include "irc-oper.h"
#include "irc-server.h"
#include "irc-write.h"
LOCAL VOID Init_Request( REQUEST *Req );
LOCAL BOOLEAN Parse_Error( CONN_ID Idx, CHAR *Error );
LOCAL BOOLEAN Validate_Prefix( REQUEST *Req );
LOCAL BOOLEAN Validate_Command( REQUEST *Req );
LOCAL BOOLEAN Validate_Args( REQUEST *Req );
LOCAL BOOLEAN Handle_Request( CONN_ID Idx, REQUEST *Req );
#include "exp.h"
GLOBAL BOOLEAN Parse_Request( CONN_ID Idx, CHAR *Request )
LOCAL VOID Init_Request PARAMS(( REQUEST *Req ));
LOCAL BOOLEAN Parse_Error PARAMS(( CONN_ID Idx, CHAR *Error ));
LOCAL BOOLEAN Validate_Prefix PARAMS(( REQUEST *Req ));
LOCAL BOOLEAN Validate_Command PARAMS(( REQUEST *Req ));
LOCAL BOOLEAN Validate_Args PARAMS(( REQUEST *Req ));
LOCAL BOOLEAN Handle_Request PARAMS(( CONN_ID Idx, REQUEST *Req ));
GLOBAL BOOLEAN
Parse_Request( CONN_ID Idx, CHAR *Request )
{
/* Client-Request parsen. Bei einem schwerwiegenden Fehler wird
* die Verbindung geschlossen und FALSE geliefert.
@ -152,7 +159,8 @@ GLOBAL BOOLEAN Parse_Request( CONN_ID Idx, CHAR *Request )
} /* Parse_Request */
LOCAL VOID Init_Request( REQUEST *Req )
LOCAL VOID
Init_Request( REQUEST *Req )
{
/* Neue Request-Struktur initialisieren */
@ -167,7 +175,8 @@ LOCAL VOID Init_Request( REQUEST *Req )
} /* Init_Request */
LOCAL BOOLEAN Parse_Error( CONN_ID Idx, CHAR *Error )
LOCAL BOOLEAN
Parse_Error( CONN_ID Idx, CHAR *Error )
{
/* Fehler beim Parsen. Fehlermeldung an den Client schicken.
* TRUE: Connection wurde durch diese Funktion nicht geschlossen,
@ -181,28 +190,32 @@ LOCAL BOOLEAN Parse_Error( CONN_ID Idx, CHAR *Error )
} /* Parse_Error */
LOCAL BOOLEAN Validate_Prefix( REQUEST *Req )
LOCAL BOOLEAN
Validate_Prefix( REQUEST *Req )
{
assert( Req != NULL );
return TRUE;
} /* Validate_Prefix */
LOCAL BOOLEAN Validate_Command( REQUEST *Req )
LOCAL BOOLEAN
Validate_Command( REQUEST *Req )
{
assert( Req != NULL );
return TRUE;
} /* Validate_Comman */
LOCAL BOOLEAN Validate_Args( REQUEST *Req )
LOCAL BOOLEAN
Validate_Args( REQUEST *Req )
{
assert( Req != NULL );
return TRUE;
} /* Validate_Args */
LOCAL BOOLEAN Handle_Request( CONN_ID Idx, REQUEST *Req )
LOCAL BOOLEAN
Handle_Request( CONN_ID Idx, REQUEST *Req )
{
/* Client-Request verarbeiten. Bei einem schwerwiegenden Fehler
* wird die Verbindung geschlossen und FALSE geliefert. */
@ -293,6 +306,9 @@ LOCAL BOOLEAN Handle_Request( CONN_ID Idx, REQUEST *Req )
else if( strcasecmp( Req->command, "TOPIC" ) == 0 ) return IRC_TOPIC( client, Req );
else if( strcasecmp( Req->command, "WHO" ) == 0 ) return IRC_WHO( client, Req );
else if( strcasecmp( Req->command, "LIST" ) == 0 ) return IRC_LIST( client, Req );
else if( strcasecmp( Req->command, "INVITE" ) == 0 ) return IRC_INVITE( client, Req );
else if( strcasecmp( Req->command, "KICK" ) == 0 ) return IRC_KICK( client, Req );
else if( strcasecmp( Req->command, "BAN" ) == 0 ) return IRC_BAN( client, Req );
/* Unbekannter Befehl */
if( Client_Type( client ) != CLIENT_SERVER ) IRC_WriteStrClient( client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( client ), Req->command );

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: parse.h,v 1.6 2002/03/12 14:37:52 alex Exp $
* $Id: parse.h,v 1.7 2002/05/27 13:09:27 alex Exp $
*
* parse.h: Parsen der Client-Anfragen (Header)
*/
@ -18,8 +18,6 @@
#ifndef __parse_h__
#define __parse_h__
#include "conn.h"
typedef struct _REQUEST /* vgl. RFC 2812, 2.3 */
{
@ -30,7 +28,7 @@ typedef struct _REQUEST /* vgl. RFC 2812, 2.3 */
} REQUEST;
GLOBAL BOOLEAN Parse_Request( CONN_ID Idx, CHAR *Request );
GLOBAL BOOLEAN Parse_Request PARAMS((CONN_ID Idx, CHAR *Request ));
#endif

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: tool.c,v 1.8 2002/03/22 00:17:27 alex Exp $
* $Id: tool.c,v 1.9 2002/05/27 13:09:27 alex Exp $
*
* tool.c: Hilfsfunktionen, ggf. Platformabhaengig
*/
@ -27,7 +27,8 @@
#include "tool.h"
GLOBAL VOID ngt_TrimStr( CHAR *String )
GLOBAL VOID
ngt_TrimStr( CHAR *String )
{
/* Mit ngt_TrimStr() werden fuehrende und folgende Leerzeichen,
* Tabulatoren und Zeilenumbrueche (ASCII 10 und ASCII 13) aus
@ -51,7 +52,8 @@ GLOBAL VOID ngt_TrimStr( CHAR *String )
} /* ngt_TrimStr */
GLOBAL CHAR *ngt_LowerStr( CHAR *String )
GLOBAL CHAR *
ngt_LowerStr( CHAR *String )
{
/* String in Kleinbuchstaben konvertieren. Der uebergebene
* Speicherbereich wird durch das Ergebnis ersetzt, zusaetzlich

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: tool.h,v 1.7 2002/03/22 00:17:27 alex Exp $
* $Id: tool.h,v 1.8 2002/05/27 13:09:27 alex Exp $
*
* log.h: Hilfsfunktionen (Header)
*/
@ -19,9 +19,9 @@
#define __tool_h__
GLOBAL VOID ngt_TrimStr( CHAR *String );
GLOBAL VOID ngt_TrimStr PARAMS((CHAR *String ));
GLOBAL CHAR *ngt_LowerStr( CHAR *String );
GLOBAL CHAR *ngt_LowerStr PARAMS((CHAR *String ));
#endif