Chapter Contents

Previous

Next
res_mkquery

res_mkquery



Makes a Domain Name Server Packet

Portability: UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
IMPLEMENTATION
RELATED FUNCTIONS


SYNOPSIS

#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>

int res_mkquery(int op, char *dname, int class, int type, char *data,
                int datalen, struct rrec *newrr, char *buf, int buflen);


DESCRIPTION

res_mkquery makes a packet for use with an Internet domain name server and places it in the buffer area pointed to by buf , with buflen specifying the length in bytes of the buffer. The other seven arguments correspond directly to the fields of a domain name query:

dname
is the domain name.

rrec
is the structure for the passage of new resource records.

class and type
are the class and type of the query.

data
gives the address of an array or string of data bytes to be included in the query.

datalen
specifies the integer length in bytes of the data array or string pointed to by data .

op
is the specified option. It can be any one of the following query types defined in the <arpa/nameser.h> header file:
QUERY standard query
IQUERY inverse query
STATUS name server status query.

This routine implements a part of the resolver, which is a set of routines providing a programming interface for communication with Internet name servers.

For information on buffer formats for Internet name servers, as well as more detailed information about res_mkquery , refer to Chapter 20, "The Domain Name System," in Internetworking with TCP/IP, Volume 1, by Douglas E. Comer, Prentice Hall, 1991.


RETURN VALUE

If successful, res_mkquery returns the size of the query. It returns a -1 if the size of the query is greater than buflen .


IMPLEMENTATION

The SAS/C version of res_mkquery is a direct port from the BSD UNIX Socket Library.


RELATED FUNCTIONS

dn_comp , res_init , res_send


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.