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