Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
libnice
libnice
Commits
b92c102f
Commit
b92c102f
authored
Mar 16, 2007
by
Dafydd Harries
Browse files
stun_message_find_attribute ()
darcs-hash:20070316024908-c9803-904bbc4e085072d1be34c7f131bb769dd838f6fd.gz
parent
f80aa521
Changes
4
Show whitespace changes
Inline
Side-by-side
stun/Makefile.am
View file @
b92c102f
...
...
@@ -25,7 +25,8 @@ check_PROGRAMS = \
test-message-pack
\
test-message-dump
\
test-message-dump-unknown
\
test-message-unpack
test-message-unpack
\
test-message-find-attribute
test_attribute_pack_LDADD
=
libstun.la
test_attribute_pack_unknown_LDADD
=
libstun.la
...
...
@@ -38,6 +39,7 @@ test_message_pack_LDADD = libstun.la
test_message_dump_LDADD
=
libstun.la
test_message_dump_unknown_LDADD
=
libstun.la
test_message_unpack_LDADD
=
libstun.la
test_message_find_attribute_LDADD
=
libstun.la
TESTS
=
$(check_PROGRAMS)
stun/stun.c
View file @
b92c102f
...
...
@@ -338,3 +338,17 @@ stun_message_dump (StunMessage *msg)
return
g_string_free
(
tmp
,
FALSE
);
}
StunAttribute
*
stun_message_find_attribute
(
StunMessage
*
msg
,
StunAttributeType
type
)
{
StunAttribute
**
attr
;
if
(
!
msg
->
attributes
)
return
NULL
;
for
(
attr
=
msg
->
attributes
;
*
attr
;
attr
++
)
if
((
*
attr
)
->
type
==
type
)
return
*
attr
;
return
NULL
;
}
stun/stun.h
View file @
b92c102f
...
...
@@ -123,6 +123,9 @@ G_GNUC_WARN_UNUSED_RESULT
StunMessage
*
stun_message_unpack
(
guint
length
,
const
gchar
*
s
);
StunAttribute
*
stun_message_find_attribute
(
StunMessage
*
msg
,
StunAttributeType
type
);
G_END_DECLS
#endif
/* __STUN_H__ */
...
...
stun/test-message-find-attribute.c
0 → 100644
View file @
b92c102f
#include
"stun.h"
int
main
(
void
)
{
StunMessage
*
msg
;
msg
=
stun_message_new
(
STUN_MESSAGE_BINDING_REQUEST
,
NULL
,
1
);
g_assert
(
NULL
==
stun_message_find_attribute
(
msg
,
STUN_ATTRIBUTE_MAPPED_ADDRESS
));
msg
->
attributes
[
0
]
=
stun_attribute_mapped_address_new
(
0x01020304
,
1234
);
g_assert
(
msg
->
attributes
[
0
]
==
stun_message_find_attribute
(
msg
,
STUN_ATTRIBUTE_MAPPED_ADDRESS
));
return
0
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment