2 * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com>
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.
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.
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.
20 * Unless otherwise indicated, Source Code is licensed under MIT license.
21 * See further explanation attached in License Statement (distributed in the file
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:
31 * The above copyright notice and this permission notice shall be included in all
32 * copies or substantial portions of the Software.
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
43 #ifndef __GST_RTSP_CONNECTION_H__
44 #define __GST_RTSP_CONNECTION_H__
48 #include <gst/rtsp/gstrtspdefs.h>
49 #include <gst/rtsp/gstrtspurl.h>
50 #include <gst/rtsp/gstrtspmessage.h>
57 * Opaque RTSP connection object.
59 typedef struct _GstRTSPConnection GstRTSPConnection;
61 /* opening/closing a connection */
62 GstRTSPResult gst_rtsp_connection_create (GstRTSPUrl *url, GstRTSPConnection **conn);
63 GstRTSPResult gst_rtsp_connection_accept (gint sock, GstRTSPConnection **conn);
64 GstRTSPResult gst_rtsp_connection_connect (GstRTSPConnection *conn, GTimeVal *timeout);
65 GstRTSPResult gst_rtsp_connection_close (GstRTSPConnection *conn);
66 GstRTSPResult gst_rtsp_connection_free (GstRTSPConnection *conn);
68 /* sending/receiving raw bytes */
69 GstRTSPResult gst_rtsp_connection_read (GstRTSPConnection * conn, guint8 * data,
70 guint size, GTimeVal * timeout);
71 GstRTSPResult gst_rtsp_connection_write (GstRTSPConnection * conn, const guint8 * data,
72 guint size, GTimeVal * timeout);
74 /* sending/receiving messages */
75 GstRTSPResult gst_rtsp_connection_send (GstRTSPConnection *conn, GstRTSPMessage *message,
77 GstRTSPResult gst_rtsp_connection_receive (GstRTSPConnection *conn, GstRTSPMessage *message,
80 /* status management */
81 GstRTSPResult gst_rtsp_connection_poll (GstRTSPConnection *conn, GstRTSPEvent events,
82 GstRTSPEvent *revents, GTimeVal *timeout);
84 /* reset the timeout */
85 GstRTSPResult gst_rtsp_connection_next_timeout (GstRTSPConnection *conn, GTimeVal *timeout);
86 GstRTSPResult gst_rtsp_connection_reset_timeout (GstRTSPConnection *conn);
89 GstRTSPResult gst_rtsp_connection_flush (GstRTSPConnection *conn, gboolean flush);
91 /* configure authentication data */
92 GstRTSPResult gst_rtsp_connection_set_auth (GstRTSPConnection *conn, GstRTSPAuthMethod method,
93 const gchar *user, const gchar *pass);
95 void gst_rtsp_connection_set_auth_param (GstRTSPConnection *conn,
98 void gst_rtsp_connection_clear_auth_params (GstRTSPConnection *conn);
101 GstRTSPResult gst_rtsp_connection_set_qos_dscp (GstRTSPConnection *conn,
105 const gchar * gst_rtsp_connection_get_ip (const GstRTSPConnection *conn);
112 * Opaque RTSP watch object that can be used for asynchronous RTSP
115 typedef struct _GstRTSPWatch GstRTSPWatch;
119 * @message_received: callback when a message was received
120 * @message_sent: callback when a message was sent
121 * @closed: callback when the connection is closed
122 * @error: callback when an error occured
124 * Callback functions from a #GstRTSPWatch.
127 GstRTSPResult (*message_received) (GstRTSPWatch *watch, GstRTSPMessage *message,
129 GstRTSPResult (*message_sent) (GstRTSPWatch *watch, guint cseq,
131 GstRTSPResult (*closed) (GstRTSPWatch *watch, gpointer user_data);
132 GstRTSPResult (*error) (GstRTSPWatch *watch, GstRTSPResult result,
136 gpointer _gst_reserved[GST_PADDING];
139 GstRTSPWatch * gst_rtsp_watch_new (GstRTSPConnection *conn,
140 GstRTSPWatchFuncs *funcs,
142 GDestroyNotify notify);
143 void gst_rtsp_watch_unref (GstRTSPWatch *watch);
145 guint gst_rtsp_watch_attach (GstRTSPWatch *watch,
146 GMainContext *context);
148 guint gst_rtsp_watch_queue_message (GstRTSPWatch *watch,
149 GstRTSPMessage *message);
153 #endif /* __GST_RTSP_CONNECTION_H__ */