summaryrefslogtreecommitdiffstats
path: root/src/sss_client/nss_mc.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/sss_client/nss_mc.h')
-rw-r--r--src/sss_client/nss_mc.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/sss_client/nss_mc.h b/src/sss_client/nss_mc.h
new file mode 100644
index 00000000..35cefe5b
--- /dev/null
+++ b/src/sss_client/nss_mc.h
@@ -0,0 +1,62 @@
+/*
+ * System Security Services Daemon. NSS client interface
+ *
+ * Copyright (C) Simo Sorce 2011
+ *
+ * This program is free software; you can redistribute it and/or 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.
+ *
+ * This program 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* NSS interfaces to mmap cache */
+
+#ifndef _NSS_MC_H_
+#define _NSS_MC_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <pwd.h>
+#include "util/mmap_cache.h"
+
+#ifndef HAVE_ERRNO_T
+#define HAVE_ERRNO_T
+typedef int errno_t;
+#endif
+
+/* common stuff */
+struct sss_cli_mc_ctx {
+ bool initialized;
+ int fd;
+
+ uint32_t seed; /* seed from the tables header */
+
+ void *mmap_base; /* base address of mmap */
+ size_t mmap_size; /* total size of mmap */
+
+ uint8_t *data_table; /* data table address (in mmap) */
+ uint32_t dt_size; /* size of data table */
+
+ uint32_t *hash_table; /* hash table address (in mmap) */
+ uint32_t ht_size; /* size of hash table */
+};
+
+errno_t sss_nss_mc_get_ctx(const char *name, struct sss_cli_mc_ctx *ctx);
+errno_t sss_nss_check_header(struct sss_cli_mc_ctx *ctx);
+uint32_t sss_nss_mc_hash(struct sss_cli_mc_ctx *ctx,
+ const char *key, size_t len);
+errno_t sss_nss_mc_get_record(struct sss_cli_mc_ctx *ctx,
+ uint32_t slot, struct sss_mc_rec **_rec);
+errno_t sss_nss_str_ptr_from_buffer(char **str, void **cookie,
+ char *buf, size_t len);
+
+#endif /* _NSS_MC_H_ */