Mercurial > pidgin
annotate src/protocols/novell/nmfield.h @ 8696:aebfa2b6af6b
[gaim-migrate @ 9449]
This was the guy that made the change to spellchk.c that Luke
later reverted, right? Sorry Matt
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 18 Apr 2004 05:47:16 +0000 |
parents | 046dd8ef2920 |
children | c7e9687bfd79 |
rev | line source |
---|---|
8675 | 1 /* |
2 * nmfield.h | |
3 * | |
4 * Copyright © 2004 Unpublished Work of Novell, Inc. All Rights Reserved. | |
5 * | |
6 * THIS WORK IS AN UNPUBLISHED WORK OF NOVELL, INC. NO PART OF THIS WORK MAY BE | |
7 * USED, PRACTICED, PERFORMED, COPIED, DISTRIBUTED, REVISED, MODIFIED, | |
8 * TRANSLATED, ABRIDGED, CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, | |
9 * RECAST, TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF NOVELL, | |
10 * INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT AUTHORIZATION COULD SUBJECT | |
11 * THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY. | |
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
12 * |
8675 | 13 * AS BETWEEN [GAIM] AND NOVELL, NOVELL GRANTS [GAIM] THE RIGHT TO REPUBLISH |
14 * THIS WORK UNDER THE GPL (GNU GENERAL PUBLIC LICENSE) WITH ALL RIGHTS AND | |
15 * LICENSES THEREUNDER. IF YOU HAVE RECEIVED THIS WORK DIRECTLY OR INDIRECTLY | |
16 * FROM [GAIM] AS PART OF SUCH A REPUBLICATION, YOU HAVE ALL RIGHTS AND LICENSES | |
17 * GRANTED BY [GAIM] UNDER THE GPL. IN CONNECTION WITH SUCH A REPUBLICATION, IF | |
18 * ANYTHING IN THIS NOTICE CONFLICTS WITH THE TERMS OF THE GPL, SUCH TERMS | |
19 * PREVAIL. | |
20 * | |
21 */ | |
22 | |
23 #ifndef NMFIELD_H | |
24 #define NMFIELD_H | |
25 | |
26 #include <glib.h> | |
27 | |
28 typedef struct NMField_t | |
29 { | |
30 char *tag; /* Field tag */ | |
31 | |
32 guint8 method; /* Method of the field */ | |
33 | |
34 guint8 flags; /* Flags */ | |
35 | |
36 guint8 type; /* Type of value */ | |
37 | |
38 guint32 size; /* Size of value if binary */ | |
39 | |
40 guint32 value; /* Value of field */ | |
41 | |
42 guint32 len; /* Length of the array */ | |
43 | |
44 } NMField; | |
45 | |
46 /* Field types */ | |
47 #define NMFIELD_TYPE_INVALID 0 | |
48 #define NMFIELD_TYPE_NUMBER 1 | |
49 #define NMFIELD_TYPE_BINARY 2 | |
50 #define NMFIELD_TYPE_BYTE 3 | |
51 #define NMFIELD_TYPE_UBYTE 4 | |
52 #define NMFIELD_TYPE_WORD 5 | |
53 #define NMFIELD_TYPE_UWORD 6 | |
54 #define NMFIELD_TYPE_DWORD 7 | |
55 #define NMFIELD_TYPE_UDWORD 8 | |
56 #define NMFIELD_TYPE_ARRAY 9 | |
57 #define NMFIELD_TYPE_UTF8 10 | |
58 #define NMFIELD_TYPE_BOOL 11 | |
59 #define NMFIELD_TYPE_MV 12 | |
60 #define NMFIELD_TYPE_DN 13 | |
61 | |
62 /* Field methods */ | |
63 #define NMFIELD_METHOD_VALID 0 | |
64 #define NMFIELD_METHOD_IGNORE 1 | |
65 #define NMFIELD_METHOD_DELETE 2 | |
66 #define NMFIELD_METHOD_DELETE_ALL 3 | |
67 #define NMFIELD_METHOD_EQUAL 4 | |
68 #define NMFIELD_METHOD_ADD 5 | |
69 #define NMFIELD_METHOD_UPDATE 6 | |
70 #define NMFIELD_METHOD_GTE 10 | |
71 #define NMFIELD_METHOD_LTE 12 | |
72 #define NMFIELD_METHOD_NE 14 | |
73 #define NMFIELD_METHOD_EXIST 15 | |
74 #define NMFIELD_METHOD_NOTEXIST 16 | |
75 #define NMFIELD_METHOD_SEARCH 17 | |
76 #define NMFIELD_METHOD_MATCHBEGIN 19 | |
77 #define NMFIELD_METHOD_MATCHEND 20 | |
78 #define NMFIELD_METHOD_NOT_ARRAY 40 | |
79 #define NMFIELD_METHOD_OR_ARRAY 41 | |
80 #define NMFIELD_METHOD_AND_ARRAY 42 | |
81 | |
82 /* Attribute Names (field tags) */ | |
83 #define NM_A_IP_ADDRESS "nnmIPAddress" | |
84 #define NM_A_PORT "nnmPort" | |
85 #define NM_A_FA_FOLDER "NM_A_FA_FOLDER" | |
86 #define NM_A_FA_CONTACT "NM_A_FA_CONTACT" | |
87 #define NM_A_FA_CONVERSATION "NM_A_FA_CONVERSATION" | |
88 #define NM_A_FA_MESSAGE "NM_A_FA_MESSAGE" | |
89 #define NM_A_FA_CONTACT_LIST "NM_A_FA_CONTACT_LIST" | |
90 #define NM_A_FA_RESULTS "NM_A_FA_RESULTS" | |
91 #define NM_A_FA_INFO_DISPLAY_ARRAY "NM_A_FA_INFO_DISPLAY_ARRAY" | |
92 #define NM_A_FA_USER_DETAILS "NM_A_FA_USER_DETAILS" | |
93 #define NM_A_SZ_OBJECT_ID "NM_A_SZ_OBJECT_ID" | |
94 #define NM_A_SZ_PARENT_ID "NM_A_SZ_PARENT_ID" | |
95 #define NM_A_SZ_SEQUENCE_NUMBER "NM_A_SZ_SEQUENCE_NUMBER" | |
96 #define NM_A_SZ_TYPE "NM_A_SZ_TYPE" | |
97 #define NM_A_SZ_STATUS "NM_A_SZ_STATUS" | |
98 #define NM_A_SZ_STATUS_TEXT "NM_A_SZ_STATUS_TEXT" | |
99 #define NM_A_SZ_DN "NM_A_SZ_DN" | |
100 #define NM_A_SZ_DISPLAY_NAME "NM_A_SZ_DISPLAY_NAME" | |
101 #define NM_A_SZ_USERID "NM_A_SZ_USERID" | |
102 #define NM_A_SZ_CREDENTIALS "NM_A_SZ_CREDENTIALS" | |
103 #define NM_A_SZ_MESSAGE_BODY "NM_A_SZ_MESSAGE_BODY" | |
104 #define NM_A_SZ_MESSAGE_TEXT "NM_A_SZ_MESSAGE_TEXT" | |
105 #define NM_A_UD_MESSAGE_TYPE "NM_A_UD_MESSAGE_TYPE" | |
106 #define NM_A_FA_PARTICIPANTS "NM_A_FA_PARTICIPANTS" | |
107 #define NM_A_FA_INVITES "NM_A_FA_INVITES" | |
108 #define NM_A_FA_EVENT "NM_A_FA_EVENT" | |
109 #define NM_A_UD_COUNT "NM_A_UD_COUNT" | |
110 #define NM_A_UD_DATE "NM_A_UD_DATE" | |
111 #define NM_A_UD_EVENT "NM_A_UD_EVENT" | |
112 #define NM_A_B_NO_CONTACTS "NM_A_B_NO_CONTACTS" | |
113 #define NM_A_B_NO_CUSTOMS "NM_A_B_NO_CUSTOMS" | |
114 #define NM_A_B_NO_PRIVACY "NM_A_B_NO_PRIVACY" | |
115 #define NM_A_UW_STATUS "NM_A_UW_STATUS" | |
116 #define NM_A_UD_OBJECT_ID "NM_A_UD_OBJECT_ID" | |
117 #define NM_A_SZ_TRANSACTION_ID "NM_A_SZ_TRANSACTION_ID" | |
118 #define NM_A_SZ_RESULT_CODE "NM_A_SZ_RESULT_CODE" | |
119 #define NM_A_UD_BUILD "NM_A_UD_BUILD" | |
120 #define NM_A_SZ_AUTH_ATTRIBUTE "NM_A_SZ_AUTH_ATTRIBUTE" | |
121 #define NM_A_UD_KEEPALIVE "NM_A_UD_KEEPALIVE" | |
122 #define NM_A_SZ_USER_AGENT "NM_A_SZ_USER_AGENT" | |
123 | |
124 #define NM_PROTOCOL_VERSION 2 | |
125 | |
126 #define NM_FIELD_TRUE "1" | |
127 #define NM_FIELD_FALSE "0" | |
128 | |
129 /** | |
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
130 * Count the number of fields |
8675 | 131 * |
132 * @param fields Field array | |
133 * | |
134 * @return The number of fields in the array. | |
135 * | |
136 */ | |
137 guint32 nm_count_fields(NMField * fields); | |
138 | |
139 /** | |
140 * Add a field to the field array. NOTE: field array that is passed | |
141 * in may be realloced so you should use the returned field array pointer | |
142 * not the passed in pointer after calling this function. | |
143 * | |
144 * @param fields Field array | |
145 * @param tag Tag for the new field | |
146 * @param size Size of the field value (if type = binary) | |
147 * @param method Field method (see method defines above) | |
148 * @param flags Flags for new field | |
149 * @param value The value of the field | |
150 * @param type The type of the field value | |
151 * | |
152 * @return Pointer to the updated field array | |
153 * | |
154 */ | |
155 NMField *nm_add_field(NMField * fields, char *tag, guint32 size, guint8 method, | |
156 guint8 flags, guint32 value, guint8 type); | |
157 | |
158 /** | |
159 * Recursively free an array of fields and set pointer to NULL. | |
160 * | |
161 * @param fields Pointer to a field array | |
162 * | |
163 */ | |
164 void nm_free_fields(NMField ** fields); | |
165 | |
166 /** | |
167 * Find first field with given tag in field array. | |
168 * | |
169 * Note: this will only work for 7-bit ascii tags (which is all that | |
170 * we use currently). | |
171 * | |
172 * @param tag Tag to search for | |
173 * @param fields Field array | |
174 * | |
175 * @return The first matching field, or NULL if no fields match. | |
176 * | |
177 */ | |
178 NMField *nm_locate_field(char *tag, NMField * fields); | |
179 | |
180 /** | |
181 * Make a deep copy of a field array | |
182 * | |
183 * @param src The array to copy | |
184 * | |
185 * @return The new (copied) array, which must be freed. | |
186 * | |
187 */ | |
188 NMField *nm_copy_field_array(NMField * src); | |
189 | |
190 /** | |
191 * Remove a field and move other fields up to fill the gap | |
192 * | |
193 * @param field The field to remove | |
194 * | |
195 */ | |
196 void nm_remove_field(NMField * field); | |
197 | |
198 /* Print a field array (for debugging purposes) */ | |
199 void nm_print_fields(NMField * fields); | |
200 | |
201 #endif |