Home | History | Annotate | Download | only in src
      1 /* ------------------------------------------------------------------
      2  * Copyright (C) 1998-2009 PacketVideo
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     13  * express or implied.
     14  * See the License for the specific language governing permissions
     15  * and limitations under the License.
     16  * -------------------------------------------------------------------
     17  */
     18 
     19 #ifndef RTSP_PAR_COM_BASIC_DS_H_
     20 #define RTSP_PAR_COM_BASIC_DS_H_
     21 
     22 //#include "oscl_types.h"
     23 #include "oscl_base.h"
     24 
     25 #include "oscl_mem.h"
     26 #include "oscl_str_ptr_len.h"
     27 #include "rtprtcp.h"
     28 
     29 #define SIMPLE_HTTP_SUPPORT
     30 #define RTSP_PLAYLIST_SUPPORT
     31 
     32 // for RTSP method id
     33 //
     34 typedef enum
     35 {
     36     METHOD_UNRECOGNIZED = 0,
     37     METHOD_DESCRIBE,
     38     METHOD_GET_PARAMETER,
     39     METHOD_OPTIONS,
     40     METHOD_PAUSE,
     41     METHOD_PLAY,
     42     METHOD_SETUP,
     43     METHOD_RECORD,
     44     METHOD_TEARDOWN,
     45     METHOD_END_OF_STREAM,
     46     METHOD_BINARY_DATA,
     47     METHOD_REDIRECT,
     48     METHOD_SET_PARAMETER
     49 #ifdef SIMPLE_HTTP_SUPPORT
     50     , METHOD_GET
     51     , METHOD_POST
     52 #endif
     53 #ifdef RTSP_PLAYLIST_SUPPORT
     54     , METHOD_PLAYLIST_PLAY
     55 #endif
     56     , METHOD_NUM_ENTRIES //placeholder
     57 
     58 } RTSPMethod;
     59 
     60 
     61 // for easy transport access
     62 //
     63 typedef struct
     64 {
     65     // fields TBD
     66 } RTSPTransport;
     67 
     68 
     69 // for easy range access
     70 typedef struct
     71 {
     72     // fields TBD
     73 } RTSPRange;
     74 
     75 
     76 // type of message
     77 //
     78 typedef enum
     79 {
     80     RTSPRequestMsg,
     81     RTSPResponseMsg,
     82     RTSPUnknownMsg
     83 
     84 } RTSPMsgType;
     85 
     86 // return type for isMalformed
     87 //
     88 typedef enum
     89 {
     90     RTSPOk,
     91     RTSPErrorVersion,
     92     RTSPErrorTooBig,
     93     RTSPErrorTooManyFields,
     94     RTSPErrorSyntax
     95 } RTSPStructureStatus;
     96 
     97 
     98 // RTSP response code values
     99 //
    100 typedef uint16 RTSPStatusCode;
    101 
    102 // RTSP session id
    103 //
    104 typedef StrPtrLen RTSPSessionId;
    105 
    106 // RTSP entity body
    107 //
    108 typedef struct OsclMemoryFragment RTSPEntityBody;
    109 
    110 const RTSPStatusCode
    111 Code100 = 100,  // continue
    112           CodeContinue = 100,
    113 
    114                          Code200 = 200, // ok
    115                                    CodeOK = 200,
    116 
    117                                             Code201 = 201,  // created
    118                                                       CodeCreated = 201,
    119 
    120                                                                     Code250 = 250,  // low on storage space
    121                                                                               CodeLowOnStorageSpace = 250,
    122 
    123                                                                                                       Code300 = 300,  // multiple choices
    124                                                                                                                 CodeMultipleChoices = 300,
    125 
    126                                                                                                                                       Code301 = 301,  // moved permanently
    127                                                                                                                                                 CodeMovedPermanently = 301,
    128 
    129                                                                                                                                                                        Code302 = 302,  // moved temporarily
    130                                                                                                                                                                                  CodeMovedTemporarily = 302,
    131 
    132                                                                                                                                                                                                         Code303 = 303,  // see other
    133                                                                                                                                                                                                                   CodeSeeOther = 303,
    134 
    135                                                                                                                                                                                                                                  Code304 = 304,  // not modified
    136                                                                                                                                                                                                                                            CodeNotModified = 304,
    137 
    138                                                                                                                                                                                                                                                              Code305 = 305,  // use proxy
    139                                                                                                                                                                                                                                                                        CodeUseProxy = 305,
    140 
    141                                                                                                                                                                                                                                                                                       Code400 = 400,    // bad request
    142                                                                                                                                                                                                                                                                                                 CodeBadRequest = 400,
    143 
    144                                                                                                                                                                                                                                                                                                                  Code401 = 401, // unauthorized
    145                                                                                                                                                                                                                                                                                                                            CodeUnauthorized = 401,
    146 
    147                                                                                                                                                                                                                                                                                                                                               Code402 = 402,  // payment required
    148                                                                                                                                                                                                                                                                                                                                                         CodePaymentRequired = 402,
    149 
    150                                                                                                                                                                                                                                                                                                                                                                               Code403 = 403,  // forbidden
    151                                                                                                                                                                                                                                                                                                                                                                                         CodeForbidden = 403,
    152 
    153                                                                                                                                                                                                                                                                                                                                                                                                         Code404 = 404,  // not found
    154                                                                                                                                                                                                                                                                                                                                                                                                                   CodeNotFound = 404,
    155 
    156                                                                                                                                                                                                                                                                                                                                                                                                                                  Code405 = 405,  // method not allowed
    157                                                                                                                                                                                                                                                                                                                                                                                                                                            CodeMethodNotAllowed = 405,
    158 
    159                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Code406 = 406,    // not acceptable
    160                                                                                                                                                                                                                                                                                                                                                                                                                                                                             CodeNotAcceptable = 406,
    161 
    162                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 Code407 = 407,  // proxy authentication required
    163                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           CodeProxyAuthenticationRequired = 407,
    164 
    165                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Code408 = 408,  // request time-out
    166                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       CodeRequestTimeOut = 408,
    167 
    168                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Code410 = 410,  // gone
    169                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      CodeGone = 410,
    170 
    171                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 Code411 = 411,  // length required
    172                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           CodeLengthRequired = 411,
    173 
    174                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Code412 = 412,  // precondition failed
    175                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          CodePreconditionFailed = 412,
    176 
    177                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Code413 = 413,    // request entity too large
    178                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             CodeRequestEntityTooLarge = 413,
    179 
    180                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Code414 = 414,  // request-uri too large
    181                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   CodeRequestURITooLarge = 414,
    182 
    183                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Code415 = 415,  // unsupported media type
    184                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      CodeUnsupportedMediaType = 415,
    185 
    186                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 Code451 = 451,  // parameter not understood
    187                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           CodeParameterNotUnderstood = 451,
    188 
    189                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Code452 = 452,  // conference not found
    190                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  CodeConferenceNotFound = 452,
    191 
    192                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           Code453 = 453,  // not enough bandwidth
    193                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     CodeNotEnoughBandwidth = 453,
    194 
    195                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Code454 = 454, // session not found
    196                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        CodeSessionNotFound = 454,
    197 
    198                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Code455 = 455, // method not valid in this state
    199                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        CodeMethodNotValidInThisState = 455,
    200 
    201                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Code456 = 456,   // header field not valid for resource
    202                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  CodeHeaderFieldNotValidForResource = 456,
    203 
    204                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       Code457 = 457,    // invalid range
    205                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 CodeInvalidRange = 457,
    206 
    207                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Code458 = 458,  // parameter is read-only
    208                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              CodeParameterIsReadOnly = 458,
    209 
    210                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Code459 = 459,   // aggregate operation not allowed
    211                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  CodeAggregateOperationNotAllowed = 459,
    212 
    213                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Code460 = 460,  // only aggregate operation allowed
    214                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               CodeOnlyAggregateOperationAllowed = 460,
    215 
    216                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Code461 = 461,    // unsupported transport
    217                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             CodeUnsupportedTransport = 461,
    218 
    219                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Code462 = 462,   // destination unreachable
    220                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  CodeDestinationUnreachable = 462,
    221 
    222                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               Code480 = 480,  // unsupported client
    223                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         CodeUnsupportedClient = 480,
    224 
    225                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 Code500 = 500,  // internal server error
    226                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           CodeInternalServerError = 500,
    227 
    228                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Code501 = 501,  // not implemented
    229                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               CodeNotImplemented = 501,
    230 
    231                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Code502 = 502,   // bad gateway
    232                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              CodeBadGateway = 502,
    233 
    234                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               Code503 = 503,    // service unavailable
    235                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         CodeServiceUnavailable = 503,
    236 
    237                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Code504 = 504, // gateway timeout
    238                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            CodeGatewayTimeout = 504,
    239 
    240                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 Code505 = 505,  // rtsp version not supported
    241                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           CodeRTSPVersionNotSupported = 505,
    242 
    243                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Code551 = 551,  // option not supported
    244                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   CodeOptionNotSupported = 551
    245                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ;
    246 
    247 typedef struct
    248 {
    249     StrPtrLen     url;
    250     bool          urlIsSet;
    251 
    252     RtpSeqType    seq;
    253     bool          seqIsSet;
    254 
    255     RtpTimeStamp  rtptime;
    256     bool          rtptimeIsSet;
    257 
    258 } RTSPRTPInfo;
    259 
    260 #endif // RTSP_PAR_COM_BASIC_DS_H_
    261