Skip to content
GitLab
Explore
Sign in
Register
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
f0f7027a
Commit
f0f7027a
authored
15 years ago
by
Alexandre Savard
Browse files
Options
Downloads
Patches
Plain Diff
[#1722] Put crypto attribute in media field
parent
a7201727
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
sflphone-common/src/sip/sdp.cpp
+41
-24
41 additions, 24 deletions
sflphone-common/src/sip/sdp.cpp
sflphone-common/test/sdesnegotiatorTest.cpp
+9
-9
9 additions, 9 deletions
sflphone-common/test/sdesnegotiatorTest.cpp
with
50 additions
and
33 deletions
sflphone-common/src/sip/sdp.cpp
+
41
−
24
View file @
f0f7027a
...
...
@@ -364,7 +364,7 @@ void Sdp::sdp_add_media_description()
}
}
// @TODO should be a vector
void
Sdp
::
sdp_add_sdes_attribute
(
std
::
string
crypto
)
{
...
...
@@ -386,10 +386,17 @@ void Sdp::sdp_add_sdes_attribute (std::string crypto)
attribute
->
value
.
ptr
=
(
char
*
)
pj_pool_alloc
(
_pool
,
attribute
->
value
.
slen
+
1
);
pj_memcpy
(
attribute
->
value
.
ptr
,
tempbuf
,
attribute
->
value
.
slen
+
1
);
// add crypto attribute to sdp session
if
(
pjmedia_sdp_attr_add
(
&
(
_local_offer
->
attr_count
),
_local_offer
->
attr
,
attribute
)
!=
PJ_SUCCESS
){
// get number of media for this SDP
int
media_count
=
_local_offer
->
media_count
;
// add crypto attribute to media
for
(
int
i
=
0
;
i
<
media_count
;
i
++
)
{
if
(
pjmedia_sdp_media_add_attr
(
_local_offer
->
media
[
i
],
attribute
)
!=
PJ_SUCCESS
)
{
// if(pjmedia_sdp_attr_add(&(_local_offer->attr_count), _local_offer->attr, attribute) != PJ_SUCCESS){
throw
sdpException
();
}
}
}
...
...
@@ -670,42 +677,52 @@ void Sdp::get_remote_sdp_media_from_offer (const pjmedia_sdp_session* remote_sdp
void
Sdp
::
get_remote_sdp_crypto_from_offer
(
const
pjmedia_sdp_session
*
remote_sdp
,
CryptoOffer
&
crypto_offer
)
{
int
i
;
int
attr_count
;
int
i
,
j
;
int
attr_count
,
media_count
;
pjmedia_sdp_attr
*
attribute
;
pjmedia_sdp_media
*
media
;
// get the number of
attribute
for this sdp session
attr
_count
=
remote_sdp
->
attr
_count
;
// get the number of
media
for this sdp session
media
_count
=
remote_sdp
->
media
_count
;
// *r_crypto = pjmedia_sdp_media_find_attr(attribute, &STR_CRYPTO, NULL);
_debug
(
"****************** Parse for Crypto
%i
********************"
,
attr_count
);
_debug
(
"****************** Parse for Crypto ********************"
);
CryptoOffer
remoteOffer
;
// iterate over all
atribute
for
(
i
=
0
;
i
<
attr
_count
;
++
i
)
{
// iterate over all
media
for
(
i
=
0
;
i
<
media
_count
;
++
i
)
{
_debug
(
"%.*s"
,
(
int
)
remote_sdp
->
attr
[
i
]
->
name
.
slen
,
remote_sdp
->
attr
[
i
]
->
name
.
ptr
);
_debug
(
"%.*s"
,
(
int
)
remote_sdp
->
attr
[
i
]
->
value
.
slen
,
remote_sdp
->
attr
[
i
]
->
value
.
ptr
);
// test if this attribute is a crypto
if
(
pj_stricmp2
(
&
remote_sdp
->
attr
[
i
]
->
name
,
"crypto"
)
==
0
)
{
// get media
media
=
remote_sdp
->
media
[
i
];
// get number of attribute for this memdia
attr_count
=
media
->
attr_count
;
attribute
=
remote_sdp
->
attr
[
i
];
// iterate over all attribute for this media
for
(
j
=
0
;
j
<
attr_count
;
j
++
)
{
attribute
=
media
->
attr
[
i
];
// test if this attribute is a crypto
if
(
pj_stricmp2
(
&
attribute
->
name
,
"crypto"
)
==
0
)
{
_debug
(
"****************** Found a Crypto ********************"
);
std
::
string
attr
(
attribute
->
value
.
ptr
,
attribute
->
value
.
slen
);
// @TODO our parser require the "acrypto:" to be present
// @TODO our parser require the "a
=
crypto:" to be present
std
::
string
full_attr
=
"a=crypto:"
;
full_attr
+=
attr
;
crypto_offer
.
push_back
(
full_attr
);
}
}
_debug
(
"****************** Did not Found any Crypto ********************"
);
}
}
}
This diff is collapsed.
Click to expand it.
sflphone-common/test/sdesnegotiatorTest.cpp
+
9
−
9
View file @
f0f7027a
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