]> git.ipfire.org Git - thirdparty/glibc.git/blame - nss/nss_db/nss_db.h
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / nss / nss_db / nss_db.h
CommitLineData
9a6450d5 1/* Common database open/close routines for nss_db.
d4697bc9 2 Copyright (C) 1999-2014 Free Software Foundation, Inc.
9a6450d5
UD
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9a6450d5
UD
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 13 Lesser General Public License for more details.
9a6450d5 14
41bdb6e2 15 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
9a6450d5
UD
18
19#ifndef _NSS_DB_H
20#define _NSS_DB_H 1
21
d1c2a14c 22#include <nss.h>
9a6450d5 23#include <stdint.h>
2666d441 24#include <bits/libc-lock.h>
9a6450d5 25
9d8525f2 26
2666d441
UD
27/* String table index type. */
28typedef uint32_t stridx_t;
d1c2a14c 29
2666d441
UD
30/* Database file header. */
31struct nss_db_header
d1c2a14c 32{
2666d441
UD
33 uint32_t magic;
34#define NSS_DB_MAGIC 0xdd110601
35 uint32_t ndbs;
36 uint64_t valstroffset;
37 uint64_t valstrlen;
38 uint64_t allocate;
39 struct
40 {
41 char id;
42 char pad[sizeof (uint32_t) - 1];
43 uint32_t hashsize;
44 uint64_t hashoffset;
45 uint64_t keyidxoffset;
46 uint64_t keystroffset;
47 } dbs[0];
48};
49
50
51/* Information about mapped database. */
52struct nss_db_map
793bd4d9 53{
2666d441
UD
54 struct nss_db_header *header;
55 size_t len;
56};
793bd4d9 57
9a6450d5 58
d1c2a14c 59/* Open the database stored in FILE. If succesful, store the database
2666d441
UD
60 handle in *MAPPINGP or a file descriptor for the file in *FDP and
61 return NSS_STATUS_SUCCESS. On failure, return the appropriate
d1c2a14c 62 lookup status. */
2666d441
UD
63enum nss_status internal_setent (const char *file,
64 struct nss_db_map *mappingp);
65
66/* Close the database FD. */
67extern void internal_endent (struct nss_db_map *mapping);
9d8525f2 68
9a6450d5 69#endif /* nss_db.h */