1/*
2 * libjingle
3 * Copyright 2004--2005, Google Inc.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 *  1. Redistributions of source code must retain the above copyright notice,
9 *     this list of conditions and the following disclaimer.
10 *  2. Redistributions in binary form must reproduce the above copyright notice,
11 *     this list of conditions and the following disclaimer in the documentation
12 *     and/or other materials provided with the distribution.
13 *  3. The name of the author may not be used to endorse or promote products
14 *     derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include "talk/xmpp/constants.h"
29
30#include <string>
31
32#include "talk/base/basicdefs.h"
33#include "talk/xmllite/xmlconstants.h"
34#include "talk/xmllite/xmlelement.h"
35#include "talk/xmllite/qname.h"
36#include "talk/xmpp/jid.h"
37
38namespace buzz {
39
40// TODO: Remove static objects of complex types, particularly
41// Jid and QName.
42
43const char NS_CLIENT[] = "jabber:client";
44const char NS_SERVER[] = "jabber:server";
45const char NS_STREAM[] = "http://etherx.jabber.org/streams";
46const char NS_XSTREAM[] = "urn:ietf:params:xml:ns:xmpp-streams";
47const char NS_TLS[] = "urn:ietf:params:xml:ns:xmpp-tls";
48const char NS_SASL[] = "urn:ietf:params:xml:ns:xmpp-sasl";
49const char NS_BIND[] = "urn:ietf:params:xml:ns:xmpp-bind";
50const char NS_DIALBACK[] = "jabber:server:dialback";
51const char NS_SESSION[] = "urn:ietf:params:xml:ns:xmpp-session";
52const char NS_STANZA[] = "urn:ietf:params:xml:ns:xmpp-stanzas";
53const char NS_PRIVACY[] = "jabber:iq:privacy";
54const char NS_ROSTER[] = "jabber:iq:roster";
55const char NS_VCARD[] = "vcard-temp";
56const char NS_AVATAR_HASH[] = "google:avatar";
57const char NS_VCARD_UPDATE[] = "vcard-temp:x:update";
58const char STR_CLIENT[] = "client";
59const char STR_SERVER[] = "server";
60const char STR_STREAM[] = "stream";
61
62const char STR_GET[] = "get";
63const char STR_SET[] = "set";
64const char STR_RESULT[] = "result";
65const char STR_ERROR[] = "error";
66
67const char STR_FORM[] = "form";
68const char STR_SUBMIT[] = "submit";
69const char STR_TEXT_SINGLE[] = "text-single";
70const char STR_LIST_SINGLE[] = "list-single";
71const char STR_LIST_MULTI[] = "list-multi";
72const char STR_HIDDEN[] = "hidden";
73const char STR_FORM_TYPE[] = "FORM_TYPE";
74
75const char STR_FROM[] = "from";
76const char STR_TO[] = "to";
77const char STR_BOTH[] = "both";
78const char STR_REMOVE[] = "remove";
79const char STR_TRUE[] = "true";
80
81const char STR_TYPE[] = "type";
82const char STR_NAME[] = "name";
83const char STR_ID[] = "id";
84const char STR_JID[] = "jid";
85const char STR_SUBSCRIPTION[] = "subscription";
86const char STR_ASK[] = "ask";
87const char STR_X[] = "x";
88const char STR_GOOGLE_COM[] = "google.com";
89const char STR_GMAIL_COM[] = "gmail.com";
90const char STR_GOOGLEMAIL_COM[] = "googlemail.com";
91const char STR_DEFAULT_DOMAIN[] = "default.talk.google.com";
92const char STR_TALK_GOOGLE_COM[] = "talk.google.com";
93const char STR_TALKX_L_GOOGLE_COM[] = "talkx.l.google.com";
94const char STR_XMPP_GOOGLE_COM[] = "xmpp.google.com";
95const char STR_XMPPX_L_GOOGLE_COM[] = "xmppx.l.google.com";
96
97#ifdef FEATURE_ENABLE_VOICEMAIL
98const char STR_VOICEMAIL[] = "voicemail";
99const char STR_OUTGOINGVOICEMAIL[] = "outgoingvoicemail";
100#endif
101
102const char STR_UNAVAILABLE[] = "unavailable";
103
104const char NS_PING[] = "urn:xmpp:ping";
105const StaticQName QN_PING = { NS_PING, "ping" };
106
107const char NS_MUC_UNIQUE[] = "http://jabber.org/protocol/muc#unique";
108const StaticQName QN_MUC_UNIQUE_QUERY = { NS_MUC_UNIQUE, "unique" };
109const StaticQName QN_HANGOUT_ID = { STR_EMPTY, "hangout-id" };
110
111const char STR_GOOGLE_MUC_LOOKUP_JID[] = "lookup.groupchat.google.com";
112
113const char STR_MUC_ROOMCONFIG_ROOMNAME[] = "muc#roomconfig_roomname";
114const char STR_MUC_ROOMCONFIG_FEATURES[] = "muc#roomconfig_features";
115const char STR_MUC_ROOM_FEATURE_ENTERPRISE[] = "muc_enterprise";
116const char STR_MUC_ROOMCONFIG[] = "http://jabber.org/protocol/muc#roomconfig";
117const char STR_MUC_ROOM_FEATURE_HANGOUT[] = "muc_es";
118const char STR_MUC_ROOM_FEATURE_HANGOUT_LITE[] = "muc_lite";
119const char STR_MUC_ROOM_FEATURE_BROADCAST[] = "broadcast";
120const char STR_MUC_ROOM_FEATURE_MULTI_USER_VC[] = "muc_muvc";
121
122const char STR_ID_TYPE_CONVERSATION[] = "conversation";
123const char NS_GOOGLE_MUC_HANGOUT[] = "google:muc#hangout";
124const StaticQName QN_GOOGLE_MUC_HANGOUT_INVITE =
125    { NS_GOOGLE_MUC_HANGOUT, "invite" };
126const StaticQName QN_GOOGLE_MUC_HANGOUT_INVITE_TYPE =
127    { NS_GOOGLE_MUC_HANGOUT, "invite-type" };
128const StaticQName QN_ATTR_CREATE_ACTIVITY =
129    { STR_EMPTY, "create-activity" };
130const StaticQName QN_GOOGLE_MUC_HANGOUT_PUBLIC =
131    { NS_GOOGLE_MUC_HANGOUT, "public" };
132const StaticQName QN_GOOGLE_MUC_HANGOUT_INVITEE =
133    { NS_GOOGLE_MUC_HANGOUT, "invitee" };
134const StaticQName QN_GOOGLE_MUC_HANGOUT_NOTIFICATION_STATUS =
135    { NS_GOOGLE_MUC_HANGOUT, "notification-status" };
136const StaticQName QN_GOOGLE_MUC_HANGOUT_NOTIFICATION_TYPE = {
137    NS_GOOGLE_MUC_HANGOUT, "notification-type" };
138const StaticQName QN_GOOGLE_MUC_HANGOUT_HANGOUT_START_CONTEXT = {
139    NS_GOOGLE_MUC_HANGOUT, "hangout-start-context" };
140const StaticQName QN_GOOGLE_MUC_HANGOUT_CONVERSATION_ID = {
141    NS_GOOGLE_MUC_HANGOUT, "conversation-id" };
142
143const StaticQName QN_STREAM_STREAM = { NS_STREAM, STR_STREAM };
144const StaticQName QN_STREAM_FEATURES = { NS_STREAM, "features" };
145const StaticQName QN_STREAM_ERROR = { NS_STREAM, "error" };
146
147const StaticQName QN_XSTREAM_BAD_FORMAT = { NS_XSTREAM, "bad-format" };
148const StaticQName QN_XSTREAM_BAD_NAMESPACE_PREFIX =
149    { NS_XSTREAM, "bad-namespace-prefix" };
150const StaticQName QN_XSTREAM_CONFLICT = { NS_XSTREAM, "conflict" };
151const StaticQName QN_XSTREAM_CONNECTION_TIMEOUT =
152    { NS_XSTREAM, "connection-timeout" };
153const StaticQName QN_XSTREAM_HOST_GONE = { NS_XSTREAM, "host-gone" };
154const StaticQName QN_XSTREAM_HOST_UNKNOWN = { NS_XSTREAM, "host-unknown" };
155const StaticQName QN_XSTREAM_IMPROPER_ADDRESSIING =
156     { NS_XSTREAM, "improper-addressing" };
157const StaticQName QN_XSTREAM_INTERNAL_SERVER_ERROR =
158    { NS_XSTREAM, "internal-server-error" };
159const StaticQName QN_XSTREAM_INVALID_FROM = { NS_XSTREAM, "invalid-from" };
160const StaticQName QN_XSTREAM_INVALID_ID = { NS_XSTREAM, "invalid-id" };
161const StaticQName QN_XSTREAM_INVALID_NAMESPACE =
162    { NS_XSTREAM, "invalid-namespace" };
163const StaticQName QN_XSTREAM_INVALID_XML = { NS_XSTREAM, "invalid-xml" };
164const StaticQName QN_XSTREAM_NOT_AUTHORIZED = { NS_XSTREAM, "not-authorized" };
165const StaticQName QN_XSTREAM_POLICY_VIOLATION =
166    { NS_XSTREAM, "policy-violation" };
167const StaticQName QN_XSTREAM_REMOTE_CONNECTION_FAILED =
168    { NS_XSTREAM, "remote-connection-failed" };
169const StaticQName QN_XSTREAM_RESOURCE_CONSTRAINT =
170    { NS_XSTREAM, "resource-constraint" };
171const StaticQName QN_XSTREAM_RESTRICTED_XML = { NS_XSTREAM, "restricted-xml" };
172const StaticQName QN_XSTREAM_SEE_OTHER_HOST = { NS_XSTREAM, "see-other-host" };
173const StaticQName QN_XSTREAM_SYSTEM_SHUTDOWN =
174    { NS_XSTREAM, "system-shutdown" };
175const StaticQName QN_XSTREAM_UNDEFINED_CONDITION =
176    { NS_XSTREAM, "undefined-condition" };
177const StaticQName QN_XSTREAM_UNSUPPORTED_ENCODING =
178    { NS_XSTREAM, "unsupported-encoding" };
179const StaticQName QN_XSTREAM_UNSUPPORTED_STANZA_TYPE =
180    { NS_XSTREAM, "unsupported-stanza-type" };
181const StaticQName QN_XSTREAM_UNSUPPORTED_VERSION =
182    { NS_XSTREAM, "unsupported-version" };
183const StaticQName QN_XSTREAM_XML_NOT_WELL_FORMED =
184    { NS_XSTREAM, "xml-not-well-formed" };
185const StaticQName QN_XSTREAM_TEXT = { NS_XSTREAM, "text" };
186
187const StaticQName QN_TLS_STARTTLS = { NS_TLS, "starttls" };
188const StaticQName QN_TLS_REQUIRED = { NS_TLS, "required" };
189const StaticQName QN_TLS_PROCEED = { NS_TLS, "proceed" };
190const StaticQName QN_TLS_FAILURE = { NS_TLS, "failure" };
191
192const StaticQName QN_SASL_MECHANISMS = { NS_SASL, "mechanisms" };
193const StaticQName QN_SASL_MECHANISM = { NS_SASL, "mechanism" };
194const StaticQName QN_SASL_AUTH = { NS_SASL, "auth" };
195const StaticQName QN_SASL_CHALLENGE = { NS_SASL, "challenge" };
196const StaticQName QN_SASL_RESPONSE = { NS_SASL, "response" };
197const StaticQName QN_SASL_ABORT = { NS_SASL, "abort" };
198const StaticQName QN_SASL_SUCCESS = { NS_SASL, "success" };
199const StaticQName QN_SASL_FAILURE = { NS_SASL, "failure" };
200const StaticQName QN_SASL_ABORTED = { NS_SASL, "aborted" };
201const StaticQName QN_SASL_INCORRECT_ENCODING =
202    { NS_SASL, "incorrect-encoding" };
203const StaticQName QN_SASL_INVALID_AUTHZID = { NS_SASL, "invalid-authzid" };
204const StaticQName QN_SASL_INVALID_MECHANISM = { NS_SASL, "invalid-mechanism" };
205const StaticQName QN_SASL_MECHANISM_TOO_WEAK =
206    { NS_SASL, "mechanism-too-weak" };
207const StaticQName QN_SASL_NOT_AUTHORIZED = { NS_SASL, "not-authorized" };
208const StaticQName QN_SASL_TEMPORARY_AUTH_FAILURE =
209    { NS_SASL, "temporary-auth-failure" };
210
211// These are non-standard.
212const char NS_GOOGLE_AUTH_PROTOCOL[] =
213    "http://www.google.com/talk/protocol/auth";
214const StaticQName QN_GOOGLE_AUTH_CLIENT_USES_FULL_BIND_RESULT =
215    { NS_GOOGLE_AUTH_PROTOCOL, "client-uses-full-bind-result" };
216const char NS_GOOGLE_AUTH_OLD[] = "google:auth";
217const StaticQName QN_GOOGLE_ALLOW_NON_GOOGLE_ID_XMPP_LOGIN =
218    { NS_GOOGLE_AUTH_PROTOCOL, "allow-non-google-login" };
219const StaticQName QN_GOOGLE_AUTH_SERVICE =
220    { NS_GOOGLE_AUTH_PROTOCOL, "service" };
221
222const StaticQName QN_DIALBACK_RESULT = { NS_DIALBACK, "result" };
223const StaticQName QN_DIALBACK_VERIFY = { NS_DIALBACK, "verify" };
224
225const StaticQName QN_STANZA_BAD_REQUEST = { NS_STANZA, "bad-request" };
226const StaticQName QN_STANZA_CONFLICT = { NS_STANZA, "conflict" };
227const StaticQName QN_STANZA_FEATURE_NOT_IMPLEMENTED =
228    { NS_STANZA, "feature-not-implemented" };
229const StaticQName QN_STANZA_FORBIDDEN = { NS_STANZA, "forbidden" };
230const StaticQName QN_STANZA_GONE = { NS_STANZA, "gone" };
231const StaticQName QN_STANZA_INTERNAL_SERVER_ERROR =
232    { NS_STANZA, "internal-server-error" };
233const StaticQName QN_STANZA_ITEM_NOT_FOUND = { NS_STANZA, "item-not-found" };
234const StaticQName QN_STANZA_JID_MALFORMED = { NS_STANZA, "jid-malformed" };
235const StaticQName QN_STANZA_NOT_ACCEPTABLE = { NS_STANZA, "not-acceptable" };
236const StaticQName QN_STANZA_NOT_ALLOWED = { NS_STANZA, "not-allowed" };
237const StaticQName QN_STANZA_PAYMENT_REQUIRED =
238    { NS_STANZA, "payment-required" };
239const StaticQName QN_STANZA_RECIPIENT_UNAVAILABLE =
240    { NS_STANZA, "recipient-unavailable" };
241const StaticQName QN_STANZA_REDIRECT = { NS_STANZA, "redirect" };
242const StaticQName QN_STANZA_REGISTRATION_REQUIRED =
243    { NS_STANZA, "registration-required" };
244const StaticQName QN_STANZA_REMOTE_SERVER_NOT_FOUND =
245    { NS_STANZA, "remote-server-not-found" };
246const StaticQName QN_STANZA_REMOTE_SERVER_TIMEOUT =
247    { NS_STANZA, "remote-server-timeout" };
248const StaticQName QN_STANZA_RESOURCE_CONSTRAINT =
249    { NS_STANZA, "resource-constraint" };
250const StaticQName QN_STANZA_SERVICE_UNAVAILABLE =
251    { NS_STANZA, "service-unavailable" };
252const StaticQName QN_STANZA_SUBSCRIPTION_REQUIRED =
253    { NS_STANZA, "subscription-required" };
254const StaticQName QN_STANZA_UNDEFINED_CONDITION =
255    { NS_STANZA, "undefined-condition" };
256const StaticQName QN_STANZA_UNEXPECTED_REQUEST =
257    { NS_STANZA, "unexpected-request" };
258const StaticQName QN_STANZA_TEXT = { NS_STANZA, "text" };
259
260const StaticQName QN_BIND_BIND = { NS_BIND, "bind" };
261const StaticQName QN_BIND_RESOURCE = { NS_BIND, "resource" };
262const StaticQName QN_BIND_JID = { NS_BIND, "jid" };
263
264const StaticQName QN_MESSAGE = { NS_CLIENT, "message" };
265const StaticQName QN_BODY = { NS_CLIENT, "body" };
266const StaticQName QN_SUBJECT = { NS_CLIENT, "subject" };
267const StaticQName QN_THREAD = { NS_CLIENT, "thread" };
268const StaticQName QN_PRESENCE = { NS_CLIENT, "presence" };
269const StaticQName QN_SHOW = { NS_CLIENT, "show" };
270const StaticQName QN_STATUS = { NS_CLIENT, "status" };
271const StaticQName QN_LANG = { NS_CLIENT, "lang" };
272const StaticQName QN_PRIORITY = { NS_CLIENT, "priority" };
273const StaticQName QN_IQ = { NS_CLIENT, "iq" };
274const StaticQName QN_ERROR = { NS_CLIENT, "error" };
275
276const StaticQName QN_SERVER_MESSAGE = { NS_SERVER, "message" };
277const StaticQName QN_SERVER_BODY = { NS_SERVER, "body" };
278const StaticQName QN_SERVER_SUBJECT = { NS_SERVER, "subject" };
279const StaticQName QN_SERVER_THREAD = { NS_SERVER, "thread" };
280const StaticQName QN_SERVER_PRESENCE = { NS_SERVER, "presence" };
281const StaticQName QN_SERVER_SHOW = { NS_SERVER, "show" };
282const StaticQName QN_SERVER_STATUS = { NS_SERVER, "status" };
283const StaticQName QN_SERVER_LANG = { NS_SERVER, "lang" };
284const StaticQName QN_SERVER_PRIORITY = { NS_SERVER, "priority" };
285const StaticQName QN_SERVER_IQ = { NS_SERVER, "iq" };
286const StaticQName QN_SERVER_ERROR = { NS_SERVER, "error" };
287
288const StaticQName QN_SESSION_SESSION = { NS_SESSION, "session" };
289
290const StaticQName QN_PRIVACY_QUERY = { NS_PRIVACY, "query" };
291const StaticQName QN_PRIVACY_ACTIVE = { NS_PRIVACY, "active" };
292const StaticQName QN_PRIVACY_DEFAULT = { NS_PRIVACY, "default" };
293const StaticQName QN_PRIVACY_LIST = { NS_PRIVACY, "list" };
294const StaticQName QN_PRIVACY_ITEM = { NS_PRIVACY, "item" };
295const StaticQName QN_PRIVACY_IQ = { NS_PRIVACY, "iq" };
296const StaticQName QN_PRIVACY_MESSAGE = { NS_PRIVACY, "message" };
297const StaticQName QN_PRIVACY_PRESENCE_IN = { NS_PRIVACY, "presence-in" };
298const StaticQName QN_PRIVACY_PRESENCE_OUT = { NS_PRIVACY, "presence-out" };
299
300const StaticQName QN_ROSTER_QUERY = { NS_ROSTER, "query" };
301const StaticQName QN_ROSTER_ITEM = { NS_ROSTER, "item" };
302const StaticQName QN_ROSTER_GROUP = { NS_ROSTER, "group" };
303
304const StaticQName QN_VCARD = { NS_VCARD, "vCard" };
305const StaticQName QN_VCARD_FN = { NS_VCARD, "FN" };
306const StaticQName QN_VCARD_PHOTO = { NS_VCARD, "PHOTO" };
307const StaticQName QN_VCARD_PHOTO_BINVAL = { NS_VCARD, "BINVAL" };
308const StaticQName QN_VCARD_AVATAR_HASH = { NS_AVATAR_HASH, "hash" };
309const StaticQName QN_VCARD_AVATAR_HASH_MODIFIED =
310    { NS_AVATAR_HASH, "modified" };
311
312const StaticQName QN_NAME = { STR_EMPTY, "name" };
313const StaticQName QN_AFFILIATION = { STR_EMPTY, "affiliation" };
314const StaticQName QN_ROLE = { STR_EMPTY, "role" };
315
316#if defined(FEATURE_ENABLE_PSTN)
317const StaticQName QN_VCARD_TEL = { NS_VCARD, "TEL" };
318const StaticQName QN_VCARD_VOICE = { NS_VCARD, "VOICE" };
319const StaticQName QN_VCARD_HOME = { NS_VCARD, "HOME" };
320const StaticQName QN_VCARD_WORK = { NS_VCARD, "WORK" };
321const StaticQName QN_VCARD_CELL = { NS_VCARD, "CELL" };
322const StaticQName QN_VCARD_NUMBER = { NS_VCARD, "NUMBER" };
323#endif
324
325const StaticQName QN_XML_LANG = { NS_XML, "lang" };
326
327const StaticQName QN_ENCODING = { STR_EMPTY, STR_ENCODING };
328const StaticQName QN_VERSION = { STR_EMPTY, STR_VERSION };
329const StaticQName QN_TO = { STR_EMPTY, "to" };
330const StaticQName QN_FROM = { STR_EMPTY, "from" };
331const StaticQName QN_TYPE = { STR_EMPTY, "type" };
332const StaticQName QN_ID = { STR_EMPTY, "id" };
333const StaticQName QN_CODE = { STR_EMPTY, "code" };
334
335const StaticQName QN_VALUE = { STR_EMPTY, "value" };
336const StaticQName QN_ACTION = { STR_EMPTY, "action" };
337const StaticQName QN_ORDER = { STR_EMPTY, "order" };
338const StaticQName QN_MECHANISM = { STR_EMPTY, "mechanism" };
339const StaticQName QN_ASK = { STR_EMPTY, "ask" };
340const StaticQName QN_JID = { STR_EMPTY, "jid" };
341const StaticQName QN_NICK = { STR_EMPTY, "nick" };
342const StaticQName QN_SUBSCRIPTION = { STR_EMPTY, "subscription" };
343const StaticQName QN_TITLE1 = { STR_EMPTY, "title1" };
344const StaticQName QN_TITLE2 = { STR_EMPTY, "title2" };
345const StaticQName QN_SOURCE = { STR_EMPTY, "source" };
346const StaticQName QN_TIME = { STR_EMPTY, "time" };
347
348const StaticQName QN_XMLNS_CLIENT = { NS_XMLNS, STR_CLIENT };
349const StaticQName QN_XMLNS_SERVER = { NS_XMLNS, STR_SERVER };
350const StaticQName QN_XMLNS_STREAM = { NS_XMLNS, STR_STREAM };
351
352
353// Presence
354const char STR_SHOW_AWAY[] = "away";
355const char STR_SHOW_CHAT[] = "chat";
356const char STR_SHOW_DND[] = "dnd";
357const char STR_SHOW_XA[] = "xa";
358const char STR_SHOW_OFFLINE[] = "offline";
359
360const char NS_GOOGLE_PSTN_CONFERENCE[] = "http://www.google.com/pstn-conference";
361const StaticQName QN_GOOGLE_PSTN_CONFERENCE_STATUS = { NS_GOOGLE_PSTN_CONFERENCE, "status" };
362const StaticQName QN_ATTR_STATUS = { STR_EMPTY, "status" };
363
364// Presence connection status
365const char STR_PSTN_CONFERENCE_STATUS_CONNECTING[] = "connecting";
366const char STR_PSTN_CONFERENCE_STATUS_JOINING[] = "joining";
367const char STR_PSTN_CONFERENCE_STATUS_CONNECTED[] = "connected";
368const char STR_PSTN_CONFERENCE_STATUS_HANGUP[] = "hangup";
369
370// Subscription
371const char STR_SUBSCRIBE[] = "subscribe";
372const char STR_SUBSCRIBED[] = "subscribed";
373const char STR_UNSUBSCRIBE[] = "unsubscribe";
374const char STR_UNSUBSCRIBED[] = "unsubscribed";
375
376// Google Invite
377const char NS_GOOGLE_SUBSCRIBE[] = "google:subscribe";
378const StaticQName QN_INVITATION = { NS_GOOGLE_SUBSCRIBE, "invitation" };
379const StaticQName QN_INVITE_NAME = { NS_GOOGLE_SUBSCRIBE, "name" };
380const StaticQName QN_INVITE_SUBJECT = { NS_GOOGLE_SUBSCRIBE, "subject" };
381const StaticQName QN_INVITE_MESSAGE = { NS_GOOGLE_SUBSCRIBE, "body" };
382
383// Kick
384const char NS_GOOGLE_MUC_ADMIN[] = "google:muc#admin";
385const StaticQName QN_GOOGLE_MUC_ADMIN_QUERY = { NS_GOOGLE_MUC_ADMIN, "query" };
386const StaticQName QN_GOOGLE_MUC_ADMIN_QUERY_ITEM =
387    { NS_GOOGLE_MUC_ADMIN, "item" };
388const StaticQName QN_GOOGLE_MUC_ADMIN_QUERY_ITEM_REASON =
389    { NS_GOOGLE_MUC_ADMIN, "reason" };
390
391// PubSub: http://xmpp.org/extensions/xep-0060.html
392const char NS_PUBSUB[] = "http://jabber.org/protocol/pubsub";
393const StaticQName QN_PUBSUB = { NS_PUBSUB, "pubsub" };
394const StaticQName QN_PUBSUB_ITEMS = { NS_PUBSUB, "items" };
395const StaticQName QN_PUBSUB_ITEM = { NS_PUBSUB, "item" };
396const StaticQName QN_PUBSUB_PUBLISH = { NS_PUBSUB, "publish" };
397const StaticQName QN_PUBSUB_RETRACT = { NS_PUBSUB, "retract" };
398const StaticQName QN_ATTR_PUBLISHER = { STR_EMPTY, "publisher" };
399
400const char NS_PUBSUB_EVENT[] = "http://jabber.org/protocol/pubsub#event";
401const StaticQName QN_NODE = { STR_EMPTY, "node" };
402const StaticQName QN_PUBSUB_EVENT = { NS_PUBSUB_EVENT, "event" };
403const StaticQName QN_PUBSUB_EVENT_ITEMS = { NS_PUBSUB_EVENT, "items" };
404const StaticQName QN_PUBSUB_EVENT_ITEM = { NS_PUBSUB_EVENT, "item" };
405const StaticQName QN_PUBSUB_EVENT_RETRACT = { NS_PUBSUB_EVENT, "retract" };
406const StaticQName QN_NOTIFY = { STR_EMPTY, "notify" };
407
408const char NS_PRESENTER[] = "google:presenter";
409const StaticQName QN_PRESENTER_PRESENTER = { NS_PRESENTER, "presenter" };
410const StaticQName QN_PRESENTER_PRESENTATION_ITEM =
411    { NS_PRESENTER, "presentation-item" };
412const StaticQName QN_PRESENTER_PRESENTATION_TYPE =
413    { NS_PRESENTER, "presentation-type" };
414const StaticQName QN_PRESENTER_PRESENTATION_ID =
415    { NS_PRESENTER, "presentation-id" };
416
417// JEP 0030
418const StaticQName QN_CATEGORY = { STR_EMPTY, "category" };
419const StaticQName QN_VAR = { STR_EMPTY, "var" };
420const char NS_DISCO_INFO[] = "http://jabber.org/protocol/disco#info";
421const char NS_DISCO_ITEMS[] = "http://jabber.org/protocol/disco#items";
422const StaticQName QN_DISCO_INFO_QUERY = { NS_DISCO_INFO, "query" };
423const StaticQName QN_DISCO_IDENTITY = { NS_DISCO_INFO, "identity" };
424const StaticQName QN_DISCO_FEATURE = { NS_DISCO_INFO, "feature" };
425
426const StaticQName QN_DISCO_ITEMS_QUERY = { NS_DISCO_ITEMS, "query" };
427const StaticQName QN_DISCO_ITEM = { NS_DISCO_ITEMS, "item" };
428
429// JEP 0020
430const char NS_FEATURE[] = "http://jabber.org/protocol/feature-neg";
431const StaticQName QN_FEATURE_FEATURE = { NS_FEATURE, "feature" };
432
433// JEP 0004
434const char NS_XDATA[] = "jabber:x:data";
435const StaticQName QN_XDATA_X = { NS_XDATA, "x" };
436const StaticQName QN_XDATA_INSTRUCTIONS = { NS_XDATA, "instructions" };
437const StaticQName QN_XDATA_TITLE = { NS_XDATA, "title" };
438const StaticQName QN_XDATA_FIELD = { NS_XDATA, "field" };
439const StaticQName QN_XDATA_REPORTED = { NS_XDATA, "reported" };
440const StaticQName QN_XDATA_ITEM = { NS_XDATA, "item" };
441const StaticQName QN_XDATA_DESC = { NS_XDATA, "desc" };
442const StaticQName QN_XDATA_REQUIRED = { NS_XDATA, "required" };
443const StaticQName QN_XDATA_VALUE = { NS_XDATA, "value" };
444const StaticQName QN_XDATA_OPTION = { NS_XDATA, "option" };
445
446// JEP 0045
447const char NS_MUC[] = "http://jabber.org/protocol/muc";
448const StaticQName QN_MUC_X = { NS_MUC, "x" };
449const StaticQName QN_MUC_ITEM = { NS_MUC, "item" };
450const StaticQName QN_MUC_AFFILIATION = { NS_MUC, "affiliation" };
451const StaticQName QN_MUC_ROLE = { NS_MUC, "role" };
452const char STR_AFFILIATION_NONE[] = "none";
453const char STR_ROLE_PARTICIPANT[] = "participant";
454
455const char NS_GOOGLE_SESSION[] = "http://www.google.com/session";
456const StaticQName QN_GOOGLE_CIRCLE_ID = { STR_EMPTY, "google-circle-id" };
457const StaticQName QN_GOOGLE_USER_ID = { STR_EMPTY, "google-user-id" };
458const StaticQName QN_GOOGLE_SESSION_BLOCKED = { NS_GOOGLE_SESSION, "blocked" };
459const StaticQName QN_GOOGLE_SESSION_BLOCKING =
460    { NS_GOOGLE_SESSION, "blocking" };
461
462const char NS_MUC_OWNER[] = "http://jabber.org/protocol/muc#owner";
463const StaticQName QN_MUC_OWNER_QUERY = { NS_MUC_OWNER, "query" };
464
465const char NS_MUC_USER[] = "http://jabber.org/protocol/muc#user";
466const StaticQName QN_MUC_USER_CONTINUE = { NS_MUC_USER, "continue" };
467const StaticQName QN_MUC_USER_X = { NS_MUC_USER, "x" };
468const StaticQName QN_MUC_USER_ITEM = { NS_MUC_USER, "item" };
469const StaticQName QN_MUC_USER_STATUS = { NS_MUC_USER, "status" };
470const StaticQName QN_MUC_USER_REASON = { NS_MUC_USER, "reason" };
471const StaticQName QN_MUC_USER_ABUSE_VIOLATION = { NS_MUC_USER, "abuse-violation" };
472
473// JEP 0055 - Jabber Search
474const char NS_SEARCH[] = "jabber:iq:search";
475const StaticQName QN_SEARCH_QUERY = { NS_SEARCH, "query" };
476const StaticQName QN_SEARCH_ITEM = { NS_SEARCH, "item" };
477const StaticQName QN_SEARCH_ROOM_NAME = { NS_SEARCH, "room-name" };
478const StaticQName QN_SEARCH_ROOM_DOMAIN = { NS_SEARCH, "room-domain" };
479const StaticQName QN_SEARCH_ROOM_JID = { NS_SEARCH, "room-jid" };
480const StaticQName QN_SEARCH_HANGOUT_ID = { NS_SEARCH, "hangout-id" };
481const StaticQName QN_SEARCH_EXTERNAL_ID = { NS_SEARCH, "external-id" };
482
483// JEP 0115
484const char NS_CAPS[] = "http://jabber.org/protocol/caps";
485const StaticQName QN_CAPS_C = { NS_CAPS, "c" };
486const StaticQName QN_VER = { STR_EMPTY, "ver" };
487const StaticQName QN_EXT = { STR_EMPTY, "ext" };
488
489// JEP 0153
490const char kNSVCard[] = "vcard-temp:x:update";
491const StaticQName kQnVCardX = { kNSVCard, "x" };
492const StaticQName kQnVCardPhoto = { kNSVCard, "photo" };
493
494// JEP 0172 User Nickname
495const char NS_NICKNAME[] = "http://jabber.org/protocol/nick";
496const StaticQName QN_NICKNAME = { NS_NICKNAME, "nick" };
497
498// JEP 0085 chat state
499const char NS_CHATSTATE[] = "http://jabber.org/protocol/chatstates";
500const StaticQName QN_CS_ACTIVE = { NS_CHATSTATE, "active" };
501const StaticQName QN_CS_COMPOSING = { NS_CHATSTATE, "composing" };
502const StaticQName QN_CS_PAUSED = { NS_CHATSTATE, "paused" };
503const StaticQName QN_CS_INACTIVE = { NS_CHATSTATE, "inactive" };
504const StaticQName QN_CS_GONE = { NS_CHATSTATE, "gone" };
505
506// JEP 0091 Delayed Delivery
507const char kNSDelay[] = "jabber:x:delay";
508const StaticQName kQnDelayX = { kNSDelay, "x" };
509const StaticQName kQnStamp = { STR_EMPTY, "stamp" };
510
511// Google time stamping (higher resolution)
512const char kNSTimestamp[] = "google:timestamp";
513const StaticQName kQnTime = { kNSTimestamp, "time" };
514const StaticQName kQnMilliseconds = { STR_EMPTY, "ms" };
515
516// Jingle Info
517const char NS_JINGLE_INFO[] = "google:jingleinfo";
518const StaticQName QN_JINGLE_INFO_QUERY = { NS_JINGLE_INFO, "query" };
519const StaticQName QN_JINGLE_INFO_STUN = { NS_JINGLE_INFO, "stun" };
520const StaticQName QN_JINGLE_INFO_RELAY = { NS_JINGLE_INFO, "relay" };
521const StaticQName QN_JINGLE_INFO_SERVER = { NS_JINGLE_INFO, "server" };
522const StaticQName QN_JINGLE_INFO_TOKEN = { NS_JINGLE_INFO, "token" };
523const StaticQName QN_JINGLE_INFO_HOST = { STR_EMPTY, "host" };
524const StaticQName QN_JINGLE_INFO_TCP = { STR_EMPTY, "tcp" };
525const StaticQName QN_JINGLE_INFO_UDP = { STR_EMPTY, "udp" };
526const StaticQName QN_JINGLE_INFO_TCPSSL = { STR_EMPTY, "tcpssl" };
527
528// Call Performance Logging
529const char NS_GOOGLE_CALLPERF_STATS[] = "google:call-perf-stats";
530const StaticQName QN_CALLPERF_STATS =
531    { NS_GOOGLE_CALLPERF_STATS, "callPerfStats" };
532const StaticQName QN_CALLPERF_SESSIONID = { STR_EMPTY, "sessionId" };
533const StaticQName QN_CALLPERF_LOCALUSER = { STR_EMPTY, "localUser" };
534const StaticQName QN_CALLPERF_REMOTEUSER = { STR_EMPTY, "remoteUser" };
535const StaticQName QN_CALLPERF_STARTTIME = { STR_EMPTY, "startTime" };
536const StaticQName QN_CALLPERF_CALL_LENGTH = { STR_EMPTY, "callLength" };
537const StaticQName QN_CALLPERF_CALL_ACCEPTED = { STR_EMPTY, "callAccepted" };
538const StaticQName QN_CALLPERF_CALL_ERROR_CODE = { STR_EMPTY, "callErrorCode" };
539const StaticQName QN_CALLPERF_TERMINATE_CODE = { STR_EMPTY, "terminateCode" };
540const StaticQName QN_CALLPERF_DATAPOINT =
541    { NS_GOOGLE_CALLPERF_STATS, "dataPoint" };
542const StaticQName QN_CALLPERF_DATAPOINT_TIME = { STR_EMPTY, "timeStamp" };
543const StaticQName QN_CALLPERF_DATAPOINT_FRACTION_LOST =
544    { STR_EMPTY, "fraction_lost" };
545const StaticQName QN_CALLPERF_DATAPOINT_CUM_LOST = { STR_EMPTY, "cum_lost" };
546const StaticQName QN_CALLPERF_DATAPOINT_EXT_MAX = { STR_EMPTY, "ext_max" };
547const StaticQName QN_CALLPERF_DATAPOINT_JITTER = { STR_EMPTY, "jitter" };
548const StaticQName QN_CALLPERF_DATAPOINT_RTT = { STR_EMPTY, "RTT" };
549const StaticQName QN_CALLPERF_DATAPOINT_BYTES_R =
550    { STR_EMPTY, "bytesReceived" };
551const StaticQName QN_CALLPERF_DATAPOINT_PACKETS_R =
552    { STR_EMPTY, "packetsReceived" };
553const StaticQName QN_CALLPERF_DATAPOINT_BYTES_S = { STR_EMPTY, "bytesSent" };
554const StaticQName QN_CALLPERF_DATAPOINT_PACKETS_S =
555    { STR_EMPTY, "packetsSent" };
556const StaticQName QN_CALLPERF_DATAPOINT_PROCESS_CPU =
557    { STR_EMPTY, "processCpu" };
558const StaticQName QN_CALLPERF_DATAPOINT_SYSTEM_CPU = { STR_EMPTY, "systemCpu" };
559const StaticQName QN_CALLPERF_DATAPOINT_CPUS = { STR_EMPTY, "cpus" };
560const StaticQName QN_CALLPERF_CONNECTION =
561    { NS_GOOGLE_CALLPERF_STATS, "connection" };
562const StaticQName QN_CALLPERF_CONNECTION_LOCAL_ADDRESS =
563    { STR_EMPTY, "localAddress" };
564const StaticQName QN_CALLPERF_CONNECTION_REMOTE_ADDRESS =
565    { STR_EMPTY, "remoteAddress" };
566const StaticQName QN_CALLPERF_CONNECTION_FLAGS = { STR_EMPTY, "flags" };
567const StaticQName QN_CALLPERF_CONNECTION_RTT = { STR_EMPTY, "rtt" };
568const StaticQName QN_CALLPERF_CONNECTION_TOTAL_BYTES_S =
569    { STR_EMPTY, "totalBytesSent" };
570const StaticQName QN_CALLPERF_CONNECTION_BYTES_SECOND_S =
571    { STR_EMPTY, "bytesSecondSent" };
572const StaticQName QN_CALLPERF_CONNECTION_TOTAL_BYTES_R =
573    { STR_EMPTY, "totalBytesRecv" };
574const StaticQName QN_CALLPERF_CONNECTION_BYTES_SECOND_R =
575    { STR_EMPTY, "bytesSecondRecv" };
576const StaticQName QN_CALLPERF_CANDIDATE =
577    { NS_GOOGLE_CALLPERF_STATS, "candidate" };
578const StaticQName QN_CALLPERF_CANDIDATE_ENDPOINT = { STR_EMPTY, "endpoint" };
579const StaticQName QN_CALLPERF_CANDIDATE_PROTOCOL = { STR_EMPTY, "protocol" };
580const StaticQName QN_CALLPERF_CANDIDATE_ADDRESS = { STR_EMPTY, "address" };
581const StaticQName QN_CALLPERF_MEDIA = { NS_GOOGLE_CALLPERF_STATS, "media" };
582const StaticQName QN_CALLPERF_MEDIA_DIRECTION = { STR_EMPTY, "direction" };
583const StaticQName QN_CALLPERF_MEDIA_SSRC = { STR_EMPTY, "SSRC" };
584const StaticQName QN_CALLPERF_MEDIA_ENERGY = { STR_EMPTY, "energy" };
585const StaticQName QN_CALLPERF_MEDIA_FIR = { STR_EMPTY, "fir" };
586const StaticQName QN_CALLPERF_MEDIA_NACK = { STR_EMPTY, "nack" };
587const StaticQName QN_CALLPERF_MEDIA_FPS = { STR_EMPTY, "fps" };
588const StaticQName QN_CALLPERF_MEDIA_FPS_NETWORK = { STR_EMPTY, "fpsNetwork" };
589const StaticQName QN_CALLPERF_MEDIA_FPS_DECODED = { STR_EMPTY, "fpsDecoded" };
590const StaticQName QN_CALLPERF_MEDIA_JITTER_BUFFER_SIZE =
591    { STR_EMPTY, "jitterBufferSize" };
592const StaticQName QN_CALLPERF_MEDIA_PREFERRED_JITTER_BUFFER_SIZE =
593    { STR_EMPTY, "preferredJitterBufferSize" };
594const StaticQName QN_CALLPERF_MEDIA_TOTAL_PLAYOUT_DELAY =
595    { STR_EMPTY, "totalPlayoutDelay" };
596
597// Muc invites.
598const StaticQName QN_MUC_USER_INVITE = { NS_MUC_USER, "invite" };
599
600// Multiway audio/video.
601const char NS_GOOGLE_MUC_USER[] = "google:muc#user";
602const StaticQName QN_GOOGLE_MUC_USER_AVAILABLE_MEDIA =
603    { NS_GOOGLE_MUC_USER, "available-media" };
604const StaticQName QN_GOOGLE_MUC_USER_ENTRY = { NS_GOOGLE_MUC_USER, "entry" };
605const StaticQName QN_GOOGLE_MUC_USER_MEDIA = { NS_GOOGLE_MUC_USER, "media" };
606const StaticQName QN_GOOGLE_MUC_USER_TYPE = { NS_GOOGLE_MUC_USER, "type" };
607const StaticQName QN_GOOGLE_MUC_USER_SRC_ID = { NS_GOOGLE_MUC_USER, "src-id" };
608const StaticQName QN_GOOGLE_MUC_USER_STATUS = { NS_GOOGLE_MUC_USER, "status" };
609const StaticQName QN_CLIENT_VERSION = { NS_GOOGLE_MUC_USER, "client-version" };
610const StaticQName QN_LOCALE = { NS_GOOGLE_MUC_USER, "locale" };
611const StaticQName QN_LABEL = { STR_EMPTY, "label" };
612
613const char NS_GOOGLE_MUC_MEDIA[] = "google:muc#media";
614const StaticQName QN_GOOGLE_MUC_AUDIO_MUTE =
615    { NS_GOOGLE_MUC_MEDIA, "audio-mute" };
616const StaticQName QN_GOOGLE_MUC_VIDEO_MUTE =
617    { NS_GOOGLE_MUC_MEDIA, "video-mute" };
618const StaticQName QN_GOOGLE_MUC_VIDEO_PAUSE =
619    { NS_GOOGLE_MUC_MEDIA, "video-pause" };
620const StaticQName QN_GOOGLE_MUC_RECORDING =
621    { NS_GOOGLE_MUC_MEDIA, "recording" };
622const StaticQName QN_GOOGLE_MUC_MEDIA_BLOCK = { NS_GOOGLE_MUC_MEDIA, "block" };
623const StaticQName QN_STATE_ATTR = { STR_EMPTY, "state" };
624
625const char AUTH_MECHANISM_GOOGLE_COOKIE[] = "X-GOOGLE-COOKIE";
626const char AUTH_MECHANISM_GOOGLE_TOKEN[] = "X-GOOGLE-TOKEN";
627const char AUTH_MECHANISM_OAUTH2[] = "X-OAUTH2";
628const char AUTH_MECHANISM_PLAIN[] = "PLAIN";
629
630}  // namespace buzz
631