Mercurial > pidgin.yaz
annotate src/protocols/novell/nmfield.h @ 8874:a2affcdf8e01
[gaim-migrate @ 9643]
"This patch fixes the Novell protocol plugin on big
endian platforms (Bug #947017). It also includes a fix
for disconnects when sending large messages." --Mike Stoddard (novell)
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 05 May 2004 20:29:21 +0000 |
parents | c7e9687bfd79 |
children | 6663ad2386d9 |
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 | |
8753 | 129 #define NMFIELD_MAX_STR_LENGTH 32768 |
130 | |
8675 | 131 /** |
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
132 * Count the number of fields |
8675 | 133 * |
134 * @param fields Field array | |
135 * | |
136 * @return The number of fields in the array. | |
137 * | |
138 */ | |
139 guint32 nm_count_fields(NMField * fields); | |
140 | |
141 /** | |
142 * Add a field to the field array. NOTE: field array that is passed | |
143 * in may be realloced so you should use the returned field array pointer | |
144 * not the passed in pointer after calling this function. | |
145 * | |
146 * @param fields Field array | |
147 * @param tag Tag for the new field | |
148 * @param size Size of the field value (if type = binary) | |
149 * @param method Field method (see method defines above) | |
150 * @param flags Flags for new field | |
151 * @param value The value of the field | |
152 * @param type The type of the field value | |
153 * | |
154 * @return Pointer to the updated field array | |
155 * | |
156 */ | |
157 NMField *nm_add_field(NMField * fields, char *tag, guint32 size, guint8 method, | |
158 guint8 flags, guint32 value, guint8 type); | |
159 | |
160 /** | |
161 * Recursively free an array of fields and set pointer to NULL. | |
162 * | |
163 * @param fields Pointer to a field array | |
164 * | |
165 */ | |
166 void nm_free_fields(NMField ** fields); | |
167 | |
168 /** | |
169 * Find first field with given tag in field array. | |
170 * | |
171 * Note: this will only work for 7-bit ascii tags (which is all that | |
172 * we use currently). | |
173 * | |
174 * @param tag Tag to search for | |
175 * @param fields Field array | |
176 * | |
177 * @return The first matching field, or NULL if no fields match. | |
178 * | |
179 */ | |
180 NMField *nm_locate_field(char *tag, NMField * fields); | |
181 | |
182 /** | |
183 * Make a deep copy of a field array | |
184 * | |
185 * @param src The array to copy | |
186 * | |
187 * @return The new (copied) array, which must be freed. | |
188 * | |
189 */ | |
190 NMField *nm_copy_field_array(NMField * src); | |
191 | |
192 /** | |
193 * Remove a field and move other fields up to fill the gap | |
194 * | |
195 * @param field The field to remove | |
196 * | |
197 */ | |
198 void nm_remove_field(NMField * field); | |
199 | |
200 /* Print a field array (for debugging purposes) */ | |
201 void nm_print_fields(NMField * fields); | |
202 | |
203 #endif |