Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
10b2aaa1
Commit
10b2aaa1
authored
5 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
upnp: cleanup
Change-Id: I85c88cfd1f2d5712fc271ad33da9f4b1b424bcfb
parent
7a8d39f1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/upnp/protocol/pupnp/pupnp.cpp
+11
-12
11 additions, 12 deletions
src/upnp/protocol/pupnp/pupnp.cpp
with
11 additions
and
12 deletions
src/upnp/protocol/pupnp/pupnp.cpp
+
11
−
12
View file @
10b2aaa1
...
...
@@ -686,8 +686,8 @@ PUPnP::actionIsIgdConnected(const UPnPIGD& igd)
return
false
;
// Action and response pointers.
std
::
unique_ptr
<
I
XML
_
Document
,
decltype
(
ixmlDocument_free
)
&>
action
(
nullptr
,
ixmlDocument_free
);
// Action pointer.
std
::
unique_ptr
<
I
XML
_
Document
,
decltype
(
ixmlDocument_free
)
&>
response
(
nullptr
,
ixmlDocument_free
);
// Response pointer.
XMLDocument
action
(
nullptr
,
ixmlDocument_free
);
// Action pointer.
XMLDocument
response
(
nullptr
,
ixmlDocument_free
);
// Response pointer.
IXML_Document
*
action_container_ptr
=
nullptr
;
IXML_Document
*
response_container_ptr
=
nullptr
;
...
...
@@ -730,19 +730,19 @@ PUPnP::actionGetExternalIP(const UPnPIGD& igd)
// Action and response pointers.
std
::
unique_ptr
<
IXML_Document
,
decltype
(
ixmlDocument_free
)
&>
action
(
nullptr
,
ixmlDocument_free
);
// Action pointer.
std
::
unique_ptr
<
IXML_Document
,
decltype
(
ixmlDocument_free
)
&>
response
(
nullptr
,
ixmlDocument_free
);
// Response pointer.
IXML_Document
*
action_container_ptr
=
nullptr
;
IXML_Document
*
response_container_ptr
=
nullptr
;
// Set action name.
st
d
::
string
action_name
{
"GetExternalIPAddress"
};
st
atic
constexpr
const
char
*
action_name
{
"GetExternalIPAddress"
};
action_container_ptr
=
UpnpMakeAction
(
action_name
.
c_str
(),
igd
.
getServiceType
().
c_str
(),
0
,
nullptr
);
IXML_Document
*
action_container_ptr
=
nullptr
;
action_container_ptr
=
UpnpMakeAction
(
action_name
,
igd
.
getServiceType
().
c_str
(),
0
,
nullptr
);
if
(
not
action_container_ptr
)
{
JAMI_WARN
(
"PUPnP: Failed to make GetExternalIPAddress action"
);
return
{};
}
action
.
reset
(
action_container_ptr
);
IXML_Document
*
response_container_ptr
=
nullptr
;
int
upnp_err
=
UpnpSendAction
(
ctrlptHandle_
,
igd
.
getControlURL
().
c_str
(),
igd
.
getServiceType
().
c_str
(),
nullptr
,
action
.
get
(),
&
response_container_ptr
);
if
(
upnp_err
!=
UPNP_E_SUCCESS
)
{
JAMI_WARN
(
"PUPnP: Failed to send GetExternalIPAddress action -> %s"
,
UpnpGetErrorMessage
(
upnp_err
));
...
...
@@ -750,7 +750,7 @@ PUPnP::actionGetExternalIP(const UPnPIGD& igd)
}
response
.
reset
(
response_container_ptr
);
if
(
errorOnResponse
(
response
.
get
()))
{
if
(
errorOnResponse
(
response
.
get
()))
{
JAMI_WARN
(
"PUPnP: Failed to get GetExternalIPAddress from %s -> %d: %s"
,
igd
.
getServiceType
().
c_str
(),
upnp_err
,
UpnpGetErrorMessage
(
upnp_err
));
return
{};
}
...
...
@@ -765,7 +765,7 @@ PUPnP::actionDeletePortMappingsByDesc(const UPnPIGD& igd, const std::string& des
return
;
// Set action name.
st
d
::
string
action_name
{
"GetGenericPortMappingEntry"
};
st
atic
constexpr
const
char
*
action_name
{
"GetGenericPortMappingEntry"
};
int
entry_idx
=
0
;
bool
done
=
false
;
...
...
@@ -777,7 +777,7 @@ PUPnP::actionDeletePortMappingsByDesc(const UPnPIGD& igd, const std::string& des
IXML_Document
*
action_container_ptr
=
nullptr
;
IXML_Document
*
response_container_ptr
=
nullptr
;
UpnpAddToAction
(
&
action_container_ptr
,
action_name
.
c_str
()
,
igd
.
getServiceType
().
c_str
(),
"NewPortMappingIndex"
,
std
::
to_string
(
entry_idx
).
c_str
());
UpnpAddToAction
(
&
action_container_ptr
,
action_name
,
igd
.
getServiceType
().
c_str
(),
"NewPortMappingIndex"
,
std
::
to_string
(
entry_idx
).
c_str
());
action
.
reset
(
action_container_ptr
);
int
upnp_err
=
UpnpSendAction
(
ctrlptHandle_
,
igd
.
getControlURL
().
c_str
(),
igd
.
getServiceType
().
c_str
(),
nullptr
,
action
.
get
(),
&
response_container_ptr
);
...
...
@@ -799,7 +799,6 @@ PUPnP::actionDeletePortMappingsByDesc(const UPnPIGD& igd, const std::string& des
errorCode
.
c_str
(),
errorDescription
.
c_str
());
}
done
=
true
;
}
else
{
// Parse the rest of the response.
std
::
string
desc_actual
=
getFirstDocItem
(
response
.
get
(),
"NewPortMappingDescription"
);
...
...
@@ -881,8 +880,8 @@ PUPnP::actionAddPortMapping(const UPnPIGD& igd, const Mapping& mapping, UPnPProt
error_code
=
UPnPProtocol
::
UpnpError
::
ERROR_OK
;
// Action and response pointers.
std
::
unique_ptr
<
I
XML
_
Document
,
decltype
(
ixmlDocument_free
)
&>
action
(
nullptr
,
ixmlDocument_free
);
// Action pointer.
std
::
unique_ptr
<
I
XML
_
Document
,
decltype
(
ixmlDocument_free
)
&>
response
(
nullptr
,
ixmlDocument_free
);
// Response pointer.
XMLDocument
action
(
nullptr
,
ixmlDocument_free
);
// Action pointer.
XMLDocument
response
(
nullptr
,
ixmlDocument_free
);
// Response pointer.
IXML_Document
*
action_container_ptr
=
nullptr
;
IXML_Document
*
response_container_ptr
=
nullptr
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment