Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

srv.h File Reference

Go to the source code of this file.

Functions

int ast_get_srv (struct ast_channel *chan, char *host, int hostlen, int *port, const char *service)


Function Documentation

int ast_get_srv struct ast_channel chan,
char *  host,
int  hostlen,
int *  port,
const char *  service
 

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 }


Generated on Fri Feb 27 12:19:53 2004 for Asterisk by doxygen 1.3.5