Sun Java System Web Proxy Server 4.0.11 NSAPI Developer's Guide

dns_set_hostent

The dns_set_hostent function sets the DNS host entry information in the request. If this function set, the proxy won’t try to resolve host information by itself. Instead, the function will use this host information that was already resolved within custom DNS resolution SAF.

Syntax

int dns_set_hostent(struct hostent *hostent, Session *sn, Request *rq);

Returns

REQ_PROCEED on success or REQ_ABORTED on error.

Parameters

struct hostent *hostent is a pointer to the host entry structure.

Session *sn identifies the Session structure.

Request *rq identifies the Request structure.

Example

int my_dns_func(pblock *pb, Session *sn, Request *rq)
{
    char *host = pblock_findval("dns-host", rq->vars);
    struct hostent *hostent;
    hostent = gethostbyname(host);//replace with custom DNS implementation
    dns_set_hostent(hostent, sn, rq);
    return REQ_PROCEED;
}