]> git.sesse.net Git - itkacl/blob - itkacl-2.2/itkacl.h
Add an API for keeping a permanent library context, for performance reasons
[itkacl] / itkacl-2.2 / itkacl.h
1 #ifndef _ITKACL_H
2 #define _ITKACL_H
3
4 /*
5  * itkacl control library, version 2.2
6  *
7  * (C) 2004-2022 Steinar H. Gunderson
8  * GPL, v2.
9  */
10
11 int itkacl_check(const char * const realm, const char * const user,
12                  char *errmsg, size_t errmsg_size);
13
14 /*
15  * Opaque context. A context is created with itkacl_create_ctx()
16  * and freed with itkacl_free_ctx(), and is thread-safe.
17  * If you are making multiple calls to itkacl_check(), it is faster
18  * to reuse the same context over and over (since libunbound can
19  * have rather high setup times depending on configuration).
20  *
21  * Configuration is only reread when the context is created.
22  */
23 struct itkacl_ctx;
24
25 struct itkacl_ctx *itkacl_create_ctx(char *errmsg, size_t errmsg_size);  // Returns NULL on failure.
26 void itkacl_free_ctx(struct itkacl_ctx *ctx);
27
28 int itkacl_check_with_ctx(struct itkacl_ctx *ctx,
29                           const char * const realm, const char * const user,
30                           char *errmsg, size_t errmsg_size);
31
32 #endif  /* !defined(_ITKACL_H) */