comparison mcabber/libjabber/jabber.h @ 417:c3ae9251c197

Sync libjabber with upstream Sync with jabberd-1.4.4.
author Mikael Berthe <mikael@lilotux.net>
date Thu, 01 Sep 2005 23:29:21 +0200
parents 17aa60c6dc63
children 98de2d166a11
comparison
equal deleted inserted replaced
416:48e7808c4191 417:c3ae9251c197
55 #define JID_RESOURCE 1 55 #define JID_RESOURCE 1
56 #define JID_USER 2 56 #define JID_USER 2
57 #define JID_SERVER 4 57 #define JID_SERVER 4
58 58
59 typedef struct jid_struct 59 typedef struct jid_struct
60 { 60 {
61 pool p; 61 pool p;
62 char* resource; 62 char* resource;
63 char* user; 63 char* user;
64 char* server; 64 char* server;
65 char* full; 65 char* full;
66 struct jid_struct *next; /* for lists of jids */ 66 struct jid_struct *next; /* for lists of jids */
67 } *jid; 67 } *jid;
68 68
69 jid jid_new(pool p, char *idstr); /* Creates a jabber id from the idstr */ 69 jid jid_new(pool p, char *idstr); /* Creates a jabber id from the idstr */
70 70
71 void jid_set(jid id, char *str, int item); /* Individually sets jid components */ 71 void jid_set(jid id, char *str, int item); /* Individually sets jid components */
72 char* jid_full(jid id); /* Builds a string type=user/resource@server from the jid data */ 72 char* jid_full(jid id); /* Builds a string type=user/resource@server from the jid data */
73 int jid_cmp(jid a, jid b); /* Compares two jid's, returns 0 for perfect match */ 73 int jid_cmp(jid a, jid b); /* Compares two jid's, returns 0 for perfect match */
74 int jid_cmpx(jid a, jid b, int parts); /* Compares just the parts specified as JID_|JID_ */ 74 int jid_cmpx(jid a, jid b, int parts); /* Compares just the parts specified as JID_|JID_ */
75 jid jid_append(jid a, jid b); /* Appending b to a (list), no dups */ 75 jid jid_append(jid a, jid b); /* Appending b to a (list), no dups */
76 xmlnode jid_xres(jid id); /* Returns xmlnode representation of the resource?query=string */ 76 xmlnode jid_xres(jid id); /* Returns xmlnode representation of the resource?query=string */
77 xmlnode jid_nodescan(jid id, xmlnode x); /* Scans the children of the node for a matching jid attribute */ 77 xmlnode jid_nodescan(jid id, xmlnode x); /* Scans the children of the node for a matching jid attribute */
78 jid jid_user(jid a); /* returns the same jid but just of the user@host part */
78 79
79 80
80 /* --------------------------------------------------------- */ 81 /* --------------------------------------------------------- */
81 /* */ 82 /* */
82 /* JPacket structures & constants */ 83 /* JPacket structures & constants */
102 #define JPACKET__UNSUBSCRIBED 11 103 #define JPACKET__UNSUBSCRIBED 11
103 #define JPACKET__AVAILABLE 12 104 #define JPACKET__AVAILABLE 12
104 #define JPACKET__UNAVAILABLE 13 105 #define JPACKET__UNAVAILABLE 13
105 #define JPACKET__PROBE 14 106 #define JPACKET__PROBE 14
106 #define JPACKET__HEADLINE 15 107 #define JPACKET__HEADLINE 15
108 #define JPACKET__INVISIBLE 16
107 109
108 typedef struct jpacket_struct 110 typedef struct jpacket_struct
109 { 111 {
110 unsigned char type; 112 unsigned char type; /**< stanza type (JPACKET_*) */
111 int subtype; 113 int subtype; /**< subtype of a stanza */
112 int flag; 114 int flag; /**< used by the session manager to flag messages, that are read from offline storage */
113 void* aux1; 115 void* aux1; /**< pointer to data passed around with a jpacket, multiple use inside jsm */
114 xmlnode x; 116 xmlnode x; /**< xmlnode containing the stanza inside the jpacket */
115 jid to; 117 jid to; /**< destination of the stanza */
116 jid from; 118 jid from; /**< source address for the stanza */
117 char* iqns; 119 char* iqns; /**< pointer to the namespace inside an IQ stanza */
118 xmlnode iq; 120 xmlnode iq; /**< "content" of an iq stanza, pointer to the element in its own namespace */
119 pool p; 121 pool p; /**< memory pool used for this stanza */
120 } *jpacket, _jpacket; 122 } *jpacket, _jpacket;
121 123
122 jpacket jpacket_new(xmlnode x); /* Creates a jabber packet from the xmlnode */ 124 jpacket jpacket_new(xmlnode x); /* Creates a jabber packet from the xmlnode */
123 jpacket jpacket_reset(jpacket p); /* Resets the jpacket values based on the xmlnode */ 125 jpacket jpacket_reset(jpacket p); /* Resets the jpacket values based on the xmlnode */
124 int jpacket_subtype(jpacket p); /* Returns the subtype value (looks at xmlnode for it) */ 126 int jpacket_subtype(jpacket p); /* Returns the subtype value (looks at xmlnode for it) */
125 127
126 128
128 /* */ 130 /* */
129 /* Presence Proxy DB structures & constants */ 131 /* Presence Proxy DB structures & constants */
130 /* */ 132 /* */
131 /* --------------------------------------------------------- */ 133 /* --------------------------------------------------------- */
132 typedef struct ppdb_struct 134 typedef struct ppdb_struct
133 { 135 {
134 jid id; /* entry data */ 136 jid id; /* entry data */
135 int pri; 137 int pri;
136 xmlnode x; 138 xmlnode x;
137 struct ppdb_struct* user; /* linked list for user@server */ 139 struct ppdb_struct* user; /* linked list for user@server */
138 pool p; /* db-level data */ 140 pool p; /* db-level data */
157 int start; 159 int start;
158 int points; 160 int points;
159 int maxt, maxp; 161 int maxt, maxp;
160 pool p; 162 pool p;
161 } *jlimit, _jlimit; 163 } *jlimit, _jlimit;
162 164
163 jlimit jlimit_new(int maxt, int maxp); 165 jlimit jlimit_new(int maxt, int maxp);
164 void jlimit_free(jlimit r); 166 void jlimit_free(jlimit r);
165 int jlimit_check(jlimit r, char *key, int points); 167 int jlimit_check(jlimit r, char *key, int points);
166 168
167 169
192 #define TERROR_EXTERNAL (terror){502,"Remote Server Error"} 194 #define TERROR_EXTERNAL (terror){502,"Remote Server Error"}
193 #define TERROR_UNAVAIL (terror){503,"Service Unavailable"} 195 #define TERROR_UNAVAIL (terror){503,"Service Unavailable"}
194 #define TERROR_EXTTIMEOUT (terror){504,"Remote Server Timeout"} 196 #define TERROR_EXTTIMEOUT (terror){504,"Remote Server Timeout"}
195 #define TERROR_DISCONNECTED (terror){510,"Disconnected"} 197 #define TERROR_DISCONNECTED (terror){510,"Disconnected"}
196 198
199 /* we define this to signal that we support xterror */
200 #define HAS_XTERROR
201
202 typedef struct xterror_struct
203 {
204 int code;
205 char msg[256];
206 char type[9];
207 char condition[64];
208 } xterror;
209
210 #define XTERROR_BAD (xterror){400,"Bad Request","modify","bad-request"}
211 #define XTERROR_CONFLICT (xterror){409,"Conflict","cancel","conflict"}
212 #define XTERROR_NOTIMPL (xterror){501,"Not Implemented","cancel","feature-not-implemented"}
213 #define XTERROR_FORBIDDEN (xterror){403,"Forbidden","auth","forbidden"}
214 #define XTERROR_GONE (xterror){302,"Gone","modify","gone"}
215 #define XTERROR_INTERNAL (xterror){500,"Internal Server Error","wait","internal-server-error"}
216 #define XTERROR_NOTFOUND (xterror){404,"Not Found","cancel","item-not-found"}
217 #define XTERROR_JIDMALFORMED (xterror){400,"Bad Request","modify","jid-malformed"}
218 #define XTERROR_NOTACCEPTABLE (xterror){406,"Not Acceptable","modify","not-acceptable"}
219 #define XTERROR_NOTALLOWED (xterror){405,"Not Allowed","cancel","not-allowed"}
220 #define XTERROR_AUTH (xterror){401,"Unauthorized","auth","not-authorized"}
221 #define XTERROR_PAY (xterror){402,"Payment Required","auth","payment-required"}
222 #define XTERROR_RECIPIENTUNAVAIL (xterror){404,"Receipient Is Unavailable","wait","recipient-unavailable"}
223 #define XTERROR_REDIRECT (xterror){302,"Redirect","modify","redirect"}
224 #define XTERROR_REGISTER (xterror){407,"Registration Required","auth","registration-required"}
225 #define XTERROR_REMOTENOTFOUND (xterror){404,"Remote Server Not Found","cancel","remote-server-not-found"}
226 #define XTERROR_REMOTETIMEOUT (xterror){504,"Remote Server Timeout","wait","remote-server-timeout"}
227 #define XTERROR_RESCONSTRAINT (xterror){500,"Resource Constraint","wait","resource-constraint"}
228 #define XTERROR_UNAVAIL (xterror){503,"Service Unavailable","cancel","service-unavailable"}
229 #define XTERROR_SUBSCRIPTIONREQ (xterror){407,"Subscription Required","auth","subscription-required"}
230 #define XTERROR_UNDEF_CANCEL (xterror){500,NULL,"cancel","undefined-condition"}
231 #define XTERROR_UNDEF_CONTINUE (xterror){500,NULL,"continue","undefined-condition"}
232 #define XTERROR_UNDEF_MODIFY (xterror){500,NULL,"modify","undefined-condition"}
233 #define XTERROR_UNDEF_AUTH (xterror){500,NULL,"auth","undefined-condition"}
234 #define XTERROR_UNDEF_WAIT (xterror){500,NULL,"wait","undefined-condition"}
235 #define XTERROR_UNEXPECTED (xterror){400,"Unexpected Request","wait","unexpected-request"}
236
237 #define XTERROR_REQTIMEOUT (xterror){408,"Request Timeout","wait","remote-server-timeout"}
238 #define XTERROR_EXTERNAL (xterror){502,"Remote Server Error","wait","service-unavailable"}
239 #define XTERROR_EXTTIMEOUT (xterror){504,"Remote Server Timeout","wait","remote-server-timeout"}
240 #define XTERROR_DISCONNECTED (xterror){510,"Disconnected","cancel","service-unavailable"}
241
197 /* --------------------------------------------------------- */ 242 /* --------------------------------------------------------- */
198 /* */ 243 /* */
199 /* Namespace constants */ 244 /* Namespace constants */
200 /* */ 245 /* */
201 /* --------------------------------------------------------- */ 246 /* --------------------------------------------------------- */
202 #define NSCHECK(x,n) (j_strcmp(xmlnode_get_attrib(x,"xmlns"),n) == 0) 247 #define NSCHECK(x,n) (j_strcmp(xmlnode_get_attrib(x,"xmlns"),n) == 0)
203 248
204 #define NS_CLIENT "jabber:client" 249 #define NS_CLIENT "jabber:client"
205 #define NS_SERVER "jabber:server" 250 #define NS_SERVER "jabber:server"
251 #define NS_DIALBACK "jabber:server:dialback"
206 #define NS_AUTH "jabber:iq:auth" 252 #define NS_AUTH "jabber:iq:auth"
253 #define NS_AUTH_CRYPT "jabber:iq:auth:crypt"
207 #define NS_REGISTER "jabber:iq:register" 254 #define NS_REGISTER "jabber:iq:register"
208 #define NS_ROSTER "jabber:iq:roster" 255 #define NS_ROSTER "jabber:iq:roster"
209 #define NS_OFFLINE "jabber:x:offline" 256 #define NS_OFFLINE "jabber:x:offline"
210 #define NS_AGENT "jabber:iq:agent" 257 #define NS_AGENT "jabber:iq:agent"
211 #define NS_AGENTS "jabber:iq:agents" 258 #define NS_AGENTS "jabber:iq:agents"
218 #define NS_OOB "jabber:iq:oob" 265 #define NS_OOB "jabber:iq:oob"
219 #define NS_XOOB "jabber:x:oob" 266 #define NS_XOOB "jabber:x:oob"
220 #define NS_ADMIN "jabber:iq:admin" 267 #define NS_ADMIN "jabber:iq:admin"
221 #define NS_FILTER "jabber:iq:filter" 268 #define NS_FILTER "jabber:iq:filter"
222 #define NS_AUTH_0K "jabber:iq:auth:0k" 269 #define NS_AUTH_0K "jabber:iq:auth:0k"
223 270 #define NS_BROWSE "jabber:iq:browse"
271 #define NS_EVENT "jabber:x:event"
272 #define NS_CONFERENCE "jabber:iq:conference"
273 #define NS_SIGNED "jabber:x:signed"
274 #define NS_ENCRYPTED "jabber:x:encrypted"
275 #define NS_GATEWAY "jabber:iq:gateway"
276 #define NS_LAST "jabber:iq:last"
277 #define NS_ENVELOPE "jabber:x:envelope"
278 #define NS_EXPIRE "jabber:x:expire"
279 #define NS_XHTML "http://www.w3.org/1999/xhtml"
280 #define NS_DISCO_INFO "http://jabber.org/protocol/disco#info"
281 #define NS_DISCO_ITEMS "http://jabber.org/protocol/disco#items"
282 #define NS_IQ_AUTH "http://jabber.org/features/iq-auth"
283 #define NS_REGISTER_FEATURE "http://jabber.org/features/iq-register"
284
285 #define NS_XDBGINSERT "jabber:xdb:ginsert"
286 #define NS_XDBNSLIST "jabber:xdb:nslist"
287
288 #define NS_XMPP_STANZAS "urn:ietf:params:xml:ns:xmpp-stanzas"
289 #define NS_XMPP_TLS "urn:ietf:params:xml:ns:xmpp-tls"
290 #define NS_XMPP_STREAMS "urn:ietf:params:xml:ns:xmpp-streams"
291
292 #define NS_JABBERD_STOREDPRESENCE "http://jabberd.org/ns/storedpresence"
293 #define NS_JABBERD_HISTORY "http://jabberd.org/ns/history"
224 294
225 /* --------------------------------------------------------- */ 295 /* --------------------------------------------------------- */
226 /* */ 296 /* */
227 /* Message Types */ 297 /* Message Types */
228 /* */ 298 /* */