#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <asterisk/channel.h>
#include <asterisk/logger.h>
#include <asterisk/srv.h>
#include <asterisk/dns.h>
#include <asterisk/options.h>
Go to the source code of this file.
Data Structures | |
struct | srv |
struct | srv_context |
Functions | |
int | ast_get_srv (struct ast_channel *chan, char *host, int hostlen, int *port, const char *service) |
Variables | |
srv | __packed__ |
|
Definition at line 93 of file srv.c. References ast_autoservice_start(), ast_autoservice_stop(), ast_search_dns(), srv_context::host, srv_context::hostlen, and srv_context::port.
00094 { 00095 struct srv_context context; 00096 int ret; 00097 00098 context.host = host; 00099 context.hostlen = hostlen; 00100 context.port = port; 00101 00102 if (chan && ast_autoservice_start(chan) < 0) 00103 return -1; 00104 00105 ret = ast_search_dns(&context, service, C_IN, T_SRV, srv_callback); 00106 00107 if (chan) 00108 ret |= ast_autoservice_stop(chan); 00109 00110 if (ret <= 0) { 00111 strcpy(host, ""); 00112 *port = -1; 00113 return ret; 00114 } 00115 return ret; 00116 } |
|
|