Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

gtask-connection.h

Go to the documentation of this file.
00001 #ifndef GTASK_CONNECTION_H
00002 #define GTASK_CONNECTION_H
00003 
00004 #include <stdio.h>
00005 #include <glib-2.0/glib-object.h>
00006 #include <libxml/xmlIO.h>
00007 
00008 #include <gtask/gtask-stream-parser.h>
00009 #include <gtask/gtask-event-dispatcher.h>
00010 
00013 /* @{ */
00014 
00015 typedef struct _GTaskConnection        GTaskConnection;
00016 typedef struct _GTaskConnectionPrivate GTaskConnectionPrivate;
00017 typedef struct _GTaskConnectionClass   GTaskConnectionClass;
00018 
00020 #define GTASK_CONNECTION_TYPE            (gtask_connection_get_type())
00021 
00023 #define GTASK_CONNECTION(obj)            (G_TYPE_CHECK_INSTANCE_CAST( (obj), \
00024                                           GTASK_CONNECTION_TYPE, \
00025                                           GTaskConnection ))
00026 
00028 #define GTASK_CONNECTION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST( (klass), \
00029                                           GTASK_CONNECTION_TYPE, \
00030                                           GTaskConnectionClass ))
00031 
00036 #define GTASK_IS_CONNECTION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE( (obj), \
00037                                           GTASK_CONNECTION_TYPE ))
00038 
00043 #define GTASK_IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE( (klass), \
00044                                           GTASK_CONNECTION_TYPE ))
00045 
00046 #define GTASK_CONNECTION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS( (obj), \
00047                                           GTASK_CONNECTION_TYPE, \
00048                                           GTaskConnectionClass ))
00049 
00050 typedef enum  {
00051     GTASK_ROLE_NONE,        
00052     GTASK_ROLE_PROXY,       
00053     GTASK_ROLE_REPORTER,    
00054     GTASK_ROLE_PROVIDER     
00055 } GTaskRole;
00056 
00057 typedef enum {
00058     GTASK_CONNECTION_METHOD_SOCKET,
00059     GTASK_CONNECTION_METHOD_LOOPBACK,
00060     GTASK_CONNECTION_METHOD_FD,
00061     GTASK_CONNECTION_METHOD_UNKNOWN
00062 } GTaskConnectionMethod;
00063 
00064 #define GTASK_ROLE_TYPE                   (gtask_role_get_type())
00065 
00069 struct _GTaskConnectionPrivate {
00070     gint                    inp_fd;     
00071     gint                    out_fd;     
00072 
00073     xmlOutputBufferPtr      xml_output; 
00074 
00075     GIOChannel              *g_input;
00076 
00077     GTaskRole                role;
00078     GString                 *name;
00079 
00080     gboolean                 g_hup_watch_on;
00081     guint                    g_hup_source_id;
00082     guint                    g_in_source_id;
00083 
00084     GTaskStreamParser       *parser;
00085     GTaskEventDispatcher    *dispatcher;
00086 
00087     /* how did we get connected in the first place? */
00088     GTaskConnectionMethod    conn_method;
00089     char                    *socket_uri;
00090 
00091     gboolean                 auto_reconnect;
00092     gboolean                 auto_parse;
00093 };
00094 
00100 struct _GTaskConnection {
00101     GObject                 parent;     
00102     GTaskConnectionPrivate *private;    
00103 };
00104 
00105 struct _GTaskConnectionClass {
00106     GObjectClass parent;
00107 
00108     guint        connected_signal_id;
00109     guint        disconnected_signal_id;
00110 };
00111 
00112 GType gtask_role_get_type( void );
00113 
00114 GType gtask_connection_get_type( void );
00115 
00116 char *
00117 gtask_connection_default_server_bind_path( );
00118 
00119 GTaskConnection *
00120 gtask_connection_new( void );
00121 
00122 GTaskConnection *
00123 gtask_connection_new_with_properties( const gchar *name, GTaskRole role );
00124 
00125 char *
00126 gtask_connection_default_server_bind_path( void );
00127 
00128 gboolean
00129 gtask_connection_connect_domain_socket_default( GTaskConnection *conn );
00130 
00131 gboolean
00132 gtask_connection_connect_domain_socket( GTaskConnection *conn, const char *file );
00133 
00134 gboolean
00135 gtask_connection_connect_fd( GTaskConnection *conn, int inp_fd, int out_fd );
00136 
00137 gboolean
00138 gtask_connection_connect_loopback( GTaskConnection *conn );
00139 
00140 gboolean
00141 gtask_connection_is_connection( GTaskConnection *conn );
00142 
00143 gboolean gtask_connection_close( GTaskConnection *conn );
00144 
00145 int
00146 gtask_connection_get_input_fd( GTaskConnection *conn );
00147 
00148 int
00149 gtask_connection_get_output_fd( GTaskConnection *conn );
00150 
00151 GIOChannel *
00152 gtask_connection_get_gio_input_channel( GTaskConnection *conn );
00153 
00154 xmlOutputBufferPtr
00155 gtask_connection_get_xml_output_buffer( GTaskConnection *conn );
00156 
00157 gboolean
00158 gtask_connection_is_connected( GTaskConnection *conn );
00159 
00160 const gchar *
00161 gtask_connection_get_name( GTaskConnection *conn );
00162 
00163 void
00164 gtask_connection_set_name( GTaskConnection *conn, const gchar *name );
00165 
00166 GTaskRole
00167 gtask_connection_get_role( GTaskConnection *conn );
00168 
00169 void
00170 gtask_connection_set_role( GTaskConnection *conn, GTaskRole role );
00171 
00172 GTaskStreamParser *
00173 gtask_connection_get_stream_parser( GTaskConnection *conn );
00174 
00175 GTaskEventDispatcher *
00176 gtask_connection_get_event_dispatcher( GTaskConnection *conn );
00177 
00178 /* @} */
00179 
00180 #endif

Generated on Mon Feb 2 21:26:14 2004 for libgtask by doxygen 1.3.4