[svn r198] Fixed problem with Coxinha.
4 * @file gmyth/gmyth_socket.h
6 * @brief <p> MythTV socket implementation, according to the MythTV Project
9 * This component provides basic socket functionalities to interact with
13 * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
14 * @author Rosfran Lins Borges <rosfran.borges@indt.org.br>
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU Lesser General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU Lesser General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 #ifndef __GMYTH_SOCKET_H__
34 #define __GMYTH_SOCKET_H__
36 #include <glib-object.h>
40 #include <sys/socket.h>
44 #include "gmyth_stringlist.h"
48 #define GMYTH_SOCKET_TYPE (gmyth_socket_get_type ())
49 #define GMYTH_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_SOCKET_TYPE, GMythSocket))
50 #define GMYTH_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_SOCKET_TYPE, GMythSocketClass))
51 #define IS_GMYTH_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_SOCKET_TYPE))
52 #define IS_GMYTH_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_SOCKET_TYPE))
53 #define GMYTH_SOCKET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_SOCKET_TYPE, GMythSocketClass))
56 typedef struct _GMythSocket GMythSocket;
57 typedef struct _GMythSocketClass GMythSocketClass;
59 struct _GMythSocketClass
61 GObjectClass parent_class;
71 /* socket descriptor */
80 /* used when no protocol version number was negotiated */
81 #define MYTHTV_CANNOT_NEGOTIATE_VERSION 0
83 GType gmyth_socket_get_type (void);
85 GMythSocket * gmyth_socket_new ( );
87 GIOChannel * gmyth_socket_get_io_channel (GMythSocket *gmyth_socket );
89 gboolean gmyth_socket_is_able_to_read (GMythSocket *gmyth_socket );
90 gboolean gmyth_socket_is_able_to_write (GMythSocket *gmyth_socket );
92 gboolean gmyth_socket_send_command (GMythSocket *gmyth_socket,
94 GString * gmyth_socket_receive_response (GMythSocket *gmyth_socket);
95 gint gmyth_socket_sendreceive_stringlist (GMythSocket *gmyth_socket,
96 GMythStringList *str_list);
98 gboolean gmyth_socket_connect (GMythSocket *gmyth_socket,
99 const gchar *hostname, gint port);
100 gboolean gmyth_socket_connect_to_backend (GMythSocket *gmyth_socket,
101 const gchar *hostname_backend, gint port,
102 gboolean blocking_client);
104 gboolean gmyth_socket_connect_to_backend_events (GMythSocket *gmyth_socket,
105 const gchar *hostname_backend, gint port,
106 gboolean blocking_client);
108 GString * gmyth_socket_get_local_hostname (void);
110 void gmyth_socket_close_connection (GMythSocket *gmyth_socket);
112 gboolean gmyth_socket_check_protocol_version (GMythSocket *gmyth_socket);
113 gint gmyth_socket_check_protocol_version_number (GMythSocket *gmyth_socket,
114 gint mythtv_version);
116 gint gmyth_socket_get_protocol_version (GMythSocket *gmyth_socket);
118 gboolean gmyth_socket_write_stringlist(GMythSocket *gmyth_socket,
119 GMythStringList* str_list);
120 gint gmyth_socket_read_stringlist(GMythSocket *gmyth_socket,
121 GMythStringList* str_list);
124 #endif /* __GMYTH_SOCKET_H__ */