<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.9.1">
  <compounddef id="upnp_8c" kind="file" language="C++">
    <compoundname>upnp.c</compoundname>
    <includes refid="upnp_8h" local="yes">upnp.h</includes>
    <includes refid="private_8h" local="yes">private.h</includes>
    <includes refid="lpconfig_8h" local="yes">lpconfig.h</includes>
    <includes local="no">ctype.h</includes>
    <incdepgraph>
      <node id="277">
        <label>ctype.h</label>
      </node>
      <node id="276">
        <label>upnp.c</label>
        <link refid="upnp.c"/>
        <childnode refid="277" relation="include">
        </childnode>
      </node>
    </incdepgraph>
    <innerclass refid="struct__UpnpPortBinding" prot="public">_UpnpPortBinding</innerclass>
    <innerclass refid="struct__UpnpStream" prot="public">_UpnpStream</innerclass>
    <innerclass refid="struct__UpnpSession" prot="public">_UpnpSession</innerclass>
    <innerclass refid="struct__UpnpContext" prot="public">_UpnpContext</innerclass>
    <innerclass refid="structlinphone__upnp__config__list__port__bindings__struct" prot="public">linphone_upnp_config_list_port_bindings_struct</innerclass>
      <sectiondef kind="define">
      <memberdef kind="define" id="upnp_8c_1a79946265f74f577890e0aa5c3dc7ec5a" prot="public" static="no">
        <name>UPNP_STRINGIFY</name>
        <param><defname>x</defname></param>
        <initializer>#x</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="25" column="9" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="25" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="upnp_8c_1a8a91d581719c2e6723c7fd7df61798e2" prot="public" static="no">
        <name>UPNP_TOSTRING</name>
        <param><defname>x</defname></param>
        <initializer>UPNP_STRINGIFY(x)</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="26" column="9" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="26" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="upnp_8c_1a858e1a053697959f465679200c119285" prot="public" static="no">
        <name>UPNP_ADD_MAX_RETRY</name>
        <initializer>4</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="28" column="9" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="28" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="upnp_8c_1a5cff34666638724349b1bedf90237c92" prot="public" static="no">
        <name>UPNP_REMOVE_MAX_RETRY</name>
        <initializer>4</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="29" column="9" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="29" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="upnp_8c_1aa415c37e5c8638e6f1993ee1ac9a9c77" prot="public" static="no">
        <name>UPNP_SECTION_NAME</name>
        <initializer>&quot;uPnP&quot;</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="30" column="9" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="30" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="upnp_8c_1ac6f07421f311f3d1dfae93bea1e88846" prot="public" static="no">
        <name>UPNP_CORE_READY_CHECK</name>
        <initializer>1</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="31" column="9" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="31" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="upnp_8c_1a9323b8c6472e38ffe853afa36aa8b217" prot="public" static="no">
        <name>UPNP_CORE_RETRY_DELAY</name>
        <initializer>10</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="32" column="9" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="32" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="upnp_8c_1a5cbdf4eeb396c1d026a9109f69876b54" prot="public" static="no">
        <name>UPNP_CALL_RETRY_DELAY</name>
        <initializer>3</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="33" column="9" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="33" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="upnp_8c_1ae8154ded25268e78ca5a7112eb8986bf" prot="public" static="no">
        <name>UPNP_UUID_LEN</name>
        <initializer>128</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="34" column="9" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="34" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="upnp_8c_1ac04b30ce2470a976191c76c017be5e03" prot="public" static="no">
        <name>UPNP_UUID_LEN_STR</name>
        <initializer>UPNP_TOSTRING(UPNP_UUID_LEN)</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="35" column="9" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="35" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="typedef">
      <memberdef kind="typedef" id="upnp_8c_1aec22453d1baa4540d4aab9d7051d5474" prot="public" static="no">
        <type>struct _UpnpPortBinding</type>
        <definition>typedef struct _UpnpPortBinding  UpnpPortBinding</definition>
        <argsstring></argsstring>
        <name>UpnpPortBinding</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="54" column="1"/>
      </memberdef>
      <memberdef kind="typedef" id="upnp_8c_1abb7a0997dea6e2259967f4deb1d54734" prot="public" static="no">
        <type>struct _UpnpStream</type>
        <definition>typedef struct _UpnpStream  UpnpStream</definition>
        <argsstring></argsstring>
        <name>UpnpStream</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="60" column="1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="func">
      <memberdef kind="function" id="upnp_8c_1ab65a2f0d01b643ec4a4f97b64ecce9ea" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>bool_t</type>
        <definition>bool_t linphone_core_upnp_hook</definition>
        <argsstring>(void *data)</argsstring>
        <name>linphone_core_upnp_hook</name>
        <param>
          <type>void *</type>
          <declname>data</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="88" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1038" bodyend="1057"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1ac0983a1e5c301e54c4e760584a8f635d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_upnp_update</definition>
        <argsstring>(UpnpContext *ctx)</argsstring>
        <name>linphone_upnp_update</name>
        <param>
          <type>UpnpContext *</type>
          <declname>ctx</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="89" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="863" bodyend="930"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1aaa0c4a9a13eb94ff624c8eec4920522d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>bool_t</type>
        <definition>bool_t linphone_upnp_is_blacklisted</definition>
        <argsstring>(UpnpContext *ctx)</argsstring>
        <name>linphone_upnp_is_blacklisted</name>
        <param>
          <type>UpnpContext *</type>
          <declname>ctx</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="90" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="509" bodyend="546"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a40f3975f308580eb31a78a5879d2e13e" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>UpnpPortBinding *</type>
        <definition>UpnpPortBinding * linphone_upnp_port_binding_new</definition>
        <argsstring>()</argsstring>
        <name>linphone_upnp_port_binding_new</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="92" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1092" bodyend="1108"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a5d8cb3d0cc6160ff46d89f0d5d6a3291" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>UpnpPortBinding *</type>
        <definition>UpnpPortBinding * linphone_upnp_port_binding_new_with_parameters</definition>
        <argsstring>(upnp_igd_ip_protocol protocol, int local_port, int external_port)</argsstring>
        <name>linphone_upnp_port_binding_new_with_parameters</name>
        <param>
          <type>upnp_igd_ip_protocol</type>
          <declname>protocol</declname>
        </param>
        <param>
          <type>int</type>
          <declname>local_port</declname>
        </param>
        <param>
          <type>int</type>
          <declname>external_port</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="93" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1110" bodyend="1116"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a40b39489b573ed31046c8433bfbb3fbe" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>UpnpPortBinding *</type>
        <definition>UpnpPortBinding * linphone_upnp_port_binding_new_or_collect</definition>
        <argsstring>(MSList *list, upnp_igd_ip_protocol protocol, int local_port, int external_port)</argsstring>
        <name>linphone_upnp_port_binding_new_or_collect</name>
        <param>
          <type>MSList *</type>
          <declname>list</declname>
        </param>
        <param>
          <type>upnp_igd_ip_protocol</type>
          <declname>protocol</declname>
        </param>
        <param>
          <type>int</type>
          <declname>local_port</declname>
        </param>
        <param>
          <type>int</type>
          <declname>external_port</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="94" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1118" bodyend="1134"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a6cd7f09b9ebde92f45513479b60e32b8" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>UpnpPortBinding *</type>
        <definition>UpnpPortBinding * linphone_upnp_port_binding_copy</definition>
        <argsstring>(const UpnpPortBinding *port)</argsstring>
        <name>linphone_upnp_port_binding_copy</name>
        <param>
          <type>const UpnpPortBinding *</type>
          <declname>port</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="95" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1136" bodyend="1145"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a9338b6bcefe940f7488b042d2c54ce0c" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_upnp_port_binding_set_device_id</definition>
        <argsstring>(UpnpPortBinding *port, const char *device_id)</argsstring>
        <name>linphone_upnp_port_binding_set_device_id</name>
        <param>
          <type>UpnpPortBinding *</type>
          <declname>port</declname>
        </param>
        <param>
          <type>const char *</type>
          <declname>device_id</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="96" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1147" bodyend="1159"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a157681e394f7593bde91bffc4673d961" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>bool_t</type>
        <definition>bool_t linphone_upnp_port_binding_equal</definition>
        <argsstring>(const UpnpPortBinding *port1, const UpnpPortBinding *port2)</argsstring>
        <name>linphone_upnp_port_binding_equal</name>
        <param>
          <type>const UpnpPortBinding *</type>
          <declname>port1</declname>
        </param>
        <param>
          <type>const UpnpPortBinding *</type>
          <declname>port2</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="97" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1179" bodyend="1183"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a1dc5b64cc2c157e7de07110eb50ccbfc" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>UpnpPortBinding *</type>
        <definition>UpnpPortBinding * linphone_upnp_port_binding_equivalent_in_list</definition>
        <argsstring>(MSList *list, const UpnpPortBinding *port)</argsstring>
        <name>linphone_upnp_port_binding_equivalent_in_list</name>
        <param>
          <type>MSList *</type>
          <declname>list</declname>
        </param>
        <param>
          <type>const UpnpPortBinding *</type>
          <declname>port</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="98" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1185" bodyend="1196"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a1e89ac67b5115430f9ef49f9630cb5bd" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>UpnpPortBinding *</type>
        <definition>UpnpPortBinding * linphone_upnp_port_binding_retain</definition>
        <argsstring>(UpnpPortBinding *port)</argsstring>
        <name>linphone_upnp_port_binding_retain</name>
        <param>
          <type>UpnpPortBinding *</type>
          <declname>port</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="99" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1198" bodyend="1203"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a23d00b2fc075282242d669156e4140d6" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_upnp_update_port_binding</definition>
        <argsstring>(UpnpContext *lupnp, UpnpPortBinding **port_mapping, upnp_igd_ip_protocol protocol, int port, int retry_delay)</argsstring>
        <name>linphone_upnp_update_port_binding</name>
        <param>
          <type>UpnpContext *</type>
          <declname>lupnp</declname>
        </param>
        <param>
          <type>UpnpPortBinding **</type>
          <declname>port_mapping</declname>
        </param>
        <param>
          <type>upnp_igd_ip_protocol</type>
          <declname>protocol</declname>
        </param>
        <param>
          <type>int</type>
          <declname>port</declname>
        </param>
        <param>
          <type>int</type>
          <declname>retry_delay</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="100" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="932" bodyend="972"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a09510ab09bf19b7e678505b3c1396ca8" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_upnp_port_binding_log</definition>
        <argsstring>(int level, const char *msg, const UpnpPortBinding *port)</argsstring>
        <name>linphone_upnp_port_binding_log</name>
        <param>
          <type>int</type>
          <declname>level</declname>
        </param>
        <param>
          <type>const char *</type>
          <declname>msg</declname>
        </param>
        <param>
          <type>const UpnpPortBinding *</type>
          <declname>port</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="101" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1161" bodyend="1176"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1afe8895b2fcbbe8c1975180edd6778947" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_upnp_port_binding_release</definition>
        <argsstring>(UpnpPortBinding *port)</argsstring>
        <name>linphone_upnp_port_binding_release</name>
        <param>
          <type>UpnpPortBinding *</type>
          <declname>port</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="102" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1205" bodyend="1217"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a9e2f1cedbf244dca82d4dc40f3f35163" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_upnp_update_config</definition>
        <argsstring>(UpnpContext *lupnp)</argsstring>
        <name>linphone_upnp_update_config</name>
        <param>
          <type>UpnpContext *</type>
          <declname>lupnp</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="103" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="974" bodyend="1006"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1ad4793d3fea490b5f8639e65e55ad04b8" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_upnp_update_proxy</definition>
        <argsstring>(UpnpContext *lupnp, bool_t force)</argsstring>
        <name>linphone_upnp_update_proxy</name>
        <param>
          <type>UpnpContext *</type>
          <declname>lupnp</declname>
        </param>
        <param>
          <type>bool_t</type>
          <declname>force</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="104" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1008" bodyend="1036"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1ad50906ca4475306f612658842cbecd5a" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>MSList *</type>
        <definition>MSList * linphone_upnp_config_list_port_bindings</definition>
        <argsstring>(struct _LpConfig *lpc, const char *device_id)</argsstring>
        <name>linphone_upnp_config_list_port_bindings</name>
        <param>
          <type>struct _LpConfig *</type>
          <declname>lpc</declname>
        </param>
        <param>
          <type>const char *</type>
          <declname>device_id</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="107" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1340" bodyend="1346"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1ad26cdf2951557e508ba52ed2d188b0ec" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_upnp_config_add_port_binding</definition>
        <argsstring>(UpnpContext *lupnp, const UpnpPortBinding *port)</argsstring>
        <name>linphone_upnp_config_add_port_binding</name>
        <param>
          <type>UpnpContext *</type>
          <declname>lupnp</declname>
        </param>
        <param>
          <type>const UpnpPortBinding *</type>
          <declname>port</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="108" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1348" bodyend="1379"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a20bab68d8c232f01efb658128ff7bd3d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_upnp_config_remove_port_binding</definition>
        <argsstring>(UpnpContext *lupnp, const UpnpPortBinding *port)</argsstring>
        <name>linphone_upnp_config_remove_port_binding</name>
        <param>
          <type>UpnpContext *</type>
          <declname>lupnp</declname>
        </param>
        <param>
          <type>const UpnpPortBinding *</type>
          <declname>port</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="109" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1381" bodyend="1412"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a75a74be59dfa4f3844e6eac1606fbadc" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int linphone_upnp_context_send_remove_port_binding</definition>
        <argsstring>(UpnpContext *lupnp, UpnpPortBinding *port, bool_t retry)</argsstring>
        <name>linphone_upnp_context_send_remove_port_binding</name>
        <param>
          <type>UpnpContext *</type>
          <declname>lupnp</declname>
        </param>
        <param>
          <type>UpnpPortBinding *</type>
          <declname>port</declname>
        </param>
        <param>
          <type>bool_t</type>
          <declname>retry</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="112" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="626" bodyend="676"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a31d3c55aa26ec816a1cc3817fff8373b" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int linphone_upnp_context_send_add_port_binding</definition>
        <argsstring>(UpnpContext *lupnp, UpnpPortBinding *port, bool_t retry)</argsstring>
        <name>linphone_upnp_context_send_add_port_binding</name>
        <param>
          <type>UpnpContext *</type>
          <declname>lupnp</declname>
        </param>
        <param>
          <type>UpnpPortBinding *</type>
          <declname>port</declname>
        </param>
        <param>
          <type>bool_t</type>
          <declname>retry</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="113" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="562" bodyend="624"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1aad25f109c32dde1176ca5753f2579029" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int linphone_upnp_strncmpi</definition>
        <argsstring>(const char *str1, const char *str2, int len)</argsstring>
        <name>linphone_upnp_strncmpi</name>
        <param>
          <type>const char *</type>
          <declname>str1</declname>
        </param>
        <param>
          <type>const char *</type>
          <declname>str2</declname>
        </param>
        <param>
          <type>int</type>
          <declname>len</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="115" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="115" bodyend="129"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a80eae1095fe2652e49b6512178fe278d" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int linphone_upnp_str_min</definition>
        <argsstring>(const char *str1, const char *str2)</argsstring>
        <name>linphone_upnp_str_min</name>
        <param>
          <type>const char *</type>
          <declname>str1</declname>
        </param>
        <param>
          <type>const char *</type>
          <declname>str2</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="131" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="131" bodyend="138"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1aeb382d19730ea1eb2032cc7d1e4fdea6" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>char *</type>
        <definition>char* linphone_upnp_format_device_id</definition>
        <argsstring>(const char *device_id)</argsstring>
        <name>linphone_upnp_format_device_id</name>
        <param>
          <type>const char *</type>
          <declname>device_id</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="140" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="140" bodyend="170"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a9d9182c1f55b92f44d54a6fd3ef7e231" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_upnp_igd_print</definition>
        <argsstring>(void *cookie, upnp_igd_print_level level, const char *fmt, va_list list)</argsstring>
        <name>linphone_upnp_igd_print</name>
        <param>
          <type>void *</type>
          <declname>cookie</declname>
        </param>
        <param>
          <type>upnp_igd_print_level</type>
          <declname>level</declname>
        </param>
        <param>
          <type>const char *</type>
          <declname>fmt</declname>
        </param>
        <param>
          <type>va_list</type>
          <declname>list</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>uPnP Callbacks </para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="177" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="177" bodyend="193"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1ab700e61bb5fe71c1be80cdaf4497a92b" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_upnp_igd_callback</definition>
        <argsstring>(void *cookie, upnp_igd_event event, void *arg)</argsstring>
        <name>linphone_upnp_igd_callback</name>
        <param>
          <type>void *</type>
          <declname>cookie</declname>
        </param>
        <param>
          <type>upnp_igd_event</type>
          <declname>event</declname>
        </param>
        <param>
          <type>void *</type>
          <declname>arg</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="195" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="195" bodyend="316"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1aaece42073ad64a00102e7d05433bc329" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>UpnpContext *</type>
        <definition>UpnpContext* linphone_upnp_context_new</definition>
        <argsstring>(LinphoneCore *lc)</argsstring>
        <name>linphone_upnp_context_new</name>
        <param>
          <type><ref refid="group__initializing_1gaa5cf635b82dd338e7ee2dd3599d05f0a" kindref="member">LinphoneCore</ref> *</type>
          <declname>lc</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>uPnP Context </para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="323" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="323" bodyend="363"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1ad4b6420702201ce8a9e45ddc108ced3a" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_upnp_context_destroy</definition>
        <argsstring>(UpnpContext *lupnp)</argsstring>
        <name>linphone_upnp_context_destroy</name>
        <param>
          <type>UpnpContext *</type>
          <declname>lupnp</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="365" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="365" bodyend="428"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1aead47a55b31fe51b9f129b7fbebd0766" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="group__initializing_1ga2c19554a0988f7600aec5c3a7588d61a" kindref="member">LinphoneUpnpState</ref></type>
        <definition>LinphoneUpnpState linphone_upnp_context_get_state</definition>
        <argsstring>(UpnpContext *lupnp)</argsstring>
        <name>linphone_upnp_context_get_state</name>
        <param>
          <type>UpnpContext *</type>
          <declname>lupnp</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="430" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="430" bodyend="438"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a90a397c3f9e46b8a70499422a1565231" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>bool_t</type>
        <definition>bool_t _linphone_upnp_context_is_ready_for_register</definition>
        <argsstring>(UpnpContext *lupnp)</argsstring>
        <name>_linphone_upnp_context_is_ready_for_register</name>
        <param>
          <type>UpnpContext *</type>
          <declname>lupnp</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="440" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="440" bodyend="473"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a8424b99e1be3a9bd1d357bdb051473cf" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>bool_t</type>
        <definition>bool_t linphone_upnp_context_is_ready_for_register</definition>
        <argsstring>(UpnpContext *lupnp)</argsstring>
        <name>linphone_upnp_context_is_ready_for_register</name>
        <param>
          <type>UpnpContext *</type>
          <declname>lupnp</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="475" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="475" bodyend="483"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a4bbd1b08a15d26b2484d6bd6e984b9d5" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int linphone_upnp_context_get_external_port</definition>
        <argsstring>(UpnpContext *lupnp)</argsstring>
        <name>linphone_upnp_context_get_external_port</name>
        <param>
          <type>UpnpContext *</type>
          <declname>lupnp</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="485" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="485" bodyend="507"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a760ff163ab0ce2f34f03e29bf4a88772" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_upnp_refresh</definition>
        <argsstring>(UpnpContext *lupnp)</argsstring>
        <name>linphone_upnp_refresh</name>
        <param>
          <type>UpnpContext *</type>
          <declname>lupnp</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="548" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="548" bodyend="550"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a977878126d84c8a0705e5327c4f89b09" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>const char *</type>
        <definition>const char* linphone_upnp_context_get_external_ipaddress</definition>
        <argsstring>(UpnpContext *lupnp)</argsstring>
        <name>linphone_upnp_context_get_external_ipaddress</name>
        <param>
          <type>UpnpContext *</type>
          <declname>lupnp</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="552" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="552" bodyend="560"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a48f42c404a1f95f92d717c61342def1d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int linphone_core_update_upnp_audio_video</definition>
        <argsstring>(LinphoneCall *call, bool_t audio, bool_t video)</argsstring>
        <name>linphone_core_update_upnp_audio_video</name>
        <param>
          <type><ref refid="group__call__control_1gac0a4861d7c4702c64f7106f2b893c69e" kindref="member">LinphoneCall</ref> *</type>
          <declname>call</declname>
        </param>
        <param>
          <type>bool_t</type>
          <declname>audio</declname>
        </param>
        <param>
          <type>bool_t</type>
          <declname>video</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="682" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="682" bodyend="724"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1ae989f6193daccb069b89f5ac4c96ed7d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int linphone_core_update_upnp_from_remote_media_description</definition>
        <argsstring>(LinphoneCall *call, const SalMediaDescription *md)</argsstring>
        <name>linphone_core_update_upnp_from_remote_media_description</name>
        <param>
          <type><ref refid="group__call__control_1gac0a4861d7c4702c64f7106f2b893c69e" kindref="member">LinphoneCall</ref> *</type>
          <declname>call</declname>
        </param>
        <param>
          <type>const SalMediaDescription *</type>
          <declname>md</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="728" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="728" bodyend="745"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a94bafdc4b6e151e4c7dcabd22d493d90" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int linphone_core_update_upnp</definition>
        <argsstring>(LinphoneCore *lc, LinphoneCall *call)</argsstring>
        <name>linphone_core_update_upnp</name>
        <param>
          <type><ref refid="group__initializing_1gaa5cf635b82dd338e7ee2dd3599d05f0a" kindref="member">LinphoneCore</ref> *</type>
          <declname>lc</declname>
        </param>
        <param>
          <type><ref refid="group__call__control_1gac0a4861d7c4702c64f7106f2b893c69e" kindref="member">LinphoneCall</ref> *</type>
          <declname>call</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="747" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="747" bodyend="749"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1aeece42651afe6f8a1c6b697a5b94fc86" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_core_update_upnp_state_in_call_stats</definition>
        <argsstring>(LinphoneCall *call)</argsstring>
        <name>linphone_core_update_upnp_state_in_call_stats</name>
        <param>
          <type><ref refid="group__call__control_1gac0a4861d7c4702c64f7106f2b893c69e" kindref="member">LinphoneCall</ref> *</type>
          <declname>call</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="751" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="751" bodyend="754"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a0d6750567d00d3f09c219345033d02c4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_upnp_update_stream_state</definition>
        <argsstring>(UpnpStream *stream)</argsstring>
        <name>linphone_upnp_update_stream_state</name>
        <param>
          <type>UpnpStream *</type>
          <declname>stream</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="756" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="756" bodyend="771"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a53b0f500410e3102f576531ff919c6e0" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int linphone_upnp_call_process</definition>
        <argsstring>(LinphoneCall *call)</argsstring>
        <name>linphone_upnp_call_process</name>
        <param>
          <type><ref refid="group__call__control_1gac0a4861d7c4702c64f7106f2b893c69e" kindref="member">LinphoneCall</ref> *</type>
          <declname>call</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="773" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="773" bodyend="854"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1ac5eb4ff4f4335b7ede8e8490dea72146" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>const char *</type>
        <definition>static const char* linphone_core_upnp_get_charptr_null</definition>
        <argsstring>(const char *str)</argsstring>
        <name>linphone_core_upnp_get_charptr_null</name>
        <param>
          <type>const char *</type>
          <declname>str</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="856" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="856" bodyend="861"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a238db35cb0c8ab95b1d4928ce6a27a09" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int linphone_core_update_local_media_description_from_upnp</definition>
        <argsstring>(SalMediaDescription *desc, UpnpSession *session)</argsstring>
        <name>linphone_core_update_local_media_description_from_upnp</name>
        <param>
          <type>SalMediaDescription *</type>
          <declname>desc</declname>
        </param>
        <param>
          <type>UpnpSession *</type>
          <declname>session</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="1059" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1059" bodyend="1085"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a5cddb506f11fac5d6468134f9b169a3f" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>UpnpStream *</type>
        <definition>UpnpStream* linphone_upnp_stream_new</definition>
        <argsstring>()</argsstring>
        <name>linphone_upnp_stream_new</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="1224" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1224" bodyend="1230"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a8448d4bc09d17d1362916b2bfc412453" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_upnp_stream_destroy</definition>
        <argsstring>(UpnpStream *stream)</argsstring>
        <name>linphone_upnp_stream_destroy</name>
        <param>
          <type>UpnpStream *</type>
          <declname>stream</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="1232" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1232" bodyend="1242"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a9cadb4599049e4bc4fa61debbad49f76" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>UpnpSession *</type>
        <definition>UpnpSession* linphone_upnp_session_new</definition>
        <argsstring>(LinphoneCall *call)</argsstring>
        <name>linphone_upnp_session_new</name>
        <param>
          <type><ref refid="group__call__control_1gac0a4861d7c4702c64f7106f2b893c69e" kindref="member">LinphoneCall</ref> *</type>
          <declname>call</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="1249" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1249" bodyend="1256"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1af119f6bee72dafc9e26222475c4b4998" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void linphone_upnp_session_destroy</definition>
        <argsstring>(UpnpSession *session)</argsstring>
        <name>linphone_upnp_session_destroy</name>
        <param>
          <type>UpnpSession *</type>
          <declname>session</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="1258" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1258" bodyend="1283"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a72b33c9b65332da02c36dacfd9133d37" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="group__initializing_1ga2c19554a0988f7600aec5c3a7588d61a" kindref="member">LinphoneUpnpState</ref></type>
        <definition>LinphoneUpnpState linphone_upnp_session_get_state</definition>
        <argsstring>(UpnpSession *session)</argsstring>
        <name>linphone_upnp_session_get_state</name>
        <param>
          <type>UpnpSession *</type>
          <declname>session</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="1285" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1285" bodyend="1287"/>
      </memberdef>
      <memberdef kind="function" id="upnp_8c_1a26469342f292256d5776c33afa2309cc" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>static void linphone_upnp_config_list_port_bindings_cb</definition>
        <argsstring>(const char *entry, struct linphone_upnp_config_list_port_bindings_struct *cookie)</argsstring>
        <name>linphone_upnp_config_list_port_bindings_cb</name>
        <param>
          <type>const char *</type>
          <declname>entry</declname>
        </param>
        <param>
          <type>struct linphone_upnp_config_list_port_bindings_struct *</type>
          <declname>cookie</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" line="1300" column="1" bodyfile="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c" bodystart="1300" bodyend="1338"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="comment">/*</highlight></codeline>
<codeline lineno="2"><highlight class="comment">linphone</highlight></codeline>
<codeline lineno="3"><highlight class="comment">Copyright<sp/>(C)<sp/>2012<sp/><sp/>Belledonne<sp/>Communications<sp/>SARL</highlight></codeline>
<codeline lineno="4"><highlight class="comment"></highlight></codeline>
<codeline lineno="5"><highlight class="comment">This<sp/>program<sp/>is<sp/>free<sp/>software;<sp/>you<sp/>can<sp/>redistribute<sp/>it<sp/>and/or</highlight></codeline>
<codeline lineno="6"><highlight class="comment">modify<sp/>it<sp/>under<sp/>the<sp/>terms<sp/>of<sp/>the<sp/>GNU<sp/>General<sp/>Public<sp/>License</highlight></codeline>
<codeline lineno="7"><highlight class="comment">as<sp/>published<sp/>by<sp/>the<sp/>Free<sp/>Software<sp/>Foundation;<sp/>either<sp/>version<sp/>2</highlight></codeline>
<codeline lineno="8"><highlight class="comment">of<sp/>the<sp/>License,<sp/>or<sp/>(at<sp/>your<sp/>option)<sp/>any<sp/>later<sp/>version.</highlight></codeline>
<codeline lineno="9"><highlight class="comment"></highlight></codeline>
<codeline lineno="10"><highlight class="comment">This<sp/>program<sp/>is<sp/>distributed<sp/>in<sp/>the<sp/>hope<sp/>that<sp/>it<sp/>will<sp/>be<sp/>useful,</highlight></codeline>
<codeline lineno="11"><highlight class="comment">but<sp/>WITHOUT<sp/>ANY<sp/>WARRANTY;<sp/>without<sp/>even<sp/>the<sp/>implied<sp/>warranty<sp/>of</highlight></codeline>
<codeline lineno="12"><highlight class="comment">MERCHANTABILITY<sp/>or<sp/>FITNESS<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE.<sp/><sp/>See<sp/>the</highlight></codeline>
<codeline lineno="13"><highlight class="comment">GNU<sp/>General<sp/>Public<sp/>License<sp/>for<sp/>more<sp/>details.</highlight></codeline>
<codeline lineno="14"><highlight class="comment"></highlight></codeline>
<codeline lineno="15"><highlight class="comment">You<sp/>should<sp/>have<sp/>received<sp/>a<sp/>copy<sp/>of<sp/>the<sp/>GNU<sp/>General<sp/>Public<sp/>License</highlight></codeline>
<codeline lineno="16"><highlight class="comment">along<sp/>with<sp/>this<sp/>program;<sp/>if<sp/>not,<sp/>write<sp/>to<sp/>the<sp/>Free<sp/>Software</highlight></codeline>
<codeline lineno="17"><highlight class="comment">Foundation,<sp/>Inc.,<sp/>59<sp/>Temple<sp/>Place<sp/>-<sp/>Suite<sp/>330,<sp/>Boston,<sp/>MA<sp/><sp/>02111-1307,<sp/>USA.</highlight></codeline>
<codeline lineno="18"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="19"><highlight class="normal"></highlight></codeline>
<codeline lineno="20"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;upnp.h&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="21"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;private.h&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="22"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;lpconfig.h&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="23"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;ctype.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="24"><highlight class="normal"></highlight></codeline>
<codeline lineno="25"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>UPNP_STRINGIFY(x)<sp/><sp/><sp/><sp/><sp/>#x</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="26"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>UPNP_TOSTRING(x)<sp/><sp/><sp/><sp/><sp/><sp/>UPNP_STRINGIFY(x)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="27"><highlight class="normal"></highlight></codeline>
<codeline lineno="28"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>UPNP_ADD_MAX_RETRY<sp/><sp/><sp/><sp/>4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="29"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>UPNP_REMOVE_MAX_RETRY<sp/>4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="30"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>UPNP_SECTION_NAME<sp/><sp/><sp/><sp/><sp/>&quot;uPnP&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="31"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>UPNP_CORE_READY_CHECK<sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="32"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>UPNP_CORE_RETRY_DELAY<sp/>10</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="33"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>UPNP_CALL_RETRY_DELAY<sp/>3</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="34"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>UPNP_UUID_LEN<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>128</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="35"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>UPNP_UUID_LEN_STR<sp/><sp/><sp/><sp/><sp/>UPNP_TOSTRING(UPNP_UUID_LEN)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="36"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="37"><highlight class="comment"><sp/>*<sp/>uPnP<sp/>Definitions</highlight></codeline>
<codeline lineno="38"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="39"><highlight class="normal"></highlight></codeline>
<codeline lineno="40"><highlight class="normal"></highlight><highlight class="keyword">typedef</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">_UpnpPortBinding<sp/>{</highlight></codeline>
<codeline lineno="41"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_t<sp/>mutex;</highlight></codeline>
<codeline lineno="42"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__initializing_1ga2c19554a0988f7600aec5c3a7588d61a" kindref="member">LinphoneUpnpState</ref><sp/>state;</highlight></codeline>
<codeline lineno="43"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>upnp_igd_ip_protocol<sp/>protocol;</highlight></codeline>
<codeline lineno="44"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*device_id;</highlight></codeline>
<codeline lineno="45"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>local_addr[LINPHONE_IPADDR_SIZE];</highlight></codeline>
<codeline lineno="46"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>local_port;</highlight></codeline>
<codeline lineno="47"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>external_addr[LINPHONE_IPADDR_SIZE];</highlight></codeline>
<codeline lineno="48"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>external_port;</highlight></codeline>
<codeline lineno="49"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>retry;</highlight></codeline>
<codeline lineno="50"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ref;</highlight></codeline>
<codeline lineno="51"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>bool_t<sp/>to_remove;</highlight></codeline>
<codeline lineno="52"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>bool_t<sp/>to_add;</highlight></codeline>
<codeline lineno="53"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>time_t<sp/>last_update;</highlight></codeline>
<codeline lineno="54"><highlight class="normal">}<sp/>UpnpPortBinding;</highlight></codeline>
<codeline lineno="55"><highlight class="normal"></highlight></codeline>
<codeline lineno="56"><highlight class="normal"></highlight><highlight class="keyword">typedef</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">_UpnpStream<sp/>{</highlight></codeline>
<codeline lineno="57"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*rtp;</highlight></codeline>
<codeline lineno="58"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*rtcp;</highlight></codeline>
<codeline lineno="59"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__initializing_1ga2c19554a0988f7600aec5c3a7588d61a" kindref="member">LinphoneUpnpState</ref><sp/>state;</highlight></codeline>
<codeline lineno="60"><highlight class="normal">}<sp/>UpnpStream;</highlight></codeline>
<codeline lineno="61"><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">_UpnpSession<sp/>{</highlight></codeline>
<codeline lineno="63"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__call__control_1gac0a4861d7c4702c64f7106f2b893c69e" kindref="member">LinphoneCall</ref><sp/>*call;</highlight></codeline>
<codeline lineno="64"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpStream<sp/>*audio;</highlight></codeline>
<codeline lineno="65"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpStream<sp/>*video;</highlight></codeline>
<codeline lineno="66"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__initializing_1ga2c19554a0988f7600aec5c3a7588d61a" kindref="member">LinphoneUpnpState</ref><sp/>state;</highlight></codeline>
<codeline lineno="67"><highlight class="normal">};</highlight></codeline>
<codeline lineno="68"><highlight class="normal"></highlight></codeline>
<codeline lineno="69"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">_UpnpContext<sp/>{</highlight></codeline>
<codeline lineno="70"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__initializing_1gaa5cf635b82dd338e7ee2dd3599d05f0a" kindref="member">LinphoneCore</ref><sp/>*lc;</highlight></codeline>
<codeline lineno="71"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>upnp_igd_context<sp/>*upnp_igd_ctxt;</highlight></codeline>
<codeline lineno="72"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*sip_tcp;</highlight></codeline>
<codeline lineno="73"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*sip_tls;</highlight></codeline>
<codeline lineno="74"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*sip_udp;</highlight></codeline>
<codeline lineno="75"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__initializing_1ga2c19554a0988f7600aec5c3a7588d61a" kindref="member">LinphoneUpnpState</ref><sp/>state;</highlight></codeline>
<codeline lineno="76"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>MSList<sp/>*removing_configs;</highlight></codeline>
<codeline lineno="77"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>MSList<sp/>*adding_configs;</highlight></codeline>
<codeline lineno="78"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>MSList<sp/>*pending_bindings;</highlight></codeline>
<codeline lineno="79"><highlight class="normal"></highlight></codeline>
<codeline lineno="80"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_t<sp/>mutex;</highlight></codeline>
<codeline lineno="81"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_cond_t<sp/>empty_cond;</highlight></codeline>
<codeline lineno="82"><highlight class="normal"></highlight></codeline>
<codeline lineno="83"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>time_t<sp/>last_ready_check;</highlight></codeline>
<codeline lineno="84"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__initializing_1ga2c19554a0988f7600aec5c3a7588d61a" kindref="member">LinphoneUpnpState</ref><sp/>last_ready_state;</highlight></codeline>
<codeline lineno="85"><highlight class="normal">};</highlight></codeline>
<codeline lineno="86"><highlight class="normal"></highlight></codeline>
<codeline lineno="87"><highlight class="normal"></highlight></codeline>
<codeline lineno="88"><highlight class="normal">bool_t<sp/>linphone_core_upnp_hook(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*data);</highlight></codeline>
<codeline lineno="89"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_update(UpnpContext<sp/>*ctx);</highlight></codeline>
<codeline lineno="90"><highlight class="normal">bool_t<sp/>linphone_upnp_is_blacklisted(UpnpContext<sp/>*ctx);</highlight></codeline>
<codeline lineno="91"><highlight class="normal"></highlight></codeline>
<codeline lineno="92"><highlight class="normal">UpnpPortBinding<sp/>*linphone_upnp_port_binding_new();</highlight></codeline>
<codeline lineno="93"><highlight class="normal">UpnpPortBinding<sp/>*linphone_upnp_port_binding_new_with_parameters(upnp_igd_ip_protocol<sp/>protocol,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>local_port,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>external_port);</highlight></codeline>
<codeline lineno="94"><highlight class="normal">UpnpPortBinding<sp/>*linphone_upnp_port_binding_new_or_collect(MSList<sp/>*list,<sp/>upnp_igd_ip_protocol<sp/>protocol,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>local_port,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>external_port);</highlight></codeline>
<codeline lineno="95"><highlight class="normal">UpnpPortBinding<sp/>*linphone_upnp_port_binding_copy(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>UpnpPortBinding<sp/>*port);</highlight></codeline>
<codeline lineno="96"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_port_binding_set_device_id(UpnpPortBinding<sp/>*port,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<sp/>device_id);</highlight></codeline>
<codeline lineno="97"><highlight class="normal">bool_t<sp/>linphone_upnp_port_binding_equal(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>UpnpPortBinding<sp/>*port1,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>UpnpPortBinding<sp/>*port2);</highlight></codeline>
<codeline lineno="98"><highlight class="normal">UpnpPortBinding<sp/>*linphone_upnp_port_binding_equivalent_in_list(MSList<sp/>*list,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>UpnpPortBinding<sp/>*port);</highlight></codeline>
<codeline lineno="99"><highlight class="normal">UpnpPortBinding<sp/>*linphone_upnp_port_binding_retain(UpnpPortBinding<sp/>*port);</highlight></codeline>
<codeline lineno="100"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_update_port_binding(UpnpContext<sp/>*lupnp,<sp/>UpnpPortBinding<sp/>**port_mapping,<sp/>upnp_igd_ip_protocol<sp/>protocol,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>port,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>retry_delay);</highlight></codeline>
<codeline lineno="101"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_port_binding_log(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>level,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*msg,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>UpnpPortBinding<sp/>*port);</highlight></codeline>
<codeline lineno="102"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_port_binding_release(UpnpPortBinding<sp/>*port);</highlight></codeline>
<codeline lineno="103"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_update_config(UpnpContext<sp/>*lupnp);</highlight></codeline>
<codeline lineno="104"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_update_proxy(UpnpContext<sp/>*lupnp,<sp/>bool_t<sp/>force);</highlight></codeline>
<codeline lineno="105"><highlight class="normal"></highlight></codeline>
<codeline lineno="106"><highlight class="normal"></highlight><highlight class="comment">//<sp/>Configuration</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="107"><highlight class="normal">MSList<sp/>*linphone_upnp_config_list_port_bindings(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>_LpConfig<sp/>*lpc,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*device_id);</highlight></codeline>
<codeline lineno="108"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_config_add_port_binding(UpnpContext<sp/>*lupnp,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>UpnpPortBinding<sp/>*port);</highlight></codeline>
<codeline lineno="109"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_config_remove_port_binding(UpnpContext<sp/>*lupnp,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>UpnpPortBinding<sp/>*port);</highlight></codeline>
<codeline lineno="110"><highlight class="normal"></highlight></codeline>
<codeline lineno="111"><highlight class="normal"></highlight><highlight class="comment">//<sp/>uPnP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="112"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>linphone_upnp_context_send_remove_port_binding(UpnpContext<sp/>*lupnp,<sp/>UpnpPortBinding<sp/>*port,<sp/>bool_t<sp/>retry);</highlight></codeline>
<codeline lineno="113"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>linphone_upnp_context_send_add_port_binding(UpnpContext<sp/>*lupnp,<sp/>UpnpPortBinding<sp/>*port,<sp/>bool_t<sp/>retry);</highlight></codeline>
<codeline lineno="114"><highlight class="normal"></highlight></codeline>
<codeline lineno="115"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>linphone_upnp_strncmpi(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*str1,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*str2,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>len)<sp/>{</highlight></codeline>
<codeline lineno="116"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="117"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>char1,<sp/>char2;</highlight></codeline>
<codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal">(i<sp/>&lt;<sp/>len)<sp/>{</highlight></codeline>
<codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>char1<sp/>=<sp/>toupper(*str1);</highlight></codeline>
<codeline lineno="120"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>char2<sp/>=<sp/>toupper(*str2);</highlight></codeline>
<codeline lineno="121"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(char1<sp/>==<sp/></highlight><highlight class="charliteral">&apos;\0&apos;</highlight><highlight class="normal"><sp/>||<sp/>char1<sp/>!=<sp/>char2)<sp/>{</highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>char1<sp/>-<sp/>char2;</highlight></codeline>
<codeline lineno="123"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="124"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>str1++;</highlight></codeline>
<codeline lineno="125"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>str2++;</highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>i++;</highlight></codeline>
<codeline lineno="127"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="128"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="129"><highlight class="normal">}</highlight></codeline>
<codeline lineno="130"><highlight class="normal"></highlight></codeline>
<codeline lineno="131"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>linphone_upnp_str_min(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*str1,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*str2)<sp/>{</highlight></codeline>
<codeline lineno="132"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>len1<sp/>=<sp/>strlen(str1);</highlight></codeline>
<codeline lineno="133"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>len2<sp/>=<sp/>strlen(str2);</highlight></codeline>
<codeline lineno="134"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(len1<sp/>&gt;<sp/>len2)<sp/>{</highlight></codeline>
<codeline lineno="135"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>len2;</highlight></codeline>
<codeline lineno="136"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="137"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>len1;</highlight></codeline>
<codeline lineno="138"><highlight class="normal">}</highlight></codeline>
<codeline lineno="139"><highlight class="normal"></highlight></codeline>
<codeline lineno="140"><highlight class="normal"></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<sp/>linphone_upnp_format_device_id(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*device_id)<sp/>{</highlight></codeline>
<codeline lineno="141"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*ret<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="142"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*tmp;</highlight></codeline>
<codeline lineno="143"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>tchar;</highlight></codeline>
<codeline lineno="144"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>bool_t<sp/>copy;</highlight></codeline>
<codeline lineno="145"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(device_id<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="146"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="147"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="148"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>ms_new0(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">,<sp/>UPNP_UUID_LEN<sp/>+<sp/>1);</highlight></codeline>
<codeline lineno="149"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tmp<sp/>=<sp/>ret;</highlight></codeline>
<codeline lineno="150"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(linphone_upnp_strncmpi(device_id,<sp/></highlight><highlight class="stringliteral">&quot;uuid:&quot;</highlight><highlight class="normal">,<sp/>linphone_upnp_str_min(device_id,<sp/></highlight><highlight class="stringliteral">&quot;uuid:&quot;</highlight><highlight class="normal">))<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="151"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>device_id<sp/>+=<sp/>strlen(</highlight><highlight class="stringliteral">&quot;uuid:&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="152"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="153"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal">(*device_id<sp/>!=<sp/></highlight><highlight class="charliteral">&apos;\0&apos;</highlight><highlight class="normal"><sp/>&amp;&amp;<sp/>tmp<sp/>-<sp/>ret<sp/>&lt;<sp/>UPNP_UUID_LEN)<sp/>{</highlight></codeline>
<codeline lineno="154"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>copy<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="155"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tchar<sp/>=<sp/>*device_id;</highlight></codeline>
<codeline lineno="156"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(tchar<sp/>&gt;=<sp/></highlight><highlight class="charliteral">&apos;0&apos;</highlight><highlight class="normal"><sp/>&amp;&amp;<sp/>tchar<sp/>&lt;=<sp/></highlight><highlight class="charliteral">&apos;9&apos;</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="157"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>copy<sp/>=<sp/>TRUE;</highlight></codeline>
<codeline lineno="158"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(!copy<sp/>&amp;&amp;<sp/>tchar<sp/>&gt;=<sp/></highlight><highlight class="charliteral">&apos;A&apos;</highlight><highlight class="normal"><sp/>&amp;&amp;<sp/>tchar<sp/>&lt;=<sp/></highlight><highlight class="charliteral">&apos;Z&apos;</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="159"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>copy<sp/>=<sp/>TRUE;</highlight></codeline>
<codeline lineno="160"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(!copy<sp/>&amp;&amp;<sp/>tchar<sp/>&gt;=<sp/></highlight><highlight class="charliteral">&apos;a&apos;</highlight><highlight class="normal"><sp/>&amp;&amp;<sp/>tchar<sp/>&lt;=<sp/></highlight><highlight class="charliteral">&apos;z&apos;</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="161"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>copy<sp/>=<sp/>TRUE;</highlight></codeline>
<codeline lineno="162"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(copy)<sp/>{</highlight></codeline>
<codeline lineno="163"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*tmp<sp/>=<sp/>*device_id;</highlight></codeline>
<codeline lineno="164"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tmp++;</highlight></codeline>
<codeline lineno="165"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="166"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>device_id++;</highlight></codeline>
<codeline lineno="167"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="168"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*tmp<sp/>=<sp/></highlight><highlight class="charliteral">&apos;\0&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="169"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="170"><highlight class="normal">}</highlight></codeline>
<codeline lineno="171"><highlight class="normal"></highlight></codeline>
<codeline lineno="176"><highlight class="comment">/*<sp/>Convert<sp/>uPnP<sp/>IGD<sp/>logs<sp/>to<sp/>ortp<sp/>logs<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="177"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_igd_print(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*cookie,<sp/>upnp_igd_print_level<sp/>level,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*fmt,<sp/>va_list<sp/>list)<sp/>{</highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ortp_level<sp/>=<sp/>ORTP_DEBUG;</highlight></codeline>
<codeline lineno="179"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal">(level)<sp/>{</highlight></codeline>
<codeline lineno="180"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>UPNP_IGD_MESSAGE:</highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ortp_level<sp/>=<sp/>ORTP_MESSAGE;</highlight></codeline>
<codeline lineno="182"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="183"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>UPNP_IGD_WARNING:</highlight></codeline>
<codeline lineno="184"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ortp_level<sp/>=<sp/>ORTP_DEBUG;<sp/></highlight><highlight class="comment">//<sp/>Too<sp/>verbose<sp/>otherwise</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="185"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="186"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>UPNP_IGD_ERROR:</highlight></codeline>
<codeline lineno="187"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ortp_level<sp/>=<sp/>ORTP_DEBUG;<sp/></highlight><highlight class="comment">//<sp/>Too<sp/>verbose<sp/>otherwise</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="188"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="189"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="190"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="191"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="192"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ortp_logv(ortp_level,<sp/>fmt,<sp/>list);</highlight></codeline>
<codeline lineno="193"><highlight class="normal">}</highlight></codeline>
<codeline lineno="194"><highlight class="normal"></highlight></codeline>
<codeline lineno="195"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_igd_callback(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*cookie,<sp/>upnp_igd_event<sp/>event,<sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*arg)<sp/>{</highlight></codeline>
<codeline lineno="196"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpContext<sp/>*lupnp<sp/>=<sp/>(UpnpContext<sp/>*)cookie;</highlight></codeline>
<codeline lineno="197"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>upnp_igd_port_mapping<sp/>*mapping<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="198"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*port_mapping<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="199"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*ip_address<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="200"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*connection_status<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="201"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>bool_t<sp/>nat_enabled<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="202"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>bool_t<sp/>blacklisted<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="203"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__initializing_1ga2c19554a0988f7600aec5c3a7588d61a" kindref="member">LinphoneUpnpState</ref><sp/>old_state;</highlight></codeline>
<codeline lineno="204"><highlight class="normal"></highlight></codeline>
<codeline lineno="205"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp<sp/>==<sp/>NULL<sp/>||<sp/>lupnp-&gt;upnp_igd_ctxt<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="206"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_error(</highlight><highlight class="stringliteral">&quot;uPnP<sp/>IGD:<sp/>Invalid<sp/>context<sp/>in<sp/>callback&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="207"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="208"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="209"><highlight class="normal"></highlight></codeline>
<codeline lineno="210"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_lock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="211"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>old_state<sp/>=<sp/>lupnp-&gt;state;</highlight></codeline>
<codeline lineno="212"><highlight class="normal"></highlight></codeline>
<codeline lineno="213"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal">(event)<sp/>{</highlight></codeline>
<codeline lineno="214"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>UPNP_IGD_DEVICE_ADDED:</highlight></codeline>
<codeline lineno="215"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>UPNP_IGD_DEVICE_REMOVED:</highlight></codeline>
<codeline lineno="216"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>UPNP_IGD_EXTERNAL_IPADDRESS_CHANGED:</highlight></codeline>
<codeline lineno="217"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>UPNP_IGD_NAT_ENABLED_CHANGED:</highlight></codeline>
<codeline lineno="218"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>UPNP_IGD_CONNECTION_STATUS_CHANGED:</highlight></codeline>
<codeline lineno="219"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip_address<sp/>=<sp/>upnp_igd_get_external_ipaddress(lupnp-&gt;upnp_igd_ctxt);</highlight></codeline>
<codeline lineno="220"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>connection_status<sp/>=<sp/>upnp_igd_get_connection_status(lupnp-&gt;upnp_igd_ctxt);</highlight></codeline>
<codeline lineno="221"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nat_enabled<sp/>=<sp/>upnp_igd_get_nat_enabled(lupnp-&gt;upnp_igd_ctxt);</highlight></codeline>
<codeline lineno="222"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>blacklisted<sp/>=<sp/>linphone_upnp_is_blacklisted(lupnp);</highlight></codeline>
<codeline lineno="223"><highlight class="normal"></highlight></codeline>
<codeline lineno="224"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(ip_address<sp/>==<sp/>NULL<sp/>||<sp/>connection_status<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="225"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_message(</highlight><highlight class="stringliteral">&quot;uPnP<sp/>IGD:<sp/>Pending&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="226"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490adb2fdfe2a5346472b0faa631c3c01f2e" kindref="member">LinphoneUpnpStatePending</ref>;</highlight></codeline>
<codeline lineno="227"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(strcasecmp(connection_status,<sp/></highlight><highlight class="stringliteral">&quot;Connected&quot;</highlight><highlight class="normal">)<sp/><sp/>||<sp/>!nat_enabled)<sp/>{</highlight></codeline>
<codeline lineno="228"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_message(</highlight><highlight class="stringliteral">&quot;uPnP<sp/>IGD:<sp/>Not<sp/>Available&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="229"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a25fee6e8fd79a2368aa46daf77a6bff9" kindref="member">LinphoneUpnpStateNotAvailable</ref>;</highlight></codeline>
<codeline lineno="230"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(blacklisted)<sp/>{</highlight></codeline>
<codeline lineno="231"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_message(</highlight><highlight class="stringliteral">&quot;uPnP<sp/>IGD:<sp/>Router<sp/>is<sp/>blacklisted&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="232"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a3b9bdacd34d15820922a89dbddd00f03" kindref="member">LinphoneUpnpStateBlacklisted</ref>;</highlight></codeline>
<codeline lineno="233"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="234"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_message(</highlight><highlight class="stringliteral">&quot;uPnP<sp/>IGD:<sp/>Connected&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="235"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>;</highlight></codeline>
<codeline lineno="236"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(old_state<sp/>!=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>)<sp/>{</highlight></codeline>
<codeline lineno="237"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_update(lupnp);</highlight></codeline>
<codeline lineno="238"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="239"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="240"><highlight class="normal"></highlight></codeline>
<codeline lineno="241"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="242"><highlight class="normal"></highlight></codeline>
<codeline lineno="243"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>UPNP_IGD_PORT_MAPPING_ADD_SUCCESS:</highlight></codeline>
<codeline lineno="244"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mapping<sp/>=<sp/>(upnp_igd_port_mapping<sp/>*)<sp/>arg;</highlight></codeline>
<codeline lineno="245"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping<sp/>=<sp/>(UpnpPortBinding*)<sp/>mapping-&gt;cookie;</highlight></codeline>
<codeline lineno="246"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping-&gt;external_port<sp/>=<sp/>mapping-&gt;remote_port;</highlight></codeline>
<codeline lineno="247"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>;</highlight></codeline>
<codeline lineno="248"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_log(ORTP_MESSAGE,<sp/></highlight><highlight class="stringliteral">&quot;Added<sp/>port<sp/>binding&quot;</highlight><highlight class="normal">,<sp/>port_mapping);</highlight></codeline>
<codeline lineno="249"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_config_add_port_binding(lupnp,<sp/>port_mapping);</highlight></codeline>
<codeline lineno="250"><highlight class="normal"></highlight></codeline>
<codeline lineno="251"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="252"><highlight class="normal"></highlight></codeline>
<codeline lineno="253"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>UPNP_IGD_PORT_MAPPING_ADD_FAILURE:</highlight></codeline>
<codeline lineno="254"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mapping<sp/>=<sp/>(upnp_igd_port_mapping<sp/>*)<sp/>arg;</highlight></codeline>
<codeline lineno="255"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping<sp/>=<sp/>(UpnpPortBinding*)<sp/>mapping-&gt;cookie;</highlight></codeline>
<codeline lineno="256"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping-&gt;external_port<sp/>=<sp/>-1;<sp/></highlight><highlight class="comment">//Force<sp/>random<sp/>external<sp/>port</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="257"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(linphone_upnp_context_send_add_port_binding(lupnp,<sp/>port_mapping,<sp/>TRUE)<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="258"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_log(ORTP_ERROR,<sp/></highlight><highlight class="stringliteral">&quot;Can&apos;t<sp/>add<sp/>port<sp/>binding&quot;</highlight><highlight class="normal">,<sp/>port_mapping);</highlight></codeline>
<codeline lineno="259"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="260"><highlight class="normal"></highlight></codeline>
<codeline lineno="261"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="262"><highlight class="normal"></highlight></codeline>
<codeline lineno="263"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>UPNP_IGD_PORT_MAPPING_REMOVE_SUCCESS:</highlight></codeline>
<codeline lineno="264"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mapping<sp/>=<sp/>(upnp_igd_port_mapping<sp/>*)<sp/>arg;</highlight></codeline>
<codeline lineno="265"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping<sp/>=<sp/>(UpnpPortBinding*)<sp/>mapping-&gt;cookie;</highlight></codeline>
<codeline lineno="266"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ac0c60c390f5cd5a27a538aea39def28b" kindref="member">LinphoneUpnpStateIdle</ref>;</highlight></codeline>
<codeline lineno="267"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_log(ORTP_MESSAGE,<sp/></highlight><highlight class="stringliteral">&quot;Removed<sp/>port<sp/>binding&quot;</highlight><highlight class="normal">,<sp/>port_mapping);</highlight></codeline>
<codeline lineno="268"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_config_remove_port_binding(lupnp,<sp/>port_mapping);</highlight></codeline>
<codeline lineno="269"><highlight class="normal"></highlight></codeline>
<codeline lineno="270"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="271"><highlight class="normal"></highlight></codeline>
<codeline lineno="272"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>UPNP_IGD_PORT_MAPPING_REMOVE_FAILURE:</highlight></codeline>
<codeline lineno="273"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mapping<sp/>=<sp/>(upnp_igd_port_mapping<sp/>*)<sp/>arg;</highlight></codeline>
<codeline lineno="274"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping<sp/>=<sp/>(UpnpPortBinding*)<sp/>mapping-&gt;cookie;</highlight></codeline>
<codeline lineno="275"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(linphone_upnp_context_send_remove_port_binding(lupnp,<sp/>port_mapping,<sp/>TRUE)<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="276"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_log(ORTP_ERROR,<sp/></highlight><highlight class="stringliteral">&quot;Can&apos;t<sp/>remove<sp/>port<sp/>binding&quot;</highlight><highlight class="normal">,<sp/>port_mapping);</highlight></codeline>
<codeline lineno="277"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_config_remove_port_binding(lupnp,<sp/>port_mapping);</highlight></codeline>
<codeline lineno="278"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="279"><highlight class="normal"></highlight></codeline>
<codeline lineno="280"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="281"><highlight class="normal"></highlight></codeline>
<codeline lineno="282"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="283"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="284"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="285"><highlight class="normal"></highlight></codeline>
<codeline lineno="286"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port_mapping<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="287"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="288"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>Execute<sp/>delayed<sp/>actions</highlight></codeline>
<codeline lineno="289"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="290"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port_mapping-&gt;to_remove)<sp/>{</highlight></codeline>
<codeline lineno="291"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port_mapping-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>)<sp/>{</highlight></codeline>
<codeline lineno="292"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping-&gt;to_remove<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="293"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_context_send_remove_port_binding(lupnp,<sp/>port_mapping,<sp/>FALSE);</highlight></codeline>
<codeline lineno="294"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port_mapping-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref>)<sp/>{</highlight></codeline>
<codeline lineno="295"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping-&gt;to_remove<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="296"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="297"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="298"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port_mapping-&gt;to_add)<sp/>{</highlight></codeline>
<codeline lineno="299"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port_mapping-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ac0c60c390f5cd5a27a538aea39def28b" kindref="member">LinphoneUpnpStateIdle</ref><sp/>||<sp/>port_mapping-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref>)<sp/>{</highlight></codeline>
<codeline lineno="300"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping-&gt;to_add<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="301"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_context_send_add_port_binding(lupnp,<sp/>port_mapping,<sp/>FALSE);</highlight></codeline>
<codeline lineno="302"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="303"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="304"><highlight class="normal"></highlight></codeline>
<codeline lineno="305"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;pending_bindings<sp/>=<sp/>ms_list_remove(lupnp-&gt;pending_bindings,<sp/>port_mapping);</highlight></codeline>
<codeline lineno="306"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_release(port_mapping);</highlight></codeline>
<codeline lineno="307"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="308"><highlight class="normal"></highlight></codeline>
<codeline lineno="309"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="310"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>If<sp/>there<sp/>is<sp/>no<sp/>pending<sp/>binding<sp/>emit<sp/>a<sp/>signal</highlight></codeline>
<codeline lineno="311"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="312"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;pending_bindings<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="313"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_cond_signal(&amp;lupnp-&gt;empty_cond);</highlight></codeline>
<codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="315"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_unlock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="316"><highlight class="normal">}</highlight></codeline>
<codeline lineno="317"><highlight class="normal"></highlight></codeline>
<codeline lineno="318"><highlight class="normal"></highlight></codeline>
<codeline lineno="323"><highlight class="normal">UpnpContext*<sp/>linphone_upnp_context_new(<ref refid="group__initializing_1gaa5cf635b82dd338e7ee2dd3599d05f0a" kindref="member">LinphoneCore</ref><sp/>*lc)<sp/>{</highlight></codeline>
<codeline lineno="324"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpContext<sp/>*lupnp<sp/>=<sp/>(UpnpContext<sp/>*)ms_new0(UpnpContext,1);</highlight></codeline>
<codeline lineno="325"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>address[LINPHONE_IPADDR_SIZE];</highlight></codeline>
<codeline lineno="326"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*upnp_binding_address=address;</highlight></codeline>
<codeline lineno="327"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(linphone_core_get_local_ip_for(lc-&gt;sip_conf.ipv6_enabled<sp/>?<sp/>AF_INET6<sp/>:<sp/>AF_INET,NULL,address))<sp/>{</highlight></codeline>
<codeline lineno="328"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_warning(</highlight><highlight class="stringliteral">&quot;Linphone<sp/>core<sp/>[%p]<sp/>cannot<sp/>guess<sp/>local<sp/>address<sp/>for<sp/>upnp,<sp/>let&apos;s<sp/>choice<sp/>the<sp/>lib&quot;</highlight><highlight class="normal">,lc);</highlight></codeline>
<codeline lineno="329"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>upnp_binding_address=NULL;</highlight></codeline>
<codeline lineno="330"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="331"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_init(&amp;lupnp-&gt;mutex,<sp/>NULL);</highlight></codeline>
<codeline lineno="332"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_cond_init(&amp;lupnp-&gt;empty_cond,<sp/>NULL);</highlight></codeline>
<codeline lineno="333"><highlight class="normal"></highlight></codeline>
<codeline lineno="334"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;last_ready_check<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="335"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;last_ready_state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ac0c60c390f5cd5a27a538aea39def28b" kindref="member">LinphoneUpnpStateIdle</ref>;</highlight></codeline>
<codeline lineno="336"><highlight class="normal"></highlight></codeline>
<codeline lineno="337"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;lc<sp/>=<sp/>lc;</highlight></codeline>
<codeline lineno="338"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;pending_bindings<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="339"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;adding_configs<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="340"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;removing_configs<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="341"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ac0c60c390f5cd5a27a538aea39def28b" kindref="member">LinphoneUpnpStateIdle</ref>;</highlight></codeline>
<codeline lineno="342"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_message(</highlight><highlight class="stringliteral">&quot;uPnP<sp/>IGD:<sp/>New<sp/>%p<sp/>for<sp/>core<sp/>%p<sp/>bound<sp/>to<sp/>%s&quot;</highlight><highlight class="normal">,<sp/>lupnp,<sp/>lc,upnp_binding_address);</highlight></codeline>
<codeline lineno="343"><highlight class="normal"></highlight></codeline>
<codeline lineno="344"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Init<sp/>ports</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="345"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;sip_udp<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="346"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;sip_tcp<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="347"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;sip_tls<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="348"><highlight class="normal"></highlight></codeline>
<codeline lineno="349"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_core_add_iterate_hook(lc,<sp/>linphone_core_upnp_hook,<sp/>lupnp);</highlight></codeline>
<codeline lineno="350"><highlight class="normal"></highlight></codeline>
<codeline lineno="351"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;upnp_igd_ctxt<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="352"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;upnp_igd_ctxt<sp/>=<sp/>upnp_igd_create(linphone_upnp_igd_callback,<sp/>linphone_upnp_igd_print,<sp/>address,<sp/>lupnp);</highlight></codeline>
<codeline lineno="353"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;upnp_igd_ctxt<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="354"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref>;</highlight></codeline>
<codeline lineno="355"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_error(</highlight><highlight class="stringliteral">&quot;Can&apos;t<sp/>create<sp/>uPnP<sp/>IGD<sp/>context&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="356"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>NULL;</highlight></codeline>
<codeline lineno="357"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="358"><highlight class="normal"></highlight></codeline>
<codeline lineno="359"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490adb2fdfe2a5346472b0faa631c3c01f2e" kindref="member">LinphoneUpnpStatePending</ref>;</highlight></codeline>
<codeline lineno="360"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>upnp_igd_start(lupnp-&gt;upnp_igd_ctxt);</highlight></codeline>
<codeline lineno="361"><highlight class="normal"></highlight></codeline>
<codeline lineno="362"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>lupnp;</highlight></codeline>
<codeline lineno="363"><highlight class="normal">}</highlight></codeline>
<codeline lineno="364"><highlight class="normal"></highlight></codeline>
<codeline lineno="365"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_context_destroy(UpnpContext<sp/>*lupnp)<sp/>{</highlight></codeline>
<codeline lineno="366"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_core_remove_iterate_hook(lupnp-&gt;lc,<sp/>linphone_core_upnp_hook,<sp/>lupnp);</highlight></codeline>
<codeline lineno="367"><highlight class="normal"></highlight></codeline>
<codeline lineno="368"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_lock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="369"><highlight class="normal"></highlight></codeline>
<codeline lineno="370"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;lc-&gt;network_reachable)<sp/>{</highlight></codeline>
<codeline lineno="371"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Send<sp/>port<sp/>binding<sp/>removes<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="372"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_udp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="373"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_context_send_remove_port_binding(lupnp,<sp/>lupnp-&gt;sip_udp,<sp/>TRUE);</highlight></codeline>
<codeline lineno="374"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="375"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_tcp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="376"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_context_send_remove_port_binding(lupnp,<sp/>lupnp-&gt;sip_tcp,<sp/>TRUE);</highlight></codeline>
<codeline lineno="377"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="378"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_tls<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="379"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_context_send_remove_port_binding(lupnp,<sp/>lupnp-&gt;sip_tls,<sp/>TRUE);</highlight></codeline>
<codeline lineno="380"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="381"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="382"><highlight class="normal"></highlight></codeline>
<codeline lineno="383"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Wait<sp/>all<sp/>pending<sp/>bindings<sp/>are<sp/>done<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="384"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;pending_bindings<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="385"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_message(</highlight><highlight class="stringliteral">&quot;uPnP<sp/>IGD:<sp/>Wait<sp/>all<sp/>pending<sp/>port<sp/>bindings<sp/>...&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="386"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_cond_wait(&amp;lupnp-&gt;empty_cond,<sp/>&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="387"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="388"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_unlock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="389"><highlight class="normal"></highlight></codeline>
<codeline lineno="390"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;upnp_igd_ctxt<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="391"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>upnp_igd_destroy(lupnp-&gt;upnp_igd_ctxt);</highlight></codeline>
<codeline lineno="392"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;upnp_igd_ctxt<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="393"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="394"><highlight class="normal"></highlight></codeline>
<codeline lineno="395"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>No<sp/>more<sp/>multi<sp/>threading<sp/>here<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="396"><highlight class="normal"></highlight></codeline>
<codeline lineno="397"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Run<sp/>one<sp/>more<sp/>time<sp/>configuration<sp/>update<sp/>and<sp/>proxy<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="398"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_update_config(lupnp);</highlight></codeline>
<codeline lineno="399"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_update_proxy(lupnp,<sp/>TRUE);</highlight></codeline>
<codeline lineno="400"><highlight class="normal"></highlight></codeline>
<codeline lineno="401"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Release<sp/>port<sp/>bindings<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="402"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_udp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="403"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_release(lupnp-&gt;sip_udp);</highlight></codeline>
<codeline lineno="404"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;sip_udp<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="405"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="406"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_tcp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="407"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_release(lupnp-&gt;sip_tcp);</highlight></codeline>
<codeline lineno="408"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;sip_tcp<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="409"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="410"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_tls<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="411"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_release(lupnp-&gt;sip_tls);</highlight></codeline>
<codeline lineno="412"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;sip_tcp<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="413"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="414"><highlight class="normal"></highlight></codeline>
<codeline lineno="415"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Release<sp/>lists<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="416"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_list_for_each(lupnp-&gt;adding_configs,(void<sp/>(*)(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*))linphone_upnp_port_binding_release);</highlight></codeline>
<codeline lineno="417"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;adding_configs<sp/>=<sp/>ms_list_free(lupnp-&gt;adding_configs);</highlight></codeline>
<codeline lineno="418"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_list_for_each(lupnp-&gt;removing_configs,(void<sp/>(*)(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*))linphone_upnp_port_binding_release);</highlight></codeline>
<codeline lineno="419"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;removing_configs<sp/>=<sp/>ms_list_free(lupnp-&gt;removing_configs);</highlight></codeline>
<codeline lineno="420"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_list_for_each(lupnp-&gt;pending_bindings,(void<sp/>(*)(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*))linphone_upnp_port_binding_release);</highlight></codeline>
<codeline lineno="421"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;pending_bindings<sp/>=<sp/>ms_list_free(lupnp-&gt;pending_bindings);</highlight></codeline>
<codeline lineno="422"><highlight class="normal"></highlight></codeline>
<codeline lineno="423"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_destroy(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="424"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_cond_destroy(&amp;lupnp-&gt;empty_cond);</highlight></codeline>
<codeline lineno="425"><highlight class="normal"></highlight></codeline>
<codeline lineno="426"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_message(</highlight><highlight class="stringliteral">&quot;uPnP<sp/>IGD:<sp/>destroy<sp/>%p&quot;</highlight><highlight class="normal">,<sp/>lupnp);</highlight></codeline>
<codeline lineno="427"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_free(lupnp);</highlight></codeline>
<codeline lineno="428"><highlight class="normal">}</highlight></codeline>
<codeline lineno="429"><highlight class="normal"></highlight></codeline>
<codeline lineno="430"><highlight class="normal"><ref refid="group__initializing_1ga2c19554a0988f7600aec5c3a7588d61a" kindref="member">LinphoneUpnpState</ref><sp/>linphone_upnp_context_get_state(UpnpContext<sp/>*lupnp)<sp/>{</highlight></codeline>
<codeline lineno="431"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__initializing_1ga2c19554a0988f7600aec5c3a7588d61a" kindref="member">LinphoneUpnpState</ref><sp/>state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref>;</highlight></codeline>
<codeline lineno="432"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="433"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_lock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="434"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>state<sp/>=<sp/>lupnp-&gt;state;</highlight></codeline>
<codeline lineno="435"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_unlock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="436"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="437"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>state;</highlight></codeline>
<codeline lineno="438"><highlight class="normal">}</highlight></codeline>
<codeline lineno="439"><highlight class="normal"></highlight></codeline>
<codeline lineno="440"><highlight class="normal">bool_t<sp/>_linphone_upnp_context_is_ready_for_register(UpnpContext<sp/>*lupnp)<sp/>{</highlight></codeline>
<codeline lineno="441"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>bool_t<sp/>ready<sp/>=<sp/>TRUE;</highlight></codeline>
<codeline lineno="442"><highlight class="normal"></highlight></codeline>
<codeline lineno="443"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>1<sp/>Check<sp/>global<sp/>uPnP<sp/>state</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="444"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ready<sp/>=<sp/>(lupnp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>);</highlight></codeline>
<codeline lineno="445"><highlight class="normal"></highlight></codeline>
<codeline lineno="446"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>2<sp/>Check<sp/>external<sp/>ip<sp/>address</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="447"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(ready)<sp/>{</highlight></codeline>
<codeline lineno="448"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(upnp_igd_get_external_ipaddress(lupnp-&gt;upnp_igd_ctxt)<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="449"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ready<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="450"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="451"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="452"><highlight class="normal"></highlight></codeline>
<codeline lineno="453"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>3<sp/>Check<sp/>sip<sp/>ports<sp/>bindings</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="454"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(ready)<sp/>{</highlight></codeline>
<codeline lineno="455"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_udp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="456"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_udp-&gt;state<sp/>!=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>)<sp/>{</highlight></codeline>
<codeline lineno="457"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ready<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="458"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="459"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_tcp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="460"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_tcp-&gt;state<sp/>!=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>)<sp/>{</highlight></codeline>
<codeline lineno="461"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ready<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="462"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="463"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_tls<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="464"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_tls-&gt;state<sp/>!=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>)<sp/>{</highlight></codeline>
<codeline lineno="465"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ready<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="466"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="467"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="468"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ready<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="469"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="470"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="471"><highlight class="normal"></highlight></codeline>
<codeline lineno="472"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ready;</highlight></codeline>
<codeline lineno="473"><highlight class="normal">}</highlight></codeline>
<codeline lineno="474"><highlight class="normal"></highlight></codeline>
<codeline lineno="475"><highlight class="normal">bool_t<sp/>linphone_upnp_context_is_ready_for_register(UpnpContext<sp/>*lupnp)<sp/>{</highlight></codeline>
<codeline lineno="476"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>bool_t<sp/>ready<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="477"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="478"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_lock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="479"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ready<sp/>=<sp/>_linphone_upnp_context_is_ready_for_register(lupnp);</highlight></codeline>
<codeline lineno="480"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_unlock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="481"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="482"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ready;</highlight></codeline>
<codeline lineno="483"><highlight class="normal">}</highlight></codeline>
<codeline lineno="484"><highlight class="normal"></highlight></codeline>
<codeline lineno="485"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>linphone_upnp_context_get_external_port(UpnpContext<sp/>*lupnp)<sp/>{</highlight></codeline>
<codeline lineno="486"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>port<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="487"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="488"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_lock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="489"><highlight class="normal"></highlight></codeline>
<codeline lineno="490"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_udp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="491"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_udp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>)<sp/>{</highlight></codeline>
<codeline lineno="492"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port<sp/>=<sp/>lupnp-&gt;sip_udp-&gt;external_port;</highlight></codeline>
<codeline lineno="493"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="494"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_tcp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="495"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_tcp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>)<sp/>{</highlight></codeline>
<codeline lineno="496"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port<sp/>=<sp/>lupnp-&gt;sip_tcp-&gt;external_port;</highlight></codeline>
<codeline lineno="497"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="498"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_tls<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="499"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_tls-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>)<sp/>{</highlight></codeline>
<codeline lineno="500"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port<sp/>=<sp/>lupnp-&gt;sip_tls-&gt;external_port;</highlight></codeline>
<codeline lineno="501"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="502"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="503"><highlight class="normal"></highlight></codeline>
<codeline lineno="504"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_unlock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="505"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="506"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>port;</highlight></codeline>
<codeline lineno="507"><highlight class="normal">}</highlight></codeline>
<codeline lineno="508"><highlight class="normal"></highlight></codeline>
<codeline lineno="509"><highlight class="normal">bool_t<sp/>linphone_upnp_is_blacklisted(UpnpContext<sp/>*lupnp)<sp/>{</highlight></codeline>
<codeline lineno="510"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<sp/>device_model_name<sp/>=<sp/>upnp_igd_get_device_model_name(lupnp-&gt;upnp_igd_ctxt);</highlight></codeline>
<codeline lineno="511"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<sp/>device_model_number<sp/>=<sp/>upnp_igd_get_device_model_number(lupnp-&gt;upnp_igd_ctxt);</highlight></codeline>
<codeline lineno="512"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<sp/>blacklist<sp/>=<sp/><ref refid="group__misc_1ga9657ebf1d68b43184a796c9bdc68c29a" kindref="member">lp_config_get_string</ref>(lupnp-&gt;lc-&gt;config,<sp/></highlight><highlight class="stringliteral">&quot;net&quot;</highlight><highlight class="normal">,<sp/></highlight><highlight class="stringliteral">&quot;upnp_blacklist&quot;</highlight><highlight class="normal">,<sp/>NULL);</highlight></codeline>
<codeline lineno="513"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>bool_t<sp/>blacklisted<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="514"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*str;</highlight></codeline>
<codeline lineno="515"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*pch;</highlight></codeline>
<codeline lineno="516"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*model_name;</highlight></codeline>
<codeline lineno="517"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*model_number;</highlight></codeline>
<codeline lineno="518"><highlight class="normal"></highlight></codeline>
<codeline lineno="519"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Sanity<sp/>checks</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="520"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(device_model_name<sp/>==<sp/>NULL<sp/>||<sp/>device_model_number<sp/>==<sp/>NULL<sp/>||<sp/>blacklist<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="521"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>FALSE;</highlight></codeline>
<codeline lineno="522"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="523"><highlight class="normal"></highlight></codeline>
<codeline lineno="524"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Find<sp/>in<sp/>the<sp/>list</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="525"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>str<sp/>=<sp/>strdup(blacklist);</highlight></codeline>
<codeline lineno="526"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pch<sp/>=<sp/>strtok(str,<sp/></highlight><highlight class="stringliteral">&quot;;&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="527"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(pch<sp/>!=<sp/>NULL<sp/>&amp;&amp;<sp/>!blacklisted)<sp/>{</highlight></codeline>
<codeline lineno="528"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Extract<sp/>model<sp/>name<sp/>&amp;<sp/>number</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="529"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>model_name<sp/>=<sp/>pch;</highlight></codeline>
<codeline lineno="530"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>model_number<sp/>=<sp/>strstr(pch,<sp/></highlight><highlight class="stringliteral">&quot;,&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="531"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(model_number<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="532"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*(model_number++)<sp/>=<sp/></highlight><highlight class="charliteral">&apos;\0&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="533"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="534"><highlight class="normal"></highlight></codeline>
<codeline lineno="535"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Compare<sp/>with<sp/>current<sp/>device</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="536"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(strcmp(model_name,<sp/>device_model_name)<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="537"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(model_number<sp/>==<sp/>NULL<sp/>||<sp/>strcmp(model_number,<sp/>device_model_number)<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="538"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>blacklisted<sp/>=<sp/>TRUE;</highlight></codeline>
<codeline lineno="539"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="540"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="541"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pch<sp/>=<sp/>strtok(NULL,<sp/></highlight><highlight class="stringliteral">&quot;;&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="542"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="543"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>free(str);</highlight></codeline>
<codeline lineno="544"><highlight class="normal"></highlight></codeline>
<codeline lineno="545"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>blacklisted;</highlight></codeline>
<codeline lineno="546"><highlight class="normal">}</highlight></codeline>
<codeline lineno="547"><highlight class="normal"></highlight></codeline>
<codeline lineno="548"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_refresh(UpnpContext<sp/>*<sp/>lupnp)<sp/>{</highlight></codeline>
<codeline lineno="549"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>upnp_igd_refresh(lupnp-&gt;upnp_igd_ctxt);</highlight></codeline>
<codeline lineno="550"><highlight class="normal">}</highlight></codeline>
<codeline lineno="551"><highlight class="normal"></highlight></codeline>
<codeline lineno="552"><highlight class="normal"></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*<sp/>linphone_upnp_context_get_external_ipaddress(UpnpContext<sp/>*lupnp)<sp/>{</highlight></codeline>
<codeline lineno="553"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*<sp/>addr<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="554"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="555"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_lock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="556"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>addr<sp/>=<sp/>upnp_igd_get_external_ipaddress(lupnp-&gt;upnp_igd_ctxt);</highlight></codeline>
<codeline lineno="557"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_unlock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="558"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="559"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>addr;</highlight></codeline>
<codeline lineno="560"><highlight class="normal">}</highlight></codeline>
<codeline lineno="561"><highlight class="normal"></highlight></codeline>
<codeline lineno="562"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>linphone_upnp_context_send_add_port_binding(UpnpContext<sp/>*lupnp,<sp/>UpnpPortBinding<sp/>*port,<sp/>bool_t<sp/>retry)<sp/>{</highlight></codeline>
<codeline lineno="563"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>upnp_igd_port_mapping<sp/>mapping;</highlight></codeline>
<codeline lineno="564"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>description[128];</highlight></codeline>
<codeline lineno="565"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="566"><highlight class="normal"></highlight></codeline>
<codeline lineno="567"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;state<sp/>!=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>)<sp/>{</highlight></codeline>
<codeline lineno="568"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-2;</highlight></codeline>
<codeline lineno="569"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="570"><highlight class="normal"></highlight></codeline>
<codeline lineno="571"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Compute<sp/>port<sp/>binding<sp/>state</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="572"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port-&gt;state<sp/>!=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ae9de2eb7e97d1b5ab38c0e8ebb057ab3" kindref="member">LinphoneUpnpStateAdding</ref>)<sp/>{</highlight></codeline>
<codeline lineno="573"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;to_remove<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="574"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal">(port-&gt;state)<sp/>{</highlight></codeline>
<codeline lineno="575"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref>:</highlight></codeline>
<codeline lineno="576"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ac0c60c390f5cd5a27a538aea39def28b" kindref="member">LinphoneUpnpStateIdle</ref>:<sp/>{</highlight></codeline>
<codeline lineno="577"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;retry<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="578"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ae9de2eb7e97d1b5ab38c0e8ebb057ab3" kindref="member">LinphoneUpnpStateAdding</ref>;</highlight></codeline>
<codeline lineno="579"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="580"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="581"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ad6371d3688d549a64096d796faf44822" kindref="member">LinphoneUpnpStateRemoving</ref>:<sp/>{</highlight></codeline>
<codeline lineno="582"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;to_add<sp/>=<sp/>TRUE;</highlight></codeline>
<codeline lineno="583"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="584"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="585"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="586"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="587"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="588"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="589"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="590"><highlight class="normal"></highlight></codeline>
<codeline lineno="591"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>No<sp/>retry<sp/>if<sp/>specified</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="592"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port-&gt;retry<sp/>!=<sp/>0<sp/>&amp;&amp;<sp/>!retry)<sp/>{</highlight></codeline>
<codeline lineno="593"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="594"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="595"><highlight class="normal"></highlight></codeline>
<codeline lineno="596"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port-&gt;retry<sp/>&gt;=<sp/>UPNP_ADD_MAX_RETRY)<sp/>{</highlight></codeline>
<codeline lineno="597"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="598"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="599"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_set_device_id(port,<sp/>upnp_igd_get_device_id(lupnp-&gt;upnp_igd_ctxt));</highlight></codeline>
<codeline lineno="600"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mapping.cookie<sp/>=<sp/>linphone_upnp_port_binding_retain(port);</highlight></codeline>
<codeline lineno="601"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;pending_bindings<sp/>=<sp/>ms_list_append(lupnp-&gt;pending_bindings,<sp/>mapping.cookie);</highlight></codeline>
<codeline lineno="602"><highlight class="normal"></highlight></codeline>
<codeline lineno="603"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mapping.local_port<sp/>=<sp/>port-&gt;local_port;</highlight></codeline>
<codeline lineno="604"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mapping.local_host<sp/>=<sp/>port-&gt;local_addr;</highlight></codeline>
<codeline lineno="605"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port-&gt;external_port<sp/>==<sp/>-1)</highlight></codeline>
<codeline lineno="606"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;external_port<sp/>=<sp/>rand()%(0xffff<sp/>-<sp/>1024)<sp/>+<sp/>1024;</highlight></codeline>
<codeline lineno="607"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mapping.remote_port<sp/>=<sp/>port-&gt;external_port;</highlight></codeline>
<codeline lineno="608"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mapping.remote_host<sp/>=<sp/></highlight><highlight class="stringliteral">&quot;&quot;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="609"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>snprintf(description,<sp/>128,<sp/></highlight><highlight class="stringliteral">&quot;%s<sp/>%s<sp/>at<sp/>%s:%d&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="610"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;Linphone&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="611"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(port-&gt;protocol<sp/>==<sp/>UPNP_IGD_IP_PROTOCOL_TCP)?<sp/></highlight><highlight class="stringliteral">&quot;TCP&quot;</highlight><highlight class="normal">:<sp/></highlight><highlight class="stringliteral">&quot;UDP&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="612"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;local_addr,<sp/>port-&gt;local_port);</highlight></codeline>
<codeline lineno="613"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mapping.description<sp/>=<sp/>description;</highlight></codeline>
<codeline lineno="614"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mapping.protocol<sp/>=<sp/>port-&gt;protocol;</highlight></codeline>
<codeline lineno="615"><highlight class="normal"></highlight></codeline>
<codeline lineno="616"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;retry++;</highlight></codeline>
<codeline lineno="617"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_log(ORTP_MESSAGE,<sp/></highlight><highlight class="stringliteral">&quot;Try<sp/>to<sp/>add<sp/>port<sp/>binding&quot;</highlight><highlight class="normal">,<sp/>port);</highlight></codeline>
<codeline lineno="618"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>upnp_igd_add_port_mapping(lupnp-&gt;upnp_igd_ctxt,<sp/>&amp;mapping);</highlight></codeline>
<codeline lineno="619"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="620"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(ret<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="621"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref>;</highlight></codeline>
<codeline lineno="622"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="623"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="624"><highlight class="normal">}</highlight></codeline>
<codeline lineno="625"><highlight class="normal"></highlight></codeline>
<codeline lineno="626"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>linphone_upnp_context_send_remove_port_binding(UpnpContext<sp/>*lupnp,<sp/>UpnpPortBinding<sp/>*port,<sp/>bool_t<sp/>retry)<sp/>{</highlight></codeline>
<codeline lineno="627"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>upnp_igd_port_mapping<sp/>mapping;</highlight></codeline>
<codeline lineno="628"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="629"><highlight class="normal"></highlight></codeline>
<codeline lineno="630"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;state<sp/>!=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>)<sp/>{</highlight></codeline>
<codeline lineno="631"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-2;</highlight></codeline>
<codeline lineno="632"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="633"><highlight class="normal"></highlight></codeline>
<codeline lineno="634"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Compute<sp/>port<sp/>binding<sp/>state</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="635"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port-&gt;state<sp/>!=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ad6371d3688d549a64096d796faf44822" kindref="member">LinphoneUpnpStateRemoving</ref>)<sp/>{</highlight></codeline>
<codeline lineno="636"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;to_add<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="637"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal">(port-&gt;state)<sp/>{</highlight></codeline>
<codeline lineno="638"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>:<sp/>{</highlight></codeline>
<codeline lineno="639"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;retry<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="640"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ad6371d3688d549a64096d796faf44822" kindref="member">LinphoneUpnpStateRemoving</ref>;</highlight></codeline>
<codeline lineno="641"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="642"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="643"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ae9de2eb7e97d1b5ab38c0e8ebb057ab3" kindref="member">LinphoneUpnpStateAdding</ref>:<sp/>{</highlight></codeline>
<codeline lineno="644"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;to_remove<sp/>=<sp/>TRUE;</highlight></codeline>
<codeline lineno="645"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="646"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="647"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="648"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="649"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="650"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="651"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="652"><highlight class="normal"></highlight></codeline>
<codeline lineno="653"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>No<sp/>retry<sp/>if<sp/>specified</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="654"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port-&gt;retry<sp/>!=<sp/>0<sp/>&amp;&amp;<sp/>!retry)<sp/>{</highlight></codeline>
<codeline lineno="655"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="656"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="657"><highlight class="normal"></highlight></codeline>
<codeline lineno="658"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port-&gt;retry<sp/>&gt;=<sp/>UPNP_REMOVE_MAX_RETRY)<sp/>{</highlight></codeline>
<codeline lineno="659"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="660"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="661"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_set_device_id(port,<sp/>upnp_igd_get_device_id(lupnp-&gt;upnp_igd_ctxt));</highlight></codeline>
<codeline lineno="662"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mapping.cookie<sp/>=<sp/>linphone_upnp_port_binding_retain(port);</highlight></codeline>
<codeline lineno="663"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;pending_bindings<sp/>=<sp/>ms_list_append(lupnp-&gt;pending_bindings,<sp/>mapping.cookie);</highlight></codeline>
<codeline lineno="664"><highlight class="normal"></highlight></codeline>
<codeline lineno="665"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mapping.remote_port<sp/>=<sp/>port-&gt;external_port;</highlight></codeline>
<codeline lineno="666"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mapping.remote_host<sp/>=<sp/></highlight><highlight class="stringliteral">&quot;&quot;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="667"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mapping.protocol<sp/>=<sp/>port-&gt;protocol;</highlight></codeline>
<codeline lineno="668"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;retry++;</highlight></codeline>
<codeline lineno="669"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_log(ORTP_MESSAGE,<sp/></highlight><highlight class="stringliteral">&quot;Try<sp/>to<sp/>remove<sp/>port<sp/>binding&quot;</highlight><highlight class="normal">,<sp/>port);</highlight></codeline>
<codeline lineno="670"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>upnp_igd_delete_port_mapping(lupnp-&gt;upnp_igd_ctxt,<sp/>&amp;mapping);</highlight></codeline>
<codeline lineno="671"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="672"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(ret<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="673"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref>;</highlight></codeline>
<codeline lineno="674"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="675"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="676"><highlight class="normal">}</highlight></codeline>
<codeline lineno="677"><highlight class="normal"></highlight></codeline>
<codeline lineno="678"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="679"><highlight class="comment"><sp/>*<sp/>uPnP<sp/>Core<sp/>interfaces</highlight></codeline>
<codeline lineno="680"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="681"><highlight class="normal"></highlight></codeline>
<codeline lineno="682"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>linphone_core_update_upnp_audio_video(<ref refid="group__call__control_1gac0a4861d7c4702c64f7106f2b893c69e" kindref="member">LinphoneCall</ref><sp/>*call,<sp/>bool_t<sp/>audio,<sp/>bool_t<sp/>video)<sp/>{</highlight></codeline>
<codeline lineno="683"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__initializing_1gaa5cf635b82dd338e7ee2dd3599d05f0a" kindref="member">LinphoneCore</ref><sp/>*lc<sp/>=<sp/>call-&gt;core;</highlight></codeline>
<codeline lineno="684"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpContext<sp/>*lupnp<sp/>=<sp/>lc-&gt;upnp;</highlight></codeline>
<codeline lineno="685"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="686"><highlight class="normal"></highlight></codeline>
<codeline lineno="687"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="688"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="689"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="690"><highlight class="normal"></highlight></codeline>
<codeline lineno="691"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_lock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="692"><highlight class="normal"></highlight></codeline>
<codeline lineno="693"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Don&apos;t<sp/>handle<sp/>when<sp/>the<sp/>call</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="694"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref><sp/>&amp;&amp;<sp/>call-&gt;upnp_session<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="695"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="696"><highlight class="normal"></highlight></codeline>
<codeline lineno="697"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="698"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>Audio<sp/>part</highlight></codeline>
<codeline lineno="699"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="700"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_update_port_binding(lupnp,<sp/>&amp;call-&gt;upnp_session-&gt;audio-&gt;rtp,</highlight></codeline>
<codeline lineno="701"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UPNP_IGD_IP_PROTOCOL_UDP,<sp/>(audio)?<sp/>call-&gt;media_ports[call-&gt;main_audio_stream_index].rtp_port:0,<sp/>UPNP_CALL_RETRY_DELAY);</highlight></codeline>
<codeline lineno="702"><highlight class="normal"></highlight></codeline>
<codeline lineno="703"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_update_port_binding(lupnp,<sp/>&amp;call-&gt;upnp_session-&gt;audio-&gt;rtcp,</highlight></codeline>
<codeline lineno="704"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UPNP_IGD_IP_PROTOCOL_UDP,<sp/>(audio)?<sp/>call-&gt;media_ports[call-&gt;main_audio_stream_index].rtcp_port:0,<sp/>UPNP_CALL_RETRY_DELAY);</highlight></codeline>
<codeline lineno="705"><highlight class="normal"></highlight></codeline>
<codeline lineno="706"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="707"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>Video<sp/>part</highlight></codeline>
<codeline lineno="708"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="709"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_update_port_binding(lupnp,<sp/>&amp;call-&gt;upnp_session-&gt;video-&gt;rtp,</highlight></codeline>
<codeline lineno="710"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UPNP_IGD_IP_PROTOCOL_UDP,<sp/>(video)?<sp/>call-&gt;media_ports[call-&gt;main_video_stream_index].rtp_port:0,<sp/>UPNP_CALL_RETRY_DELAY);</highlight></codeline>
<codeline lineno="711"><highlight class="normal"></highlight></codeline>
<codeline lineno="712"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_update_port_binding(lupnp,<sp/>&amp;call-&gt;upnp_session-&gt;video-&gt;rtcp,</highlight></codeline>
<codeline lineno="713"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UPNP_IGD_IP_PROTOCOL_UDP,<sp/>(video)?<sp/>call-&gt;media_ports[call-&gt;main_video_stream_index].rtcp_port:0,<sp/>UPNP_CALL_RETRY_DELAY);</highlight></codeline>
<codeline lineno="714"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="715"><highlight class="normal"></highlight></codeline>
<codeline lineno="716"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_unlock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="717"><highlight class="normal"></highlight></codeline>
<codeline lineno="718"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="719"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>Update<sp/>uPnP<sp/>call<sp/>state</highlight></codeline>
<codeline lineno="720"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="721"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_call_process(call);</highlight></codeline>
<codeline lineno="722"><highlight class="normal"></highlight></codeline>
<codeline lineno="723"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="724"><highlight class="normal">}</highlight></codeline>
<codeline lineno="725"><highlight class="normal"></highlight></codeline>
<codeline lineno="726"><highlight class="normal"></highlight></codeline>
<codeline lineno="727"><highlight class="normal"></highlight></codeline>
<codeline lineno="728"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>linphone_core_update_upnp_from_remote_media_description(<ref refid="group__call__control_1gac0a4861d7c4702c64f7106f2b893c69e" kindref="member">LinphoneCall</ref><sp/>*call,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>SalMediaDescription<sp/>*md)<sp/>{</highlight></codeline>
<codeline lineno="729"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>bool_t<sp/>audio<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="730"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>bool_t<sp/>video<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="731"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="732"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>SalStreamDescription<sp/>*stream;</highlight></codeline>
<codeline lineno="733"><highlight class="normal"></highlight></codeline>
<codeline lineno="734"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>SAL_MEDIA_DESCRIPTION_MAX_STREAMS;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="735"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>stream<sp/>=<sp/>&amp;md-&gt;streams[i];</highlight></codeline>
<codeline lineno="736"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!sal_stream_description_active(stream))<sp/></highlight><highlight class="keywordflow">continue</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="737"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(stream-&gt;type<sp/>==<sp/>SalAudio)<sp/>{</highlight></codeline>
<codeline lineno="738"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>audio<sp/>=<sp/>TRUE;</highlight></codeline>
<codeline lineno="739"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(stream-&gt;type<sp/>==<sp/>SalVideo)<sp/>{</highlight></codeline>
<codeline lineno="740"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>video<sp/>=<sp/>TRUE;</highlight></codeline>
<codeline lineno="741"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="742"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="743"><highlight class="normal"></highlight></codeline>
<codeline lineno="744"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>linphone_core_update_upnp_audio_video(call,<sp/>audio,<sp/>video);</highlight></codeline>
<codeline lineno="745"><highlight class="normal">}</highlight></codeline>
<codeline lineno="746"><highlight class="normal"></highlight></codeline>
<codeline lineno="747"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>linphone_core_update_upnp(<ref refid="group__initializing_1gaa5cf635b82dd338e7ee2dd3599d05f0a" kindref="member">LinphoneCore</ref><sp/>*lc,<sp/><ref refid="group__call__control_1gac0a4861d7c4702c64f7106f2b893c69e" kindref="member">LinphoneCall</ref><sp/>*call)<sp/>{</highlight></codeline>
<codeline lineno="748"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>linphone_core_update_upnp_audio_video(call,<sp/>call-&gt;audiostream!=NULL,<sp/>call-&gt;videostream!=NULL);</highlight></codeline>
<codeline lineno="749"><highlight class="normal">}</highlight></codeline>
<codeline lineno="750"><highlight class="normal"></highlight></codeline>
<codeline lineno="751"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_core_update_upnp_state_in_call_stats(<ref refid="group__call__control_1gac0a4861d7c4702c64f7106f2b893c69e" kindref="member">LinphoneCall</ref><sp/>*call)<sp/>{</highlight></codeline>
<codeline lineno="752"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>call-&gt;stats[LINPHONE_CALL_STATS_AUDIO].upnp_state<sp/>=<sp/>call-&gt;upnp_session-&gt;audio-&gt;state;</highlight></codeline>
<codeline lineno="753"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>call-&gt;stats[LINPHONE_CALL_STATS_VIDEO].upnp_state<sp/>=<sp/>call-&gt;upnp_session-&gt;video-&gt;state;</highlight></codeline>
<codeline lineno="754"><highlight class="normal">}</highlight></codeline>
<codeline lineno="755"><highlight class="normal"></highlight></codeline>
<codeline lineno="756"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_update_stream_state(UpnpStream<sp/>*stream)<sp/>{</highlight></codeline>
<codeline lineno="757"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">((stream-&gt;rtp<sp/>==<sp/>NULL<sp/>||<sp/>stream-&gt;rtp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref><sp/>||<sp/>stream-&gt;rtp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ac0c60c390f5cd5a27a538aea39def28b" kindref="member">LinphoneUpnpStateIdle</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="758"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(stream-&gt;rtcp<sp/>==<sp/>NULL<sp/>||<sp/>stream-&gt;rtcp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref><sp/>||<sp/>stream-&gt;rtcp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ac0c60c390f5cd5a27a538aea39def28b" kindref="member">LinphoneUpnpStateIdle</ref>))<sp/>{</highlight></codeline>
<codeline lineno="759"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>stream-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>;</highlight></codeline>
<codeline lineno="760"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">((stream-&gt;rtp<sp/>!=<sp/>NULL<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="761"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(stream-&gt;rtp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ae9de2eb7e97d1b5ab38c0e8ebb057ab3" kindref="member">LinphoneUpnpStateAdding</ref><sp/>||<sp/>stream-&gt;rtp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ad6371d3688d549a64096d796faf44822" kindref="member">LinphoneUpnpStateRemoving</ref>))<sp/>||</highlight></codeline>
<codeline lineno="762"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(stream-&gt;rtcp<sp/>!=<sp/>NULL<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="763"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(stream-&gt;rtcp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ae9de2eb7e97d1b5ab38c0e8ebb057ab3" kindref="member">LinphoneUpnpStateAdding</ref><sp/>||<sp/>stream-&gt;rtcp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ad6371d3688d549a64096d796faf44822" kindref="member">LinphoneUpnpStateRemoving</ref>)))<sp/>{</highlight></codeline>
<codeline lineno="764"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>stream-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490adb2fdfe2a5346472b0faa631c3c01f2e" kindref="member">LinphoneUpnpStatePending</ref>;</highlight></codeline>
<codeline lineno="765"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">((stream-&gt;rtp<sp/>!=<sp/>NULL<sp/>&amp;&amp;<sp/>stream-&gt;rtp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref>)<sp/>||</highlight></codeline>
<codeline lineno="766"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(stream-&gt;rtcp<sp/>!=<sp/>NULL<sp/>&amp;&amp;<sp/>stream-&gt;rtcp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref>))<sp/>{</highlight></codeline>
<codeline lineno="767"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>stream-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref>;</highlight></codeline>
<codeline lineno="768"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="769"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_error(</highlight><highlight class="stringliteral">&quot;Invalid<sp/>stream<sp/>%p<sp/>state&quot;</highlight><highlight class="normal">,<sp/>stream);</highlight></codeline>
<codeline lineno="770"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="771"><highlight class="normal">}</highlight></codeline>
<codeline lineno="772"><highlight class="normal"></highlight></codeline>
<codeline lineno="773"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>linphone_upnp_call_process(<ref refid="group__call__control_1gac0a4861d7c4702c64f7106f2b893c69e" kindref="member">LinphoneCall</ref><sp/>*call)<sp/>{</highlight></codeline>
<codeline lineno="774"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__initializing_1gaa5cf635b82dd338e7ee2dd3599d05f0a" kindref="member">LinphoneCore</ref><sp/>*lc<sp/>=<sp/>call-&gt;core;</highlight></codeline>
<codeline lineno="775"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpContext<sp/>*lupnp<sp/>=<sp/>lc-&gt;upnp;</highlight></codeline>
<codeline lineno="776"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="777"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__initializing_1ga2c19554a0988f7600aec5c3a7588d61a" kindref="member">LinphoneUpnpState</ref><sp/>oldState<sp/>=<sp/>0,<sp/>newState<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="778"><highlight class="normal"></highlight></codeline>
<codeline lineno="779"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="780"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="781"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="782"><highlight class="normal"></highlight></codeline>
<codeline lineno="783"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_lock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="784"><highlight class="normal"></highlight></codeline>
<codeline lineno="785"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Don&apos;t<sp/>handle<sp/>when<sp/>the<sp/>call</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="786"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref><sp/>&amp;&amp;<sp/>call-&gt;upnp_session<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="787"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="788"><highlight class="normal"></highlight></codeline>
<codeline lineno="789"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="790"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>Update<sp/>Audio<sp/>state</highlight></codeline>
<codeline lineno="791"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="792"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_update_stream_state(call-&gt;upnp_session-&gt;audio);</highlight></codeline>
<codeline lineno="793"><highlight class="normal"></highlight></codeline>
<codeline lineno="794"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="795"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>Update<sp/>Video<sp/>state</highlight></codeline>
<codeline lineno="796"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="797"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_update_stream_state(call-&gt;upnp_session-&gt;video);</highlight></codeline>
<codeline lineno="798"><highlight class="normal"></highlight></codeline>
<codeline lineno="799"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="800"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>Update<sp/>stat</highlight></codeline>
<codeline lineno="801"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="802"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_core_update_upnp_state_in_call_stats(call);</highlight></codeline>
<codeline lineno="803"><highlight class="normal"></highlight></codeline>
<codeline lineno="804"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="805"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>Update<sp/>session<sp/>state</highlight></codeline>
<codeline lineno="806"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="807"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>oldState<sp/>=<sp/>call-&gt;upnp_session-&gt;state;</highlight></codeline>
<codeline lineno="808"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(call-&gt;upnp_session-&gt;audio-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref><sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="809"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>call-&gt;upnp_session-&gt;video-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>)<sp/>{</highlight></codeline>
<codeline lineno="810"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>call-&gt;upnp_session-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>;</highlight></codeline>
<codeline lineno="811"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(call-&gt;upnp_session-&gt;audio-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490adb2fdfe2a5346472b0faa631c3c01f2e" kindref="member">LinphoneUpnpStatePending</ref><sp/>||</highlight></codeline>
<codeline lineno="812"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>call-&gt;upnp_session-&gt;video-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490adb2fdfe2a5346472b0faa631c3c01f2e" kindref="member">LinphoneUpnpStatePending</ref>)<sp/>{</highlight></codeline>
<codeline lineno="813"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>call-&gt;upnp_session-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490adb2fdfe2a5346472b0faa631c3c01f2e" kindref="member">LinphoneUpnpStatePending</ref>;</highlight></codeline>
<codeline lineno="814"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(call-&gt;upnp_session-&gt;audio-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref><sp/>||</highlight></codeline>
<codeline lineno="815"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>call-&gt;upnp_session-&gt;video-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref>)<sp/>{</highlight></codeline>
<codeline lineno="816"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>call-&gt;upnp_session-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref>;</highlight></codeline>
<codeline lineno="817"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="818"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>call-&gt;upnp_session-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ac0c60c390f5cd5a27a538aea39def28b" kindref="member">LinphoneUpnpStateIdle</ref>;</highlight></codeline>
<codeline lineno="819"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="820"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>newState<sp/>=<sp/>call-&gt;upnp_session-&gt;state;</highlight></codeline>
<codeline lineno="821"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="822"><highlight class="normal"></highlight></codeline>
<codeline lineno="823"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_unlock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="824"><highlight class="normal"></highlight></codeline>
<codeline lineno="825"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>When<sp/>change<sp/>is<sp/>done<sp/>proceed<sp/>update<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="826"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(oldState<sp/>!=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref><sp/>&amp;&amp;<sp/>oldState<sp/>!=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref><sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="827"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(newState<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref><sp/>||<sp/>newState<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref>))<sp/>{</highlight></codeline>
<codeline lineno="828"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(call-&gt;upnp_session-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>)</highlight></codeline>
<codeline lineno="829"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_message(</highlight><highlight class="stringliteral">&quot;uPnP<sp/>IGD:<sp/>uPnP<sp/>for<sp/>Call<sp/>%p<sp/>is<sp/>ok&quot;</highlight><highlight class="normal">,<sp/>call);</highlight></codeline>
<codeline lineno="830"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="831"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_message(</highlight><highlight class="stringliteral">&quot;uPnP<sp/>IGD:<sp/>uPnP<sp/>for<sp/>Call<sp/>%p<sp/>is<sp/>ko&quot;</highlight><highlight class="normal">,<sp/>call);</highlight></codeline>
<codeline lineno="832"><highlight class="normal"></highlight></codeline>
<codeline lineno="833"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(call-&gt;state)<sp/>{</highlight></codeline>
<codeline lineno="834"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__call__control_1ggafc310fd9ba742f7730c632fd72b875eaa29a21291bee6ab53a5595c1d3aaf8bde" kindref="member">LinphoneCallUpdating</ref>:</highlight></codeline>
<codeline lineno="835"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_core_start_update_call(lc,<sp/>call);</highlight></codeline>
<codeline lineno="836"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="837"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__call__control_1ggafc310fd9ba742f7730c632fd72b875eaad51ee049c7dee729776ef5bc76ddb2c2" kindref="member">LinphoneCallUpdatedByRemote</ref>:</highlight></codeline>
<codeline lineno="838"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_core_start_accept_call_update(lc,<sp/>call,call-&gt;prevstate,linphone_call_state_to_string(call-&gt;prevstate));</highlight></codeline>
<codeline lineno="839"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="840"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__call__control_1ggafc310fd9ba742f7730c632fd72b875eaae99727dfb0a8e30ef04ff96ce3bf7e36" kindref="member">LinphoneCallOutgoingInit</ref>:</highlight></codeline>
<codeline lineno="841"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_core_proceed_with_invite_if_ready(lc,<sp/>call,<sp/>NULL);</highlight></codeline>
<codeline lineno="842"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="843"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__call__control_1ggafc310fd9ba742f7730c632fd72b875eaa0148699614584db8dbbd7f2af177af39" kindref="member">LinphoneCallIdle</ref>:</highlight></codeline>
<codeline lineno="844"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_call_update_local_media_description_from_ice_or_upnp(call);</highlight></codeline>
<codeline lineno="845"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sal_call_set_local_media_description(call-&gt;op,call-&gt;localdesc);</highlight></codeline>
<codeline lineno="846"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_core_notify_incoming_call(lc,<sp/>call);</highlight></codeline>
<codeline lineno="847"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="848"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="849"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="850"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="851"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="852"><highlight class="normal"></highlight></codeline>
<codeline lineno="853"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="854"><highlight class="normal">}</highlight></codeline>
<codeline lineno="855"><highlight class="normal"></highlight></codeline>
<codeline lineno="856"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*linphone_core_upnp_get_charptr_null(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*str)<sp/>{</highlight></codeline>
<codeline lineno="857"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(str<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="858"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>str;</highlight></codeline>
<codeline lineno="859"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="860"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/></highlight><highlight class="stringliteral">&quot;(Null)&quot;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="861"><highlight class="normal">}</highlight></codeline>
<codeline lineno="862"><highlight class="normal"></highlight></codeline>
<codeline lineno="863"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_update(UpnpContext<sp/>*lupnp)<sp/>{</highlight></codeline>
<codeline lineno="864"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>MSList<sp/>*global_list<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="865"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>MSList<sp/>*list<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="866"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>MSList<sp/>*item;</highlight></codeline>
<codeline lineno="867"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__call__control_1gac0a4861d7c4702c64f7106f2b893c69e" kindref="member">LinphoneCall</ref><sp/>*call;</highlight></codeline>
<codeline lineno="868"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*port_mapping,<sp/>*port_mapping2;</highlight></codeline>
<codeline lineno="869"><highlight class="normal"></highlight></codeline>
<codeline lineno="870"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_message(</highlight><highlight class="stringliteral">&quot;uPnP<sp/>IGD:<sp/>Name:%s&quot;</highlight><highlight class="normal">,<sp/>linphone_core_upnp_get_charptr_null(upnp_igd_get_device_name(lupnp-&gt;upnp_igd_ctxt)));</highlight></codeline>
<codeline lineno="871"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_message(</highlight><highlight class="stringliteral">&quot;uPnP<sp/>IGD:<sp/>Device:%s<sp/>%s&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="872"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_core_upnp_get_charptr_null(upnp_igd_get_device_model_name(lupnp-&gt;upnp_igd_ctxt)),</highlight></codeline>
<codeline lineno="873"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_core_upnp_get_charptr_null(upnp_igd_get_device_model_number(lupnp-&gt;upnp_igd_ctxt)));</highlight></codeline>
<codeline lineno="874"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_message(</highlight><highlight class="stringliteral">&quot;uPnP<sp/>IGD:<sp/>Refresh<sp/>mappings&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="875"><highlight class="normal"></highlight></codeline>
<codeline lineno="876"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_udp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="877"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>global_list<sp/>=<sp/>ms_list_append(global_list,<sp/>lupnp-&gt;sip_udp);</highlight></codeline>
<codeline lineno="878"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="879"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_tcp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="880"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>global_list<sp/>=<sp/>ms_list_append(global_list,<sp/>lupnp-&gt;sip_tcp);</highlight></codeline>
<codeline lineno="881"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="882"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;sip_tls<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="883"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>global_list<sp/>=<sp/>ms_list_append(global_list,<sp/>lupnp-&gt;sip_tls);</highlight></codeline>
<codeline lineno="884"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="885"><highlight class="normal"></highlight></codeline>
<codeline lineno="886"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list<sp/>=<sp/>lupnp-&gt;lc-&gt;calls;</highlight></codeline>
<codeline lineno="887"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal">(list<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="888"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>call<sp/>=<sp/>(<ref refid="group__call__control_1gac0a4861d7c4702c64f7106f2b893c69e" kindref="member">LinphoneCall</ref><sp/>*)list-&gt;data;</highlight></codeline>
<codeline lineno="889"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(call-&gt;upnp_session<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="890"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(call-&gt;upnp_session-&gt;audio-&gt;rtp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="891"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>global_list<sp/>=<sp/>ms_list_append(global_list,<sp/>call-&gt;upnp_session-&gt;audio-&gt;rtp);</highlight></codeline>
<codeline lineno="892"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="893"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(call-&gt;upnp_session-&gt;audio-&gt;rtcp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="894"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>global_list<sp/>=<sp/>ms_list_append(global_list,<sp/>call-&gt;upnp_session-&gt;audio-&gt;rtcp);</highlight></codeline>
<codeline lineno="895"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="896"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(call-&gt;upnp_session-&gt;video-&gt;rtp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="897"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>global_list<sp/>=<sp/>ms_list_append(global_list,<sp/>call-&gt;upnp_session-&gt;video-&gt;rtp);</highlight></codeline>
<codeline lineno="898"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="899"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(call-&gt;upnp_session-&gt;video-&gt;rtcp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="900"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>global_list<sp/>=<sp/>ms_list_append(global_list,<sp/>call-&gt;upnp_session-&gt;video-&gt;rtcp);</highlight></codeline>
<codeline lineno="901"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="902"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="903"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list<sp/>=<sp/>list-&gt;next;</highlight></codeline>
<codeline lineno="904"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="905"><highlight class="normal"></highlight></codeline>
<codeline lineno="906"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list<sp/>=<sp/>linphone_upnp_config_list_port_bindings(lupnp-&gt;lc-&gt;config,<sp/>upnp_igd_get_device_id(lupnp-&gt;upnp_igd_ctxt));</highlight></codeline>
<codeline lineno="907"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(item<sp/>=<sp/>list;item<sp/>!=<sp/>NULL;<sp/>item<sp/>=<sp/>item-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="908"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping<sp/>=<sp/>(UpnpPortBinding<sp/>*)item-&gt;data;</highlight></codeline>
<codeline lineno="909"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping2<sp/>=<sp/>linphone_upnp_port_binding_equivalent_in_list(global_list,<sp/>port_mapping);</highlight></codeline>
<codeline lineno="910"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port_mapping2<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="911"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_context_send_remove_port_binding(lupnp,<sp/>port_mapping,<sp/>TRUE);</highlight></codeline>
<codeline lineno="912"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port_mapping2-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ac0c60c390f5cd5a27a538aea39def28b" kindref="member">LinphoneUpnpStateIdle</ref>){</highlight></codeline>
<codeline lineno="913"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Force<sp/>to<sp/>remove<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="914"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping2-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>;</highlight></codeline>
<codeline lineno="915"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="916"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="917"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_list_for_each(list,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>(*)(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*))linphone_upnp_port_binding_release);</highlight></codeline>
<codeline lineno="918"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list<sp/>=<sp/>ms_list_free(list);</highlight></codeline>
<codeline lineno="919"><highlight class="normal"></highlight></codeline>
<codeline lineno="920"><highlight class="normal"></highlight></codeline>
<codeline lineno="921"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>(Re)Add<sp/>removed<sp/>port<sp/>bindings</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="922"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list<sp/>=<sp/>global_list;</highlight></codeline>
<codeline lineno="923"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal">(list<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="924"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping<sp/>=<sp/>(UpnpPortBinding<sp/>*)list-&gt;data;</highlight></codeline>
<codeline lineno="925"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_context_send_remove_port_binding(lupnp,<sp/>port_mapping,<sp/>TRUE);</highlight></codeline>
<codeline lineno="926"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_context_send_add_port_binding(lupnp,<sp/>port_mapping,<sp/>TRUE);</highlight></codeline>
<codeline lineno="927"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list<sp/>=<sp/>list-&gt;next;</highlight></codeline>
<codeline lineno="928"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="929"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>global_list<sp/>=<sp/>ms_list_free(global_list);</highlight></codeline>
<codeline lineno="930"><highlight class="normal">}</highlight></codeline>
<codeline lineno="931"><highlight class="normal"></highlight></codeline>
<codeline lineno="932"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_update_port_binding(UpnpContext<sp/>*lupnp,<sp/>UpnpPortBinding<sp/>**port_mapping,<sp/>upnp_igd_ip_protocol<sp/>protocol,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>port,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>retry_delay)<sp/>{</highlight></codeline>
<codeline lineno="933"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*local_addr,<sp/>*external_addr;</highlight></codeline>
<codeline lineno="934"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>time_t<sp/>now<sp/>=<sp/>time(NULL);</highlight></codeline>
<codeline lineno="935"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="936"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(*port_mapping<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="937"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port<sp/>!=<sp/>(*port_mapping)-&gt;local_port)<sp/>{</highlight></codeline>
<codeline lineno="938"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_context_send_remove_port_binding(lupnp,<sp/>*port_mapping,<sp/>FALSE);</highlight></codeline>
<codeline lineno="939"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*port_mapping<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="940"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="941"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="942"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(*port_mapping<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="943"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*port_mapping<sp/>=<sp/>linphone_upnp_port_binding_new_or_collect(lupnp-&gt;pending_bindings,<sp/>protocol,<sp/>port,<sp/>port);</highlight></codeline>
<codeline lineno="944"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="945"><highlight class="normal"></highlight></codeline>
<codeline lineno="946"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Get<sp/>addresses</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="947"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>local_addr<sp/>=<sp/>upnp_igd_get_local_ipaddress(lupnp-&gt;upnp_igd_ctxt);</highlight></codeline>
<codeline lineno="948"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>external_addr<sp/>=<sp/>upnp_igd_get_external_ipaddress(lupnp-&gt;upnp_igd_ctxt);</highlight></codeline>
<codeline lineno="949"><highlight class="normal"></highlight></codeline>
<codeline lineno="950"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Force<sp/>binding<sp/>update<sp/>on<sp/>local<sp/>address<sp/>change</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="951"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(local_addr<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="952"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(strncmp((*port_mapping)-&gt;local_addr,<sp/>local_addr,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">((*port_mapping)-&gt;local_addr)))<sp/>{</highlight></codeline>
<codeline lineno="953"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_context_send_remove_port_binding(lupnp,<sp/>*port_mapping,<sp/>FALSE);</highlight></codeline>
<codeline lineno="954"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>strncpy((*port_mapping)-&gt;local_addr,<sp/>local_addr,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">((*port_mapping)-&gt;local_addr));</highlight></codeline>
<codeline lineno="955"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="956"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="957"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(external_addr<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="958"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>strncpy((*port_mapping)-&gt;external_addr,<sp/>external_addr,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">((*port_mapping)-&gt;external_addr));</highlight></codeline>
<codeline lineno="959"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="960"><highlight class="normal"></highlight></codeline>
<codeline lineno="961"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Add<sp/>(if<sp/>not<sp/>already<sp/>done)<sp/>the<sp/>binding</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="962"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(now<sp/>-<sp/>(*port_mapping)-&gt;last_update<sp/>&gt;=<sp/>retry_delay)<sp/>{</highlight></codeline>
<codeline lineno="963"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(*port_mapping)-&gt;last_update<sp/>=<sp/>now;</highlight></codeline>
<codeline lineno="964"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_context_send_add_port_binding(lupnp,<sp/>*port_mapping,<sp/>FALSE);</highlight></codeline>
<codeline lineno="965"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="966"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="967"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(*port_mapping<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="968"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_context_send_remove_port_binding(lupnp,<sp/>*port_mapping,<sp/>FALSE);</highlight></codeline>
<codeline lineno="969"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*port_mapping<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="970"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="971"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="972"><highlight class="normal">}</highlight></codeline>
<codeline lineno="973"><highlight class="normal"></highlight></codeline>
<codeline lineno="974"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_update_config(UpnpContext*<sp/>lupnp)<sp/>{</highlight></codeline>
<codeline lineno="975"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>key[64];</highlight></codeline>
<codeline lineno="976"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>MSList<sp/>*item;</highlight></codeline>
<codeline lineno="977"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*port_mapping;</highlight></codeline>
<codeline lineno="978"><highlight class="normal"></highlight></codeline>
<codeline lineno="979"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Add<sp/>configs<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="980"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(item<sp/>=<sp/>lupnp-&gt;adding_configs;item!=NULL;item=item-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="981"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping<sp/>=<sp/>(UpnpPortBinding<sp/>*)item-&gt;data;</highlight></codeline>
<codeline lineno="982"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>snprintf(key,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(key),<sp/></highlight><highlight class="stringliteral">&quot;%s-%s-%d-%d&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="983"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping-&gt;device_id,</highlight></codeline>
<codeline lineno="984"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(port_mapping-&gt;protocol<sp/>==<sp/>UPNP_IGD_IP_PROTOCOL_TCP)?<sp/></highlight><highlight class="stringliteral">&quot;TCP&quot;</highlight><highlight class="normal">:</highlight><highlight class="stringliteral">&quot;UDP&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="985"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping-&gt;external_port,</highlight></codeline>
<codeline lineno="986"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping-&gt;local_port);</highlight></codeline>
<codeline lineno="987"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__misc_1ga2b9f058c7b12d124be96149100d9b079" kindref="member">lp_config_set_string</ref>(lupnp-&gt;lc-&gt;config,<sp/>UPNP_SECTION_NAME,<sp/>key,<sp/></highlight><highlight class="stringliteral">&quot;uPnP&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="988"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_log(ORTP_DEBUG,<sp/></highlight><highlight class="stringliteral">&quot;Configuration:<sp/>Added<sp/>port<sp/>binding&quot;</highlight><highlight class="normal">,<sp/>port_mapping);</highlight></codeline>
<codeline lineno="989"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="990"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_list_for_each(lupnp-&gt;adding_configs,(void<sp/>(*)(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*))linphone_upnp_port_binding_release);</highlight></codeline>
<codeline lineno="991"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;adding_configs<sp/>=<sp/>ms_list_free(lupnp-&gt;adding_configs);</highlight></codeline>
<codeline lineno="992"><highlight class="normal"></highlight></codeline>
<codeline lineno="993"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Remove<sp/>configs<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="994"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(item<sp/>=<sp/>lupnp-&gt;removing_configs;item!=NULL;item=item-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="995"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping<sp/>=<sp/>(UpnpPortBinding<sp/>*)item-&gt;data;</highlight></codeline>
<codeline lineno="996"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>snprintf(key,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(key),<sp/></highlight><highlight class="stringliteral">&quot;%s-%s-%d-%d&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="997"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping-&gt;device_id,</highlight></codeline>
<codeline lineno="998"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(port_mapping-&gt;protocol<sp/>==<sp/>UPNP_IGD_IP_PROTOCOL_TCP)?<sp/></highlight><highlight class="stringliteral">&quot;TCP&quot;</highlight><highlight class="normal">:</highlight><highlight class="stringliteral">&quot;UDP&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="999"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping-&gt;external_port,</highlight></codeline>
<codeline lineno="1000"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping-&gt;local_port);</highlight></codeline>
<codeline lineno="1001"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__misc_1ga2b9f058c7b12d124be96149100d9b079" kindref="member">lp_config_set_string</ref>(lupnp-&gt;lc-&gt;config,<sp/>UPNP_SECTION_NAME,<sp/>key,<sp/>NULL);</highlight></codeline>
<codeline lineno="1002"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_log(ORTP_DEBUG,<sp/></highlight><highlight class="stringliteral">&quot;Configuration:<sp/>Removed<sp/>port<sp/>binding&quot;</highlight><highlight class="normal">,<sp/>port_mapping);</highlight></codeline>
<codeline lineno="1003"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1004"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_list_for_each(lupnp-&gt;removing_configs,(void<sp/>(*)(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*))linphone_upnp_port_binding_release);</highlight></codeline>
<codeline lineno="1005"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;removing_configs<sp/>=<sp/>ms_list_free(lupnp-&gt;removing_configs);</highlight></codeline>
<codeline lineno="1006"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1007"><highlight class="normal"></highlight></codeline>
<codeline lineno="1008"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_update_proxy(UpnpContext*<sp/>lupnp,<sp/>bool_t<sp/>force)<sp/>{</highlight></codeline>
<codeline lineno="1009"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__initializing_1ga2c19554a0988f7600aec5c3a7588d61a" kindref="member">LinphoneUpnpState</ref><sp/>ready_state;</highlight></codeline>
<codeline lineno="1010"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>MSList<sp/>*item;</highlight></codeline>
<codeline lineno="1011"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>time_t<sp/>now<sp/>=<sp/>(force)?<sp/>(lupnp-&gt;last_ready_check<sp/>+<sp/>UPNP_CORE_READY_CHECK)<sp/>:<sp/>time(NULL);</highlight></codeline>
<codeline lineno="1012"><highlight class="normal"></highlight></codeline>
<codeline lineno="1013"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Refresh<sp/>registers<sp/>if<sp/>we<sp/>are<sp/>ready<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1014"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(now<sp/>-<sp/>lupnp-&gt;last_ready_check<sp/>&gt;=<sp/>UPNP_CORE_READY_CHECK)<sp/>{</highlight></codeline>
<codeline lineno="1015"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;last_ready_check<sp/>=<sp/>now;</highlight></codeline>
<codeline lineno="1016"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ready_state<sp/>=<sp/>(_linphone_upnp_context_is_ready_for_register(lupnp))?<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>:<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref>;</highlight></codeline>
<codeline lineno="1017"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(ready_state<sp/>!=<sp/>lupnp-&gt;last_ready_state)<sp/>{</highlight></codeline>
<codeline lineno="1018"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(item=<ref refid="group__proxies_1gad167a93dd8d6b6fa9b9d36c9ce7cc3fc" kindref="member">linphone_core_get_proxy_config_list</ref>(lupnp-&gt;lc);item!=NULL;item=item-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="1019"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__proxies_1ga1879a0d59e068457b688138da97f2d0b" kindref="member">LinphoneProxyConfig</ref><sp/>*cfg=(<ref refid="group__proxies_1ga1879a0d59e068457b688138da97f2d0b" kindref="member">LinphoneProxyConfig</ref>*)item-&gt;data;</highlight></codeline>
<codeline lineno="1020"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>if<sp/>(<ref refid="group__proxies_1ga0b8cd45acee99fda4a8273f159f9db51" kindref="member">linphone_proxy_config_register_enabled</ref>(cfg))<sp/>{</highlight></codeline>
<codeline lineno="1021"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ready_state<sp/>!=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1022"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Only<sp/>reset<sp/>ithe<sp/>registration<sp/>if<sp/>we<sp/>require<sp/>that<sp/>upnp<sp/>should<sp/>be<sp/>ok</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1023"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;lc-&gt;sip_conf.register_only_when_upnp_is_ok)<sp/>{</highlight></codeline>
<codeline lineno="1024"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_proxy_config_set_state(cfg,<sp/><ref refid="group__proxies_1ggaea1b64a739b1faf0b490fe0f52cfe65ea07341285f0270fe6e3b1e21949725d54" kindref="member">LinphoneRegistrationNone</ref>,<sp/></highlight><highlight class="stringliteral">&quot;Registration<sp/>impossible<sp/>(uPnP<sp/>not<sp/>ready)&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="1025"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1026"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cfg-&gt;commit=TRUE;</highlight></codeline>
<codeline lineno="1027"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1028"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1029"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cfg-&gt;commit=TRUE;</highlight></codeline>
<codeline lineno="1030"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1031"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1032"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1033"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;last_ready_state<sp/>=<sp/>ready_state;</highlight></codeline>
<codeline lineno="1034"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1035"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1036"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1037"><highlight class="normal"></highlight></codeline>
<codeline lineno="1038"><highlight class="normal">bool_t<sp/>linphone_core_upnp_hook(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*data)<sp/>{</highlight></codeline>
<codeline lineno="1039"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="struct__LCSipTransports" kindref="compound">LCSipTransports</ref><sp/>transport;</highlight></codeline>
<codeline lineno="1040"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpContext<sp/>*lupnp<sp/>=<sp/>(UpnpContext<sp/>*)data;</highlight></codeline>
<codeline lineno="1041"><highlight class="normal"></highlight></codeline>
<codeline lineno="1042"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_lock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="1043"><highlight class="normal"></highlight></codeline>
<codeline lineno="1044"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Update<sp/>ports<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1045"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lupnp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1046"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__network__parameters_1gaf13b4063c40e63acd25a5cc52f486842" kindref="member">linphone_core_get_sip_transports</ref>(lupnp-&gt;lc,<sp/>&amp;transport);</highlight></codeline>
<codeline lineno="1047"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_update_port_binding(lupnp,<sp/>&amp;lupnp-&gt;sip_udp,<sp/>UPNP_IGD_IP_PROTOCOL_UDP,<sp/>transport.<ref refid="struct__LCSipTransports_1a07ac7c1bcadb37cd529891388c89a7fb" kindref="member">udp_port</ref>,<sp/>UPNP_CORE_RETRY_DELAY);</highlight></codeline>
<codeline lineno="1048"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_update_port_binding(lupnp,<sp/>&amp;lupnp-&gt;sip_tcp,<sp/>UPNP_IGD_IP_PROTOCOL_TCP,<sp/>transport.<ref refid="struct__LCSipTransports_1aed73e2a8a17c55f8511fb6d3eaa65d7b" kindref="member">tcp_port</ref>,<sp/>UPNP_CORE_RETRY_DELAY);</highlight></codeline>
<codeline lineno="1049"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_update_port_binding(lupnp,<sp/>&amp;lupnp-&gt;sip_tls,<sp/>UPNP_IGD_IP_PROTOCOL_TCP,<sp/>transport.<ref refid="struct__LCSipTransports_1ae23a827fac01111c0e8a3ece822ede93" kindref="member">tls_port</ref>,<sp/>UPNP_CORE_RETRY_DELAY);</highlight></codeline>
<codeline lineno="1050"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1051"><highlight class="normal"></highlight></codeline>
<codeline lineno="1052"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_update_proxy(lupnp,<sp/>FALSE);</highlight></codeline>
<codeline lineno="1053"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_update_config(lupnp);</highlight></codeline>
<codeline lineno="1054"><highlight class="normal"></highlight></codeline>
<codeline lineno="1055"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_unlock(&amp;lupnp-&gt;mutex);</highlight></codeline>
<codeline lineno="1056"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>TRUE;</highlight></codeline>
<codeline lineno="1057"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1058"><highlight class="normal"></highlight></codeline>
<codeline lineno="1059"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>linphone_core_update_local_media_description_from_upnp(SalMediaDescription<sp/>*desc,<sp/>UpnpSession<sp/>*session)<sp/>{</highlight></codeline>
<codeline lineno="1060"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1061"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>SalStreamDescription<sp/>*stream;</highlight></codeline>
<codeline lineno="1062"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpStream<sp/>*upnpStream;</highlight></codeline>
<codeline lineno="1063"><highlight class="normal"></highlight></codeline>
<codeline lineno="1064"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>SAL_MEDIA_DESCRIPTION_MAX_STREAMS;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1065"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>stream<sp/>=<sp/>&amp;desc-&gt;streams[i];</highlight></codeline>
<codeline lineno="1066"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!sal_stream_description_active(stream))<sp/></highlight><highlight class="keywordflow">continue</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1067"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>upnpStream<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="1068"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(stream-&gt;type<sp/>==<sp/>SalAudio)<sp/>{</highlight></codeline>
<codeline lineno="1069"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>upnpStream<sp/>=<sp/>session-&gt;audio;</highlight></codeline>
<codeline lineno="1070"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(stream-&gt;type<sp/>==<sp/>SalVideo)<sp/>{</highlight></codeline>
<codeline lineno="1071"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>upnpStream<sp/>=<sp/>session-&gt;video;</highlight></codeline>
<codeline lineno="1072"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1073"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(upnpStream<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1074"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(upnpStream-&gt;rtp<sp/>!=<sp/>NULL<sp/>&amp;&amp;<sp/>upnpStream-&gt;rtp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1075"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>strncpy(stream-&gt;rtp_addr,<sp/>upnpStream-&gt;rtp-&gt;external_addr,<sp/>LINPHONE_IPADDR_SIZE);</highlight></codeline>
<codeline lineno="1076"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>stream-&gt;rtp_port<sp/>=<sp/>upnpStream-&gt;rtp-&gt;external_port;</highlight></codeline>
<codeline lineno="1077"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1078"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(upnpStream-&gt;rtcp<sp/>!=<sp/>NULL<sp/>&amp;&amp;<sp/>upnpStream-&gt;rtcp-&gt;state<sp/>==<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1079"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>strncpy(stream-&gt;rtcp_addr,<sp/>upnpStream-&gt;rtcp-&gt;external_addr,<sp/>LINPHONE_IPADDR_SIZE);</highlight></codeline>
<codeline lineno="1080"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>stream-&gt;rtcp_port<sp/>=<sp/>upnpStream-&gt;rtcp-&gt;external_port;</highlight></codeline>
<codeline lineno="1081"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1082"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1083"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1084"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="1085"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1086"><highlight class="normal"></highlight></codeline>
<codeline lineno="1087"><highlight class="normal"></highlight></codeline>
<codeline lineno="1088"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="1089"><highlight class="comment"><sp/>*<sp/>uPnP<sp/>Port<sp/>Binding</highlight></codeline>
<codeline lineno="1090"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1091"><highlight class="normal"></highlight></codeline>
<codeline lineno="1092"><highlight class="normal">UpnpPortBinding<sp/>*linphone_upnp_port_binding_new()<sp/>{</highlight></codeline>
<codeline lineno="1093"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*port<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="1094"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port<sp/>=<sp/>ms_new0(UpnpPortBinding,1);</highlight></codeline>
<codeline lineno="1095"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_init(&amp;port-&gt;mutex,<sp/>NULL);</highlight></codeline>
<codeline lineno="1096"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ac0c60c390f5cd5a27a538aea39def28b" kindref="member">LinphoneUpnpStateIdle</ref>;</highlight></codeline>
<codeline lineno="1097"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;protocol<sp/>=<sp/>UPNP_IGD_IP_PROTOCOL_UDP;</highlight></codeline>
<codeline lineno="1098"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;device_id<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="1099"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;local_addr[0]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;\0&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1100"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;local_port<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="1101"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;external_addr[0]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;\0&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1102"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;external_port<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="1103"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;to_remove<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="1104"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;to_add<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="1105"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;ref<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1106"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;last_update<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1107"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>port;</highlight></codeline>
<codeline lineno="1108"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1109"><highlight class="normal"></highlight></codeline>
<codeline lineno="1110"><highlight class="normal">UpnpPortBinding<sp/>*linphone_upnp_port_binding_new_with_parameters(upnp_igd_ip_protocol<sp/>protocol,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>local_port,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>external_port)<sp/>{</highlight></codeline>
<codeline lineno="1111"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*port_binding<sp/>=<sp/>linphone_upnp_port_binding_new();</highlight></codeline>
<codeline lineno="1112"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_binding-&gt;protocol<sp/>=<sp/>protocol;</highlight></codeline>
<codeline lineno="1113"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_binding-&gt;local_port<sp/>=<sp/>local_port;</highlight></codeline>
<codeline lineno="1114"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_binding-&gt;external_port<sp/>=<sp/>external_port;</highlight></codeline>
<codeline lineno="1115"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>port_binding;</highlight></codeline>
<codeline lineno="1116"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1117"><highlight class="normal"></highlight></codeline>
<codeline lineno="1118"><highlight class="normal">UpnpPortBinding<sp/>*linphone_upnp_port_binding_new_or_collect(MSList<sp/>*list,<sp/>upnp_igd_ip_protocol<sp/>protocol,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>local_port,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>external_port)<sp/>{</highlight></codeline>
<codeline lineno="1119"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*tmp_binding;</highlight></codeline>
<codeline lineno="1120"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*end_binding;</highlight></codeline>
<codeline lineno="1121"><highlight class="normal"></highlight></codeline>
<codeline lineno="1122"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Seek<sp/>an<sp/>binding<sp/>with<sp/>same<sp/>protocol<sp/>and<sp/>local<sp/>port</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1123"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>end_binding<sp/>=<sp/>linphone_upnp_port_binding_new_with_parameters(protocol,<sp/>local_port,<sp/>-1);</highlight></codeline>
<codeline lineno="1124"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tmp_binding<sp/>=<sp/>linphone_upnp_port_binding_equivalent_in_list(list,<sp/>end_binding);</highlight></codeline>
<codeline lineno="1125"><highlight class="normal"></highlight></codeline>
<codeline lineno="1126"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Must<sp/>be<sp/>not<sp/>attached<sp/>to<sp/>any<sp/>struct</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1127"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(tmp_binding<sp/>!=<sp/>NULL<sp/>&amp;&amp;<sp/>tmp_binding-&gt;ref<sp/>==<sp/>1)<sp/>{</highlight></codeline>
<codeline lineno="1128"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_release(end_binding);</highlight></codeline>
<codeline lineno="1129"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>end_binding<sp/>=<sp/>linphone_upnp_port_binding_retain(tmp_binding);</highlight></codeline>
<codeline lineno="1130"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1131"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>end_binding-&gt;external_port<sp/>=<sp/>external_port;</highlight></codeline>
<codeline lineno="1132"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1133"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>end_binding;</highlight></codeline>
<codeline lineno="1134"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1135"><highlight class="normal"></highlight></codeline>
<codeline lineno="1136"><highlight class="normal">UpnpPortBinding<sp/>*linphone_upnp_port_binding_copy(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>UpnpPortBinding<sp/>*port)<sp/>{</highlight></codeline>
<codeline lineno="1137"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*new_port<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="1138"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>new_port<sp/>=<sp/>ms_new0(UpnpPortBinding,1);</highlight></codeline>
<codeline lineno="1139"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>memcpy(new_port,<sp/>port,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(UpnpPortBinding));</highlight></codeline>
<codeline lineno="1140"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>new_port-&gt;device_id<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="1141"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_set_device_id(new_port,<sp/>port-&gt;device_id);</highlight></codeline>
<codeline lineno="1142"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_init(&amp;new_port-&gt;mutex,<sp/>NULL);</highlight></codeline>
<codeline lineno="1143"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>new_port-&gt;ref<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1144"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>new_port;</highlight></codeline>
<codeline lineno="1145"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1146"><highlight class="normal"></highlight></codeline>
<codeline lineno="1147"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_port_binding_set_device_id(UpnpPortBinding<sp/>*port,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*device_id)<sp/>{</highlight></codeline>
<codeline lineno="1148"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*formated_device_id<sp/>=<sp/>linphone_upnp_format_device_id(device_id);</highlight></codeline>
<codeline lineno="1149"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(formated_device_id<sp/>!=<sp/>NULL<sp/>&amp;&amp;<sp/>port-&gt;device_id<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1150"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(strcmp(formated_device_id,<sp/>port-&gt;device_id)<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1151"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_free(formated_device_id);</highlight></codeline>
<codeline lineno="1152"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1153"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1154"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1155"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port-&gt;device_id<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1156"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_free(port-&gt;device_id);</highlight></codeline>
<codeline lineno="1157"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1158"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;device_id<sp/>=<sp/>formated_device_id;</highlight></codeline>
<codeline lineno="1159"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1160"><highlight class="normal"></highlight></codeline>
<codeline lineno="1161"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_port_binding_log(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>level,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*msg,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>UpnpPortBinding<sp/>*port)<sp/>{</highlight></codeline>
<codeline lineno="1162"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(strlen(port-&gt;local_addr))<sp/>{</highlight></codeline>
<codeline lineno="1163"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ortp_log(level,<sp/></highlight><highlight class="stringliteral">&quot;uPnP<sp/>IGD:<sp/>%s<sp/>%s|%d-&gt;%s:%d<sp/>(retry<sp/>%d)&quot;</highlight><highlight class="normal">,<sp/>msg,</highlight></codeline>
<codeline lineno="1164"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(port-&gt;protocol<sp/>==<sp/>UPNP_IGD_IP_PROTOCOL_TCP)?<sp/></highlight><highlight class="stringliteral">&quot;TCP&quot;</highlight><highlight class="normal">:</highlight><highlight class="stringliteral">&quot;UDP&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1165"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;external_port,</highlight></codeline>
<codeline lineno="1166"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;local_addr,</highlight></codeline>
<codeline lineno="1167"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;local_port,</highlight></codeline>
<codeline lineno="1168"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;retry<sp/>-<sp/>1);</highlight></codeline>
<codeline lineno="1169"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1170"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ortp_log(level,<sp/></highlight><highlight class="stringliteral">&quot;uPnP<sp/>IGD:<sp/>%s<sp/>%s|%d-&gt;%d<sp/>(retry<sp/>%d)&quot;</highlight><highlight class="normal">,<sp/>msg,</highlight></codeline>
<codeline lineno="1171"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(port-&gt;protocol<sp/>==<sp/>UPNP_IGD_IP_PROTOCOL_TCP)?<sp/></highlight><highlight class="stringliteral">&quot;TCP&quot;</highlight><highlight class="normal">:</highlight><highlight class="stringliteral">&quot;UDP&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1172"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;external_port,</highlight></codeline>
<codeline lineno="1173"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;local_port,</highlight></codeline>
<codeline lineno="1174"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;retry<sp/>-<sp/>1);</highlight></codeline>
<codeline lineno="1175"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1176"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1177"><highlight class="normal"></highlight></codeline>
<codeline lineno="1178"><highlight class="normal"></highlight><highlight class="comment">//<sp/>Return<sp/>true<sp/>if<sp/>the<sp/>binding<sp/>are<sp/>equivalent.<sp/>(Note<sp/>external_port<sp/>==<sp/>-1<sp/>means<sp/>&quot;don&apos;t<sp/>care&quot;)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1179"><highlight class="normal">bool_t<sp/>linphone_upnp_port_binding_equal(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>UpnpPortBinding<sp/>*port1,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>UpnpPortBinding<sp/>*port2)<sp/>{</highlight></codeline>
<codeline lineno="1180"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>port1-&gt;protocol<sp/>==<sp/>port2-&gt;protocol<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1181"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port1-&gt;local_port<sp/>==<sp/>port2-&gt;local_port<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1182"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(port1-&gt;external_port<sp/>==<sp/>-1<sp/>||<sp/>port2-&gt;external_port<sp/>==<sp/>-1<sp/>||<sp/>port1-&gt;external_port<sp/>==<sp/>port2-&gt;external_port);</highlight></codeline>
<codeline lineno="1183"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1184"><highlight class="normal"></highlight></codeline>
<codeline lineno="1185"><highlight class="normal">UpnpPortBinding<sp/>*linphone_upnp_port_binding_equivalent_in_list(MSList<sp/>*list,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>UpnpPortBinding<sp/>*port)<sp/>{</highlight></codeline>
<codeline lineno="1186"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*port_mapping;</highlight></codeline>
<codeline lineno="1187"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal">(list<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1188"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port_mapping<sp/>=<sp/>(UpnpPortBinding<sp/>*)list-&gt;data;</highlight></codeline>
<codeline lineno="1189"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(linphone_upnp_port_binding_equal(port,<sp/>port_mapping))<sp/>{</highlight></codeline>
<codeline lineno="1190"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>port_mapping;</highlight></codeline>
<codeline lineno="1191"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1192"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list<sp/>=<sp/>list-&gt;next;</highlight></codeline>
<codeline lineno="1193"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1194"><highlight class="normal"></highlight></codeline>
<codeline lineno="1195"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>NULL;</highlight></codeline>
<codeline lineno="1196"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1197"><highlight class="normal"></highlight></codeline>
<codeline lineno="1198"><highlight class="normal">UpnpPortBinding<sp/>*linphone_upnp_port_binding_retain(UpnpPortBinding<sp/>*port)<sp/>{</highlight></codeline>
<codeline lineno="1199"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_lock(&amp;port-&gt;mutex);</highlight></codeline>
<codeline lineno="1200"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;ref++;</highlight></codeline>
<codeline lineno="1201"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_unlock(&amp;port-&gt;mutex);</highlight></codeline>
<codeline lineno="1202"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>port;</highlight></codeline>
<codeline lineno="1203"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1204"><highlight class="normal"></highlight></codeline>
<codeline lineno="1205"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_port_binding_release(UpnpPortBinding<sp/>*port)<sp/>{</highlight></codeline>
<codeline lineno="1206"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_lock(&amp;port-&gt;mutex);</highlight></codeline>
<codeline lineno="1207"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(--port-&gt;ref<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1208"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port-&gt;device_id<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1209"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_free(port-&gt;device_id);</highlight></codeline>
<codeline lineno="1210"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1211"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_unlock(&amp;port-&gt;mutex);</highlight></codeline>
<codeline lineno="1212"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_destroy(&amp;port-&gt;mutex);</highlight></codeline>
<codeline lineno="1213"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_free(port);</highlight></codeline>
<codeline lineno="1214"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1215"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1216"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_mutex_unlock(&amp;port-&gt;mutex);</highlight></codeline>
<codeline lineno="1217"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1218"><highlight class="normal"></highlight></codeline>
<codeline lineno="1219"><highlight class="normal"></highlight></codeline>
<codeline lineno="1220"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="1221"><highlight class="comment"><sp/>*<sp/>uPnP<sp/>Stream</highlight></codeline>
<codeline lineno="1222"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1223"><highlight class="normal"></highlight></codeline>
<codeline lineno="1224"><highlight class="normal">UpnpStream*<sp/>linphone_upnp_stream_new()<sp/>{</highlight></codeline>
<codeline lineno="1225"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpStream<sp/>*stream<sp/>=<sp/>ms_new0(UpnpStream,1);</highlight></codeline>
<codeline lineno="1226"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>stream-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ac0c60c390f5cd5a27a538aea39def28b" kindref="member">LinphoneUpnpStateIdle</ref>;</highlight></codeline>
<codeline lineno="1227"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>stream-&gt;rtp<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="1228"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>stream-&gt;rtcp<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="1229"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>stream;</highlight></codeline>
<codeline lineno="1230"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1231"><highlight class="normal"></highlight></codeline>
<codeline lineno="1232"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_stream_destroy(UpnpStream*<sp/>stream)<sp/>{</highlight></codeline>
<codeline lineno="1233"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(stream-&gt;rtp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1234"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_release(stream-&gt;rtp);</highlight></codeline>
<codeline lineno="1235"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>stream-&gt;rtp<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="1236"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1237"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(stream-&gt;rtcp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1238"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_release(stream-&gt;rtcp);</highlight></codeline>
<codeline lineno="1239"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>stream-&gt;rtcp<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="1240"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1241"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_free(stream);</highlight></codeline>
<codeline lineno="1242"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1243"><highlight class="normal"></highlight></codeline>
<codeline lineno="1244"><highlight class="normal"></highlight></codeline>
<codeline lineno="1245"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="1246"><highlight class="comment"><sp/>*<sp/>uPnP<sp/>Session</highlight></codeline>
<codeline lineno="1247"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1248"><highlight class="normal"></highlight></codeline>
<codeline lineno="1249"><highlight class="normal">UpnpSession*<sp/>linphone_upnp_session_new(<ref refid="group__call__control_1gac0a4861d7c4702c64f7106f2b893c69e" kindref="member">LinphoneCall</ref>*<sp/>call)<sp/>{</highlight></codeline>
<codeline lineno="1250"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpSession<sp/>*session<sp/>=<sp/>ms_new0(UpnpSession,1);</highlight></codeline>
<codeline lineno="1251"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>session-&gt;call<sp/>=<sp/>call;</highlight></codeline>
<codeline lineno="1252"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>session-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490ac0c60c390f5cd5a27a538aea39def28b" kindref="member">LinphoneUpnpStateIdle</ref>;</highlight></codeline>
<codeline lineno="1253"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>session-&gt;audio<sp/>=<sp/>linphone_upnp_stream_new();</highlight></codeline>
<codeline lineno="1254"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>session-&gt;video<sp/>=<sp/>linphone_upnp_stream_new();</highlight></codeline>
<codeline lineno="1255"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>session;</highlight></codeline>
<codeline lineno="1256"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1257"><highlight class="normal"></highlight></codeline>
<codeline lineno="1258"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_session_destroy(UpnpSession<sp/>*session)<sp/>{</highlight></codeline>
<codeline lineno="1259"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__initializing_1gaa5cf635b82dd338e7ee2dd3599d05f0a" kindref="member">LinphoneCore</ref><sp/>*lc<sp/>=<sp/>session-&gt;call-&gt;core;</highlight></codeline>
<codeline lineno="1260"><highlight class="normal"></highlight></codeline>
<codeline lineno="1261"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(lc-&gt;upnp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1262"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Remove<sp/>bindings<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1263"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(session-&gt;audio-&gt;rtp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1264"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_context_send_remove_port_binding(lc-&gt;upnp,<sp/>session-&gt;audio-&gt;rtp,<sp/>TRUE);</highlight></codeline>
<codeline lineno="1265"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1266"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(session-&gt;audio-&gt;rtcp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1267"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_context_send_remove_port_binding(lc-&gt;upnp,<sp/>session-&gt;audio-&gt;rtcp,<sp/>TRUE);</highlight></codeline>
<codeline lineno="1268"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1269"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(session-&gt;video-&gt;rtp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1270"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_context_send_remove_port_binding(lc-&gt;upnp,<sp/>session-&gt;video-&gt;rtp,<sp/>TRUE);</highlight></codeline>
<codeline lineno="1271"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1272"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(session-&gt;video-&gt;rtcp<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1273"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_context_send_remove_port_binding(lc-&gt;upnp,<sp/>session-&gt;video-&gt;rtcp,<sp/>TRUE);</highlight></codeline>
<codeline lineno="1274"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1275"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1276"><highlight class="normal"></highlight></codeline>
<codeline lineno="1277"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>session-&gt;call-&gt;stats[LINPHONE_CALL_STATS_AUDIO].upnp_state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref>;</highlight></codeline>
<codeline lineno="1278"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>session-&gt;call-&gt;stats[LINPHONE_CALL_STATS_VIDEO].upnp_state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a228f1c0991292d1867ee7d29e5f5fb85" kindref="member">LinphoneUpnpStateKo</ref>;</highlight></codeline>
<codeline lineno="1279"><highlight class="normal"></highlight></codeline>
<codeline lineno="1280"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_stream_destroy(session-&gt;audio);</highlight></codeline>
<codeline lineno="1281"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_stream_destroy(session-&gt;video);</highlight></codeline>
<codeline lineno="1282"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_free(session);</highlight></codeline>
<codeline lineno="1283"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1284"><highlight class="normal"></highlight></codeline>
<codeline lineno="1285"><highlight class="normal"><ref refid="group__initializing_1ga2c19554a0988f7600aec5c3a7588d61a" kindref="member">LinphoneUpnpState</ref><sp/>linphone_upnp_session_get_state(UpnpSession<sp/>*session)<sp/>{</highlight></codeline>
<codeline lineno="1286"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>session-&gt;state;</highlight></codeline>
<codeline lineno="1287"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1288"><highlight class="normal"></highlight></codeline>
<codeline lineno="1289"><highlight class="normal"></highlight></codeline>
<codeline lineno="1290"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="1291"><highlight class="comment"><sp/>*<sp/>uPnP<sp/>Config</highlight></codeline>
<codeline lineno="1292"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1293"><highlight class="normal"></highlight></codeline>
<codeline lineno="1294"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">linphone_upnp_config_list_port_bindings_struct<sp/>{</highlight></codeline>
<codeline lineno="1295"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">_LpConfig<sp/>*lpc;</highlight></codeline>
<codeline lineno="1296"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>MSList<sp/>*retList;</highlight></codeline>
<codeline lineno="1297"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*device_id;</highlight></codeline>
<codeline lineno="1298"><highlight class="normal">};</highlight></codeline>
<codeline lineno="1299"><highlight class="normal"></highlight></codeline>
<codeline lineno="1300"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_config_list_port_bindings_cb(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*entry,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>linphone_upnp_config_list_port_bindings_struct<sp/>*cookie)<sp/>{</highlight></codeline>
<codeline lineno="1301"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>device_id[UPNP_UUID_LEN<sp/>+<sp/>1];</highlight></codeline>
<codeline lineno="1302"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>protocol_str[4];<sp/></highlight><highlight class="comment">//<sp/>TCP<sp/>or<sp/>UDP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1303"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>upnp_igd_ip_protocol<sp/>protocol;</highlight></codeline>
<codeline lineno="1304"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>external_port;</highlight></codeline>
<codeline lineno="1305"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>local_port;</highlight></codeline>
<codeline lineno="1306"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="1307"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>bool_t<sp/>valid<sp/>=<sp/>TRUE;</highlight></codeline>
<codeline lineno="1308"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*port;</highlight></codeline>
<codeline lineno="1309"><highlight class="normal"></highlight></codeline>
<codeline lineno="1310"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>sscanf(entry,<sp/></highlight><highlight class="stringliteral">&quot;%&quot;</highlight><highlight class="normal">UPNP_UUID_LEN_STR</highlight><highlight class="stringliteral">&quot;[^-]-%3s-%i-%i&quot;</highlight><highlight class="normal">,<sp/>device_id,<sp/>protocol_str,<sp/>&amp;external_port,<sp/>&amp;local_port);</highlight></codeline>
<codeline lineno="1311"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(ret<sp/>==<sp/>4)<sp/>{</highlight></codeline>
<codeline lineno="1312"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Handle<sp/>only<sp/>wanted<sp/>device<sp/>bindings</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1313"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(device_id<sp/>!=<sp/>NULL<sp/>&amp;&amp;<sp/>strcmp(cookie-&gt;device_id,<sp/>device_id)<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1314"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1315"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1316"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(linphone_upnp_strncmpi(protocol_str,<sp/></highlight><highlight class="stringliteral">&quot;TCP&quot;</highlight><highlight class="normal">,<sp/>3)<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1317"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>protocol<sp/>=<sp/>UPNP_IGD_IP_PROTOCOL_TCP;</highlight></codeline>
<codeline lineno="1318"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(linphone_upnp_strncmpi(protocol_str,<sp/></highlight><highlight class="stringliteral">&quot;UDP&quot;</highlight><highlight class="normal">,<sp/>3)<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1319"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>protocol<sp/>=<sp/>UPNP_IGD_IP_PROTOCOL_UDP;</highlight></codeline>
<codeline lineno="1320"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1321"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>valid<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="1322"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1323"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(valid)<sp/>{</highlight></codeline>
<codeline lineno="1324"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port<sp/>=<sp/>linphone_upnp_port_binding_new();</highlight></codeline>
<codeline lineno="1325"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_set_device_id(port,<sp/>device_id);</highlight></codeline>
<codeline lineno="1326"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;state<sp/>=<sp/><ref refid="group__initializing_1gga3d626fbc6cee8294fef83d197fa27490a69b1709a2087dcf1089d1204ed25a09a" kindref="member">LinphoneUpnpStateOk</ref>;</highlight></codeline>
<codeline lineno="1327"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;protocol<sp/>=<sp/>protocol;</highlight></codeline>
<codeline lineno="1328"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;external_port<sp/>=<sp/>external_port;</highlight></codeline>
<codeline lineno="1329"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>port-&gt;local_port<sp/>=<sp/>local_port;</highlight></codeline>
<codeline lineno="1330"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cookie-&gt;retList<sp/>=<sp/>ms_list_append(cookie-&gt;retList,<sp/>port);</highlight></codeline>
<codeline lineno="1331"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1332"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1333"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>valid<sp/>=<sp/>FALSE;</highlight></codeline>
<codeline lineno="1334"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1335"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(!valid)<sp/>{</highlight></codeline>
<codeline lineno="1336"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_warning(</highlight><highlight class="stringliteral">&quot;uPnP<sp/>configuration<sp/>invalid<sp/>line:<sp/>%s&quot;</highlight><highlight class="normal">,<sp/>entry);</highlight></codeline>
<codeline lineno="1337"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1338"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1339"><highlight class="normal"></highlight></codeline>
<codeline lineno="1340"><highlight class="normal">MSList<sp/>*linphone_upnp_config_list_port_bindings(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>_LpConfig<sp/>*lpc,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*device_id)<sp/>{</highlight></codeline>
<codeline lineno="1341"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*formated_device_id<sp/>=<sp/>linphone_upnp_format_device_id(device_id);</highlight></codeline>
<codeline lineno="1342"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">linphone_upnp_config_list_port_bindings_struct<sp/>cookie<sp/>=<sp/>{lpc,<sp/>NULL,<sp/>formated_device_id};</highlight></codeline>
<codeline lineno="1343"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__misc_1ga2595b0b6d2133c44de3664e25f756f2f" kindref="member">lp_config_for_each_entry</ref>(lpc,<sp/>UPNP_SECTION_NAME,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">(*)(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*,<sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*))linphone_upnp_config_list_port_bindings_cb,<sp/>&amp;cookie);</highlight></codeline>
<codeline lineno="1344"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_free(formated_device_id);</highlight></codeline>
<codeline lineno="1345"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>cookie.retList;</highlight></codeline>
<codeline lineno="1346"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1347"><highlight class="normal"></highlight></codeline>
<codeline lineno="1348"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_config_add_port_binding(UpnpContext<sp/>*lupnp,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>UpnpPortBinding<sp/>*port)<sp/>{</highlight></codeline>
<codeline lineno="1349"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>MSList<sp/>*list;</highlight></codeline>
<codeline lineno="1350"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*list_port;</highlight></codeline>
<codeline lineno="1351"><highlight class="normal"></highlight></codeline>
<codeline lineno="1352"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port-&gt;device_id<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1353"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_error(</highlight><highlight class="stringliteral">&quot;Can&apos;t<sp/>remove<sp/>port<sp/>binding<sp/>without<sp/>device_id&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="1354"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1355"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1356"><highlight class="normal"></highlight></codeline>
<codeline lineno="1357"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list<sp/>=<sp/>lupnp-&gt;removing_configs;</highlight></codeline>
<codeline lineno="1358"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal">(list<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1359"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list_port<sp/>=<sp/>(UpnpPortBinding<sp/>*)list-&gt;data;</highlight></codeline>
<codeline lineno="1360"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(linphone_upnp_port_binding_equal(list_port,<sp/>port)<sp/>==<sp/>TRUE)<sp/>{</highlight></codeline>
<codeline lineno="1361"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;removing_configs<sp/>=<sp/>ms_list_remove(lupnp-&gt;removing_configs,<sp/>list_port);</highlight></codeline>
<codeline lineno="1362"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_release(list_port);</highlight></codeline>
<codeline lineno="1363"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1364"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1365"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list<sp/>=<sp/>ms_list_next(list);</highlight></codeline>
<codeline lineno="1366"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1367"><highlight class="normal"></highlight></codeline>
<codeline lineno="1368"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list<sp/>=<sp/>lupnp-&gt;adding_configs;</highlight></codeline>
<codeline lineno="1369"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal">(list<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1370"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list_port<sp/>=<sp/>(UpnpPortBinding<sp/>*)list-&gt;data;</highlight></codeline>
<codeline lineno="1371"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(linphone_upnp_port_binding_equal(list_port,<sp/>port)<sp/>==<sp/>TRUE)<sp/>{</highlight></codeline>
<codeline lineno="1372"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1373"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1374"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list<sp/>=<sp/>ms_list_next(list);</highlight></codeline>
<codeline lineno="1375"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1376"><highlight class="normal"></highlight></codeline>
<codeline lineno="1377"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list_port<sp/>=<sp/>linphone_upnp_port_binding_copy(port);</highlight></codeline>
<codeline lineno="1378"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;adding_configs<sp/>=<sp/>ms_list_append(lupnp-&gt;adding_configs,<sp/>list_port);</highlight></codeline>
<codeline lineno="1379"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1380"><highlight class="normal"></highlight></codeline>
<codeline lineno="1381"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>linphone_upnp_config_remove_port_binding(UpnpContext<sp/>*lupnp,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>UpnpPortBinding<sp/>*port)<sp/>{</highlight></codeline>
<codeline lineno="1382"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>MSList<sp/>*list;</highlight></codeline>
<codeline lineno="1383"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>UpnpPortBinding<sp/>*list_port;</highlight></codeline>
<codeline lineno="1384"><highlight class="normal"></highlight></codeline>
<codeline lineno="1385"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(port-&gt;device_id<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1386"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ms_error(</highlight><highlight class="stringliteral">&quot;Can&apos;t<sp/>remove<sp/>port<sp/>binding<sp/>without<sp/>device_id&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="1387"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1388"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1389"><highlight class="normal"></highlight></codeline>
<codeline lineno="1390"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list<sp/>=<sp/>lupnp-&gt;adding_configs;</highlight></codeline>
<codeline lineno="1391"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal">(list<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1392"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list_port<sp/>=<sp/>(UpnpPortBinding<sp/>*)list-&gt;data;</highlight></codeline>
<codeline lineno="1393"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(linphone_upnp_port_binding_equal(list_port,<sp/>port)<sp/>==<sp/>TRUE)<sp/>{</highlight></codeline>
<codeline lineno="1394"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;adding_configs<sp/>=<sp/>ms_list_remove(lupnp-&gt;adding_configs,<sp/>list_port);</highlight></codeline>
<codeline lineno="1395"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>linphone_upnp_port_binding_release(list_port);</highlight></codeline>
<codeline lineno="1396"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1397"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1398"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list<sp/>=<sp/>ms_list_next(list);</highlight></codeline>
<codeline lineno="1399"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1400"><highlight class="normal"></highlight></codeline>
<codeline lineno="1401"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list<sp/>=<sp/>lupnp-&gt;removing_configs;</highlight></codeline>
<codeline lineno="1402"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal">(list<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1403"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list_port<sp/>=<sp/>(UpnpPortBinding<sp/>*)list-&gt;data;</highlight></codeline>
<codeline lineno="1404"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(linphone_upnp_port_binding_equal(list_port,<sp/>port)<sp/>==<sp/>TRUE)<sp/>{</highlight></codeline>
<codeline lineno="1405"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1406"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1407"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list<sp/>=<sp/>ms_list_next(list);</highlight></codeline>
<codeline lineno="1408"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1409"><highlight class="normal"></highlight></codeline>
<codeline lineno="1410"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list_port<sp/>=<sp/>linphone_upnp_port_binding_copy(port);</highlight></codeline>
<codeline lineno="1411"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lupnp-&gt;removing_configs<sp/>=<sp/>ms_list_append(lupnp-&gt;removing_configs,<sp/>list_port);</highlight></codeline>
<codeline lineno="1412"><highlight class="normal">}</highlight></codeline>
    </programlisting>
    <location file="/usr/src/slapt-src/network/linphone/linphone-3.9.1/coreapi/upnp.c"/>
  </compounddef>
</doxygen>
