X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=include%2Fstruct.h;h=cd2712c931c8b8897b0b247c70c897ca90a7ccf3;hb=a36ad5e29241b0c89379947b13887cb6930ef3e0;hp=1a18590dcec3bc2edf0936de1a7258a6c8bc5a17;hpb=b70944c4b84fc2b707d0853ddf03975569dac2bd;p=ircu2.10.12-pk.git diff --git a/include/struct.h b/include/struct.h index 1a18590..cd2712c 100644 --- a/include/struct.h +++ b/include/struct.h @@ -18,149 +18,72 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef STRUCT_H -#define STRUCT_H - -#include /* Needed for struct in_addr */ -#include "whowas.h" /* Needed for whowas struct */ - -#ifndef INCLUDED_dbuf_h -#include "dbuf.h" -#endif - - -/*============================================================================= - * General defines +/** @file + * @brief Structure definitions for users and servers. + * @version $Id$ */ +#ifndef INCLUDED_struct_h +#define INCLUDED_struct_h +#ifndef INCLUDED_sys_types_h +#include /* time_t */ +#define INCLUDED_sys_types_h +#endif +#ifndef INCLUDED_ircd_defs_h +#include "ircd_defs.h" /* sizes */ +#endif -#define NICKLEN 9 -#define USERLEN 10 -#define HOSTLEN 63 -#define REALLEN 50 -#define PASSWDLEN 20 -#define BUFSIZE 512 /* WARNING: *DONT* CHANGE THIS!!!! */ -#define MAXTARGETS 20 -#define STARTTARGETS 10 -#define RESERVEDTARGETS 12 - -/*----------------------------------------------------------------------------- - * Macro's - */ - -#define CLIENT_LOCAL_SIZE sizeof(aClient) -#define CLIENT_REMOTE_SIZE offsetof(aClient, count) - -#define MyConnect(x) ((x)->from == (x)) -#define MyUser(x) (MyConnect(x) && IsUser(x)) -#define MyOper(x) (MyConnect(x) && IsOper(x)) -#define Protocol(x) ((x)->serv->prot) +struct DLink; +struct Client; +struct User; +struct Membership; +struct SLink; -/*============================================================================= - * Structures - * - * Only put structures here that are being used in a very large number of - * source files. Other structures go in the header file of there corresponding - * source file, or in the source file itself (when only used in that file). - */ +/** Describes a server on the network. */ +struct Server { + struct Client* up; /**< Server one closer to me */ + struct DLink* down; /**< List with downlink servers */ + struct DLink* updown; /**< own Dlink in up->serv->down struct */ + struct Client** client_list; /**< List with client pointers on this server */ + struct User* user; /**< who activated this connection */ + time_t timestamp; /**< Remotely determined connect try time */ + time_t ghost; /**< Local time at which a new server + caused a Ghost */ + int lag; /**< Approximation of the amount of lag to this server */ + unsigned int clients; /**< Number of clients on the server */ + unsigned short prot; /**< Major protocol */ + unsigned int nn_mask; /**< Number of clients supported by server, minus 1 */ + char nn_capacity[4]; /**< Numeric representation of server capacity */ -struct Client { - struct Client *next, *prev, *hnext; - struct User *user; /* ...defined, if this is a User */ - struct Server *serv; /* ...defined, if this is a server */ - struct Whowas *whowas; /* Pointer to ww struct to be freed on quit */ - char yxx[4]; /* Numeric Nick: YMM if this is a server, - XX0 if this is a user */ - time_t lasttime; /* ...should be only LOCAL clients? --msa */ - time_t firsttime; /* time client was created */ - time_t since; /* last time we parsed something */ - time_t lastnick; /* TimeStamp on nick */ - int marker; /* /who processing marker */ - unsigned int flags; /* client flags */ - struct Client *from; /* == self, if Local Client, *NEVER* NULL! */ - int fd; /* >= 0, for local clients */ - unsigned int hopcount; /* number of servers to this 0 = local */ - short status; /* Client type */ - struct in_addr ip; /* Real ip# - NOT defined for remote servers! */ - char name[HOSTLEN + 1]; /* Unique name of the client, nick or host */ - char username[USERLEN + 1]; /* username here now for auth stuff */ - char info[REALLEN + 1]; /* Free form additional client information */ - /* - * The following fields are allocated only for local clients - * (directly connected to *this* server with a socket. - * The first of them *MUST* be the "count"--it is the field - * to which the allocation is tied to! *Never* refer to - * these fields, if (from != self). - */ - unsigned int count; /* Amount of data in buffer, DON'T PUT - variables ABOVE this one! */ - snomask_t snomask; /* mask for server messages */ - char buffer[BUFSIZE]; /* Incoming message buffer; or the error that - caused this clients socket to be `dead' */ - unsigned short int lastsq; /* # of 2k blocks when sendqueued called last */ - time_t nextnick; /* Next time that a nick change is allowed */ - time_t nexttarget; /* Next time that a target change is allowed */ - unsigned char targets[MAXTARGETS]; /* Hash values of current targets */ - unsigned int cookie; /* Random number the user must PONG */ - struct DBuf sendQ; /* Outgoing message queue--if socket full */ - struct DBuf recvQ; /* Hold for data incoming yet to be parsed */ - unsigned int sendM; /* Statistics: protocol messages send */ - unsigned int sendK; /* Statistics: total k-bytes send */ - unsigned int receiveM; /* Statistics: protocol messages received */ - unsigned int receiveK; /* Statistics: total k-bytes received */ - unsigned short int sendB; /* counters to count upto 1-k lots of bytes */ - unsigned short int receiveB; /* sent and received. */ - struct Client *acpt; /* listening client which we accepted from */ - struct SLink *confs; /* Configuration record associated */ - int authfd; /* fd for rfc931 authentication */ - unsigned short int port; /* and the remote port# too :-) */ - struct hostent *hostp; - struct ListingArgs *listing; -#ifdef pyr - struct timeval lw; -#endif - char sockhost[HOSTLEN + 1]; /* This is the host name from the socket and - after which the connection was accepted. */ - char passwd[PASSWDLEN + 1]; -}; + int asll_rtt; /**< AsLL round-trip time */ + int asll_to; /**< AsLL upstream lag */ + int asll_from; /**< AsLL downstream lag */ + time_t asll_last; /**< Last time we sent or received an AsLL ping */ -struct Server { - struct Server *nexts; - struct Client *up; /* Server one closer to me */ - struct DSlink *down; /* List with downlink servers */ - struct DSlink *updown; /* own Dlink in up->serv->down struct */ - aClient **client_list; /* List with client pointers on this server */ - struct User *user; /* who activated this connection */ - struct ConfItem *nline; /* N-line pointer for this server */ - time_t timestamp; /* Remotely determined connect try time */ - time_t ghost; /* Local time at which a new server - caused a Ghost */ - unsigned short prot; /* Major protocol */ - unsigned short nn_last; /* Last numeric nick for p9 servers only */ - unsigned int nn_mask; /* [Remote] FD_SETSIZE - 1 */ - char nn_capacity[4]; /* numeric representation of server capacity */ -#ifdef LIST_DEBUG - struct Client *bcptr; -#endif - char *last_error_msg; /* Allocated memory with last message receive with an ERROR */ - char by[NICKLEN + 1]; + char *last_error_msg; /**< Allocated memory with last message receive with an ERROR */ + char by[NICKLEN + 1]; /**< Numnick of client who requested the link */ }; +/** Describes a user on the network. */ struct User { - struct User *nextu; - struct Client *server; /* client structure of server */ - struct SLink *channel; /* chain of channel pointer blocks */ - struct SLink *invited; /* chain of invite pointer blocks */ - struct SLink *silence; /* chain of silence pointer blocks */ - char *away; /* pointer to away message */ - time_t last; - unsigned int refcnt; /* Number of times this block is referenced */ - unsigned int joined; /* number of channels joined */ - char username[USERLEN + 1]; - char host[HOSTLEN + 1]; -#ifdef LIST_DEBUG - struct Client *bcptr; -#endif + struct Client* server; /**< client structure of server */ + struct Membership* channel; /**< chain of channel pointer blocks */ + struct SLink* invited; /**< chain of invite pointer blocks */ + struct Ban* silence; /**< chain of silence pointer blocks */ + char* away; /**< pointer to away message */ + time_t last; /**< last time user sent a message */ + unsigned int refcnt; /**< Number of times this block is referenced */ + unsigned int joined; /**< number of channels joined */ + unsigned int invites; /**< Number of channels we've been invited to */ + /** Remote account name. Before registration is complete, this is + * either empty or contains the username from the USER command. + * After registration, that may be prefixed with ~ or it may be + * overwritten with the ident response. + */ + char username[USERLEN + 1]; + char host[HOSTLEN + 1]; /**< displayed hostname */ + char realhost[HOSTLEN + 1]; /**< actual hostname */ + char account[ACCOUNTLEN + 1]; /**< IRC account name */ + time_t acc_create; /**< IRC account timestamp */ }; -#endif /* STRUCT_H */ +#endif /* INCLUDED_struct_h */