]> git.0d.be Git - empathy.git/blob - libempathy/empathy-tp-tube.h
8e63945e52d1c4abbab21791e7c2aadae1877fca
[empathy.git] / libempathy / empathy-tp-tube.h
1 /*
2  * Copyright (C) 2008 Collabora Ltd.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
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  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  *
18  * Authors: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
19  *          Elliot Fairweather <elliot.fairweather@collabora.co.uk>
20  */
21
22 #ifndef __EMPATHY_TP_TUBE_H__
23 #define __EMPATHY_TP_TUBE_H__
24
25 #include <glib-object.h>
26
27 #include <telepathy-glib/channel.h>
28
29 #include "empathy-contact.h"
30
31 G_BEGIN_DECLS
32
33 #define EMPATHY_TYPE_TP_TUBE (empathy_tp_tube_get_type ())
34 #define EMPATHY_TP_TUBE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), \
35     EMPATHY_TYPE_TP_TUBE, EmpathyTpTube))
36 #define EMPATHY_TP_TUBE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
37     EMPATHY_TYPE_TP_TUBE, EmpathyTpTubeClass))
38 #define EMPATHY_IS_TP_TUBE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), \
39     EMPATHY_TYPE_TP_TUBE))
40 #define EMPATHY_IS_TP_TUBE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
41     EMPATHY_TYPE_TP_TUBE))
42 #define EMPATHY_TP_TUBE_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), \
43     EMPATHY_TYPE_TP_TUBE, EmpathyTpTubeClass))
44
45 typedef struct _EmpathyTpTube EmpathyTpTube;
46 typedef struct _EmpathyTpTubeClass EmpathyTpTubeClass;
47
48 typedef struct {
49   TpSocketAddressType type;
50   union {
51     struct socket_address_t {
52       GArray *path;
53     } socket;
54     struct inet_address_t {
55       gchar *hostname;
56       guint port;
57     } inet;
58   } a;
59 } EmpathyTpTubeAddress;
60
61 struct _EmpathyTpTube {
62   GObject parent;
63   gpointer priv;
64 };
65
66 struct _EmpathyTpTubeClass {
67   GObjectClass parent_class;
68 };
69
70 GType empathy_tp_tube_get_type (void) G_GNUC_CONST;
71 EmpathyTpTube *empathy_tp_tube_new (TpChannel *channel);
72 EmpathyTpTube *empathy_tp_tube_new_stream_tube (EmpathyContact *contact,
73     TpSocketAddressType type, const gchar *hostname, guint port,
74     const gchar *service, GHashTable *parameters);
75
76 typedef void (EmpatyTpTubeAcceptStreamTubeCb) (EmpathyTpTube *tube,
77   const EmpathyTpTubeAddress *address, const GError *error,
78   gpointer user_data);
79
80 void empathy_tp_tube_accept_stream_tube (EmpathyTpTube *tube,
81   TpSocketAddressType type, EmpatyTpTubeAcceptStreamTubeCb *callback,
82   gpointer user_data);
83
84 G_END_DECLS
85
86 #endif /* __EMPATHY_TP_TUBE_H__ */