*** empty log message ***
authorKevin P. Fleming <kpfleming@digium.com>
Wed, 6 Apr 2005 21:12:32 +0000 (21:12 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Wed, 6 Apr 2005 21:12:32 +0000 (21:12 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5431 65c4cc65-6c06-0410-ace0-fbb531ad65f3

Makefile
asterisk.c
asterisk.h
channels/chan_iax2.c
channels/chan_sip.c
loader.c
utils.c

index 38b738f..79bb3b2 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -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
index 47fe5f1..ee0bef9 100755 (executable)
@@ -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 */
index e1cf447..09410fd 100755 (executable)
@@ -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
index 2c66ecc..40dbdb8 100755 (executable)
@@ -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 */
@@ -7872,8 +7874,8 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, in
                                        if (peer->expire > -1)
                                                ast_sched_del(sched, peer->expire);
                                        peer->expire = -1;
-                                       ast_clear_flag(peer, IAX_DYNAMIC);      
-                                       if (ast_get_ip(&peer->addr, v->value)) {
+                                       ast_clear_flag(peer, IAX_DYNAMIC);
+                                       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);
 }
 
index 2f053f7..58db1ec 100755 (executable)
@@ -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);
 }
 
index 911fb94..20d1c3f 100755 (executable)
--- a/loader.c
+++ b/loader.c
@@ -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);
diff --git a/utils.c b/utils.c
index 6d99111..b485fd3 100755 (executable)
--- a/utils.c
+++ b/utils.c
@@ -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 */