#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 91 of file srv.c. References ast_autoservice_start(), ast_autoservice_stop(), ast_search_dns(), srv_context::host, srv_context::hostlen, and srv_context::port.
00092 { 00093 struct srv_context context; 00094 int ret; 00095 00096 context.host = host; 00097 context.hostlen = hostlen; 00098 context.port = port; 00099 00100 if (chan && ast_autoservice_start(chan) < 0) 00101 return -1; 00102 00103 ret = ast_search_dns(&context, service, C_IN, T_SRV, srv_callback); 00104 00105 if (chan) 00106 ret |= ast_autoservice_stop(chan); 00107 00108 if (ret <= 0) { 00109 strcpy(host, ""); 00110 *port = -1; 00111 return ret; 00112 } 00113 return ret; 00114 } |
|
|