Doxyfy list.h and list.c.
[ircu2.10.12-pk.git] / include / list.h
1 /* @file list.h
2  * @brief Singly and doubly linked list manipulation interface.
3  * @version $Id$
4  */
5 #ifndef INCLUDED_list_h
6 #define INCLUDED_list_h
7 #ifndef INCLUDED_sys_types_h
8 #include <sys/types.h>         /* time_t, size_t */
9 #define INCLUDED_sys_types_h
10 #endif
11
12 struct Client;
13 struct Connection;
14 struct Channel;
15 struct ConfItem;
16
17 /*
18  * Structures
19  */
20
21 /** Node in a singly linked list. */
22 struct SLink {
23   struct SLink *next; /**< Next element in list. */
24   union {
25     struct Client *cptr;    /**< List element as a client. */
26     struct Channel *chptr;  /**< List element as a channel. */
27     struct ConfItem *aconf; /**< List element as a configuration item. */
28     char *cp;               /**< List element as a string. */
29     struct {
30       char *banstr;         /**< Ban hostmask. */
31       char *who;            /**< Name of client that set the ban. */
32       time_t when;          /**< Timestamp when ban was added. */
33     } ban;                  /**< List element as a ban. */
34   } value;                  /**< Value of list element. */
35   unsigned int flags;       /**< Modifier flags for list element. */
36 };
37
38 /** Node in a doubly linked list. */
39 struct DLink {
40   struct DLink*  next;      /**< Next element in list. */
41   struct DLink*  prev;      /**< Previous element in list. */
42   union {
43     struct Client*  cptr;   /**< List element as a client. */
44     struct Channel* chptr;  /**< List element as a channel. */
45     char*           ch;     /**< List element as a string. */
46   } value;                  /**< Value of list element. */
47 };
48
49 /*
50  * Proto types
51  */
52
53 extern void free_link(struct SLink *lp);
54 extern struct SLink *make_link(void);
55 extern struct SLink *find_user_link(struct SLink *lp, struct Client *ptr);
56 extern void init_list(void);
57 extern struct Client *make_client(struct Client *from, int status);
58 extern void free_connection(struct Connection *con);
59 extern void free_client(struct Client *cptr);
60 extern struct Server *make_server(struct Client *cptr);
61 extern void remove_client_from_list(struct Client *cptr);
62 extern void add_client_to_list(struct Client *cptr);
63 extern struct DLink *add_dlink(struct DLink **lpp, struct Client *cp);
64 extern void remove_dlink(struct DLink **lpp, struct DLink *lp);
65 extern struct ConfItem *make_conf(void);
66 extern void free_conf(struct ConfItem *aconf);
67 extern void send_listinfo(struct Client *cptr, char *name);
68
69 #endif /* INCLUDED_list_h */