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