Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
3d0d5a90
Commit
3d0d5a90
authored
Jun 19, 2008
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a default validater function
parent
59169ee7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
stun/stunagent.c
stun/stunagent.c
+21
-0
stun/stunagent.h
stun/stunagent.h
+11
-0
No files found.
stun/stunagent.c
View file @
3d0d5a90
...
@@ -68,6 +68,27 @@ void stun_agent_init (StunAgent *agent, const uint16_t *known_attributes,
...
@@ -68,6 +68,27 @@ void stun_agent_init (StunAgent *agent, const uint16_t *known_attributes,
}
}
bool
stun_agent_default_validater
(
StunAgent
*
agent
,
StunMessage
*
message
,
uint8_t
*
username
,
uint16_t
username_len
,
uint8_t
**
password
,
size_t
*
password_len
,
void
*
user_data
)
{
stun_validater_data
*
val
=
(
stun_validater_data
*
)
user_data
;
int
i
;
for
(
i
=
0
;
val
&&
val
[
i
].
username
;
i
++
)
{
if
(
username_len
==
val
[
i
].
username_len
||
memcmp
(
username
,
val
[
i
].
username
,
username_len
)
==
0
)
{
*
password
=
(
uint8_t
*
)
val
[
i
].
password
;
*
password_len
=
val
[
i
].
password_len
;
return
true
;
}
}
return
false
;
}
StunValidationStatus
stun_agent_validate
(
StunAgent
*
agent
,
StunMessage
*
msg
,
StunValidationStatus
stun_agent_validate
(
StunAgent
*
agent
,
StunMessage
*
msg
,
const
uint8_t
*
buffer
,
size_t
buffer_len
,
const
uint8_t
*
buffer
,
size_t
buffer_len
,
StunMessageIntegrityValidate
validater
,
void
*
validater_data
)
StunMessageIntegrityValidate
validater
,
void
*
validater_data
)
...
...
stun/stunagent.h
View file @
3d0d5a90
...
@@ -84,10 +84,21 @@ struct stun_agent_t {
...
@@ -84,10 +84,21 @@ struct stun_agent_t {
uint32_t
usage_flags
;
uint32_t
usage_flags
;
};
};
typedef
struct
{
const
uint8_t
*
username
;
const
size_t
username_len
;
const
uint8_t
*
password
;
const
size_t
password_len
;
}
stun_validater_data
;
typedef
bool
(
*
StunMessageIntegrityValidate
)
(
StunAgent
*
agent
,
typedef
bool
(
*
StunMessageIntegrityValidate
)
(
StunAgent
*
agent
,
StunMessage
*
message
,
uint8_t
*
username
,
uint16_t
username_len
,
StunMessage
*
message
,
uint8_t
*
username
,
uint16_t
username_len
,
uint8_t
**
password
,
size_t
*
password_len
,
void
*
user_data
);
uint8_t
**
password
,
size_t
*
password_len
,
void
*
user_data
);
bool
stun_agent_default_validater
(
StunAgent
*
agent
,
StunMessage
*
message
,
uint8_t
*
username
,
uint16_t
username_len
,
uint8_t
**
password
,
size_t
*
password_len
,
void
*
user_data
);
void
stun_agent_init
(
StunAgent
*
agent
,
const
uint16_t
*
known_attributes
,
void
stun_agent_init
(
StunAgent
*
agent
,
const
uint16_t
*
known_attributes
,
StunCompatibility
compatibility
,
uint32_t
usage_flags
);
StunCompatibility
compatibility
,
uint32_t
usage_flags
);
...
...
Write
Preview
Markdown
is supported
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