#include <netdb.h>
#endif
+struct rtsp_header
+{
+ const gchar *name;
+ gboolean multiple;
+};
+
static const gchar *rtsp_results[] = {
"OK",
/* errors */
NULL
};
-static const gchar *rtsp_headers[] = {
- "Accept", /* Accept R opt. entity */
- "Accept-Encoding", /* Accept-Encoding R opt. entity */
- "Accept-Language", /* Accept-Language R opt. all */
- "Allow", /* Allow r opt. all */
- "Authorization", /* Authorization R opt. all */
- "Bandwidth", /* Bandwidth R opt. all */
- "Blocksize", /* Blocksize R opt. all but OPTIONS, TEARDOWN */
- "Cache-Control", /* Cache-Control g opt. SETUP */
- "Conference", /* Conference R opt. SETUP */
- "Connection", /* Connection g req. all */
- "Content-Base", /* Content-Base e opt. entity */
- "Content-Encoding", /* Content-Encoding e req. SET_PARAMETER, DESCRIBE, ANNOUNCE */
- "Content-Language", /* Content-Language e req. DESCRIBE, ANNOUNCE */
- "Content-Length", /* Content-Length e req. SET_PARAMETER, ANNOUNCE, entity */
- "Content-Location", /* Content-Location e opt. entity */
- "Content-Type", /* Content-Type e req. SET_PARAMETER, ANNOUNCE, entity */
- "CSeq", /* CSeq g req. all */
- "Date", /* Date g opt. all */
- "Expires", /* Expires e opt. DESCRIBE, ANNOUNCE */
- "From", /* From R opt. all */
- "If-Modified-Since", /* If-Modified-Since R opt. DESCRIBE, SETUP */
- "Last-Modified", /* Last-Modified e opt. entity */
- "Proxy-Authenticate", /* Proxy-Authenticate */
- "Proxy-Require", /* Proxy-Require R req. all */
- "Public", /* Public r opt. all */
- "Range", /* Range Rr opt. PLAY, PAUSE, RECORD */
- "Referer", /* Referer R opt. all */
- "Require", /* Require R req. all */
- "Retry-After", /* Retry-After r opt. all */
- "RTP-Info", /* RTP-Info r req. PLAY */
- "Scale", /* Scale Rr opt. PLAY, RECORD */
- "Session", /* Session Rr req. all but SETUP, OPTIONS */
- "Server", /* Server r opt. all */
- "Speed", /* Speed Rr opt. PLAY */
- "Transport", /* Transport Rr req. SETUP */
- "Unsupported", /* Unsupported r req. all */
- "User-Agent", /* User-Agent R opt. all */
- "Via", /* Via g opt. all */
- "WWW-Authenticate", /* WWW-Authenticate r opt. all */
+static struct rtsp_header rtsp_headers[] = {
+ {"Accept", TRUE},
+ {"Accept-Encoding", TRUE},
+ {"Accept-Language", TRUE},
+ {"Allow", TRUE},
+ {"Authorization", FALSE},
+ {"Bandwidth", FALSE},
+ {"Blocksize", FALSE},
+ {"Cache-Control", TRUE},
+ {"Conference", FALSE},
+ {"Connection", TRUE},
+ {"Content-Base", FALSE},
+ {"Content-Encoding", TRUE},
+ {"Content-Language", TRUE},
+ {"Content-Length", FALSE},
+ {"Content-Location", FALSE},
+ {"Content-Type", FALSE},
+ {"CSeq", FALSE},
+ {"Date", FALSE},
+ {"Expires", FALSE},
+ {"From", FALSE},
+ {"If-Modified-Since", FALSE},
+ {"Last-Modified", FALSE},
+ {"Proxy-Authenticate", TRUE},
+ {"Proxy-Require", TRUE},
+ {"Public", TRUE},
+ {"Range", FALSE},
+ {"Referer", FALSE},
+ {"Require", TRUE},
+ {"Retry-After", FALSE},
+ {"RTP-Info", TRUE},
+ {"Scale", FALSE},
+ {"Session", FALSE},
+ {"Server", FALSE},
+ {"Speed", FALSE},
+ {"Transport", FALSE},
+ {"Unsupported", FALSE},
+ {"User-Agent", FALSE},
+ {"Via", TRUE},
+ {"WWW-Authenticate", TRUE},
/* Real extensions */
- "ClientChallenge", /* ClientChallenge */
- "RealChallenge1", /* RealChallenge1 */
- "RealChallenge2", /* RealChallenge2 */
- "RealChallenge3", /* RealChallenge3 */
- "Subscribe", /* Subscribe */
- "Alert", /* Alert */
- "ClientID", /* ClientID */
- "CompanyID", /* CompanyID */
- "GUID", /* GUID */
- "RegionData", /* RegionData */
- "SupportsMaximumASMBandwidth", /* SupportsMaximumASMBandwidth */
- "Language", /* Language */
- "PlayerStarttime", /* PlayerStarttime */
-
- "Location", /* Location */
- "ETag", /* ETag */
- "If-Match", /* If-Match */
-
- /* WM extensions [MS-RTSP] */
- "Accept-Charset", /* Accept-Charset */
- "Supported", /* Supported */
- "Vary", /* Vary */
- "X-Accelerate-Streaming", /* X-Accelerate-Streaming */
- "X-Accept-Authentication", /* X-Accept-Authentication */
- "X-Accept-Proxy-Authentication", /* X-Accept-Proxy-Authentication */
- "X-Broadcast-Id", /* X-Broadcast-Id */
- "X-Burst-Streaming", /* X-Burst-Streaming */
- "X-Notice", /* X-Notice */
- "X-Player-Lag-Time", /* X-Player-Lag-Time */
- "X-Playlist", /* X-Playlist */
- "X-Playlist-Change-Notice", /* X-Playlist-Change-Notice */
- "X-Playlist-Gen-Id", /* X-Playlist-Gen-Id */
- "X-Playlist-Seek-Id", /* X-Playlist-Seek-Id */
- "X-Proxy-Client-Agent", /* X-Proxy-Client-Agent */
- "X-Proxy-Client-Verb", /* X-Proxy-Client-Verb */
- "X-Receding-PlaylistChange", /* X-Receding-PlaylistChange */
- "X-RTP-Info", /* X-RTP-Info */
- "X-StartupProfile", /* X-StartupProfile */
-
- "Timestamp", /* Timestamp */
-
- "Authentication-Info", /* Authentication-Info */
- "Host", /* Host */
- "Pragma", /* Pragma */
- "X-Server-IP-Address", /* X-Server-IP-Address */
- "X-Sessioncookie", /* X-Sessioncookie */
-
- NULL
+ {"ClientChallenge", FALSE},
+ {"RealChallenge1", FALSE},
+ {"RealChallenge2", FALSE},
+ {"RealChallenge3", FALSE},
+ {"Subscribe", FALSE},
+ {"Alert", FALSE},
+ {"ClientID", FALSE},
+ {"CompanyID", FALSE},
+ {"GUID", FALSE},
+ {"RegionData", FALSE},
+ {"SupportsMaximumASMBandwidth", FALSE},
+ {"Language", FALSE},
+ {"PlayerStarttime", FALSE},
+
+ /* Since 0.10.16 */
+ {"Location", FALSE},
+
+ /* Since 0.10.23 */
+ {"ETag", FALSE},
+ {"If-Match", TRUE},
+
+ /* WM extensions [MS-RTSP] Since 0.10.23 */
+ {"Accept-Charset", TRUE},
+ {"Supported", TRUE},
+ {"Vary", TRUE},
+ {"X-Accelerate-Streaming", FALSE},
+ {"X-Accept-Authentication", FALSE},
+ {"X-Accept-Proxy-Authentication", FALSE},
+ {"X-Broadcast-Id", FALSE},
+ {"X-Burst-Streaming", FALSE},
+ {"X-Notice", FALSE},
+ {"X-Player-Lag-Time", FALSE},
+ {"X-Playlist", FALSE},
+ {"X-Playlist-Change-Notice", FALSE},
+ {"X-Playlist-Gen-Id", FALSE},
+ {"X-Playlist-Seek-Id", FALSE},
+ {"X-Proxy-Client-Agent", FALSE},
+ {"X-Proxy-Client-Verb", FALSE},
+ {"X-Receding-PlaylistChange", FALSE},
+ {"X-RTP-Info", FALSE},
+ {"X-StartupProfile", FALSE},
+
+ /* Since 0.10.24 */
+ {"Timestamp", FALSE},
+
+ /* Since 0.10.25 */
+ {"Authentication-Info", FALSE},
+ {"Host", FALSE},
+ {"Pragma", TRUE},
+ {"X-Server-IP-Address", FALSE},
+ {"X-Sessioncookie", FALSE},
+
+ {NULL, FALSE}
};
#define DEF_STATUS(c, t) \
if (field == GST_RTSP_HDR_INVALID)
return NULL;
else
- return rtsp_headers[field - 1];
+ return rtsp_headers[field - 1].name;
}
/**
{
gint idx;
- for (idx = 0; rtsp_headers[idx]; idx++) {
- if (g_ascii_strcasecmp (rtsp_headers[idx], header) == 0) {
+ for (idx = 0; rtsp_headers[idx].name; idx++) {
+ if (g_ascii_strcasecmp (rtsp_headers[idx].name, header) == 0) {
return idx + 1;
}
}
return g_string_free (str, FALSE);
}
+
+/**
+ * gst_rtsp_header_allow_multiple:
+ * @field: a #GstRTSPHeaderField
+ *
+ * Check whether @field may appear multiple times in a message.
+ *
+ * Returns: %TRUE if multiple headers are allowed.
+ *
+ * Since: 0.10.25
+ */
+gboolean
+gst_rtsp_header_allow_multiple (GstRTSPHeaderField field)
+{
+ if (field == GST_RTSP_HDR_INVALID)
+ return FALSE;
+ else
+ return rtsp_headers[field - 1].multiple;
+}