3 Copyright (C) 2012 Belledonne Communications SARL
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef LINPHONE_UPNP_H
21 #define LINPHONE_UPNP_H
23 #include "mediastreamer2/upnp_igd.h"
24 #include "linphonecore.h"
28 LinphoneUpnpStateIdle,
29 LinphoneUpnpStatePending,
30 LinphoneUpnpStateAdding, // Only used by port binding
31 LinphoneUpnpStateRemoving, // Only used by port binding
32 LinphoneUpnpStateNotAvailable, // Only used by uPnP context
38 typedef struct _UpnpPortBinding {
41 upnp_igd_ip_protocol protocol;
42 char local_addr[LINPHONE_IPADDR_SIZE];
44 char external_addr[LINPHONE_IPADDR_SIZE];
50 typedef struct _UpnpStream {
52 UpnpPortBinding *rtcp;
56 typedef struct _UpnpSession {
62 typedef struct _UpnpContext {
63 upnp_igd_context *upnp_igd_ctxt;
64 UpnpPortBinding *sip_tcp;
65 UpnpPortBinding *sip_tls;
66 UpnpPortBinding *sip_udp;
68 MSList *removing_configs;
69 MSList *adding_configs;
70 MSList *pending_bindings;
72 bool_t clean; // True if at the next loop clean the port bindings
73 bool_t cleaning; // True if the cleaning processing;
74 bool_t emit; // True if at the next loop emit the port bindings
81 void linphone_core_update_local_media_description_from_upnp(SalMediaDescription *desc, UpnpSession *session);
82 int linphone_core_update_upnp_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md);
83 int linphone_core_update_upnp(LinphoneCore *lc, LinphoneCall *call);
84 int upnp_call_process(LinphoneCall *call);
85 UpnpSession* upnp_session_new();
86 void upnp_session_destroy(LinphoneCall* call);
88 int upnp_context_init(LinphoneCore *lc);
89 void upnp_context_uninit(LinphoneCore *lc);
91 #endif //LINPHONE_UPNP_H