*** empty log message ***

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5431 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2005-04-06 21:12:32 +00:00
parent a7230de79a
commit d254db31c8
7 changed files with 25 additions and 6 deletions

View File

@@ -265,7 +265,7 @@ OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
cdr.o tdd.o acl.o rtp.o manager.o asterisk.o ast_expr.o \
dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
utils.o config_old.o plc.o jitterbuf.o
utils.o config_old.o plc.o jitterbuf.o dnsmgr.o
ifeq (${OSARCH},Darwin)
OBJS+=poll.o dlfcn.o
ASTLINK=-Wl,-dynamic

View File

@@ -1960,6 +1960,10 @@ int main(int argc, char *argv[])
printf(term_quit());
exit(1);
}
if (dnsmgr_init()) {
printf(term_quit());
exit(1);
}
#if 0
/* This should no longer be necessary */
/* sync cust config and reload some internals in case a custom config handler binded to them */

View File

@@ -52,5 +52,8 @@ extern int term_init(void);
extern int astdb_init(void);
/* Provided by channel.c */
extern void ast_channels_init(void);
/* Provided by dnsmgr.c */
extern int dnsmgr_init(void);
extern void dnsmgr_reload(void);
#endif

View File

@@ -37,6 +37,7 @@
#include <asterisk/causes.h>
#include <asterisk/localtime.h>
#include <asterisk/aes.h>
#include <asterisk/dnsmgr.h>
#include <sys/mman.h>
#include <arpa/inet.h>
#include <dirent.h>
@@ -265,6 +266,7 @@ struct iax2_peer {
char peercontext[AST_MAX_EXTENSION]; /* Context to pass to peer */
char mailbox[AST_MAX_EXTENSION]; /* Mailbox */
struct ast_codec_pref prefs;
struct ast_dnsmgr_entry *dnsmgr; /* DNS refresh manager */
struct sockaddr_in addr;
int formats;
int sockfd; /* Socket to use for transmission */
@@ -7873,7 +7875,7 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, in
ast_sched_del(sched, peer->expire);
peer->expire = -1;
ast_clear_flag(peer, IAX_DYNAMIC);
if (ast_get_ip(&peer->addr, v->value)) {
if (ast_dnsmgr_lookup(v->value, &peer->addr.sin_addr, &peer->dnsmgr)) {
free(peer);
return NULL;
}
@@ -8193,6 +8195,8 @@ static void destroy_peer(struct iax2_peer *peer)
if (peer->callno > 0)
iax2_destroy(peer->callno);
register_peer_exten(peer, 0);
if (peer->dnsmgr)
ast_dnsmgr_release(peer->dnsmgr);
free(peer);
}

View File

@@ -41,6 +41,7 @@
#include <asterisk/utils.h>
#include <asterisk/file.h>
#include <asterisk/astobj.h>
#include <asterisk/dnsmgr.h>
#ifdef OSP_SUPPORT
#include <asterisk/astosp.h>
#endif
@@ -549,6 +550,7 @@ struct sip_peer {
int rtpkeepalive; /* Send RTP packets for keepalive */
ast_group_t callgroup; /* Call group */
ast_group_t pickupgroup; /* Pickup group */
struct ast_dnsmgr_entry *dnsmgr;/* DNS refresh manager for peer */
struct sockaddr_in addr; /* IP address of peer */
struct in_addr mask;
@@ -1253,6 +1255,8 @@ static void sip_destroy_peer(struct sip_peer *peer)
speerobjs--;
clear_realm_authentication(peer->auth);
peer->auth = (struct sip_auth *) NULL;
if (peer->dnsmgr)
ast_dnsmgr_release(peer->dnsmgr);
free(peer);
}

View File

@@ -215,6 +215,10 @@ int ast_module_reload(const char *name)
ast_rtp_reload();
reloaded = 2;
}
if (!name || !strcasecmp(name, "dnsmgr")) {
dnsmgr_reload();
reloaded = 2;
}
time(&ast_lastreloadtime);
ast_mutex_lock(&modlock);

View File

@@ -150,8 +150,8 @@ static int gethostbyname_r (const char *name, struct hostent *ret, char *buf,
#endif
/* Recursive thread safe version of gethostbyname that replaces the
standard gethostbyname (which is not recursive)
/* Re-entrant (thread safe) version of gethostbyname that replaces the
standard gethostbyname (which is not thread safe)
*/
struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp)
{
@@ -457,4 +457,4 @@ char *ast_strcasestr(const char *haystack, const char *needle)
return NULL;
}
}
#endif
#endif /* LINUX */