2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

the great type change

This commit is contained in:
Bob Halley
1998-12-13 23:45:21 +00:00
parent 26ec6d6655
commit 3740b569ae
31 changed files with 754 additions and 816 deletions

View File

@@ -5,7 +5,7 @@ top_srcdir = @top_srcdir@
@BIND9_VERSION@
HEADERS = time.h
HEADERS = sockaddr.h time.h
SUBDIRS =
TARGETS =

View File

@@ -0,0 +1,32 @@
/*
* 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.
*/
#ifndef ISC_SOCKADDR_H
#define ISC_SOCKADDR_H 1
#include <netinet/in.h>
typedef struct isc_sockaddr {
/*
* XXX Must be big enough for all sockaddr types we care about.
*/
union {
struct sockaddr_in sin;
} type;
} isc_sockaddr_t;
#endif /* ISC_SOCKADDR_H */

View File

@@ -18,7 +18,6 @@
#ifndef ISC_TIME_H
#define ISC_TIME_H 1
#include <sys/time.h>
#include <time.h>
#include <isc/result.h>
@@ -32,16 +31,15 @@
* The contents of this structure are private, and MUST NOT be accessed
* directly by callers.
*
* The contents are exposed only so that callers may avoid dynamic allocation
* and instead just declare a 'struct isc_interval'.
* The contents are exposed only to allow callers to avoid dynamic allocation.
*/
typedef struct isc_interval {
unsigned int seconds;
unsigned int nanoseconds;
} *isc_interval_t;
} isc_interval_t;
void
isc_interval_set(isc_interval_t i,
isc_interval_set(isc_interval_t *i,
unsigned int seconds, unsigned int nanoseconds);
/*
* Set 'i' to a value representing an interval of 'seconds' seconds and
@@ -56,7 +54,7 @@ isc_interval_set(isc_interval_t i,
*/
isc_boolean_t
isc_interval_iszero(isc_interval_t i);
isc_interval_iszero(isc_interval_t *i);
/*
* Returns ISC_TRUE iff. 'i' is the zero interval.
*
@@ -74,17 +72,16 @@ isc_interval_iszero(isc_interval_t i);
* The contents of this structure are private, and MUST NOT be accessed
* directly by callers.
*
* The contents are exposed only so that callers may avoid dynamic allocation
* and instead just declare a 'struct isc_time'.
* The contents are exposed only to allow callers to avoid dynamic allocation.
*/
typedef struct isc_time {
time_t seconds;
unsigned int nanoseconds;
} *isc_time_t;
} isc_time_t;
void
isc_time_settoepoch(isc_time_t t);
isc_time_settoepoch(isc_time_t *t);
/*
* Set 't' to the time of the epoch.
*
@@ -95,7 +92,7 @@ isc_time_settoepoch(isc_time_t t);
*/
isc_boolean_t
isc_time_isepoch(isc_time_t t);
isc_time_isepoch(isc_time_t *t);
/*
* Returns ISC_TRUE iff. 't' is the epoch ("time zero").
*
@@ -106,7 +103,7 @@ isc_time_isepoch(isc_time_t t);
*/
isc_result_t
isc_time_get(isc_time_t t);
isc_time_get(isc_time_t *t);
/*
* Set 't' to the current absolute time.
*
@@ -121,7 +118,7 @@ isc_time_get(isc_time_t t);
*/
int
isc_time_compare(isc_time_t t1, isc_time_t t2);
isc_time_compare(isc_time_t *t1, isc_time_t *t2);
/*
* Compare the times referenced by 't1' and 't2'
*
@@ -137,7 +134,7 @@ isc_time_compare(isc_time_t t1, isc_time_t t2);
*/
void
isc_time_add(isc_time_t t, isc_interval_t i, isc_time_t result);
isc_time_add(isc_time_t *t, isc_interval_t *i, isc_time_t *result);
/*
* Add 'i' to 't', storing the result in 'result'.
*
@@ -147,7 +144,7 @@ isc_time_add(isc_time_t t, isc_interval_t i, isc_time_t result);
*/
void
isc_time_subtract(isc_time_t t, isc_interval_t t2, isc_time_t result);
isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result);
/*
* Subtract 'i' from 't', storing the result in 'result'.
*
@@ -158,52 +155,4 @@ isc_time_subtract(isc_time_t t, isc_interval_t t2, isc_time_t result);
* t >= epoch + i (comparing times, not pointers)
*/
/***
*** UNIX-only
***/
void
isc_time_fromtimeval(isc_time_t t, struct timeval *tv);
/*
* Set 't' to the time given by 'ts'.
*
* Requires:
*
* 't' and 'tv' are a valid.
*
*/
void
isc_time_totimeval(isc_time_t t, struct timeval *tv);
/*
* Convert 't' to a UNIX timeval.
*
* Requires:
*
* 't' and 'tv' are a valid.
*
*/
void
isc_time_fromtimespec(isc_time_t t, struct timespec *ts);
/*
* Set 't' to the time given by 'ts'.
*
* Requires:
*
* 't' and 'ts' are a valid.
*
*/
void
isc_time_totimespec(isc_time_t t, struct timespec *ts);
/*
* Convert 't' to a UNIX timespec.
*
* Requires:
*
* 't' and 'ts' are a valid.
*
*/
#endif /* ISC_TIME_H */