2000-01-02 04:20:21 +00:00
|
|
|
/* Common database open/close routines for nss_db.
|
2016-01-04 16:05:18 +00:00
|
|
|
Copyright (C) 1999-2016 Free Software Foundation, Inc.
|
2000-01-02 04:20:21 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:58:11 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
2000-01-02 04:20:21 +00:00
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:58:11 +00:00
|
|
|
Lesser General Public License for more details.
|
2000-01-02 04:20:21 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
2000-01-02 04:20:21 +00:00
|
|
|
|
|
|
|
#ifndef _NSS_DB_H
|
|
|
|
#define _NSS_DB_H 1
|
|
|
|
|
2000-05-08 04:50:45 +00:00
|
|
|
#include <nss.h>
|
2000-01-02 04:20:21 +00:00
|
|
|
#include <stdint.h>
|
2015-09-08 21:11:03 +00:00
|
|
|
#include <libc-lock.h>
|
2000-01-02 04:20:21 +00:00
|
|
|
|
2000-01-08 05:28:22 +00:00
|
|
|
|
2011-06-15 02:21:51 +00:00
|
|
|
/* String table index type. */
|
|
|
|
typedef uint32_t stridx_t;
|
2000-05-08 04:50:45 +00:00
|
|
|
|
2011-06-15 02:21:51 +00:00
|
|
|
/* Database file header. */
|
|
|
|
struct nss_db_header
|
2000-05-08 04:50:45 +00:00
|
|
|
{
|
2011-06-15 02:21:51 +00:00
|
|
|
uint32_t magic;
|
|
|
|
#define NSS_DB_MAGIC 0xdd110601
|
|
|
|
uint32_t ndbs;
|
|
|
|
uint64_t valstroffset;
|
|
|
|
uint64_t valstrlen;
|
|
|
|
uint64_t allocate;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
char id;
|
|
|
|
char pad[sizeof (uint32_t) - 1];
|
|
|
|
uint32_t hashsize;
|
|
|
|
uint64_t hashoffset;
|
|
|
|
uint64_t keyidxoffset;
|
|
|
|
uint64_t keystroffset;
|
|
|
|
} dbs[0];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Information about mapped database. */
|
|
|
|
struct nss_db_map
|
2000-01-02 08:45:58 +00:00
|
|
|
{
|
2011-06-15 02:21:51 +00:00
|
|
|
struct nss_db_header *header;
|
|
|
|
size_t len;
|
|
|
|
};
|
2000-01-02 08:45:58 +00:00
|
|
|
|
2000-01-02 04:20:21 +00:00
|
|
|
|
2000-05-08 04:50:45 +00:00
|
|
|
/* Open the database stored in FILE. If succesful, store the database
|
2011-06-15 02:21:51 +00:00
|
|
|
handle in *MAPPINGP or a file descriptor for the file in *FDP and
|
|
|
|
return NSS_STATUS_SUCCESS. On failure, return the appropriate
|
2000-05-08 04:50:45 +00:00
|
|
|
lookup status. */
|
2011-06-15 02:21:51 +00:00
|
|
|
enum nss_status internal_setent (const char *file,
|
|
|
|
struct nss_db_map *mappingp);
|
|
|
|
|
|
|
|
/* Close the database FD. */
|
|
|
|
extern void internal_endent (struct nss_db_map *mapping);
|
2000-01-08 05:28:22 +00:00
|
|
|
|
2000-01-02 04:20:21 +00:00
|
|
|
#endif /* nss_db.h */
|