Integrate 0.9.8 NDS read-only lab, repair upstream hook and simplify setup guidance
This commit is contained in:
32
nds/nds_directory.h
Normal file
32
nds/nds_directory.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef MARS_NDS_DIRECTORY_H
|
||||
#define MARS_NDS_DIRECTORY_H
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <sqlite3.h>
|
||||
/* Trusted local backend only: no wire encoding or authentication. */
|
||||
#define NDS_DN_MAX 511
|
||||
#define NDS_NAME_MAX 63
|
||||
#define NDS_PAGE_MAX 128
|
||||
#define NDS_OK 0
|
||||
#define NDS_NOT_FOUND 1
|
||||
#define NDS_INVALID 2
|
||||
#define NDS_DB_ERROR 3
|
||||
#define NDS_AMBIGUOUS 4
|
||||
struct nds_entry { uint32_t id, parent; char dn[NDS_DN_MAX+1], name[NDS_NAME_MAX+1], cls[24]; int enabled; };
|
||||
enum nds_scope { NDS_BASE=0, NDS_ONE=1, NDS_SUBTREE=2 };
|
||||
int nds_open(sqlite3 **db, const char *path);
|
||||
int nds_resolve(sqlite3 *db, const char *dn, struct nds_entry *out);
|
||||
int nds_read(sqlite3 *db, uint32_t id, struct nds_entry *out);
|
||||
/* after=0 for first page; next=0 at EOF, else last ID. Exact name/class filters, NULL = all. */
|
||||
int nds_search(sqlite3 *db, uint32_t base, enum nds_scope scope, const char *name, const char *cls, uint32_t after, struct nds_entry *out, size_t capacity, size_t *count, uint32_t *next);
|
||||
/* Local schema subset. These enum values are internal, NOT NDAP wire IDs.
|
||||
* No credential, membership or ACL attributes are exposed by this API. */
|
||||
enum nds_attr_kind { NDS_ATTR_CI_STRING=1, NDS_ATTR_DN, NDS_ATTR_BOOL };
|
||||
#define NDS_ATTR_MAX 8
|
||||
#define NDS_BUFFER_SMALL 5
|
||||
struct nds_attr { const char *name; enum nds_attr_kind kind; char value[NDS_DN_MAX+1]; };
|
||||
/* On insufficient capacity, count is the required size, out untouched. */
|
||||
int nds_attributes(sqlite3 *db, uint32_t id, struct nds_attr *out, size_t capacity, size_t *count);
|
||||
/* NDS_NOT_FOUND means missing object or absent attribute, not a false match. */
|
||||
int nds_compare(sqlite3 *db, uint32_t id, const char *attribute, const char *value, int *matched);
|
||||
#endif
|
||||
Reference in New Issue
Block a user