gst_plugins_base/gst-libs/gst/rtsp/gstrtspdefs.h
changeset 0 0e761a78d257
child 8 4a7fac7dd34a
equal deleted inserted replaced
-1:000000000000 0:0e761a78d257
       
     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 
       
    48 G_BEGIN_DECLS
       
    49 
       
    50 /**
       
    51  * GST_RTSP_CHECK:
       
    52  * @stmt: a statement
       
    53  * @label: a label
       
    54  *
       
    55  * Macro that checks the return value of @stmt and jumps to @label when it does
       
    56  * not equal #GST_RTSP_OK.
       
    57  */
       
    58 #define GST_RTSP_CHECK(stmt, label)  \
       
    59 G_STMT_START { \
       
    60   if (G_UNLIKELY ((res = (stmt)) != GST_RTSP_OK)) \
       
    61     goto label; \
       
    62 } G_STMT_END
       
    63 
       
    64 /**
       
    65  * GstRTSPResult:
       
    66  * @GST_RTSP_OK: no error
       
    67  * @GST_RTSP_ERROR: some unspecified error occured
       
    68  * @GST_RTSP_EINVAL: invalid arguments were provided to a function
       
    69  * @GST_RTSP_EINTR: an operation was canceled
       
    70  * @GST_RTSP_ENOMEM: no memory was available for the operation
       
    71  * @GST_RTSP_ERESOLV: a host resolve error occured
       
    72  * @GST_RTSP_ENOTIMPL: function not implemented
       
    73  * @GST_RTSP_ESYS: a system error occured, errno contains more details
       
    74  * @GST_RTSP_EPARSE: a persing error occured
       
    75  * @GST_RTSP_EWSASTART: windows networking could not start
       
    76  * @GST_RTSP_EWSAVERSION: windows networking stack has wrong version
       
    77  * @GST_RTSP_EEOF: end-of-file was reached
       
    78  * @GST_RTSP_ENET: a network problem occured, h_errno contains more details
       
    79  * @GST_RTSP_ENOTIP: the host is not an IP host
       
    80  * @GST_RTSP_ETIMEOUT: a timeout occured
       
    81  * @GST_RTSP_ELAST: last error
       
    82  *
       
    83  * Result codes from the RTSP functions.
       
    84  */
       
    85 typedef enum {
       
    86   GST_RTSP_OK          =  0,
       
    87   /* errors */
       
    88   GST_RTSP_ERROR       = -1,
       
    89   GST_RTSP_EINVAL      = -2,
       
    90   GST_RTSP_EINTR       = -3,
       
    91   GST_RTSP_ENOMEM      = -4,
       
    92   GST_RTSP_ERESOLV     = -5,
       
    93   GST_RTSP_ENOTIMPL    = -6,
       
    94   GST_RTSP_ESYS        = -7,
       
    95   GST_RTSP_EPARSE      = -8,
       
    96   GST_RTSP_EWSASTART   = -9,
       
    97   GST_RTSP_EWSAVERSION = -10,
       
    98   GST_RTSP_EEOF        = -11,
       
    99   GST_RTSP_ENET        = -12,
       
   100   GST_RTSP_ENOTIP      = -13,
       
   101   GST_RTSP_ETIMEOUT    = -14,
       
   102 
       
   103   GST_RTSP_ELAST       = -15
       
   104 } GstRTSPResult;
       
   105 
       
   106 /**
       
   107  * GstRTSPEvent:
       
   108  * @GST_RTSP_EV_READ: connection is readable
       
   109  * @GST_RTSP_EV_WRITE: connection is writable
       
   110  *
       
   111  * The possible events for the connection.
       
   112  */
       
   113 typedef enum {
       
   114   GST_RTSP_EV_READ  = (1 << 0),
       
   115   GST_RTSP_EV_WRITE = (1 << 1)
       
   116 } GstRTSPEvent;
       
   117 
       
   118 /**
       
   119  * GstRTSPFamily:
       
   120  * @GST_RTSP_FAM_NONE: unknown network family
       
   121  * @GST_RTSP_FAM_INET: internet
       
   122  * @GST_RTSP_FAM_INET6: internet V6
       
   123  *
       
   124  * The possible network families.
       
   125  */
       
   126 typedef enum {
       
   127   GST_RTSP_FAM_NONE,
       
   128   GST_RTSP_FAM_INET,
       
   129   GST_RTSP_FAM_INET6
       
   130 } GstRTSPFamily;
       
   131 
       
   132 /**
       
   133  * GstRTSPState:
       
   134  * @GST_RTSP_STATE_INVALID: invalid state
       
   135  * @GST_RTSP_STATE_INIT: initializing
       
   136  * @GST_RTSP_STATE_READY: ready for operation
       
   137  * @GST_RTSP_STATE_SEEKING: seeking in progress
       
   138  * @GST_RTSP_STATE_PLAYING: playing
       
   139  * @GST_RTSP_STATE_RECORDING: recording
       
   140  *
       
   141  * The different RTSP states.
       
   142  */
       
   143 typedef enum {
       
   144   GST_RTSP_STATE_INVALID,
       
   145   GST_RTSP_STATE_INIT,
       
   146   GST_RTSP_STATE_READY,
       
   147   GST_RTSP_STATE_SEEKING,
       
   148   GST_RTSP_STATE_PLAYING,
       
   149   GST_RTSP_STATE_RECORDING
       
   150 } GstRTSPState;
       
   151 
       
   152 /**
       
   153  * GstRTSPVersion:
       
   154  * @GST_RTSP_VERSION_INVALID: unknown/invalid version
       
   155  * @GST_RTSP_VERSION_1_0: version 1.0
       
   156  *
       
   157  * The supported RTSP versions.
       
   158  */
       
   159 typedef enum {
       
   160   GST_RTSP_VERSION_INVALID = 0x00,
       
   161   GST_RTSP_VERSION_1_0     = 0x10
       
   162 } GstRTSPVersion;
       
   163 
       
   164 /**
       
   165  * GstRTSPMethod:
       
   166  * @GST_RTSP_INVALID: invalid method
       
   167  * @GST_RTSP_DESCRIBE: the DESCRIBE method
       
   168  * @GST_RTSP_ANNOUNCE: the ANNOUNCE method
       
   169  * @GST_RTSP_GET_PARAMETER: the GET_PARAMETER method
       
   170  * @GST_RTSP_OPTIONS: the OPTIONS method
       
   171  * @GST_RTSP_PAUSE: the PAUSE method
       
   172  * @GST_RTSP_PLAY: the PLAY method
       
   173  * @GST_RTSP_RECORD: the RECORD method
       
   174  * @GST_RTSP_REDIRECT: the REDIRECT method
       
   175  * @GST_RTSP_SETUP: the SETUP method
       
   176  * @GST_RTSP_SET_PARAMETER: the SET_PARAMETER method
       
   177  * @GST_RTSP_TEARDOWN: the TEARDOWN method
       
   178  *
       
   179  * The different supported RTSP methods. 
       
   180  */
       
   181 typedef enum {
       
   182   GST_RTSP_INVALID          = 0,
       
   183   GST_RTSP_DESCRIBE         = (1 <<  0),
       
   184   GST_RTSP_ANNOUNCE         = (1 <<  1),
       
   185   GST_RTSP_GET_PARAMETER    = (1 <<  2),
       
   186   GST_RTSP_OPTIONS          = (1 <<  3),
       
   187   GST_RTSP_PAUSE            = (1 <<  4),
       
   188   GST_RTSP_PLAY             = (1 <<  5),
       
   189   GST_RTSP_RECORD           = (1 <<  6),
       
   190   GST_RTSP_REDIRECT         = (1 <<  7),
       
   191   GST_RTSP_SETUP            = (1 <<  8),
       
   192   GST_RTSP_SET_PARAMETER    = (1 <<  9),
       
   193   GST_RTSP_TEARDOWN         = (1 << 10)
       
   194 } GstRTSPMethod;
       
   195 
       
   196 /**
       
   197  * GstRTSPAuthMethod:
       
   198  * @GST_RTSP_AUTH_NONE: no authentication
       
   199  * @GST_RTSP_AUTH_BASIC: basic authentication
       
   200  * @GST_RTSP_AUTH_DIGEST: digest authentication
       
   201  *
       
   202  * Authentication methods, ordered by strength
       
   203  */
       
   204 typedef enum {
       
   205   GST_RTSP_AUTH_NONE    = 0x00,
       
   206   GST_RTSP_AUTH_BASIC   = 0x01,
       
   207   GST_RTSP_AUTH_DIGEST  = 0x02
       
   208 } GstRTSPAuthMethod;
       
   209 
       
   210 /**
       
   211  * GST_RTSP_AUTH_MAX:
       
   212  *
       
   213  * Strongest available authentication method 
       
   214  */
       
   215 #define GST_RTSP_AUTH_MAX GST_RTSP_AUTH_DIGEST
       
   216 
       
   217 typedef enum {
       
   218   GST_RTSP_HDR_INVALID,
       
   219 
       
   220   /*
       
   221    * R = Request
       
   222    * r = response
       
   223    * g = general
       
   224    * e = entity
       
   225    */
       
   226   GST_RTSP_HDR_ACCEPT,              /* Accept               R      opt.      entity */
       
   227   GST_RTSP_HDR_ACCEPT_ENCODING,     /* Accept-Encoding      R      opt.      entity */
       
   228   GST_RTSP_HDR_ACCEPT_LANGUAGE,     /* Accept-Language      R      opt.      all */
       
   229   GST_RTSP_HDR_ALLOW,               /* Allow                r      opt.      all */
       
   230   GST_RTSP_HDR_AUTHORIZATION,       /* Authorization        R      opt.      all */
       
   231   GST_RTSP_HDR_BANDWIDTH,           /* Bandwidth            R      opt.      all */
       
   232   GST_RTSP_HDR_BLOCKSIZE,           /* Blocksize            R      opt.      all but OPTIONS, TEARDOWN */
       
   233   GST_RTSP_HDR_CACHE_CONTROL,       /* Cache-Control        g      opt.      SETUP */
       
   234   GST_RTSP_HDR_CONFERENCE,          /* Conference           R      opt.      SETUP */
       
   235   GST_RTSP_HDR_CONNECTION,          /* Connection           g      req.      all */
       
   236   GST_RTSP_HDR_CONTENT_BASE,        /* Content-Base         e      opt.      entity */
       
   237   GST_RTSP_HDR_CONTENT_ENCODING,    /* Content-Encoding     e      req.      SET_PARAMETER, DESCRIBE, ANNOUNCE */
       
   238   GST_RTSP_HDR_CONTENT_LANGUAGE,    /* Content-Language     e      req.      DESCRIBE, ANNOUNCE */
       
   239   GST_RTSP_HDR_CONTENT_LENGTH,      /* Content-Length       e      req.      SET_PARAMETER, ANNOUNCE, entity */
       
   240   GST_RTSP_HDR_CONTENT_LOCATION,    /* Content-Location     e      opt.      entity */
       
   241   GST_RTSP_HDR_CONTENT_TYPE,        /* Content-Type         e      req.      SET_PARAMETER, ANNOUNCE, entity */
       
   242   GST_RTSP_HDR_CSEQ,                /* CSeq                 g      req.      all */
       
   243   GST_RTSP_HDR_DATE,                /* Date                 g      opt.      all */
       
   244   GST_RTSP_HDR_EXPIRES,             /* Expires              e      opt.      DESCRIBE, ANNOUNCE */
       
   245   GST_RTSP_HDR_FROM,                /* From                 R      opt.      all */
       
   246   GST_RTSP_HDR_IF_MODIFIED_SINCE,   /* If-Modified-Since    R      opt.      DESCRIBE, SETUP */
       
   247   GST_RTSP_HDR_LAST_MODIFIED,       /* Last-Modified        e      opt.      entity */
       
   248   GST_RTSP_HDR_PROXY_AUTHENTICATE,  /* Proxy-Authenticate */
       
   249   GST_RTSP_HDR_PROXY_REQUIRE,       /* Proxy-Require        R      req.      all */
       
   250   GST_RTSP_HDR_PUBLIC,              /* Public               r      opt.      all */
       
   251   GST_RTSP_HDR_RANGE,               /* Range                Rr     opt.      PLAY, PAUSE, RECORD */
       
   252   GST_RTSP_HDR_REFERER,             /* Referer              R      opt.      all */
       
   253   GST_RTSP_HDR_REQUIRE,             /* Require              R      req.      all */
       
   254   GST_RTSP_HDR_RETRY_AFTER,         /* Retry-After          r      opt.      all */
       
   255   GST_RTSP_HDR_RTP_INFO,            /* RTP-Info             r      req.      PLAY */
       
   256   GST_RTSP_HDR_SCALE,               /* Scale                Rr     opt.      PLAY, RECORD */
       
   257   GST_RTSP_HDR_SESSION,             /* Session              Rr     req.      all but SETUP, OPTIONS */
       
   258   GST_RTSP_HDR_SERVER,              /* Server               r      opt.      all */
       
   259   GST_RTSP_HDR_SPEED,               /* Speed                Rr     opt.      PLAY */
       
   260   GST_RTSP_HDR_TRANSPORT,           /* Transport            Rr     req.      SETUP */
       
   261   GST_RTSP_HDR_UNSUPPORTED,         /* Unsupported          r      req.      all */
       
   262   GST_RTSP_HDR_USER_AGENT,          /* User-Agent           R      opt.      all */
       
   263   GST_RTSP_HDR_VIA,                 /* Via                  g      opt.      all */
       
   264   GST_RTSP_HDR_WWW_AUTHENTICATE,    /* WWW-Authenticate     r      opt.      all */
       
   265 
       
   266   /* Real extensions */
       
   267   GST_RTSP_HDR_CLIENT_CHALLENGE,    /* ClientChallenge */
       
   268   GST_RTSP_HDR_REAL_CHALLENGE1,     /* RealChallenge1 */
       
   269   GST_RTSP_HDR_REAL_CHALLENGE2,     /* RealChallenge2 */
       
   270   GST_RTSP_HDR_REAL_CHALLENGE3,     /* RealChallenge3 */
       
   271   GST_RTSP_HDR_SUBSCRIBE,           /* Subscribe */
       
   272   GST_RTSP_HDR_ALERT,               /* Alert */
       
   273   GST_RTSP_HDR_CLIENT_ID,           /* ClientID */
       
   274   GST_RTSP_HDR_COMPANY_ID,          /* CompanyID */
       
   275   GST_RTSP_HDR_GUID,                /* GUID */
       
   276   GST_RTSP_HDR_REGION_DATA,         /* RegionData */
       
   277   GST_RTSP_HDR_MAX_ASM_WIDTH,       /* SupportsMaximumASMBandwidth */
       
   278   GST_RTSP_HDR_LANGUAGE,            /* Language */
       
   279   GST_RTSP_HDR_PLAYER_START_TIME,   /* PlayerStarttime */
       
   280 
       
   281   /* Since 0.10.16 */
       
   282   GST_RTSP_HDR_LOCATION             /* Location */
       
   283 
       
   284 } GstRTSPHeaderField;
       
   285 
       
   286 typedef enum {
       
   287   GST_RTSP_STS_INVALID                              = 0, 
       
   288   GST_RTSP_STS_CONTINUE                             = 100, 
       
   289   GST_RTSP_STS_OK                                   = 200, 
       
   290   GST_RTSP_STS_CREATED                              = 201, 
       
   291   GST_RTSP_STS_LOW_ON_STORAGE                       = 250, 
       
   292   GST_RTSP_STS_MULTIPLE_CHOICES                     = 300, 
       
   293   GST_RTSP_STS_MOVED_PERMANENTLY                    = 301, 
       
   294   GST_RTSP_STS_MOVE_TEMPORARILY                     = 302, 
       
   295   GST_RTSP_STS_SEE_OTHER                            = 303, 
       
   296   GST_RTSP_STS_NOT_MODIFIED                         = 304, 
       
   297   GST_RTSP_STS_USE_PROXY                            = 305, 
       
   298   GST_RTSP_STS_BAD_REQUEST                          = 400, 
       
   299   GST_RTSP_STS_UNAUTHORIZED                         = 401, 
       
   300   GST_RTSP_STS_PAYMENT_REQUIRED                     = 402, 
       
   301   GST_RTSP_STS_FORBIDDEN                            = 403, 
       
   302   GST_RTSP_STS_NOT_FOUND                            = 404, 
       
   303   GST_RTSP_STS_METHOD_NOT_ALLOWED                   = 405, 
       
   304   GST_RTSP_STS_NOT_ACCEPTABLE                       = 406, 
       
   305   GST_RTSP_STS_PROXY_AUTH_REQUIRED                  = 407, 
       
   306   GST_RTSP_STS_REQUEST_TIMEOUT                      = 408, 
       
   307   GST_RTSP_STS_GONE                                 = 410, 
       
   308   GST_RTSP_STS_LENGTH_REQUIRED                      = 411, 
       
   309   GST_RTSP_STS_PRECONDITION_FAILED                  = 412, 
       
   310   GST_RTSP_STS_REQUEST_ENTITY_TOO_LARGE             = 413, 
       
   311   GST_RTSP_STS_REQUEST_URI_TOO_LARGE                = 414, 
       
   312   GST_RTSP_STS_UNSUPPORTED_MEDIA_TYPE               = 415, 
       
   313   GST_RTSP_STS_PARAMETER_NOT_UNDERSTOOD             = 451, 
       
   314   GST_RTSP_STS_CONFERENCE_NOT_FOUND                 = 452, 
       
   315   GST_RTSP_STS_NOT_ENOUGH_BANDWIDTH                 = 453, 
       
   316   GST_RTSP_STS_SESSION_NOT_FOUND                    = 454, 
       
   317   GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE       = 455, 
       
   318   GST_RTSP_STS_HEADER_FIELD_NOT_VALID_FOR_RESOURCE  = 456, 
       
   319   GST_RTSP_STS_INVALID_RANGE                        = 457, 
       
   320   GST_RTSP_STS_PARAMETER_IS_READONLY                = 458, 
       
   321   GST_RTSP_STS_AGGREGATE_OPERATION_NOT_ALLOWED      = 459, 
       
   322   GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED     = 460, 
       
   323   GST_RTSP_STS_UNSUPPORTED_TRANSPORT                = 461, 
       
   324   GST_RTSP_STS_DESTINATION_UNREACHABLE              = 462, 
       
   325   GST_RTSP_STS_INTERNAL_SERVER_ERROR                = 500, 
       
   326   GST_RTSP_STS_NOT_IMPLEMENTED                      = 501, 
       
   327   GST_RTSP_STS_BAD_GATEWAY                          = 502, 
       
   328   GST_RTSP_STS_SERVICE_UNAVAILABLE                  = 503, 
       
   329   GST_RTSP_STS_GATEWAY_TIMEOUT                      = 504, 
       
   330   GST_RTSP_STS_RTSP_VERSION_NOT_SUPPORTED           = 505, 
       
   331   GST_RTSP_STS_OPTION_NOT_SUPPORTED                 = 551
       
   332 } GstRTSPStatusCode;
       
   333 
       
   334 gchar*             gst_rtsp_strresult          (GstRTSPResult result);
       
   335 
       
   336 const gchar*       gst_rtsp_method_as_text     (GstRTSPMethod method);
       
   337 const gchar*       gst_rtsp_version_as_text    (GstRTSPVersion version);
       
   338 const gchar*       gst_rtsp_header_as_text     (GstRTSPHeaderField field);
       
   339 const gchar*       gst_rtsp_status_as_text     (GstRTSPStatusCode code);
       
   340 
       
   341 GstRTSPHeaderField gst_rtsp_find_header_field  (const gchar *header);
       
   342 GstRTSPMethod      gst_rtsp_find_method        (const gchar *method);
       
   343 
       
   344 G_END_DECLS
       
   345 
       
   346 #endif /* __GST_RTSP_DEFS_H__ */