rdata.c revision 217f572018871cdf09db052a676b9933512cdbfa
/*
* Copyright (C) 1998 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* 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 INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM 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.
*/
/* $Id: rdata.c,v 1.22 1999/02/02 22:34:20 marka Exp $ */
#include <config.h>
#include <stdio.h>
#include <time.h>
#include <isc/assertions.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
#define RETERR(x) do { \
dns_result_t __r = (x); \
if (__r != DNS_R_SUCCESS) \
return (__r); \
} while (0)
dns_name_t *target);
unsigned int type);
unsigned int length);
static const char hexdigits[] = "0123456789abcdef";
static const char decdigits[] = "0123456789";
static const char octdigits[] = "01234567";
#include "code.h"
#define META 0x0001
#define RESERVED 0x0002
#define METATYPES \
{ 0, "NONE", META }, \
#define METACLASSES \
{ 0, "NONE", META }, \
struct tbl {
int value;
char *name;
int flags;
/***
*** Initialization
***/
void
/* ISC_LIST_INIT(rdata->list); */
}
/***
*** Comparisons
***/
int
int result = 0;
if (use_default) {
}
return (result);
}
/***
*** Conversions
***/
void
isc_region_t *r) {
}
void
}
isc_buffer_t *target) {
if (use_default)
(void)NULL;
/* We should have consumed all out buffer */
}
if (result != DNS_R_SUCCESS) {
}
return (result);
}
isc_buffer_t *target) {
if (use_default) {
return (DNS_R_NOSPACE);
return (DNS_R_SUCCESS);
}
return (result);
}
isc_buffer_t *target) {
if (use_default)
(void)NULL;
/*
* Consume to end of line / file.
* If not at end of line initially set error code.
*/
do {
!= ISC_R_SUCCESS) {
if (result == DNS_R_SUCCESS)
break;
if (result == DNS_R_SUCCESS)
} else
break;
} while (1);
}
if (result != DNS_R_SUCCESS) {
}
return (result);
}
if (use_default)
(void)NULL;
return (result);
}
void *source,
isc_buffer_t *target) {
if (use_default)
(void)NULL;
}
if (result != DNS_R_SUCCESS)
return (result);
}
if (use_default)
(void)NULL;
return (result);
}
int i = 0;
unsigned int n;
return (DNS_R_NOTIMPLEMENTED);
return (DNS_R_SUCCESS);
}
i++;
}
return (DNS_R_UNKNOWN);
}
int i = 0;
unsigned int n;
return (DNS_R_NOSPACE);
isc_buffer_add(target, n);
return (DNS_R_SUCCESS);
}
i++;
}
return (DNS_R_UNKNOWN);
}
int i = 0;
unsigned int n;
return (DNS_R_NOTIMPLEMENTED);
return (DNS_R_SUCCESS);
}
i++;
}
return (DNS_R_UNKNOWN);
}
int i = 0;
unsigned int n;
return (DNS_R_NOSPACE);
isc_buffer_add(target, n);
return (DNS_R_SUCCESS);
}
i++;
}
return (DNS_R_UNKNOWN);
}
/* Private function */
static unsigned int
}
static dns_result_t
unsigned int tl;
unsigned int n;
unsigned char *sp;
char *tp;
n = *sp++;
if (tl < 1)
return (DNS_R_NOSPACE);
*tp++ = '"';
tl--;
while (n--) {
if (tl < 4)
return (DNS_R_NOSPACE);
tp += 4;
tl -= 4;
continue;
}
if (tl < 2)
return (DNS_R_NOSPACE);
*tp++ = '\\';
tl--;
}
if (tl < 1)
return (DNS_R_NOSPACE);
tl--;
}
if (tl < 1)
return (DNS_R_NOSPACE);
*tp++ = '"';
tl--;
return (DNS_R_SUCCESS);
}
static dns_result_t
return (DNS_R_NOSPACE);
return (DNS_R_TEXTTOLONG);
return (DNS_R_SUCCESS);
}
static dns_result_t
unsigned int n;
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTEDEND);
return (DNS_R_NOSPACE);
isc_buffer_forward(source, n);
isc_buffer_add(target, n);
return (DNS_R_SUCCESS);
}
static isc_boolean_t
goto return_false;
goto return_false;
goto return_false;
goto return_false;
return (ISC_TRUE);
return (ISC_FALSE);
}
static dns_result_t
unsigned int l;
return (DNS_R_NOSPACE);
isc_buffer_add(target, l);
return (DNS_R_SUCCESS);
}
static isc_boolean_t
}
static void
unsigned int type) {
}
static dns_result_t
return (DNS_R_NOSPACE);
return (DNS_R_SUCCESS);
}
static dns_result_t
if (value > 0xffff)
return (DNS_R_RANGE);
return (DNS_R_NOSPACE);
return (DNS_R_SUCCESS);
}
static unsigned long
unsigned long value;
return(value);
}
static unsigned short
}
static dns_result_t
isc_boolean_t eol) {
if (expect == isc_tokentype_qstring)
if (expect == isc_tokentype_number)
return (DNS_R_UNEXPECTED);
return (DNS_R_SUCCESS);
return (DNS_R_SUCCESS);
return(DNS_R_UNEXPECTEDEND);
return (DNS_R_UNEXPECTED);
}
return (DNS_R_SUCCESS);
}
static dns_result_t
return (DNS_R_NOSPACE);
return (DNS_R_SUCCESS);
}
static int
unsigned int l;
int result;
else
}
static int
char *s;
return (-1);
return (-1);
return (s - hexdigits);
}
static int
char *s;
return (-1);
return (-1);
return (s - decdigits);
}
static const char base64[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
static dns_result_t
char buf[5];
int loops = 0;
loops = 0;
}
}
}
return (DNS_R_SUCCESS);
}
static dns_result_t
int digits = 0;
int val[4];
unsigned char buf[3];
int seen_end = 0;
unsigned int i;
char *s;
int n;
while (1) {
break;
if (seen_end)
return (DNS_R_SYNTAX);
return (DNS_R_SYNTAX);
if (digits == 4) {
return (DNS_R_SYNTAX);
return (DNS_R_SYNTAX);
if (n != 3) {
seen_end = 1;
val[2] = 0;
val[3] = 0;
}
digits = 0;
}
}
}
if (digits)
return (DNS_R_SYNTAX);
return (DNS_R_SUCCESS);
}
static dns_result_t
long long start;
long long base;
long long t;
char buf[sizeof "YYYYMMDDHHMMSS"];
int secs;
/* find the right epoch */
start -= 0x7fffffff;
base = 0;
base += 0x80000000;
base += 0x80000000;
}
t -= secs;
}
t -= secs;
}
while (86400 <= t) {
t -= 86400;
}
while (3600 <= t) {
t -= 3600;
}
while (60 <= t) {
t -= 60;
}
/* yy mm dd HH MM SS */
}
static dns_result_t
unsigned long value;
int secs;
int i;
do { \
return (DNS_R_RANGE); \
} while (0)
return (DNS_R_SYNTAX);
return (DNS_R_SYNTAX);
/* calulate seconds since epoch */
for (i = 0; i < (month - 1) ; i++)
value += 86400;
for (i = 1970; i < year; i++) {
}
}