]> jfr.im git - irc/quakenet/snircd.git/blame - include/list.h
seems snircd also needs gline_resend updated - it was using ircu .12 gline format...
[irc/quakenet/snircd.git] / include / list.h
CommitLineData
189935b1 1/** @file list.h
2 * @brief Singly and doubly linked list manipulation interface.
3 * @version $Id: list.h,v 1.12 2005/05/30 21:07:33 entrope Exp $
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
12struct Client;
13struct Connection;
14struct Channel;
15struct ConfItem;
16
17/*
18 * Structures
19 */
20
21/** Node in a singly linked list. */
22struct 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 } value; /**< Value of list element. */
30 unsigned int flags; /**< Modifier flags for list element. */
31};
32
33/** Node in a doubly linked list. */
34struct DLink {
35 struct DLink* next; /**< Next element in list. */
36 struct DLink* prev; /**< Previous element in list. */
37 union {
38 struct Client* cptr; /**< List element as a client. */
39 struct Channel* chptr; /**< List element as a channel. */
40 char* ch; /**< List element as a string. */
41 } value; /**< Value of list element. */
42};
43
44/*
45 * Proto types
46 */
47
48extern void free_link(struct SLink *lp);
49extern struct SLink *make_link(void);
50extern void init_list(void);
51extern struct Client *make_client(struct Client *from, int status);
52extern void free_connection(struct Connection *con);
53extern void free_client(struct Client *cptr);
54extern struct Server *make_server(struct Client *cptr);
55extern void remove_client_from_list(struct Client *cptr);
56extern void add_client_to_list(struct Client *cptr);
57extern struct DLink *add_dlink(struct DLink **lpp, struct Client *cp);
58extern void remove_dlink(struct DLink **lpp, struct DLink *lp);
59extern struct ConfItem *make_conf(int type);
60extern void free_conf(struct ConfItem *aconf);
61extern void send_listinfo(struct Client *cptr, char *name);
62
63#endif /* INCLUDED_list_h */