/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef lint
#endif
#include <port_before.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <port_after.h>
/* Initialize a "newmsg" object to empty.
*/
int
return (0);
}
/* Initialize a "newmsg" object by copying an existing parsed message.
*/
int
int i, count;
for (i = 0; i < count; i++) {
int x;
return (-1);
x = ns_newmsg_q(handle,
ns_rr_type(rr),
ns_rr_class(rr));
else
ns_rr_type(rr),
ns_rr_rdata(rr));
if (x < 0)
return (-1);
}
}
return (0);
}
/* Set the message-ID in a "newmsg" object.
*/
void
}
/* Set a flag (including rcode or opcode) in a "newmsg" object.
*/
void
}
/* Add a question (or zone, if it's an update) to a "newmsg" object.
*/
int
{
u_char *t;
int n;
return (-1);
}
if (n < 0)
return (-1);
t += n;
return (-1);
}
return (0);
}
/* Add an RR to a "newmsg" object.
*/
int
{
u_char *t;
int n;
return (-1);
}
}
if (n < 0)
return (-1);
t += n;
return (-1);
}
return (-1);
return (0);
}
/* Complete a "newmsg" object and return its size for use in write().
* (Note: the "newmsg" object is also made ready for ns_parserr() etc.)
*/
u_char *t;
}
/* Private. */
/* Copy an RDATA, using compression pointers where RFC1035 permits.
*/
static int
u_char *t = p + NS_INT16SZ;
u_char *s = t;
int n;
switch (type) {
case ns_t_soa:
/* MNAME. */
if (n < 0)
return (-1);
t += n;
return (-1);
/* ANAME. */
if (n < 0)
return (-1);
t += n;
return (-1);
/* Serial, Refresh, Retry, Expiry, and Minimum. */
return (-1);
}
t += (NS_INT32SZ * 5);
break;
case ns_t_ptr:
case ns_t_cname:
case ns_t_ns:
/* PTRDNAME, CNAME, or NSDNAME. */
if (n < 0)
return (-1);
t += n;
break;
default:
t += rdlen;
}
NS_PUT16(t - s, p);
return (0);
}