Home | History | Annotate | Download | only in base
      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 <string>
     29 
     30 #include "talk/p2p/base/constants.h"
     31 #include "talk/xmllite/qname.h"
     32 
     33 namespace cricket {
     34 
     35 const std::string NS_EMPTY("");
     36 const std::string NS_JINGLE("urn:xmpp:jingle:1");
     37 const std::string NS_GINGLE("http://www.google.com/session");
     38 
     39 // actions (aka <session> or <jingle>)
     40 const buzz::QName QN_ACTION(true, NS_EMPTY, "action");
     41 const std::string LN_INITIATOR("initiator");
     42 const buzz::QName QN_INITIATOR(true, NS_EMPTY, LN_INITIATOR);
     43 const buzz::QName QN_CREATOR(true, NS_EMPTY, "creator");
     44 
     45 const buzz::QName QN_JINGLE(true, NS_JINGLE, "jingle");
     46 const buzz::QName QN_JINGLE_CONTENT(true, NS_JINGLE, "content");
     47 const buzz::QName QN_JINGLE_CONTENT_NAME(true, NS_EMPTY, "name");
     48 const buzz::QName QN_JINGLE_CONTENT_MEDIA(true, NS_EMPTY, "media");
     49 const buzz::QName QN_JINGLE_REASON(true, NS_JINGLE, "reason");
     50 const std::string JINGLE_CONTENT_MEDIA_AUDIO("audio");
     51 const std::string JINGLE_CONTENT_MEDIA_VIDEO("video");
     52 const std::string JINGLE_ACTION_SESSION_INITIATE("session-initiate");
     53 const std::string JINGLE_ACTION_SESSION_INFO("session-info");
     54 const std::string JINGLE_ACTION_SESSION_ACCEPT("session-accept");
     55 const std::string JINGLE_ACTION_SESSION_TERMINATE("session-terminate");
     56 const std::string JINGLE_ACTION_TRANSPORT_INFO("transport-info");
     57 const std::string JINGLE_ACTION_TRANSPORT_ACCEPT("transport-accept");
     58 
     59 const buzz::QName QN_GINGLE_SESSION(true, NS_GINGLE, "session");
     60 const std::string GINGLE_ACTION_INITIATE("initiate");
     61 const std::string GINGLE_ACTION_INFO("info");
     62 const std::string GINGLE_ACTION_ACCEPT("accept");
     63 const std::string GINGLE_ACTION_REJECT("reject");
     64 const std::string GINGLE_ACTION_TERMINATE("terminate");
     65 const std::string GINGLE_ACTION_CANDIDATES("candidates");
     66 const std::string GINGLE_ACTION_NOTIFY("notify");
     67 const std::string GINGLE_ACTION_UPDATE("update");
     68 const std::string GINGLE_ACTION_VIEW("view");
     69 
     70 const std::string LN_ERROR("error");
     71 const buzz::QName QN_GINGLE_REDIRECT(true, NS_GINGLE, "redirect");
     72 const std::string STR_REDIRECT_PREFIX("xmpp:");
     73 
     74 // Session Contents (aka Gingle <session><description>
     75 //                   or Jingle <content><description>)
     76 const std::string LN_DESCRIPTION("description");
     77 const std::string LN_PAYLOADTYPE("payload-type");
     78 const buzz::QName QN_ID(true, NS_EMPTY, "id");
     79 const buzz::QName QN_SID(true, NS_EMPTY, "sid");
     80 const buzz::QName QN_NAME(true, NS_EMPTY, "name");
     81 const buzz::QName QN_CLOCKRATE(true, NS_EMPTY, "clockrate");
     82 const buzz::QName QN_BITRATE(true, NS_EMPTY, "bitrate");
     83 const buzz::QName QN_CHANNELS(true, NS_EMPTY, "channels");
     84 const buzz::QName QN_WIDTH(true, NS_EMPTY, "width");
     85 const buzz::QName QN_HEIGHT(true, NS_EMPTY, "height");
     86 const buzz::QName QN_FRAMERATE(true, NS_EMPTY, "framerate");
     87 const std::string LN_NAME("name");
     88 const std::string LN_VALUE("value");
     89 const buzz::QName QN_PAYLOADTYPE_PARAMETER_NAME(true, NS_EMPTY, LN_NAME);
     90 const buzz::QName QN_PAYLOADTYPE_PARAMETER_VALUE(true, NS_EMPTY, LN_VALUE);
     91 const std::string PAYLOADTYPE_PARAMETER_BITRATE("bitrate");
     92 const std::string PAYLOADTYPE_PARAMETER_HEIGHT("height");
     93 const std::string PAYLOADTYPE_PARAMETER_WIDTH("width");
     94 const std::string PAYLOADTYPE_PARAMETER_FRAMERATE("framerate");
     95 const std::string LN_BANDWIDTH("bandwidth");
     96 
     97 const std::string CN_AUDIO("audio");
     98 const std::string CN_VIDEO("video");
     99 const std::string CN_OTHER("main");
    100 
    101 const std::string NS_JINGLE_RTP("urn:xmpp:jingle:apps:rtp:1");
    102 const buzz::QName QN_JINGLE_RTP_CONTENT(
    103     true, NS_JINGLE_RTP, LN_DESCRIPTION);
    104 const buzz::QName QN_JINGLE_RTP_PAYLOADTYPE(
    105     true, NS_JINGLE_RTP, LN_PAYLOADTYPE);
    106 const buzz::QName QN_JINGLE_RTP_BANDWIDTH(
    107     true, NS_JINGLE_RTP, LN_BANDWIDTH);
    108 const buzz::QName QN_PARAMETER(true, NS_JINGLE_RTP, "parameter");
    109 
    110 const std::string NS_GINGLE_AUDIO("http://www.google.com/session/phone");
    111 const buzz::QName QN_GINGLE_AUDIO_CONTENT(
    112     true, NS_GINGLE_AUDIO, LN_DESCRIPTION);
    113 const buzz::QName QN_GINGLE_AUDIO_PAYLOADTYPE(
    114     true, NS_GINGLE_AUDIO, LN_PAYLOADTYPE);
    115 const buzz::QName QN_GINGLE_AUDIO_SRCID(true, NS_GINGLE_AUDIO, "src-id");
    116 const std::string NS_GINGLE_VIDEO("http://www.google.com/session/video");
    117 const buzz::QName QN_GINGLE_VIDEO_CONTENT(
    118     true, NS_GINGLE_VIDEO, LN_DESCRIPTION);
    119 const buzz::QName QN_GINGLE_VIDEO_PAYLOADTYPE(
    120     true, NS_GINGLE_VIDEO, LN_PAYLOADTYPE);
    121 const buzz::QName QN_GINGLE_VIDEO_SRCID(true, NS_GINGLE_VIDEO, "src-id");
    122 const buzz::QName QN_GINGLE_VIDEO_BANDWIDTH(
    123     true, NS_GINGLE_VIDEO, LN_BANDWIDTH);
    124 
    125 // Crypto support.
    126 const buzz::QName QN_ENCRYPTION(true, NS_JINGLE_RTP, "encryption");
    127 const buzz::QName QN_ENCRYPTION_REQUIRED(true, NS_EMPTY, "required");
    128 const buzz::QName QN_CRYPTO(true, NS_JINGLE_RTP, "crypto");
    129 const buzz::QName QN_GINGLE_AUDIO_CRYPTO_USAGE(true, NS_GINGLE_AUDIO, "usage");
    130 const buzz::QName QN_GINGLE_VIDEO_CRYPTO_USAGE(true, NS_GINGLE_VIDEO, "usage");
    131 const buzz::QName QN_CRYPTO_SUITE(true, NS_EMPTY, "crypto-suite");
    132 const buzz::QName QN_CRYPTO_KEY_PARAMS(true, NS_EMPTY, "key-params");
    133 const buzz::QName QN_CRYPTO_TAG(true, NS_EMPTY, "tag");
    134 const buzz::QName QN_CRYPTO_SESSION_PARAMS(true, NS_EMPTY, "session-params");
    135 
    136 // transports and candidates
    137 const std::string LN_TRANSPORT("transport");
    138 const std::string LN_CANDIDATE("candidate");
    139 const buzz::QName QN_UFRAG(true, cricket::NS_EMPTY, "ufrag");
    140 const buzz::QName QN_PWD(true, cricket::NS_EMPTY, "pwd");
    141 const buzz::QName QN_COMPONENT(true, cricket::NS_EMPTY, "component");
    142 const buzz::QName QN_IP(true, cricket::NS_EMPTY, "ip");
    143 const buzz::QName QN_PORT(true, cricket::NS_EMPTY, "port");
    144 const buzz::QName QN_NETWORK(true, cricket::NS_EMPTY, "network");
    145 const buzz::QName QN_GENERATION(true, cricket::NS_EMPTY, "generation");
    146 const buzz::QName QN_PRIORITY(true, cricket::NS_EMPTY, "priority");
    147 const buzz::QName QN_PROTOCOL(true, cricket::NS_EMPTY, "protocol");
    148 const std::string JINGLE_CANDIDATE_TYPE_PEER_STUN("prflx");
    149 const std::string JINGLE_CANDIDATE_TYPE_SERVER_STUN("srflx");
    150 const std::string JINGLE_CANDIDATE_NAME_RTP("1");
    151 const std::string JINGLE_CANDIDATE_NAME_RTCP("2");
    152 
    153 // TODO Once we are full ICE-UDP compliant, use this namespace.
    154 // For now, just use the same as NS_GINGLE_P2P.
    155 // const std::string NS_JINGLE_ICE_UDP("urn:xmpp:jingle:transports:ice-udp:1");
    156 const std::string NS_GINGLE_P2P("http://www.google.com/transport/p2p");
    157 const buzz::QName QN_GINGLE_P2P_TRANSPORT(true, NS_GINGLE_P2P, LN_TRANSPORT);
    158 const buzz::QName QN_GINGLE_P2P_CANDIDATE(true, NS_GINGLE_P2P, LN_CANDIDATE);
    159 const buzz::QName QN_GINGLE_P2P_UNKNOWN_CHANNEL_NAME(
    160     true, NS_GINGLE_P2P, "unknown-channel-name");
    161 const buzz::QName QN_GINGLE_CANDIDATE(true, NS_GINGLE, LN_CANDIDATE);
    162 const buzz::QName QN_ADDRESS(true, cricket::NS_EMPTY, "address");
    163 const buzz::QName QN_USERNAME(true, cricket::NS_EMPTY, "username");
    164 const buzz::QName QN_PASSWORD(true, cricket::NS_EMPTY, "password");
    165 const buzz::QName QN_PREFERENCE(true, cricket::NS_EMPTY, "preference");
    166 const std::string GINGLE_CANDIDATE_TYPE_STUN("stun");
    167 const std::string GINGLE_CANDIDATE_NAME_RTP("rtp");
    168 const std::string GINGLE_CANDIDATE_NAME_RTCP("rtcp");
    169 const std::string GINGLE_CANDIDATE_NAME_VIDEO_RTP("video_rtp");
    170 const std::string GINGLE_CANDIDATE_NAME_VIDEO_RTCP("video_rtcp");
    171 
    172 // terminate reasons and errors
    173 const std::string JINGLE_ERROR_BAD_REQUEST("bad-request");
    174 const std::string JINGLE_ERROR_OUT_OF_ORDER("out-of-order");
    175 const std::string JINGLE_ERROR_UNKNOWN_SESSION("unknown-session");
    176 
    177 // Call terminate reasons from XEP-166
    178 const std::string STR_TERMINATE_DECLINE("decline");
    179 const std::string STR_TERMINATE_SUCCESS("success");
    180 const std::string STR_TERMINATE_ERROR("general-error");
    181 const std::string STR_TERMINATE_INCOMPATIBLE_PARAMETERS(
    182     "incompatible-parameters");
    183 
    184 // Old terminate reasons used by cricket
    185 const std::string STR_TERMINATE_CALL_ENDED("call-ended");
    186 const std::string STR_TERMINATE_RECIPIENT_UNAVAILABLE("recipient-unavailable");
    187 const std::string STR_TERMINATE_RECIPIENT_BUSY("recipient-busy");
    188 const std::string STR_TERMINATE_INSUFFICIENT_FUNDS("insufficient-funds");
    189 const std::string STR_TERMINATE_NUMBER_MALFORMED("number-malformed");
    190 const std::string STR_TERMINATE_NUMBER_DISALLOWED("number-disallowed");
    191 const std::string STR_TERMINATE_PROTOCOL_ERROR("protocol-error");
    192 const std::string STR_TERMINATE_INTERNAL_SERVER_ERROR("internal-server-error");
    193 const std::string STR_TERMINATE_UNKNOWN_ERROR("unknown-error");
    194 
    195 // Session notify messages
    196 const buzz::QName QN_GINGLE_NOTIFY(true, NS_GINGLE, "notify");
    197 const buzz::QName QN_GINGLE_NOTIFY_NICK(true, cricket::NS_EMPTY, "nick");
    198 const buzz::QName QN_GINGLE_NOTIFY_SOURCE(true, NS_GINGLE, "source");
    199 const buzz::QName QN_GINGLE_NOTIFY_SOURCE_MTYPE(
    200     true, cricket::NS_EMPTY, "mtype");
    201 const buzz::QName QN_GINGLE_NOTIFY_SOURCE_SSRC(true, cricket::NS_EMPTY, "ssrc");
    202 const std::string GINGLE_NOTIFY_SOURCE_MTYPE_AUDIO("audio");
    203 const std::string GINGLE_NOTIFY_SOURCE_MTYPE_VIDEO("video");
    204 
    205 // Session view messages
    206 const buzz::QName QN_GINGLE_VIEW(true, cricket::NS_EMPTY, "view");
    207 const buzz::QName QN_GINGLE_VIEW_TYPE(true, cricket::NS_EMPTY, "type");
    208 const buzz::QName QN_GINGLE_VIEW_NICK(true, cricket::NS_EMPTY, "nick");
    209 const buzz::QName QN_GINGLE_VIEW_MEDIA_TYPE(true, cricket::NS_EMPTY, "mtype");
    210 const buzz::QName QN_GINGLE_VIEW_SSRC(true, cricket::NS_EMPTY, "ssrc");
    211 const std::string GINGLE_VIEW_TYPE_STATIC("static");
    212 const std::string GINGLE_VIEW_TYPE_DYNAMIC("dynamic");
    213 const std::string GINGLE_VIEW_MEDIA_TYPE_AUDIO("audio");
    214 const std::string GINGLE_VIEW_MEDIA_TYPE_VIDEO("video");
    215 const buzz::QName QN_GINGLE_VIEW_PARAMS(true, cricket::NS_EMPTY, "params");
    216 const buzz::QName QN_GINGLE_VIEW_PARAMS_WIDTH(true, cricket::NS_EMPTY, "width");
    217 const buzz::QName QN_GINGLE_VIEW_PARAMS_HEIGHT(
    218     true, cricket::NS_EMPTY, "height");
    219 const buzz::QName QN_GINGLE_VIEW_PARAMS_FRAMERATE(
    220     true, cricket::NS_EMPTY, "framerate");
    221 
    222 
    223 // old stuff
    224 #ifdef FEATURE_ENABLE_VOICEMAIL
    225 const std::string NS_VOICEMAIL("http://www.google.com/session/voicemail");
    226 const buzz::QName QN_VOICEMAIL_REGARDING(true, NS_VOICEMAIL, "regarding");
    227 #endif
    228 
    229 }  // namespace cricket
    230