constants.h revision 731df977c0511bca2206b5f333555b1205ff1f43
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
37namespace cricket {
38
39// There are 3 different types of Jingle messages or protocols: Jingle
40// (the spec in XEP-166, etc), Gingle (the legacy protocol) and hybrid
41// (both at the same time).  Gingle2 is a temporary protocol that we
42// are only keeping around right now during this refactoring phase.
43// Once we finish refactoring and start implementing Jingle, we will
44// remove Gingle2.
45
46// NS_ == namespace
47// QN_ == buzz::QName (namespace + name)
48// LN_ == "local name" == QName::LocalPart()
49//   these are useful when you need to find a tag
50//   that has different namespaces (like <description> or <transport>)
51
52extern const std::string NS_EMPTY;
53extern const std::string NS_JINGLE;
54extern const std::string NS_GINGLE;
55
56enum SignalingProtocol {
57  PROTOCOL_JINGLE,
58  PROTOCOL_GINGLE,
59  PROTOCOL_HYBRID,
60};
61
62// actions (aka Gingle <session> or Jingle <jingle>)
63extern const buzz::QName QN_ACTION;
64extern const std::string LN_INITIATOR;
65extern const buzz::QName QN_INITIATOR;
66extern const buzz::QName QN_CREATOR;
67
68extern const buzz::QName QN_JINGLE;
69extern const buzz::QName QN_JINGLE_CONTENT;
70extern const buzz::QName QN_JINGLE_CONTENT_NAME;
71extern const buzz::QName QN_JINGLE_CONTENT_MEDIA;
72extern const buzz::QName QN_JINGLE_REASON;
73extern const std::string JINGLE_CONTENT_MEDIA_AUDIO;
74extern const std::string JINGLE_CONTENT_MEDIA_VIDEO;
75extern const std::string JINGLE_ACTION_SESSION_INITIATE;
76extern const std::string JINGLE_ACTION_SESSION_INFO;
77extern const std::string JINGLE_ACTION_SESSION_ACCEPT;
78extern const std::string JINGLE_ACTION_SESSION_TERMINATE;
79extern const std::string JINGLE_ACTION_TRANSPORT_INFO;
80extern const std::string JINGLE_ACTION_TRANSPORT_ACCEPT;
81
82extern const buzz::QName QN_GINGLE_SESSION;
83extern const std::string GINGLE_ACTION_INITIATE;
84extern const std::string GINGLE_ACTION_INFO;
85extern const std::string GINGLE_ACTION_ACCEPT;
86extern const std::string GINGLE_ACTION_REJECT;
87extern const std::string GINGLE_ACTION_TERMINATE;
88extern const std::string GINGLE_ACTION_CANDIDATES;
89
90
91// Session Contents (aka Gingle <session><description>
92//                   or Jingle <content><description>)
93extern const std::string LN_DESCRIPTION;
94extern const std::string LN_PAYLOADTYPE;
95extern const buzz::QName QN_ID;
96extern const buzz::QName QN_NAME;
97extern const buzz::QName QN_CLOCKRATE;
98extern const buzz::QName QN_BITRATE;
99extern const buzz::QName QN_CHANNELS;
100extern const buzz::QName QN_WIDTH;
101extern const buzz::QName QN_HEIGHT;
102extern const buzz::QName QN_FRAMERATE;
103extern const buzz::QName QN_PARAMETER;
104extern const std::string LN_NAME;
105extern const std::string LN_VALUE;
106extern const buzz::QName QN_PAYLOADTYPE_PARAMETER_NAME;
107extern const buzz::QName QN_PAYLOADTYPE_PARAMETER_VALUE;
108extern const std::string PAYLOADTYPE_PARAMETER_BITRATE;
109extern const std::string PAYLOADTYPE_PARAMETER_HEIGHT;
110extern const std::string PAYLOADTYPE_PARAMETER_WIDTH;
111extern const std::string PAYLOADTYPE_PARAMETER_FRAMERATE;
112
113// CN_ == "content name".  When we initiate a session, we choose the
114// name, and when we receive a Gingle session, we provide default
115// names (since Gingle has no content names).  But when we receive a
116// Jingle call, the content name can be anything, so don't rely on
117// these values being the same as the ones received.
118extern const std::string CN_AUDIO;
119extern const std::string CN_VIDEO;
120extern const std::string CN_OTHER;
121
122extern const std::string NS_JINGLE_RTP;
123extern const buzz::QName QN_JINGLE_RTP_CONTENT;
124extern const buzz::QName QN_JINGLE_RTP_PAYLOADTYPE;
125
126extern const std::string NS_GINGLE_AUDIO;
127extern const buzz::QName QN_GINGLE_AUDIO_CONTENT;
128extern const buzz::QName QN_GINGLE_AUDIO_PAYLOADTYPE;
129extern const buzz::QName QN_GINGLE_AUDIO_SRCID;
130extern const std::string NS_GINGLE_VIDEO;
131extern const buzz::QName QN_GINGLE_VIDEO_CONTENT;
132extern const buzz::QName QN_GINGLE_VIDEO_PAYLOADTYPE;
133extern const buzz::QName QN_GINGLE_VIDEO_SRCID;
134extern const buzz::QName QN_GINGLE_VIDEO_BANDWIDTH;
135
136// transports and candidates
137extern const std::string LN_TRANSPORT;
138extern const std::string LN_CANDIDATE;
139extern const buzz::QName QN_JINGLE_P2P_TRANSPORT;
140extern const buzz::QName QN_JINGLE_P2P_CANDIDATE;
141extern const buzz::QName QN_UFRAG;
142extern const buzz::QName QN_COMPONENT;
143extern const buzz::QName QN_PWD;
144extern const buzz::QName QN_IP;
145extern const buzz::QName QN_PORT;
146extern const buzz::QName QN_NETWORK;
147extern const buzz::QName QN_GENERATION;
148extern const buzz::QName QN_PRIORITY;
149extern const buzz::QName QN_PROTOCOL;
150extern const std::string JINGLE_CANDIDATE_TYPE_PEER_STUN;
151extern const std::string JINGLE_CANDIDATE_TYPE_SERVER_STUN;
152extern const std::string JINGLE_CANDIDATE_NAME_RTP;
153extern const std::string JINGLE_CANDIDATE_NAME_RTCP;
154
155extern const std::string NS_GINGLE_P2P;
156extern const buzz::QName QN_GINGLE_P2P_TRANSPORT;
157extern const buzz::QName QN_GINGLE_P2P_CANDIDATE;
158extern const buzz::QName QN_GINGLE_P2P_UNKNOWN_CHANNEL_NAME;
159extern const buzz::QName QN_GINGLE_CANDIDATE;
160extern const buzz::QName QN_ADDRESS;
161extern const buzz::QName QN_USERNAME;
162extern const buzz::QName QN_PASSWORD;
163extern const buzz::QName QN_PREFERENCE;
164extern const std::string GINGLE_CANDIDATE_TYPE_STUN;
165extern const std::string GINGLE_CANDIDATE_NAME_RTP;
166extern const std::string GINGLE_CANDIDATE_NAME_RTCP;
167extern const std::string GINGLE_CANDIDATE_NAME_VIDEO_RTP;
168extern const std::string GINGLE_CANDIDATE_NAME_VIDEO_RTCP;
169
170extern const std::string NS_GINGLE_RAW;
171extern const buzz::QName QN_GINGLE_RAW_TRANSPORT;
172extern const buzz::QName QN_GINGLE_RAW_CHANNEL;
173
174// terminate reasons and errors: see http://xmpp.org/extensions/xep-0166.html
175extern const std::string JINGLE_ERROR_BAD_REQUEST;  // like parse error
176// got transport-info before session-initiate, for example
177extern const std::string JINGLE_ERROR_OUT_OF_ORDER;
178extern const std::string JINGLE_ERROR_UNKNOWN_SESSION;
179
180// Call terminate reasons from XEP-166
181extern const std::string STR_TERMINATE_DECLINE;  // polite reject
182extern const std::string STR_TERMINATE_SUCCESS;  // polite hangup
183extern const std::string STR_TERMINATE_ERROR;  // something bad happened
184extern const std::string STR_TERMINATE_INCOMPATIBLE_PARAMETERS;  // no codecs?
185
186// Old terminate reasons used by cricket
187extern const std::string STR_TERMINATE_CALL_ENDED;
188extern const std::string STR_TERMINATE_RECIPIENT_UNAVAILABLE;
189extern const std::string STR_TERMINATE_RECIPIENT_BUSY;
190extern const std::string STR_TERMINATE_INSUFFICIENT_FUNDS;
191extern const std::string STR_TERMINATE_NUMBER_MALFORMED;
192extern const std::string STR_TERMINATE_NUMBER_DISALLOWED;
193extern const std::string STR_TERMINATE_PROTOCOL_ERROR;
194extern const std::string STR_TERMINATE_INTERNAL_SERVER_ERROR;
195extern const std::string STR_TERMINATE_UNKNOWN_ERROR;
196
197// old stuff
198#ifdef FEATURE_ENABLE_VOICEMAIL
199extern const std::string NS_VOICEMAIL;
200extern const buzz::QName QN_VOICEMAIL_REGARDING;
201#endif
202
203}  // namespace cricket
204
205#endif  // TALK_P2P_BASE_CONSTANTS_H_
206