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
belle-sip
Commits
bc5d63b8
Commit
bc5d63b8
authored
Feb 27, 2013
by
jehan
Browse files
use res_ninit to guess dns names
parent
3cf4815b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
9 deletions
+47
-9
.cproject
.cproject
+8
-3
configure.ac
configure.ac
+5
-0
src/belle_sip_resolver.c
src/belle_sip_resolver.c
+8
-4
src/dns.c
src/dns.c
+20
-0
src/dns.h
src/dns.h
+6
-2
No files found.
.cproject
View file @
bc5d63b8
...
...
@@ -78,6 +78,11 @@
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry
flags=
"VALUE_WORKSPACE_PATH"
kind=
"sourcePath"
name=
"include/belle-sip"
/>
<entry
flags=
"VALUE_WORKSPACE_PATH"
kind=
"sourcePath"
name=
"src"
/>
<entry
flags=
"VALUE_WORKSPACE_PATH"
kind=
"sourcePath"
name=
"tester"
/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule
moduleId=
"org.eclipse.cdt.core.externalSettings"
/>
...
...
@@ -114,6 +119,7 @@
</target>
</buildTargets>
</storageModule>
<storageModule
moduleId=
"org.eclipse.cdt.core.LanguageSettingsProviders"
/>
<storageModule
moduleId=
"scannerConfiguration"
>
<autodiscovery
enabled=
"true"
problemReportingEnabled=
"true"
selectedProfileId=
""
/>
<profile
id=
"org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"
>
...
...
@@ -199,7 +205,7 @@
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo
instanceId=
"cdt.managedbuild.toolchain.gnu.macosx.base.557244179;cdt.managedbuild.toolchain.gnu.macosx.base.557244179.
779699347
;cdt.managedbuild.tool.gnu.c.compiler.macosx.base.
1327025999
;cdt.managedbuild.tool.gnu.c.compiler.input.
1517483722
"
>
<scannerConfigBuildInfo
instanceId=
"cdt.managedbuild.toolchain.gnu.macosx.base.557244179
.959032290
;cdt.managedbuild.toolchain.gnu.macosx.base.557244179.
959032290.
;cdt.managedbuild.tool.gnu.c.compiler.macosx.base.
3940526
;cdt.managedbuild.tool.gnu.c.compiler.input.
2089521215
"
>
<autodiscovery
enabled=
"true"
problemReportingEnabled=
"true"
selectedProfileId=
"org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"
/>
<profile
id=
"org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"
>
<buildOutputProvider>
...
...
@@ -242,7 +248,7 @@
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo
instanceId=
"cdt.managedbuild.toolchain.gnu.macosx.base.557244179
.959032290
;cdt.managedbuild.toolchain.gnu.macosx.base.557244179.
959032290.
;cdt.managedbuild.tool.gnu.c.compiler.macosx.base.
3940526
;cdt.managedbuild.tool.gnu.c.compiler.input.
2089521215
"
>
<scannerConfigBuildInfo
instanceId=
"cdt.managedbuild.toolchain.gnu.macosx.base.557244179;cdt.managedbuild.toolchain.gnu.macosx.base.557244179.
779699347
;cdt.managedbuild.tool.gnu.c.compiler.macosx.base.
1327025999
;cdt.managedbuild.tool.gnu.c.compiler.input.
1517483722
"
>
<autodiscovery
enabled=
"true"
problemReportingEnabled=
"true"
selectedProfileId=
"org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"
/>
<profile
id=
"org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"
>
<buildOutputProvider>
...
...
@@ -286,5 +292,4 @@
</profile>
</scannerConfigBuildInfo>
</storageModule>
<storageModule
moduleId=
"org.eclipse.cdt.core.LanguageSettingsProviders"
/>
</cproject>
configure.ac
View file @
bc5d63b8
...
...
@@ -71,6 +71,11 @@ CPPFLAGS_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $ANTLR_CFLAGS"
AC_CHECK_HEADERS([antlr3.h], [found_antlr3=yes])
AC_CHECK_DECL([antlr3StringStreamNew], [found_antlr3=yes], [found_antlr3=no],[#include <antlr3.h>])
AC_CHECK_DECL([res_ninit]
,[AC_DEFINE(HAVE_RESINIT,1,[Defined when res_ninit api is available]) LIBS="$LIBS -lresolv"]
,[foo=bar]
,[#include <resolv.h>])
CPPFLAGS=$CPPFLAGS_save
if test "$found_antlr3" != "yes" ; then
...
...
src/belle_sip_resolver.c
View file @
bc5d63b8
...
...
@@ -25,7 +25,7 @@
static
struct
dns_resolv_conf
*
resconf
(
belle_sip_resolver_context_t
*
ctx
)
{
#if
ndef
_WIN32
#if
!
_WIN32
&& !HAVE_RESINIT
const
char
*
path
;
#endif
int
error
;
...
...
@@ -43,12 +43,16 @@ static struct dns_resolv_conf *resconf(belle_sip_resolver_context_t *ctx) {
if
(
error
)
{
belle_sip_error
(
"%s dns_resconf_loadwin error"
,
__FUNCTION__
);
}
#else
#ifdef ANDROID
#elif ANDROID
error
=
dns_resconf_loadandroid
(
ctx
->
resconf
);
if
(
error
)
{
belle_sip_error
(
"%s dns_resconf_loadandroid error"
,
__FUNCTION__
);
}
#elif HAVE_RESINIT
error
=
dns_resconf_loadfromresolv
(
ctx
->
resconf
);
if
(
error
)
{
belle_sip_error
(
"%s dns_resconf_loadfromresolv error"
,
__FUNCTION__
);
}
#else
path
=
"/etc/resolv.conf"
;
error
=
dns_resconf_loadpath
(
ctx
->
resconf
,
path
);
...
...
@@ -63,7 +67,7 @@ static struct dns_resolv_conf *resconf(belle_sip_resolver_context_t *ctx) {
belle_sip_message
(
"%s dns_nssconf_loadpath error [%s]: %s"
,
__FUNCTION__
,
path
,
dns_strerror
(
error
));
}
#endif
#endif
return
ctx
->
resconf
;
}
...
...
src/dns.c
View file @
bc5d63b8
...
...
@@ -104,6 +104,9 @@
#include "dns.h"
#ifdef HAVE_RESINIT
#include <resolv.h>
#endif
/*
* C O M P I L E R A N N O T A T I O N S
...
...
@@ -4367,6 +4370,23 @@ int dns_resconf_loadandroid(struct dns_resolv_conf *resconf) {
}
/* dns_resconf_loadandroid */
#endif
#ifdef HAVE_RESINIT
int
dns_resconf_loadfromresolv
(
struct
dns_resolv_conf
*
resconf
)
{
struct
__res_state
res
;
union
res_sockaddr_union
addresses
[
3
];
int
i
,
error
;
if
((
error
=
res_ninit
(
&
res
)))
{
return
error
;
}
for
(
i
=
0
;
i
<
res_getservers
(
&
res
,
addresses
,
res
.
nscount
)
&&
i
<
3
/*only 3 element*/
;
i
++
)
{
memcpy
(
&
resconf
->
nameserver
[
i
],
&
addresses
[
i
],
sizeof
(
union
res_sockaddr_union
));
}
res_ndestroy
(
&
res
);
return
i
>
0
?
0
:-
1
;
}
#endif
/*HAVE_RESINIT*/
struct
dns_anyconf
{
char
*
token
[
16
];
...
...
src/dns.h
View file @
bc5d63b8
...
...
@@ -25,7 +25,9 @@
*/
#ifndef DNS_H
#define DNS_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stddef.h>
/* size_t offsetof() */
#include <stdio.h>
/* FILE */
...
...
@@ -911,7 +913,9 @@ int dns_resconf_loadpath(struct dns_resolv_conf *, const char *);
#ifdef _WIN32
int
dns_resconf_loadwin
(
struct
dns_resolv_conf
*
);
#endif
#ifdef HAVE_RESINIT
int
dns_resconf_loadfromresolv
(
struct
dns_resolv_conf
*
resconf
);
#endif
/*HAVE_RESINIT*/
int
dns_nssconf_loadfile
(
struct
dns_resolv_conf
*
,
FILE
*
);
int
dns_nssconf_loadpath
(
struct
dns_resolv_conf
*
,
const
char
*
);
...
...
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