audio: depurple candidate
[siplcs.git] / src / api / sipe-media.h
blob3d04ccd29348b9a5cf2c8477e1381b0263a751a6
1 /**
2 * @file sipe-media.h
4 * pidgin-sipe
6 * Copyright (C) 2010 Jakub Adam <jakub.adam@tieto.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 struct sipe_account_data;
25 typedef enum sipe_media_type {
26 SIPE_MEDIA_AUDIO,
27 SIPE_MEDIA_VIDEO
28 } SipeMediaType;
30 typedef enum sipe_call_state {
31 SIPE_CALL_CONNECTING,
32 SIPE_CALL_RUNNING,
33 SIPE_CALL_HELD,
34 SIPE_CALL_FINISHED
35 } SipeCallState;
37 typedef enum sipe_component_type {
38 SIPE_COMPONENT_NONE = 0,
39 SIPE_COMPONENT_RTP = 1,
40 SIPE_COMPONENT_RTCP = 2
41 } SipeComponentType;
43 typedef enum sipe_candidate_type {
44 SIPE_CANDIDATE_TYPE_HOST,
45 SIPE_CANDIDATE_TYPE_RELAY,
46 SIPE_CANDIDATE_TYPE_SRFLX
47 } SipeCandidateType;
49 typedef enum sipe_network_protocol {
50 SIPE_NETWORK_PROTOCOL_TCP,
51 SIPE_NETWORK_PROTOCOL_UDP
52 } SipeNetworkProtocol;
54 typedef gpointer sipe_codec;
55 typedef gpointer sipe_candidate;
57 typedef struct _sipe_media_call {
58 gpointer media;
59 struct sip_session *session;
60 struct sip_dialog *dialog;
62 gchar *remote_ip;
63 guint16 remote_port;
65 GSList *sdp_attrs;
66 struct sipmsg *invitation;
67 GList *remote_candidates;
68 GList *remote_codecs;
69 gchar *sdp_response;
70 gboolean legacy_mode;
71 SipeCallState state;
72 } sipe_media_call;
74 void sipe_media_incoming_invite(struct sipe_account_data *sip, struct sipmsg *msg);
76 void sipe_media_hangup(struct sipe_account_data *sip);
78 gchar *sipe_media_get_callid(sipe_media_call *call);
81 /* Backend functions **********************************************************/
83 sipe_codec * sipe_backend_codec_new(int id, const char *name,
84 SipeMediaType type, guint clock_rate);
86 void sipe_backend_codec_free(sipe_codec *codec);
88 int sipe_backend_codec_get_id(sipe_codec *codec);
90 gchar * sipe_backend_codec_get_name(sipe_codec *codec);
92 guint sipe_backend_codec_get_clock_rate(sipe_codec *codec);
94 GList *sipe_backend_codec_get_optional_parameters(sipe_codec *codec);
96 gboolean sipe_backend_set_remote_codecs(sipe_media_call* call, gchar* participant);
98 GList* sipe_backend_get_local_codecs(sipe_media_call* call);
101 sipe_candidate * sipe_backend_candidate_new(const gchar *foundation,
102 SipeComponentType component,
103 SipeCandidateType type,
104 SipeNetworkProtocol proto,
105 const gchar *ip, guint port);
107 void sipe_backend_candidate_free(sipe_candidate *candidate);
109 gchar *sipe_backend_candidate_get_username(sipe_candidate *candidate);
110 gchar *sipe_backend_candidate_get_password(sipe_candidate *candidate);
111 gchar *sipe_backend_candidate_get_foundation(sipe_candidate *candidate);
112 gchar *sipe_backend_candidate_get_ip(sipe_candidate *candidate);
113 guint sipe_backend_candidate_get_port(sipe_candidate *candidate);
114 guint32 sipe_backend_candidate_get_priority(sipe_candidate *candidate);
115 SipeComponentType sipe_backend_candidate_get_component_type(sipe_candidate *candidate);
116 SipeCandidateType sipe_backend_candidate_get_type(sipe_candidate *candidate);
117 SipeNetworkProtocol sipe_backend_candidate_get_protocol(sipe_candidate *candidate);
119 void sipe_backend_candidate_set_username_and_pwd(sipe_candidate *candidate,
120 const gchar *username,
121 const gchar *password);