jabberd2  2.2.17
xdata.h
Go to the documentation of this file.
1 /*
2  * jabberd - Jabber Open Source Server
3  * Copyright (c) 2002-2003 Jeremie Miller, Thomas Muldowney,
4  * Ryan Eatmon, Robert Norris
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
19  */
20 
21 /* prototypes for xdata */
22 
23 #ifndef INCL_XDATA_H
24 #define INCL_XDATA_H
25 
26 #include "util.h"
27 
28 typedef struct _xdata_st *xdata_t;
31 typedef struct _xdata_item_st *xdata_item_t;
32 
33 typedef enum {
39 } xdata_type_t;
40 
41 struct _xdata_st {
43 
45 
46  char *title;
47  char *instructions;
48 
49  xdata_field_t fields, flast;
50  xdata_field_t rfields, rflast; /* reported fields */
51 
52  xdata_item_t items, ilast;
53 };
54 
55 typedef enum {
68 
71 
73 
74  char *var;
75 
76  char *label;
77 
78  char *desc;
79 
80  int required;
81 
82  char **values;
83  int nvalues;
84 
85  xdata_option_t options, olast;
86 
87  xdata_field_t next;
88 };
89 
92 
93  char *label;
94  char *value;
95 
96  xdata_option_t next;
97 };
98 
101 
102  xdata_field_t fields, flast;
103 
104  xdata_item_t next;
105 };
106 
108 JABBERD2_API xdata_t xdata_new(xdata_type_t type, char *title, char *instructions);
109 JABBERD2_API xdata_t xdata_parse(nad_t nad, int root);
110 
112 JABBERD2_API xdata_field_t xdata_field_new(xdata_t xd, xdata_field_type_t type, char *var, char *label, char *desc, int required);
113 
115 JABBERD2_API xdata_item_t xdata_item_new(xdata_t xd);
116 
118 JABBERD2_API void xdata_add_field(xdata_t xd, xdata_field_t xdf);
119 JABBERD2_API void xdata_add_rfield(xdata_t xd, xdata_field_t xdf);
120 JABBERD2_API void xdata_add_field_item(xdata_item_t item, xdata_field_t xdf);
121 
123 JABBERD2_API void xdata_add_item(xdata_t xd, xdata_item_t xdi);
124 
126 JABBERD2_API void xdata_add_option(xdata_field_t xdf, char *value, int lvalue, char *label, int llabel);
127 
129 JABBERD2_API void xdata_add_value(xdata_field_t xdf, char *value, int vlen);
130 
131 #endif