Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
external
sofia-sip
Commits
bc3aaa44
Commit
bc3aaa44
authored
Jun 15, 2006
by
Kai Vehmanen
Browse files
Added host_is_local() to bnf module.
darcs-hash:20060615144657-7659e-d8a6a2e9b5291d50f695604313639282d8e590f9.gz
parent
8c245499
Changes
5
Hide whitespace changes
Inline
Side-by-side
RELEASE
View file @
bc3aaa44
...
...
@@ -18,6 +18,10 @@ API/ABI changes and versioning
other important information to developers;
- and should be updated _continuously_! />
[libsofia-sip-ua]
- Added sofia-sip/hostdomain.h:host_is_local() (implemented
by the bnf module).
[libsofia-sip-ua-glib]
- Applications must now separately check for libsofia-sip-ua-glib
with pkg-config. The pkg-config dependency 'libsofia-sip-ua ->
...
...
libsofia-sip-ua/bnf/ChangeLog
View file @
bc3aaa44
2006-06-15 Kai Vehmanen <kai.vehmanen@nokia.com>
* sofia-sip/hostdomain.h (host_is_local): Function added.
2005-07-18 Kai Vehmanen <kai.vehmanen@nokia.com>
* Initial import of the module to Sofia-SIP tree.
libsofia-sip-ua/bnf/bnf.c
View file @
bc3aaa44
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
* Copyright (C) 2005
,2006
Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
...
...
@@ -26,6 +26,7 @@
* @brief Character syntax table for HTTP-like protocols.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
* @author Kai Vehmanen <Kai.Vehmanen@nokia.com>
*
* @date Created: Thu Jun 8 19:28:55 2000 ppessi
*/
...
...
@@ -724,6 +725,24 @@ int host_is_valid(char const *string)
return
n
>
0
&&
string
[
n
]
==
'\0'
;
}
/** Returns true if @a string is describing a local address.
*
* Uses the definitions of local addresses found in RFC1700 and
* RFC4291.
*/
int
host_is_local
(
char
const
*
host
)
{
if
(
host_ip6_reference
(
host
))
return
(
strcmp
(
host
,
"[::1]"
)
==
0
);
else
if
(
host_is_ip6_address
(
host
))
return
(
strcmp
(
host
,
"::1"
)
==
0
);
else
if
(
host_is_ip4_address
(
host
))
return
(
strncmp
(
host
,
"127."
,
4
)
==
0
);
else
return
(
strcmp
(
host
,
"localhost"
)
==
0
||
strcmp
(
host
,
"localhost.localdomain"
)
==
0
);
}
/** Return true if @a string has domain name in "invalid." domain.
*
*/
...
...
libsofia-sip-ua/bnf/sofia-sip/hostdomain.h
View file @
bc3aaa44
...
...
@@ -47,6 +47,7 @@ SOFIAPUBFUN int host_ip6_reference(char const *string);
SOFIAPUBFUN
int
host_is_ip_address
(
char
const
*
string
);
SOFIAPUBFUN
int
host_is_domain
(
char
const
*
string
);
SOFIAPUBFUN
int
host_is_valid
(
char
const
*
string
);
SOFIAPUBFUN
int
host_is_local
(
char
const
*
string
);
SOFIAPUBFUN
int
host_has_domain_invalid
(
char
const
*
string
);
SOFIA_END_DECLS
...
...
libsofia-sip-ua/bnf/torture_bnf.c
View file @
bc3aaa44
...
...
@@ -289,6 +289,18 @@ int host_test(void)
TEST
(
span_domain
(
"a.b.-"
),
0
);
TEST
(
span_domain
(
"a.b-"
),
0
);
TEST
(
host_is_localhost
(
"126.0.0.0"
),
0
);
TEST
(
host_is_localhost
(
"127.0.0.0"
),
1
);
TEST
(
host_is_localhost
(
"0.0.0.0"
),
0
);
TEST
(
host_is_localhost
(
"::1"
),
1
);
TEST
(
host_is_localhost
(
"::1"
),
1
);
TEST
(
host_is_localhost
(
"::1:3fff"
),
0
);
TEST
(
host_is_localhost
(
"[::1]"
),
1
);
TEST
(
host_is_localhost
(
"localdomain.domain.org"
),
0
);
TEST
(
host_is_localhost
(
"localhost.domain.org"
),
0
);
TEST
(
host_is_localhost
(
"localhost"
),
1
);
TEST
(
host_is_localhost
(
"localhost.localdomain"
),
1
);
TEST
(
host_has_domain_invalid
(
"invalid"
),
1
);
TEST
(
host_has_domain_invalid
(
"invalid."
),
1
);
TEST
(
host_has_domain_invalid
(
"1.invalid"
),
1
);
...
...
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