From d19687d6ebc545b633e14c07429f7892a599d0b9 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 15 Sep 2004 08:25:49 +0000 Subject: Update. 2004-09-15 Ulrich Drepper * nscd/Makefile (rountines): Add nscd_getai. (nscd-modules): Add aicache. * nscd/aicache.c: New file. * nscd/nscd_getai.c: New file. * nscd/cache.c (prune_cache): Handle GETAI request type. * nscd/connections.c: Add GETAI support in request handling. * nscd/nscd-client.h (request_type): Add GETAI. Define ai_response_header and struct nscd_ai_result types. (struct datahead): Add aidata field. Declare __nscd_getai. * nscd/nscd.c: Add getaddrinfo definition to catch problems. * nscd/nscd.h: Declare addhstai and readdhstai. * sysdeps/posix/getaddrinfo.c: Add support for using cached results. * nscd/nscd-client.h (struct datahead): Use uint8_t instead of bool. --- nscd/nscd-client.h | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'nscd/nscd-client.h') diff --git a/nscd/nscd-client.h b/nscd/nscd-client.h index 8f3f3a1..1a0dd73 100644 --- a/nscd/nscd-client.h +++ b/nscd/nscd-client.h @@ -61,6 +61,7 @@ typedef enum GETFDPW, GETFDGR, GETFDHST, + GETAI, LASTREQ } request_type; @@ -118,6 +119,28 @@ typedef struct } hst_response_header; +/* Structure sent in reply to addrinfo query. Note that this struct is + sent also if the service is disabled or there is no record found. */ +typedef struct +{ + int32_t version; + int32_t found; + nscd_ssize_t naddrs; + nscd_ssize_t addrslen; + nscd_ssize_t canonlen; + int32_t error; +} ai_response_header; + +/* Structure filled in by __nscd_getai. */ +struct nscd_ai_result +{ + int naddrs; + char *canon; + uint8_t *family; + char *addrs; +}; + + /* Type for offsets in data part of database. */ typedef uint32_t ref_t; /* Value for invalid/no reference. */ @@ -136,9 +159,9 @@ struct datahead nscd_ssize_t allocsize; /* Allocated Bytes. */ nscd_ssize_t recsize; /* Size of the record. */ nscd_time_t timeout; /* Time when this entry becomes invalid. */ - bool notfound; /* Nonzero if data has not been found. */ + uint8_t notfound; /* Nonzero if data has not been found. */ uint8_t nreloads; /* Reloads without use. */ - bool usable; /* False if the entry must be ignored. */ + uint8_t usable; /* False if the entry must be ignored. */ uint64_t :40; /* Alignment. */ /* We need to have the following element aligned for the response @@ -149,6 +172,7 @@ struct datahead pw_response_header pwdata; gr_response_header grdata; hst_response_header hstdata; + ai_response_header aidata; nscd_ssize_t align1; nscd_time_t align2; } data[0]; @@ -270,4 +294,8 @@ extern const struct datahead *__nscd_cache_search (request_type type, size_t keylen, const struct mapped_database *mapped); +/* Look up in addrinfo cache. */ +extern int __nscd_getai (const char *key, struct nscd_ai_result **result, + int *h_errnop); + #endif /* nscd.h */ -- cgit v1.1