#ifndef NG_IPADDR_HDR
#define NG_IPADDR_HDR
+
#include "portab.h"
/**
#define REMOVE_QUIT 1
#define REMOVE_KICK 2
-
static CHANNEL *My_Channels;
static CL2CHAN *My_Cl2Chan;
-
static CL2CHAN *Get_Cl2Chan PARAMS(( CHANNEL *Chan, CLIENT *Client ));
static CL2CHAN *Add_Client PARAMS(( CHANNEL *Chan, CLIENT *Client ));
static bool Remove_Client PARAMS(( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, const char *Reason, bool InformServer ));
char *Convert_Message PARAMS((iconv_t Handle, char *Message));
-
/**
* Set client character encoding on a connection.
*
return Encoding_Buffer;
}
-#endif
+#endif /* ICONV */
/**
* Convert encoding of a message received from a connection.
#include "exp.h"
#include "conn-func.h"
-
/**
* Update "idle timestamp", the time of the last visible user action
* (e. g. like sending messages, joining or leaving channels).
return time( NULL ) - My_Connections[Idx].lastprivmsg;
} /* Conn_GetIdle */
-
GLOBAL time_t
Conn_LastPing( CONN_ID Idx )
{
return My_Connections[Idx].lastping;
} /* Conn_LastPing */
-
/**
* Add "penalty time" for a connection.
*
#endif
} /* Conn_SetPenalty */
-
GLOBAL void
Conn_ClearFlags( void )
{
for( i = 0; i < Pool_Size; i++ ) My_Connections[i].flag = 0;
} /* Conn_ClearFlags */
-
GLOBAL int
Conn_Flag( CONN_ID Idx )
{
return My_Connections[Idx].flag;
} /* Conn_Flag */
-
GLOBAL void
Conn_SetFlag( CONN_ID Idx, int Flag )
{
My_Connections[Idx].flag = Flag;
} /* Conn_SetFlag */
-
GLOBAL CONN_ID
Conn_First( void )
{
return NONE;
} /* Conn_First */
-
GLOBAL CONN_ID
Conn_Next( CONN_ID Idx )
{
return NONE;
} /* Conn_Next */
-
GLOBAL UINT16
Conn_Options( CONN_ID Idx )
{
return My_Connections[Idx].options;
} /* Conn_Options */
-
/**
* Set connection option.
*/
Conn_OPTION_ADD(&My_Connections[Idx], Option);
} /* Conn_SetOption */
-
/**
* Get the start time of the connection.
* The result is the start time in seconds since 1970-01-01, as reported
return array_bytes(&My_Connections[Idx].wbuf);
} /* Conn_SendQ */
-
/**
* return number of messages sent on this connection so far
*/
return My_Connections[Idx].msg_out;
} /* Conn_SendMsg */
-
/**
* return number of (uncompressed) bytes sent
* on this connection so far
return My_Connections[Idx].bytes_out;
} /* Conn_SendBytes */
-
/**
* return number of bytes pending in read buffer
*/
return array_bytes(&My_Connections[Idx].rbuf);
} /* Conn_RecvQ */
-
/**
* return number of messages received on this connection so far
*/
return My_Connections[Idx].msg_in;
} /* Conn_RecvMsg */
-
/**
* return number of (uncompressed) bytes received on this
* connection so far
return ng_ipaddr_tostr(&My_Connections[Idx].addr);
}
-
GLOBAL void
Conn_ResetWCounter( void )
{
WCounter = 0;
} /* Conn_ResetWCounter */
-
GLOBAL long
Conn_WCounter( void )
{
return WCounter;
} /* Conn_WCounter */
-
/* -eof- */
#define SD_LISTEN_FDS_START 3
-
static bool Handle_Write PARAMS(( CONN_ID Idx ));
static bool Conn_Write PARAMS(( CONN_ID Idx, char *Data, size_t Len ));
static int New_Connection PARAMS(( int Sock, bool IsSSL ));
static int NewListener PARAMS(( const char *listen_addr, UINT16 Port ));
static void Account_Connection PARAMS((void));
-
static array My_Listeners;
static array My_ConnArray;
static size_t NumConnections, NumConnectionsMax, NumConnectionsAccepted;
#include "exp.h"
#include "log.h"
-
static bool Is_Daemon;
#include "defines.h"
#include "tool.h"
-
/*
* The pattern matching functions [Matche(), Matche_After_Star()] are based
* on code of J. Kercheval. Version 1.1 has been released on 1991-03-12 as
* "public domain": <http://c.snippets.org/snip_lister.php?fname=match.c>
*/
-
static int Matche PARAMS(( const char *p, const char *t ));
static int Matche_After_Star PARAMS(( const char *p, const char *t ));
-
#define MATCH_PATTERN 6 /**< bad pattern */
#define MATCH_LITERAL 5 /**< match failure on literal match */
#define MATCH_RANGE 4 /**< match failure on [..] construct */
#define MATCH_END 2 /**< premature end of pattern string */
#define MATCH_VALID 1 /**< valid match */
-
/**
* Match string with pattern.
*
else return false;
} /* Match */
-
/**
* Match string with pattern case-insensitive.
*
return Match(Pattern, ngt_LowerStr(haystack));
} /* MatchCaseInsensitive */
-
/**
* Match string with pattern case-insensitive.
*
return false;
} /* MatchCaseInsensitive */
-
static int
Matche( const char *p, const char *t )
{
else return MATCH_VALID;
} /* Matche */
-
static int
Matche_After_Star( const char *p, const char *t )
{
return match;
} /* Matche_After_Star */
-
/* -eof- */
#include "exp.h"
#include "ngircd.h"
-
static void Show_Version PARAMS(( void ));
static void Show_Help PARAMS(( void ));
return CONNECTED;
} /* Announce_Channel */
-
/**
* Announce new server in the network
* @param Client New server
Client_MyToken(Server), Client_Info(Server));
} /* Announce_Server */
-
#ifdef IRCPLUS
/**
return CONNECTED;
}
-
/**
* Send CHANINFO commands to a new server (inform it about existing channels).
* @param Client New server
#endif /* IRCPLUS */
-
/**
* Handle ENDOFMOTD (376) numeric and login remote server.
* The peer is either an IRC server (no IRC+ protocol), or we got the
return CONNECTED;
} /* IRC_Num_ENDOFMOTD */
-
/**
* Handle ISUPPORT (005) numeric.
*/
return CONNECTED;
} /* IRC_Num_ISUPPORT */
-
/* -eof- */
}
} /* Op_NoPrivileges */
-
/**
* Check that the originator of a request is an IRC operator and allowed
* to administer this server.
return c;
} /* Op_Check */
-
/* -eof- */
# endif
#endif
-
/* datatypes */
#ifndef PROTOTYPES
#undef GLOBAL
#define GLOBAL
-
/* SPLint */
#ifdef S_SPLINT_S
#include "splint.h"
#endif
-
/* target constants */
#ifndef HOST_OS
#define PACKAGE_VERSION VERSION
#endif
-
#endif
-
/* -eof- */
#endif
-
#ifndef HAVE_STRLCPY
GLOBAL size_t
#endif
-
/* -eof- */
dup = malloc(len);
if (dup)
strlcpy(dup, s, len);
+
return dup;
}
#endif
-