pidgin  2.13.0
About: Pidgin is a chat program (multi-protocol instant messaging client) which lets you log in to accounts on multiple chat networks simultaneously (old name "gaim").
  Fossies Dox: pidgin-2.13.0.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

backend-iface.c
Go to the documentation of this file.
1 
6 /* purple
7  *
8  * Purple is the legal property of its developers, whose names are too numerous
9  * to list here. Please refer to the COPYRIGHT file distributed with this
10  * source distribution.
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25  */
26 
27 #include "backend-iface.h"
28 
29 #include "marshallers.h"
30 
31 enum {
38 };
39 
41 
42 static void
44 {
45  static gboolean is_initialized = FALSE;
46 
47  if (is_initialized)
48  return;
49 
50  g_object_interface_install_property(iface,
51  g_param_spec_string("conference-type",
52  "Conference Type",
53  "The type of conference that this backend "
54  "has been created to provide.",
55  NULL,
56  G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
57  g_object_interface_install_property(iface,
58  g_param_spec_object("media",
59  "Purple Media",
60  "The media object that this backend is bound to.",
62  G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
63 
65  g_signal_new("error", G_TYPE_FROM_CLASS(iface),
66  G_SIGNAL_RUN_LAST, 0, NULL, NULL,
67  g_cclosure_marshal_VOID__STRING,
68  G_TYPE_NONE, 1, G_TYPE_STRING);
70  g_signal_new("candidates-prepared",
71  G_TYPE_FROM_CLASS(iface),
72  G_SIGNAL_RUN_LAST, 0, NULL, NULL,
74  G_TYPE_NONE, 2, G_TYPE_STRING,
75  G_TYPE_STRING);
77  g_signal_new("codecs-changed",
78  G_TYPE_FROM_CLASS(iface),
79  G_SIGNAL_RUN_LAST, 0, NULL, NULL,
80  g_cclosure_marshal_VOID__STRING,
81  G_TYPE_NONE, 1, G_TYPE_STRING);
83  g_signal_new("new-candidate",
84  G_TYPE_FROM_CLASS(iface),
85  G_SIGNAL_RUN_LAST, 0, NULL, NULL,
87  G_TYPE_NONE, 3, G_TYPE_POINTER,
88  G_TYPE_POINTER, PURPLE_TYPE_MEDIA_CANDIDATE);
90  g_signal_new("active-candidate-pair",
91  G_TYPE_FROM_CLASS(iface),
92  G_SIGNAL_RUN_LAST, 0, NULL, NULL,
94  G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING,
97 
98  is_initialized = TRUE;
99 }
100 
101 GType
103 {
104  static GType iface_type = 0;
105  if (iface_type == 0) {
106  static const GTypeInfo info = {
107  sizeof(PurpleMediaBackendIface),
109  NULL,
110  NULL,
111  NULL,
112  NULL,
113  0,
114  0,
115  NULL,
116  NULL
117  };
118 
119  iface_type = g_type_register_static (G_TYPE_INTERFACE,
120  "PurpleMediaBackend", &info, 0);
121  }
122 
123  return iface_type;
124 }
125 
126 gboolean
128  const gchar *sess_id, const gchar *who,
129  PurpleMediaSessionType type, gboolean initiator,
130  const gchar *transmitter,
131  guint num_params, GParameter *params)
132 {
133  g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), FALSE);
134  return PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->add_stream(self,
135  sess_id, who, type, initiator, transmitter,
136  num_params, params);
137 }
138 
139 void
141  const gchar *sess_id, const gchar *participant,
142  GList *remote_candidates)
143 {
144  g_return_if_fail(PURPLE_IS_MEDIA_BACKEND(self));
145  PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->add_remote_candidates(self,
146  sess_id, participant, remote_candidates);
147 }
148 
149 gboolean
151  const gchar *sess_id)
152 {
153  g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), FALSE);
154  return PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->codecs_ready(self,
155  sess_id);
156 }
157 
158 GList *
160  const gchar *sess_id)
161 {
162  g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), NULL);
163  return PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->get_codecs(self,
164  sess_id);
165 }
166 
167 GList *
169  const gchar *sess_id, const gchar *participant)
170 {
171  g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), NULL);
173  get_local_candidates(self,
174  sess_id, participant);
175 }
176 
177 gboolean
179  const gchar *sess_id, const gchar *participant,
180  GList *codecs)
181 {
182  g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), FALSE);
183  return PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->set_remote_codecs(
184  self, sess_id, participant, codecs);
185 }
186 
187 gboolean
189  const gchar *sess_id, PurpleMediaCodec *codec)
190 {
191  g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), FALSE);
192  return PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->set_send_codec(self,
193  sess_id, codec);
194 }
195 
196 gboolean
198  const gchar *sess_id, const gchar *cipher,
199  const gchar *auth, const gchar *key, gsize key_len)
200 {
201  PurpleMediaBackendIface *backend_iface;
202 
203  g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), FALSE);
204  backend_iface = PURPLE_MEDIA_BACKEND_GET_INTERFACE(self);
205  g_return_val_if_fail(backend_iface->set_encryption_parameters, FALSE);
206  return backend_iface->set_encryption_parameters(self,
207  sess_id, cipher, auth, key, key_len);
208 }
209 
210 gboolean
212  const gchar *sess_id, const gchar *participant,
213  const gchar *cipher, const gchar *auth,
214  const gchar *key, gsize key_len)
215 {
216  PurpleMediaBackendIface *backend_iface;
217 
218  g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), FALSE);
219  backend_iface = PURPLE_MEDIA_BACKEND_GET_INTERFACE(self);
220  g_return_val_if_fail(backend_iface->set_decryption_parameters, FALSE);
221  return backend_iface->set_decryption_parameters(self,
222  sess_id, participant, cipher, auth, key, key_len);
223 }
224 
225 void
227  guint num_params, GParameter *params)
228 {
229  g_return_if_fail(PURPLE_IS_MEDIA_BACKEND(self));
230  PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->set_params(self, num_params, params);
231 }
232 
233 const gchar **
235 {
236  static const gchar *NULL_ARRAY[] = { NULL };
237 
238  g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), NULL_ARRAY);
239  return PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->get_available_params();
240 }
241 
242 gboolean
244  const gchar *sess_id, const gchar *participant, gboolean send_rtcp_mux)
245 {
246  PurpleMediaBackendIface *backend_iface;
247 
248  g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), FALSE);
249  backend_iface = PURPLE_MEDIA_BACKEND_GET_INTERFACE(self);
250  g_return_val_if_fail(backend_iface->set_send_rtcp_mux, FALSE);
251  return backend_iface->set_send_rtcp_mux(self,
252  sess_id, participant, send_rtcp_mux);
253 }
purple_media_backend_set_decryption_parameters
gboolean purple_media_backend_set_decryption_parameters(PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant, const gchar *cipher, const gchar *auth, const gchar *key, gsize key_len)
Definition: backend-iface.c:211
info
static PurplePluginInfo info
Definition: gntclipboard.c:147
PURPLE_TYPE_MEDIA_CANDIDATE
#define PURPLE_TYPE_MEDIA_CANDIDATE
Definition: candidate.h:36
purple_media_backend_set_send_rtcp_mux
gboolean purple_media_backend_set_send_rtcp_mux(PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant, gboolean send_rtcp_mux)
Definition: backend-iface.c:243
purple_media_backend_add_remote_candidates
void purple_media_backend_add_remote_candidates(PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant, GList *remote_candidates)
Definition: backend-iface.c:140
_PurpleMediaBackendIface::set_decryption_parameters
gboolean(* set_decryption_parameters)(PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant, const gchar *cipher, const gchar *auth, const gchar *key, gsize key_len)
Definition: backend-iface.h:74
CODECS_CHANGED
Definition: backend-iface.c:34
NEW_CANDIDATE
Definition: backend-iface.c:35
purple_smarshal_VOID__STRING_STRING_OBJECT_OBJECT
void purple_smarshal_VOID__STRING_STRING_OBJECT_OBJECT(GClosure *closure, GValue *return_value G_GNUC_UNUSED, guint n_param_values, const GValue *param_values, gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data)
Definition: marshallers.c:328
purple_media_backend_set_params
void purple_media_backend_set_params(PurpleMediaBackend *self, guint num_params, GParameter *params)
Definition: backend-iface.c:226
_PurpleMediaBackendIface::set_send_rtcp_mux
gboolean(* set_send_rtcp_mux)(PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant, gboolean send_rtcp_mux)
Definition: backend-iface.h:84
PurpleMediaSessionType
PurpleMediaSessionType
Definition: enum-types.h:91
marshallers.h
purple_media_backend_codecs_ready
gboolean purple_media_backend_codecs_ready(PurpleMediaBackend *self, const gchar *sess_id)
Definition: backend-iface.c:150
PurpleMediaBackendIface
struct _PurpleMediaBackendIface PurpleMediaBackendIface
Definition: backend-iface.h:45
purple_smarshal_VOID__POINTER_POINTER_OBJECT
void purple_smarshal_VOID__POINTER_POINTER_OBJECT(GClosure *closure, GValue *return_value G_GNUC_UNUSED, guint n_param_values, const GValue *param_values, gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data)
Definition: marshallers.c:53
CANDIDATES_PREPARED
Definition: backend-iface.c:33
purple_media_backend_get_type
GType purple_media_backend_get_type(void)
Definition: backend-iface.c:102
purple_media_backend_get_available_params
const gchar ** purple_media_backend_get_available_params(PurpleMediaBackend *self)
Definition: backend-iface.c:234
PURPLE_IS_MEDIA_BACKEND
#define PURPLE_IS_MEDIA_BACKEND(obj)
Definition: backend-iface.h:38
purple_media_backend_get_codecs
GList * purple_media_backend_get_codecs(PurpleMediaBackend *self, const gchar *sess_id)
Definition: backend-iface.c:159
NULL
#define NULL
Definition: getopt1.c:52
PURPLE_TYPE_MEDIA
#define PURPLE_TYPE_MEDIA
Definition: media.h:39
TRUE
#define TRUE
Definition: protobuf-c.c:56
dbus-analyze-signals.type
string type
Definition: dbus-analyze-signals.py:42
FALSE
#define FALSE
Definition: protobuf-c.c:57
purple_smarshal_VOID__STRING_STRING
void purple_smarshal_VOID__STRING_STRING(GClosure *closure, GValue *return_value G_GNUC_UNUSED, guint n_param_values, const GValue *param_values, gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data)
Definition: marshallers.c:135
purple_media_backend_signals
static guint purple_media_backend_signals[LAST_SIGNAL]
Definition: backend-iface.c:40
LAST_SIGNAL
Definition: backend-iface.c:37
PURPLE_MEDIA_BACKEND_GET_INTERFACE
#define PURPLE_MEDIA_BACKEND_GET_INTERFACE(inst)
Definition: backend-iface.h:40
_PurpleMediaBackendIface
Definition: backend-iface.h:47
_PurpleMediaCodec
Definition: codec.c:43
S_ERROR
Definition: backend-iface.c:32
backend-iface.h
purple_media_backend_get_local_candidates
GList * purple_media_backend_get_local_candidates(PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant)
Definition: backend-iface.c:168
ACTIVE_CANDIDATE_PAIR
Definition: backend-iface.c:36
purple_media_backend_set_send_codec
gboolean purple_media_backend_set_send_codec(PurpleMediaBackend *self, const gchar *sess_id, PurpleMediaCodec *codec)
Definition: backend-iface.c:188
params
GList * params
Definition: gntbindable.c:48
PurpleMediaBackend
struct _PurpleMediaBackend PurpleMediaBackend
Definition: backend-iface.h:43
_PurpleMediaBackendIface::set_encryption_parameters
gboolean(* set_encryption_parameters)(PurpleMediaBackend *self, const gchar *sess_id, const gchar *cipher, const gchar *auth, const gchar *key, gsize key_len)
Definition: backend-iface.h:71
purple_media_backend_set_remote_codecs
gboolean purple_media_backend_set_remote_codecs(PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant, GList *codecs)
Definition: backend-iface.c:178
purple_media_backend_base_init
static void purple_media_backend_base_init(gpointer iface)
Definition: backend-iface.c:43
purple_media_backend_set_encryption_parameters
gboolean purple_media_backend_set_encryption_parameters(PurpleMediaBackend *self, const gchar *sess_id, const gchar *cipher, const gchar *auth, const gchar *key, gsize key_len)
Definition: backend-iface.c:197
purple_media_backend_add_stream
gboolean purple_media_backend_add_stream(PurpleMediaBackend *self, const gchar *sess_id, const gchar *who, PurpleMediaSessionType type, gboolean initiator, const gchar *transmitter, guint num_params, GParameter *params)
Definition: backend-iface.c:127