tizen 2.3.1 release
[framework/multimedia/gst-plugins-base0.10.git] / gst-libs / gst / rtsp / gstrtspdefs.h
1 /* GStreamer
2  * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 /*
20  * Unless otherwise indicated, Source Code is licensed under MIT license.
21  * See further explanation attached in License Statement (distributed in the file
22  * LICENSE).
23  *
24  * Permission is hereby granted, free of charge, to any person obtaining a copy of
25  * this software and associated documentation files (the "Software"), to deal in
26  * the Software without restriction, including without limitation the rights to
27  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
28  * of the Software, and to permit persons to whom the Software is furnished to do
29  * so, subject to the following conditions:
30  *
31  * The above copyright notice and this permission notice shall be included in all
32  * copies or substantial portions of the Software.
33  *
34  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
40  * SOFTWARE.
41  */
42
43 #ifndef __GST_RTSP_DEFS_H__
44 #define __GST_RTSP_DEFS_H__
45
46 #include <glib.h>
47 #include <glib-object.h>
48
49 G_BEGIN_DECLS
50
51 /**
52  * GST_RTSP_CHECK:
53  * @stmt: a statement
54  * @label: a label
55  *
56  * Macro that checks the return value of @stmt and jumps to @label when it does
57  * not equal #GST_RTSP_OK.
58  */
59 #define GST_RTSP_CHECK(stmt, label)  \
60 G_STMT_START { \
61   if (G_UNLIKELY ((res = (stmt)) != GST_RTSP_OK)) \
62     goto label; \
63 } G_STMT_END
64
65 /**
66  * GstRTSPResult:
67  * @GST_RTSP_OK: no error
68  * @GST_RTSP_ERROR: some unspecified error occured
69  * @GST_RTSP_EINVAL: invalid arguments were provided to a function
70  * @GST_RTSP_EINTR: an operation was canceled
71  * @GST_RTSP_ENOMEM: no memory was available for the operation
72  * @GST_RTSP_ERESOLV: a host resolve error occured
73  * @GST_RTSP_ENOTIMPL: function not implemented
74  * @GST_RTSP_ESYS: a system error occured, errno contains more details
75  * @GST_RTSP_EPARSE: a persing error occured
76  * @GST_RTSP_EWSASTART: windows networking could not start
77  * @GST_RTSP_EWSAVERSION: windows networking stack has wrong version
78  * @GST_RTSP_EEOF: end-of-file was reached
79  * @GST_RTSP_ENET: a network problem occured, h_errno contains more details
80  * @GST_RTSP_ENOTIP: the host is not an IP host
81  * @GST_RTSP_ETIMEOUT: a timeout occured
82  * @GST_RTSP_ETGET: the tunnel GET request has been performed
83  * @GST_RTSP_ETPOST: the tunnel POST request has been performed
84  * @GST_RTSP_ENOHDCPKEY: HDCP key was not installed
85  * @GST_RTSP_ELAST: last error
86  *
87  * Result codes from the RTSP functions.
88  */
89 typedef enum {
90   GST_RTSP_OK          =  0,
91   /* errors */
92   GST_RTSP_ERROR       = -1,
93   GST_RTSP_EINVAL      = -2,
94   GST_RTSP_EINTR       = -3,
95   GST_RTSP_ENOMEM      = -4,
96   GST_RTSP_ERESOLV     = -5,
97   GST_RTSP_ENOTIMPL    = -6,
98   GST_RTSP_ESYS        = -7,
99   GST_RTSP_EPARSE      = -8,
100   GST_RTSP_EWSASTART   = -9,
101   GST_RTSP_EWSAVERSION = -10,
102   GST_RTSP_EEOF        = -11,
103   GST_RTSP_ENET        = -12,
104   GST_RTSP_ENOTIP      = -13,
105   GST_RTSP_ETIMEOUT    = -14,
106   GST_RTSP_ETGET       = -15,
107   GST_RTSP_ETPOST      = -16,
108   GST_RTSP_ENOHDCPKEY   = -17,
109   GST_RTSP_ELAST       = -18
110 } GstRTSPResult;
111
112 /**
113  * GstRTSPEvent:
114  * @GST_RTSP_EV_READ: connection is readable
115  * @GST_RTSP_EV_WRITE: connection is writable
116  *
117  * The possible events for the connection.
118  */
119 typedef enum {
120   GST_RTSP_EV_READ  = (1 << 0),
121   GST_RTSP_EV_WRITE = (1 << 1)
122 } GstRTSPEvent;
123
124 /**
125  * GstRTSPFamily:
126  * @GST_RTSP_FAM_NONE: unknown network family
127  * @GST_RTSP_FAM_INET: internet
128  * @GST_RTSP_FAM_INET6: internet V6
129  *
130  * The possible network families.
131  */
132 typedef enum {
133   GST_RTSP_FAM_NONE,
134   GST_RTSP_FAM_INET,
135   GST_RTSP_FAM_INET6
136 } GstRTSPFamily;
137
138 /**
139  * GstRTSPState:
140  * @GST_RTSP_STATE_INVALID: invalid state
141  * @GST_RTSP_STATE_INIT: initializing
142  * @GST_RTSP_STATE_READY: ready for operation
143  * @GST_RTSP_STATE_SEEKING: seeking in progress
144  * @GST_RTSP_STATE_PLAYING: playing
145  * @GST_RTSP_STATE_RECORDING: recording
146  *
147  * The different RTSP states.
148  */
149 typedef enum {
150   GST_RTSP_STATE_INVALID,
151   GST_RTSP_STATE_INIT,
152   GST_RTSP_STATE_READY,
153   GST_RTSP_STATE_SEEKING,
154   GST_RTSP_STATE_PLAYING,
155   GST_RTSP_STATE_RECORDING
156 } GstRTSPState;
157
158 /**
159  * GstRTSPVersion:
160  * @GST_RTSP_VERSION_INVALID: unknown/invalid version
161  * @GST_RTSP_VERSION_1_0: version 1.0
162  * @GST_RTSP_VERSION_1_1: version 1.1. Since 0.10.25
163  *
164  * The supported RTSP versions.
165  */
166 typedef enum {
167   GST_RTSP_VERSION_INVALID = 0x00,
168   GST_RTSP_VERSION_1_0     = 0x10,
169   GST_RTSP_VERSION_1_1     = 0x11
170 } GstRTSPVersion;
171
172 /**
173  * GstRTSPMethod:
174  * @GST_RTSP_INVALID: invalid method
175  * @GST_RTSP_DESCRIBE: the DESCRIBE method
176  * @GST_RTSP_ANNOUNCE: the ANNOUNCE method
177  * @GST_RTSP_GET_PARAMETER: the GET_PARAMETER method
178  * @GST_RTSP_OPTIONS: the OPTIONS method
179  * @GST_RTSP_PAUSE: the PAUSE method
180  * @GST_RTSP_PLAY: the PLAY method
181  * @GST_RTSP_RECORD: the RECORD method
182  * @GST_RTSP_REDIRECT: the REDIRECT method
183  * @GST_RTSP_SETUP: the SETUP method
184  * @GST_RTSP_SET_PARAMETER: the SET_PARAMETER method
185  * @GST_RTSP_TEARDOWN: the TEARDOWN method
186  * @GST_RTSP_GET: the GET method (HTTP). Since 0.10.25
187  * @GST_RTSP_POST: the POST method (HTTP). Since 0.10.25
188  *
189  * The different supported RTSP methods.
190  */
191 typedef enum {
192   GST_RTSP_INVALID          = 0,
193   GST_RTSP_DESCRIBE         = (1 <<  0),
194   GST_RTSP_ANNOUNCE         = (1 <<  1),
195   GST_RTSP_GET_PARAMETER    = (1 <<  2),
196   GST_RTSP_OPTIONS          = (1 <<  3),
197   GST_RTSP_PAUSE            = (1 <<  4),
198   GST_RTSP_PLAY             = (1 <<  5),
199   GST_RTSP_RECORD           = (1 <<  6),
200   GST_RTSP_REDIRECT         = (1 <<  7),
201   GST_RTSP_SETUP            = (1 <<  8),
202   GST_RTSP_SET_PARAMETER    = (1 <<  9),
203   GST_RTSP_TEARDOWN         = (1 << 10),
204   GST_RTSP_GET              = (1 << 11),
205   GST_RTSP_POST             = (1 << 12)
206 } GstRTSPMethod;
207
208 /**
209  * GstRTSPAuthMethod:
210  * @GST_RTSP_AUTH_NONE: no authentication
211  * @GST_RTSP_AUTH_BASIC: basic authentication
212  * @GST_RTSP_AUTH_DIGEST: digest authentication
213  *
214  * Authentication methods, ordered by strength
215  */
216 typedef enum {
217   GST_RTSP_AUTH_NONE    = 0x00,
218   GST_RTSP_AUTH_BASIC   = 0x01,
219   GST_RTSP_AUTH_DIGEST  = 0x02
220 } GstRTSPAuthMethod;
221
222 /**
223  * GST_RTSP_AUTH_MAX:
224  *
225  * Strongest available authentication method
226  */
227 #define GST_RTSP_AUTH_MAX GST_RTSP_AUTH_DIGEST
228
229 /**
230  * GstRTSPHeaderField:
231  *
232  * Enumeration of rtsp header fields.
233  */
234 typedef enum {
235   /*< protected >*/
236   GST_RTSP_HDR_INVALID,
237
238   /*
239    * R = Request
240    * r = response
241    * g = general
242    * e = entity
243    */
244   GST_RTSP_HDR_ACCEPT,              /* Accept               R      opt.      entity */
245   GST_RTSP_HDR_ACCEPT_ENCODING,     /* Accept-Encoding      R      opt.      entity */
246   GST_RTSP_HDR_ACCEPT_LANGUAGE,     /* Accept-Language      R      opt.      all */
247   GST_RTSP_HDR_ALLOW,               /* Allow                r      opt.      all */
248   GST_RTSP_HDR_AUTHORIZATION,       /* Authorization        R      opt.      all */
249   GST_RTSP_HDR_BANDWIDTH,           /* Bandwidth            R      opt.      all */
250   GST_RTSP_HDR_BLOCKSIZE,           /* Blocksize            R      opt.      all but OPTIONS, TEARDOWN */
251   GST_RTSP_HDR_CACHE_CONTROL,       /* Cache-Control        g      opt.      SETUP */
252   GST_RTSP_HDR_CONFERENCE,          /* Conference           R      opt.      SETUP */
253   GST_RTSP_HDR_CONNECTION,          /* Connection           g      req.      all */
254   GST_RTSP_HDR_CONTENT_BASE,        /* Content-Base         e      opt.      entity */
255   GST_RTSP_HDR_CONTENT_ENCODING,    /* Content-Encoding     e      req.      SET_PARAMETER, DESCRIBE, ANNOUNCE */
256   GST_RTSP_HDR_CONTENT_LANGUAGE,    /* Content-Language     e      req.      DESCRIBE, ANNOUNCE */
257   GST_RTSP_HDR_CONTENT_LENGTH,      /* Content-Length       e      req.      SET_PARAMETER, ANNOUNCE, entity */
258   GST_RTSP_HDR_CONTENT_LOCATION,    /* Content-Location     e      opt.      entity */
259   GST_RTSP_HDR_CONTENT_TYPE,        /* Content-Type         e      req.      SET_PARAMETER, ANNOUNCE, entity */
260   GST_RTSP_HDR_CSEQ,                /* CSeq                 g      req.      all */
261   GST_RTSP_HDR_DATE,                /* Date                 g      opt.      all */
262   GST_RTSP_HDR_EXPIRES,             /* Expires              e      opt.      DESCRIBE, ANNOUNCE */
263   GST_RTSP_HDR_FROM,                /* From                 R      opt.      all */
264   GST_RTSP_HDR_IF_MODIFIED_SINCE,   /* If-Modified-Since    R      opt.      DESCRIBE, SETUP */
265   GST_RTSP_HDR_LAST_MODIFIED,       /* Last-Modified        e      opt.      entity */
266   GST_RTSP_HDR_PROXY_AUTHENTICATE,  /* Proxy-Authenticate */
267   GST_RTSP_HDR_PROXY_REQUIRE,       /* Proxy-Require        R      req.      all */
268   GST_RTSP_HDR_PUBLIC,              /* Public               r      opt.      all */
269   GST_RTSP_HDR_RANGE,               /* Range                Rr     opt.      PLAY, PAUSE, RECORD */
270   GST_RTSP_HDR_REFERER,             /* Referer              R      opt.      all */
271   GST_RTSP_HDR_REQUIRE,             /* Require              R      req.      all */
272   GST_RTSP_HDR_RETRY_AFTER,         /* Retry-After          r      opt.      all */
273   GST_RTSP_HDR_RTP_INFO,            /* RTP-Info             r      req.      PLAY */
274   GST_RTSP_HDR_SCALE,               /* Scale                Rr     opt.      PLAY, RECORD */
275   GST_RTSP_HDR_SESSION,             /* Session              Rr     req.      all but SETUP, OPTIONS */
276   GST_RTSP_HDR_SERVER,              /* Server               r      opt.      all */
277   GST_RTSP_HDR_SPEED,               /* Speed                Rr     opt.      PLAY */
278   GST_RTSP_HDR_TRANSPORT,           /* Transport            Rr     req.      SETUP */
279   GST_RTSP_HDR_UNSUPPORTED,         /* Unsupported          r      req.      all */
280   GST_RTSP_HDR_USER_AGENT,          /* User-Agent           R      opt.      all */
281   GST_RTSP_HDR_VIA,                 /* Via                  g      opt.      all */
282   GST_RTSP_HDR_WWW_AUTHENTICATE,    /* WWW-Authenticate     r      opt.      all */
283
284   /* Real extensions */
285   GST_RTSP_HDR_CLIENT_CHALLENGE,    /* ClientChallenge */
286   GST_RTSP_HDR_REAL_CHALLENGE1,     /* RealChallenge1 */
287   GST_RTSP_HDR_REAL_CHALLENGE2,     /* RealChallenge2 */
288   GST_RTSP_HDR_REAL_CHALLENGE3,     /* RealChallenge3 */
289   GST_RTSP_HDR_SUBSCRIBE,           /* Subscribe */
290   GST_RTSP_HDR_ALERT,               /* Alert */
291   GST_RTSP_HDR_CLIENT_ID,           /* ClientID */
292   GST_RTSP_HDR_COMPANY_ID,          /* CompanyID */
293   GST_RTSP_HDR_GUID,                /* GUID */
294   GST_RTSP_HDR_REGION_DATA,         /* RegionData */
295   GST_RTSP_HDR_MAX_ASM_WIDTH,       /* SupportsMaximumASMBandwidth */
296   GST_RTSP_HDR_LANGUAGE,            /* Language */
297   GST_RTSP_HDR_PLAYER_START_TIME,   /* PlayerStarttime */
298
299   /* Since 0.10.16 */
300   GST_RTSP_HDR_LOCATION,            /* Location */
301
302   /* Since 0.10.23 */
303   GST_RTSP_HDR_ETAG,                /* ETag */
304   GST_RTSP_HDR_IF_MATCH,            /* If-Match */
305
306   /* WM extensions [MS-RTSP] Since 0.10.23 */
307   GST_RTSP_HDR_ACCEPT_CHARSET,      /* Accept-Charset */
308   GST_RTSP_HDR_SUPPORTED,           /* Supported */
309   GST_RTSP_HDR_VARY,                /* Vary */
310   GST_RTSP_HDR_X_ACCELERATE_STREAMING,    /* X-Accelerate-Streaming */
311   GST_RTSP_HDR_X_ACCEPT_AUTHENT,    /* X-Accept-Authentication */
312   GST_RTSP_HDR_X_ACCEPT_PROXY_AUTHENT,    /* X-Accept-Proxy-Authentication */
313   GST_RTSP_HDR_X_BROADCAST_ID,      /* X-Broadcast-Id */
314   GST_RTSP_HDR_X_BURST_STREAMING,   /* X-Burst-Streaming */
315   GST_RTSP_HDR_X_NOTICE,            /* X-Notice */
316   GST_RTSP_HDR_X_PLAYER_LAG_TIME,   /* X-Player-Lag-Time */
317   GST_RTSP_HDR_X_PLAYLIST,          /* X-Playlist */
318   GST_RTSP_HDR_X_PLAYLIST_CHANGE_NOTICE,  /* X-Playlist-Change-Notice */
319   GST_RTSP_HDR_X_PLAYLIST_GEN_ID,   /* X-Playlist-Gen-Id */
320   GST_RTSP_HDR_X_PLAYLIST_SEEK_ID,  /* X-Playlist-Seek-Id */
321   GST_RTSP_HDR_X_PROXY_CLIENT_AGENT,      /* X-Proxy-Client-Agent */
322   GST_RTSP_HDR_X_PROXY_CLIENT_VERB, /* X-Proxy-Client-Verb */
323   GST_RTSP_HDR_X_RECEDING_PLAYLISTCHANGE, /* X-Receding-PlaylistChange */
324   GST_RTSP_HDR_X_RTP_INFO,          /* X-RTP-Info */
325   GST_RTSP_HDR_X_STARTUPPROFILE,    /* X-StartupProfile */
326
327   /* Since 0.10.24 */
328   GST_RTSP_HDR_TIMESTAMP,           /* Timestamp */
329
330   /* Since 0.10.25 */
331   GST_RTSP_HDR_AUTHENTICATION_INFO, /* Authentication-Info */
332   GST_RTSP_HDR_HOST,                /* Host */
333   GST_RTSP_HDR_PRAGMA,              /* Pragma */
334   GST_RTSP_HDR_X_SERVER_IP_ADDRESS, /* X-Server-IP-Address */
335   GST_RTSP_HDR_X_SESSIONCOOKIE,     /* X-Sessioncookie */
336
337   /* Since 0.10.36 */
338   GST_RTSP_HDR_RTCP_INTERVAL,       /* RTCP-Interval */
339
340   GST_RTSP_HDR_LAST
341 } GstRTSPHeaderField;
342
343 /**
344  * GstRTSPStatusCode:
345  *
346  * Enumeration of rtsp status codes.
347  */
348 typedef enum {
349   /*< protected >*/
350   GST_RTSP_STS_INVALID                              = 0,
351   GST_RTSP_STS_CONTINUE                             = 100,
352   GST_RTSP_STS_OK                                   = 200,
353   GST_RTSP_STS_CREATED                              = 201,
354   GST_RTSP_STS_LOW_ON_STORAGE                       = 250,
355   GST_RTSP_STS_MULTIPLE_CHOICES                     = 300,
356   GST_RTSP_STS_MOVED_PERMANENTLY                    = 301,
357   GST_RTSP_STS_MOVE_TEMPORARILY                     = 302,
358   GST_RTSP_STS_SEE_OTHER                            = 303,
359   GST_RTSP_STS_NOT_MODIFIED                         = 304,
360   GST_RTSP_STS_USE_PROXY                            = 305,
361   GST_RTSP_STS_BAD_REQUEST                          = 400,
362   GST_RTSP_STS_UNAUTHORIZED                         = 401,
363   GST_RTSP_STS_PAYMENT_REQUIRED                     = 402,
364   GST_RTSP_STS_FORBIDDEN                            = 403,
365   GST_RTSP_STS_NOT_FOUND                            = 404,
366   GST_RTSP_STS_METHOD_NOT_ALLOWED                   = 405,
367   GST_RTSP_STS_NOT_ACCEPTABLE                       = 406,
368   GST_RTSP_STS_PROXY_AUTH_REQUIRED                  = 407,
369   GST_RTSP_STS_REQUEST_TIMEOUT                      = 408,
370   GST_RTSP_STS_GONE                                 = 410,
371   GST_RTSP_STS_LENGTH_REQUIRED                      = 411,
372   GST_RTSP_STS_PRECONDITION_FAILED                  = 412,
373   GST_RTSP_STS_REQUEST_ENTITY_TOO_LARGE             = 413,
374   GST_RTSP_STS_REQUEST_URI_TOO_LARGE                = 414,
375   GST_RTSP_STS_UNSUPPORTED_MEDIA_TYPE               = 415,
376   GST_RTSP_STS_PARAMETER_NOT_UNDERSTOOD             = 451,
377   GST_RTSP_STS_CONFERENCE_NOT_FOUND                 = 452,
378   GST_RTSP_STS_NOT_ENOUGH_BANDWIDTH                 = 453,
379   GST_RTSP_STS_SESSION_NOT_FOUND                    = 454,
380   GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE       = 455,
381   GST_RTSP_STS_HEADER_FIELD_NOT_VALID_FOR_RESOURCE  = 456,
382   GST_RTSP_STS_INVALID_RANGE                        = 457,
383   GST_RTSP_STS_PARAMETER_IS_READONLY                = 458,
384   GST_RTSP_STS_AGGREGATE_OPERATION_NOT_ALLOWED      = 459,
385   GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED     = 460,
386   GST_RTSP_STS_UNSUPPORTED_TRANSPORT                = 461,
387   GST_RTSP_STS_DESTINATION_UNREACHABLE              = 462,
388   GST_RTSP_STS_INTERNAL_SERVER_ERROR                = 500,
389   GST_RTSP_STS_NOT_IMPLEMENTED                      = 501,
390   GST_RTSP_STS_BAD_GATEWAY                          = 502,
391   GST_RTSP_STS_SERVICE_UNAVAILABLE                  = 503,
392   GST_RTSP_STS_GATEWAY_TIMEOUT                      = 504,
393   GST_RTSP_STS_RTSP_VERSION_NOT_SUPPORTED           = 505,
394   GST_RTSP_STS_OPTION_NOT_SUPPORTED                 = 551
395 } GstRTSPStatusCode;
396
397 gchar*             gst_rtsp_strresult          (GstRTSPResult result);
398
399 const gchar*       gst_rtsp_method_as_text     (GstRTSPMethod method);
400 const gchar*       gst_rtsp_version_as_text    (GstRTSPVersion version);
401 const gchar*       gst_rtsp_header_as_text     (GstRTSPHeaderField field);
402 const gchar*       gst_rtsp_status_as_text     (GstRTSPStatusCode code);
403
404 gchar*             gst_rtsp_options_as_text    (GstRTSPMethod options);
405
406 GstRTSPHeaderField gst_rtsp_find_header_field  (const gchar *header);
407 GstRTSPMethod      gst_rtsp_find_method        (const gchar *method);
408
409 gboolean           gst_rtsp_header_allow_multiple (GstRTSPHeaderField field);
410
411 G_END_DECLS
412
413 #endif /* __GST_RTSP_DEFS_H__ */