X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=include%2Flist.h;h=3d591b635f6a0a65df52d860cc18699ca745896e;hb=a36ad5e29241b0c89379947b13887cb6930ef3e0;hp=ef61f3a88382c37ca60acac51b04084eab57f024;hpb=b70944c4b84fc2b707d0853ddf03975569dac2bd;p=ircu2.10.12-pk.git diff --git a/include/list.h b/include/list.h index ef61f3a..3d591b6 100644 --- a/include/list.h +++ b/include/list.h @@ -1,70 +1,63 @@ -#ifndef LIST_H -#define LIST_H - -/*============================================================================= - * General defines - */ - -/*============================================================================= - * Macro's +/** @file list.h + * @brief Singly and doubly linked list manipulation interface. + * @version $Id$ */ - -/* ============================================================================ +#ifndef INCLUDED_list_h +#define INCLUDED_list_h +#ifndef INCLUDED_sys_types_h +#include /* time_t, size_t */ +#define INCLUDED_sys_types_h +#endif + +struct Client; +struct Connection; +struct Channel; +struct ConfItem; + +/* * Structures */ +/** Node in a singly linked list. */ struct SLink { - struct SLink *next; + struct SLink *next; /**< Next element in list. */ union { - aClient *cptr; - struct Channel *chptr; - struct ConfItem *aconf; - char *cp; - struct { - char *banstr; - char *who; - time_t when; - } ban; - } value; - unsigned int flags; + struct Client *cptr; /**< List element as a client. */ + struct Channel *chptr; /**< List element as a channel. */ + struct ConfItem *aconf; /**< List element as a configuration item. */ + char *cp; /**< List element as a string. */ + } value; /**< Value of list element. */ + unsigned int flags; /**< Modifier flags for list element. */ }; -struct DSlink { - struct DSlink *next; - struct DSlink *prev; +/** Node in a doubly linked list. */ +struct DLink { + struct DLink* next; /**< Next element in list. */ + struct DLink* prev; /**< Previous element in list. */ union { - aClient *cptr; - struct Channel *chptr; - struct ConfItem *aconf; - char *cp; - } value; + struct Client* cptr; /**< List element as a client. */ + struct Channel* chptr; /**< List element as a channel. */ + char* ch; /**< List element as a string. */ + } value; /**< Value of list element. */ }; -/*============================================================================= +/* * Proto types */ -extern void free_link(Link *lp); -extern Link *make_link(void); -extern Link *find_user_link(Link *lp, aClient *ptr); -extern void initlists(void); -extern void outofmemory(void); -extern aClient *make_client(aClient *from, int status); -extern void free_client(aClient *cptr); -extern struct User *make_user(aClient *cptr); -extern struct Server *make_server(aClient *cptr); -extern void free_user(struct User *user, aClient *cptr); -extern void remove_client_from_list(aClient *cptr); -extern void add_client_to_list(aClient *cptr); -extern Dlink *add_dlink(Dlink **lpp, aClient *cp); -extern void remove_dlink(Dlink **lpp, Dlink *lp); -extern struct ConfItem *make_conf(void); -extern void delist_conf(struct ConfItem *aconf); +extern void free_link(struct SLink *lp); +extern struct SLink *make_link(void); +extern void init_list(void); +extern struct Client *make_client(struct Client *from, int status); +extern void free_connection(struct Connection *con); +extern void free_client(struct Client *cptr); +extern struct Server *make_server(struct Client *cptr); +extern void remove_client_from_list(struct Client *cptr); +extern void add_client_to_list(struct Client *cptr); +extern struct DLink *add_dlink(struct DLink **lpp, struct Client *cp); +extern void remove_dlink(struct DLink **lpp, struct DLink *lp); +extern struct ConfItem *make_conf(int type); extern void free_conf(struct ConfItem *aconf); -extern aGline *make_gline(int is_ipmask, char *host, char *reason, char *name, - time_t expire); -extern aGline *find_gline(aClient *cptr, aGline **pgline); -extern void free_gline(aGline *agline, aGline *pgline); -extern void send_listinfo(aClient *cptr, char *name); +extern void send_listinfo(struct Client *cptr, char *name); -#endif /* LIST_H */ +#endif /* INCLUDED_list_h */