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