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 #ifndef TALK_P2P_BASE_CONSTANTS_H_
     29 #define TALK_P2P_BASE_CONSTANTS_H_
     30 
     31 #include <string>
     32 #include "talk/xmllite/qname.h"
     33 
     34 // This file contains constants related to signaling that are used in various
     35 // classes in this directory.
     36 
     37 namespace cricket {
     38 
     39 // NS_ == namespace
     40 // QN_ == buzz::QName (namespace + name)
     41 // LN_ == "local name" == QName::LocalPart()
     42 //   these are useful when you need to find a tag
     43 //   that has different namespaces (like <description> or <transport>)
     44 
     45 extern const std::string NS_EMPTY;
     46 extern const std::string NS_JINGLE;
     47 extern const std::string NS_GINGLE;
     48 
     49 enum SignalingProtocol {
     50   PROTOCOL_JINGLE,
     51   PROTOCOL_GINGLE,
     52   PROTOCOL_HYBRID,
     53 };
     54 
     55 // actions (aka Gingle <session> or Jingle <jingle>)
     56 extern const buzz::QName QN_ACTION;
     57 extern const std::string LN_INITIATOR;
     58 extern const buzz::QName QN_INITIATOR;
     59 extern const buzz::QName QN_CREATOR;
     60 
     61 extern const buzz::QName QN_JINGLE;
     62 extern const buzz::QName QN_JINGLE_CONTENT;
     63 extern const buzz::QName QN_JINGLE_CONTENT_NAME;
     64 extern const buzz::QName QN_JINGLE_CONTENT_MEDIA;
     65 extern const buzz::QName QN_JINGLE_REASON;
     66 extern const std::string JINGLE_CONTENT_MEDIA_AUDIO;
     67 extern const std::string JINGLE_CONTENT_MEDIA_VIDEO;
     68 extern const std::string JINGLE_ACTION_SESSION_INITIATE;
     69 extern const std::string JINGLE_ACTION_SESSION_INFO;
     70 extern const std::string JINGLE_ACTION_SESSION_ACCEPT;
     71 extern const std::string JINGLE_ACTION_SESSION_TERMINATE;
     72 extern const std::string JINGLE_ACTION_TRANSPORT_INFO;
     73 extern const std::string JINGLE_ACTION_TRANSPORT_ACCEPT;
     74 
     75 extern const buzz::QName QN_GINGLE_SESSION;
     76 extern const std::string GINGLE_ACTION_INITIATE;
     77 extern const std::string GINGLE_ACTION_INFO;
     78 extern const std::string GINGLE_ACTION_ACCEPT;
     79 extern const std::string GINGLE_ACTION_REJECT;
     80 extern const std::string GINGLE_ACTION_TERMINATE;
     81 extern const std::string GINGLE_ACTION_CANDIDATES;
     82 extern const std::string GINGLE_ACTION_NOTIFY;
     83 extern const std::string GINGLE_ACTION_UPDATE;
     84 extern const std::string GINGLE_ACTION_VIEW;
     85 
     86 extern const std::string LN_ERROR;
     87 extern const buzz::QName QN_GINGLE_REDIRECT;
     88 extern const std::string STR_REDIRECT_PREFIX;
     89 
     90 // Session Contents (aka Gingle <session><description>
     91 //                   or Jingle <content><description>)
     92 extern const std::string LN_DESCRIPTION;
     93 extern const std::string LN_PAYLOADTYPE;
     94 extern const buzz::QName QN_ID;
     95 extern const buzz::QName QN_SID;
     96 extern const buzz::QName QN_NAME;
     97 extern const buzz::QName QN_CLOCKRATE;
     98 extern const buzz::QName QN_BITRATE;
     99 extern const buzz::QName QN_CHANNELS;
    100 extern const buzz::QName QN_WIDTH;
    101 extern const buzz::QName QN_HEIGHT;
    102 extern const buzz::QName QN_FRAMERATE;
    103 extern const buzz::QName QN_PARAMETER;
    104 extern const std::string LN_NAME;
    105 extern const std::string LN_VALUE;
    106 extern const buzz::QName QN_PAYLOADTYPE_PARAMETER_NAME;
    107 extern const buzz::QName QN_PAYLOADTYPE_PARAMETER_VALUE;
    108 extern const std::string PAYLOADTYPE_PARAMETER_BITRATE;
    109 extern const std::string PAYLOADTYPE_PARAMETER_HEIGHT;
    110 extern const std::string PAYLOADTYPE_PARAMETER_WIDTH;
    111 extern const std::string PAYLOADTYPE_PARAMETER_FRAMERATE;
    112 extern const std::string LN_BANDWIDTH;
    113 
    114 // CN_ == "content name".  When we initiate a session, we choose the
    115 // name, and when we receive a Gingle session, we provide default
    116 // names (since Gingle has no content names).  But when we receive a
    117 // Jingle call, the content name can be anything, so don't rely on
    118 // these values being the same as the ones received.
    119 extern const std::string CN_AUDIO;
    120 extern const std::string CN_VIDEO;
    121 extern const std::string CN_OTHER;
    122 
    123 extern const std::string NS_JINGLE_RTP;
    124 extern const buzz::QName QN_JINGLE_RTP_CONTENT;
    125 extern const buzz::QName QN_JINGLE_RTP_PAYLOADTYPE;
    126 extern const buzz::QName QN_JINGLE_RTP_BANDWIDTH;
    127 
    128 extern const std::string NS_GINGLE_AUDIO;
    129 extern const buzz::QName QN_GINGLE_AUDIO_CONTENT;
    130 extern const buzz::QName QN_GINGLE_AUDIO_PAYLOADTYPE;
    131 extern const buzz::QName QN_GINGLE_AUDIO_SRCID;
    132 extern const std::string NS_GINGLE_VIDEO;
    133 extern const buzz::QName QN_GINGLE_VIDEO_CONTENT;
    134 extern const buzz::QName QN_GINGLE_VIDEO_PAYLOADTYPE;
    135 extern const buzz::QName QN_GINGLE_VIDEO_SRCID;
    136 extern const buzz::QName QN_GINGLE_VIDEO_BANDWIDTH;
    137 
    138 // Crypto support.
    139 extern const buzz::QName QN_ENCRYPTION;
    140 extern const buzz::QName QN_ENCRYPTION_REQUIRED;
    141 extern const buzz::QName QN_CRYPTO;
    142 extern const buzz::QName QN_GINGLE_AUDIO_CRYPTO_USAGE;
    143 extern const buzz::QName QN_GINGLE_VIDEO_CRYPTO_USAGE;
    144 extern const buzz::QName QN_CRYPTO_SUITE;
    145 extern const buzz::QName QN_CRYPTO_KEY_PARAMS;
    146 extern const buzz::QName QN_CRYPTO_TAG;
    147 extern const buzz::QName QN_CRYPTO_SESSION_PARAMS;
    148 
    149 // transports and candidates
    150 extern const std::string LN_TRANSPORT;
    151 extern const std::string LN_CANDIDATE;
    152 extern const buzz::QName QN_JINGLE_P2P_TRANSPORT;
    153 extern const buzz::QName QN_JINGLE_P2P_CANDIDATE;
    154 extern const buzz::QName QN_UFRAG;
    155 extern const buzz::QName QN_COMPONENT;
    156 extern const buzz::QName QN_PWD;
    157 extern const buzz::QName QN_IP;
    158 extern const buzz::QName QN_PORT;
    159 extern const buzz::QName QN_NETWORK;
    160 extern const buzz::QName QN_GENERATION;
    161 extern const buzz::QName QN_PRIORITY;
    162 extern const buzz::QName QN_PROTOCOL;
    163 extern const std::string JINGLE_CANDIDATE_TYPE_PEER_STUN;
    164 extern const std::string JINGLE_CANDIDATE_TYPE_SERVER_STUN;
    165 extern const std::string JINGLE_CANDIDATE_NAME_RTP;
    166 extern const std::string JINGLE_CANDIDATE_NAME_RTCP;
    167 
    168 extern const std::string NS_GINGLE_P2P;
    169 extern const buzz::QName QN_GINGLE_P2P_TRANSPORT;
    170 extern const buzz::QName QN_GINGLE_P2P_CANDIDATE;
    171 extern const buzz::QName QN_GINGLE_P2P_UNKNOWN_CHANNEL_NAME;
    172 extern const buzz::QName QN_GINGLE_CANDIDATE;
    173 extern const buzz::QName QN_ADDRESS;
    174 extern const buzz::QName QN_USERNAME;
    175 extern const buzz::QName QN_PASSWORD;
    176 extern const buzz::QName QN_PREFERENCE;
    177 extern const std::string GINGLE_CANDIDATE_TYPE_STUN;
    178 extern const std::string GINGLE_CANDIDATE_NAME_RTP;
    179 extern const std::string GINGLE_CANDIDATE_NAME_RTCP;
    180 extern const std::string GINGLE_CANDIDATE_NAME_VIDEO_RTP;
    181 extern const std::string GINGLE_CANDIDATE_NAME_VIDEO_RTCP;
    182 
    183 extern const std::string NS_GINGLE_RAW;
    184 extern const buzz::QName QN_GINGLE_RAW_TRANSPORT;
    185 extern const buzz::QName QN_GINGLE_RAW_CHANNEL;
    186 
    187 // terminate reasons and errors: see http://xmpp.org/extensions/xep-0166.html
    188 extern const std::string JINGLE_ERROR_BAD_REQUEST;  // like parse error
    189 // got transport-info before session-initiate, for example
    190 extern const std::string JINGLE_ERROR_OUT_OF_ORDER;
    191 extern const std::string JINGLE_ERROR_UNKNOWN_SESSION;
    192 
    193 // Call terminate reasons from XEP-166
    194 extern const std::string STR_TERMINATE_DECLINE;  // polite reject
    195 extern const std::string STR_TERMINATE_SUCCESS;  // polite hangup
    196 extern const std::string STR_TERMINATE_ERROR;  // something bad happened
    197 extern const std::string STR_TERMINATE_INCOMPATIBLE_PARAMETERS;  // no codecs?
    198 
    199 // Old terminate reasons used by cricket
    200 extern const std::string STR_TERMINATE_CALL_ENDED;
    201 extern const std::string STR_TERMINATE_RECIPIENT_UNAVAILABLE;
    202 extern const std::string STR_TERMINATE_RECIPIENT_BUSY;
    203 extern const std::string STR_TERMINATE_INSUFFICIENT_FUNDS;
    204 extern const std::string STR_TERMINATE_NUMBER_MALFORMED;
    205 extern const std::string STR_TERMINATE_NUMBER_DISALLOWED;
    206 extern const std::string STR_TERMINATE_PROTOCOL_ERROR;
    207 extern const std::string STR_TERMINATE_INTERNAL_SERVER_ERROR;
    208 extern const std::string STR_TERMINATE_UNKNOWN_ERROR;
    209 
    210 // Session notify messages
    211 extern const buzz::QName QN_GINGLE_NOTIFY;
    212 extern const buzz::QName QN_GINGLE_NOTIFY_NICK;
    213 extern const buzz::QName QN_GINGLE_NOTIFY_SOURCE;
    214 extern const buzz::QName QN_GINGLE_NOTIFY_SOURCE_MTYPE;
    215 extern const buzz::QName QN_GINGLE_NOTIFY_SOURCE_SSRC;
    216 extern const std::string GINGLE_NOTIFY_SOURCE_MTYPE_AUDIO;
    217 extern const std::string GINGLE_NOTIFY_SOURCE_MTYPE_VIDEO;
    218 
    219 // Session view messages
    220 extern const buzz::QName QN_GINGLE_VIEW;
    221 extern const buzz::QName QN_GINGLE_VIEW_TYPE;
    222 extern const buzz::QName QN_GINGLE_VIEW_NICK;
    223 extern const buzz::QName QN_GINGLE_VIEW_MEDIA_TYPE;
    224 extern const buzz::QName QN_GINGLE_VIEW_SSRC;
    225 extern const std::string GINGLE_VIEW_TYPE_STATIC;
    226 extern const std::string GINGLE_VIEW_TYPE_DYNAMIC;
    227 extern const std::string GINGLE_VIEW_MEDIA_TYPE_AUDIO;
    228 extern const std::string GINGLE_VIEW_MEDIA_TYPE_VIDEO;
    229 extern const buzz::QName QN_GINGLE_VIEW_PARAMS;
    230 extern const buzz::QName QN_GINGLE_VIEW_PARAMS_WIDTH;
    231 extern const buzz::QName QN_GINGLE_VIEW_PARAMS_HEIGHT;
    232 extern const buzz::QName QN_GINGLE_VIEW_PARAMS_FRAMERATE;
    233 
    234 // old stuff
    235 #ifdef FEATURE_ENABLE_VOICEMAIL
    236 extern const std::string NS_VOICEMAIL;
    237 extern const buzz::QName QN_VOICEMAIL_REGARDING;
    238 #endif
    239 
    240 }  // namespace cricket
    241 
    242 #endif  // TALK_P2P_BASE_CONSTANTS_H_
    243