summaryrefslogtreecommitdiff
path: root/src/jingle-transport-iface.h
blob: 9e0a368106c16410e5d3a8c5bce08b28ce1e98ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
 * jingle_transport-iface.h - Header for GabbleJingleTransport interface
 * Copyright (C) 2007-2008 Collabora Ltd.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef __GABBLE_JINGLE_TRANSPORT_IFACE_H__
#define __GABBLE_JINGLE_TRANSPORT_IFACE_H__

#include <glib-object.h>
#include <loudmouth/loudmouth.h>

#include "jingle-factory.h"
#include "types.h"

G_BEGIN_DECLS

typedef enum
{
  JINGLE_TRANSPORT_STATE_DISCONNECTED,
  JINGLE_TRANSPORT_STATE_CONNECTING,
  JINGLE_TRANSPORT_STATE_CONNECTED
} JingleTransportState;

typedef struct _GabbleJingleTransportIface GabbleJingleTransportIface;
typedef struct _GabbleJingleTransportIfaceClass GabbleJingleTransportIfaceClass;

struct _GabbleJingleTransportIfaceClass {
  GTypeInterface parent;

  void (*parse_candidates) (GabbleJingleTransportIface *,
    LmMessageNode *, GError **);

  void (*new_local_candidates) (GabbleJingleTransportIface *, GList *);
  void (*inject_candidates) (GabbleJingleTransportIface *,
      LmMessageNode *transport_node);
  void (*send_candidates) (GabbleJingleTransportIface *, gboolean all);
  gboolean (*can_accept) (GabbleJingleTransportIface *);

  GList * (*get_remote_candidates) (GabbleJingleTransportIface *);
  GList * (*get_local_candidates) (GabbleJingleTransportIface *);
  JingleTransportType (*get_transport_type) (void);
};

GType gabble_jingle_transport_iface_get_type (void);

/* TYPE MACROS */
#define GABBLE_TYPE_JINGLE_TRANSPORT_IFACE \
  (gabble_jingle_transport_iface_get_type ())
#define GABBLE_JINGLE_TRANSPORT_IFACE(obj) \
  (G_TYPE_CHECK_INSTANCE_CAST((obj), GABBLE_TYPE_JINGLE_TRANSPORT_IFACE, GabbleJingleTransportIface))
#define GABBLE_IS_JINGLE_TRANSPORT_IFACE(obj) \
  (G_TYPE_CHECK_INSTANCE_TYPE((obj), GABBLE_TYPE_JINGLE_TRANSPORT_IFACE))
#define GABBLE_JINGLE_TRANSPORT_IFACE_GET_CLASS(obj) \
  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GABBLE_TYPE_JINGLE_TRANSPORT_IFACE,\
                              GabbleJingleTransportIfaceClass))

void gabble_jingle_transport_iface_parse_candidates (GabbleJingleTransportIface *,
    LmMessageNode *, GError **);

void gabble_jingle_transport_iface_new_local_candidates (
    GabbleJingleTransportIface *self,
    GList *candidates);
void gabble_jingle_transport_iface_inject_candidates (
    GabbleJingleTransportIface *self,
    LmMessageNode *transport_node);
void gabble_jingle_transport_iface_send_candidates (
    GabbleJingleTransportIface *self,
    gboolean all);
gboolean gabble_jingle_transport_iface_can_accept (
    GabbleJingleTransportIface *self);

GList *gabble_jingle_transport_iface_get_remote_candidates (GabbleJingleTransportIface *);
GList *gabble_jingle_transport_iface_get_local_candidates (GabbleJingleTransportIface *);
JingleTransportType gabble_jingle_transport_iface_get_transport_type (GabbleJingleTransportIface *);

GabbleJingleTransportIface *gabble_jingle_transport_iface_new (
    GType type, GabbleJingleContent *content, const gchar *transport_ns);

JingleCandidate *jingle_candidate_new (JingleTransportProtocol protocol,
    JingleCandidateType type, const gchar *id, int component,
    const gchar *address, int port, int generation, int preference,
    const gchar *username, const gchar *password, int network);

void jingle_candidate_free (JingleCandidate *c);
void jingle_transport_free_candidates (GList *candidates);


G_END_DECLS

#endif /* #ifndef __GABBLE_JINGLE_TRANSPORT_IFACE_H__ */