ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/include/metadata.h
Revision: 296
Committed: Mon Dec 5 20:41:51 2005 UTC (20 years, 8 months ago) by nenolod
Content type: text/x-chdr
File size: 1537 byte(s)
Log Message:
- Add a simple metadata API for extending channel/client/whatever structs
  via adding a single dlink_list to the structure you wish to make extensible.

Reviewed by db.

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * metadata.h: header describing the metadata system
4 *
5 * Copyright (C) 2005 by the past and present ircd coders, and others.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 *
22 * $Id$
23 */
24
25 #ifndef METADATA_H_INCLUDED
26 #define METADATA_H_INCLUDED
27
28 #include "stdinc.h" /* EXTERN */
29
30 /*
31 * The metadata structure is a simple structure that defines a key,
32 * and value, the value is a union.
33 */
34 struct Metadata {
35 char *key;
36 union {
37 char *strval;
38 int intval;
39 } u;
40 };
41
42 EXTERN struct Metadata *add_metadata_str(dlink_list *mtable, char *key, char *strval);
43 EXTERN struct Metadata *add_metadata_int(dlink_list *mtable, char *key, int intval);
44 EXTERN struct Metadata *find_metadata(dlink_list *mtable, char *key);
45 EXTERN void destroy_metadata(dlink_list *mtable, char *key);
46
47 #endif