ekg2  GIT master
connections.h
Idź do dokumentacji tego pliku.
1 /*
2  * Asynchronous read/write handling for connections
3  *
4  * (C) Copyright 2011 EKG2 team
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License Version 2 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifndef __EKG_CONNECTIONS_H
21 #define __EKG_CONNECTIONS_H
22 
23 #define EKG_CONNECTION_ERROR ekg_connection_error_quark()
24 G_GNUC_CONST GQuark ekg_connection_error_quark();
25 
28 };
29 
30 typedef void (*ekg_input_callback_t) (
31  GDataInputStream *instream,
32  gpointer data);
33 typedef void (*ekg_failure_callback_t) (
34  GDataInputStream *instream,
35  GError *err,
36  gpointer data);
37 typedef void (*ekg_connection_callback_t) (
38  GSocketConnection *conn,
39  GInputStream *instream,
40  GOutputStream *outstream,
41  gpointer data);
43  GError *err,
44  gpointer data);
45 
46 GDataOutputStream *ekg_connection_add(
47  GSocketConnection *conn,
48  GInputStream *rawinstream,
49  GOutputStream *rawoutstream,
50  ekg_input_callback_t callback,
51  ekg_failure_callback_t failure_callback,
52  gpointer priv_data);
53 
54 void ekg_disconnect_by_outstream(GDataOutputStream *f);
55 
56 void ekg_connection_write_buf(GDataOutputStream *f, gconstpointer buf, gsize len);
57 
59  GDataOutputStream *f,
60  const gchar *format,
61  ...) G_GNUC_PRINTF(2,3);
62 
64 
65 ekg_connection_starter_t ekg_connection_starter_new(guint16 defport);
66 void ekg_connection_starter_free(ekg_connection_starter_t cs);
67 
69  ekg_connection_starter_t cs,
70  const gchar *hostname);
72  ekg_connection_starter_t cs,
73  const gchar *service,
74  const gchar *domain);
76  ekg_connection_starter_t cs,
77  const gchar *servers);
79  ekg_connection_starter_t cs,
80  gboolean use_tls); /* XXX */
81 
82 GCancellable *ekg_connection_starter_run(
83  ekg_connection_starter_t cs,
84  GSocketClient *sock,
86  ekg_connection_failure_callback_t failure_callback,
87  gpointer priv_data);
88 
89 #endif /* __EKG_CONNECTIONS_H */
ekg_connection_error
Definition: connections.h:26
Definition: ekg_hash_benchmark.c:47
void ekg_connection_write(GDataOutputStream *f, const gchar *format,...) G_GNUC_PRINTF(2
void ekg_connection_starter_set_servers(ekg_connection_starter_t cs, const gchar *servers)
Definition: connections.c:453
void ekg_connection_starter_bind(ekg_connection_starter_t cs, const gchar *hostname)
Definition: connections.c:434
void ekg_connection_starter_free(ekg_connection_starter_t cs)
Definition: connections.c:425
Definition: connections.c:331
void(* ekg_connection_failure_callback_t)(GError *err, gpointer data)
Definition: connections.h:42
void ekg_disconnect_by_outstream(GDataOutputStream *f)
Definition: connections.c:271
Definition: connections.h:27
ekg_connection_starter_t ekg_connection_starter_new(guint16 defport)
Definition: connections.c:417
typedefvoid struct ekg_connection_starter * ekg_connection_starter_t
Definition: connections.h:63
static DBusError err
Definition: dbus.c:38
void ekg_connection_starter_set_srv_resolver(ekg_connection_starter_t cs, const gchar *service, const gchar *domain)
Definition: connections.c:442
GDataOutputStream * ekg_connection_add(GSocketConnection *conn, GInputStream *rawinstream, GOutputStream *rawoutstream, ekg_input_callback_t callback, ekg_failure_callback_t failure_callback, gpointer priv_data)
Definition: connections.c:215
void ekg_connection_starter_set_use_tls(ekg_connection_starter_t cs, gboolean use_tls)
Definition: connections.c:461
void(* ekg_input_callback_t)(GDataInputStream *instream, gpointer data)
Definition: connections.h:30
GCancellable * ekg_connection_starter_run(ekg_connection_starter_t cs, GSocketClient *sock, ekg_connection_callback_t callback, ekg_connection_failure_callback_t failure_callback, gpointer priv_data)
Definition: connections.c:468
void(* ekg_failure_callback_t)(GDataInputStream *instream, GError *err, gpointer data)
Definition: connections.h:33
G_GNUC_CONST GQuark ekg_connection_error_quark()
Definition: connections.c:31
void(* ekg_connection_callback_t)(GSocketConnection *conn, GInputStream *instream, GOutputStream *outstream, gpointer data)
Definition: connections.h:37
void ekg_connection_write_buf(GDataOutputStream *f, gconstpointer buf, gsize len)
Definition: connections.c:284
static DBusConnection * conn
Definition: dbus.c:37