sss_simpleifp 2.6.1
sss_sifp.h
1/*
2 Authors:
3 Pavel Březina <pbrezina@redhat.com>
4
5 Copyright (C) 2014 Red Hat
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#ifndef SSS_SIFP_H_
22#define SSS_SIFP_H_
23
24#include <stdint.h>
25#include <stdbool.h>
26#include <unistd.h>
27#include <dhash.h>
28
45#define SSS_SIFP_ADDRESS "org.freedesktop.sssd.infopipe"
46
47/* Backwards-compatible address */
48#define SSS_SIFP_IFP SSS_SIFP_ADDRESS
49
50/* Backwards-compatible interface definitions */
51#define SSS_SIFP_IFACE_IFP SSS_SIFP_IFP
52#define SSS_SIFP_IFACE_COMPONENTS "org.freedesktop.sssd.infopipe.Components"
53#define SSS_SIFP_IFACE_SERVICES "org.freedesktop.sssd.infopipe.Services"
54#define SSS_SIFP_IFACE_DOMAINS "org.freedesktop.sssd.infopipe.Domains"
55#define SSS_SIFP_IFACE_USERS "org.freedesktop.sssd.infopipe.Users"
56#define SSS_SIFP_IFACE_GROUPS "org.freedesktop.sssd.infopipe.Groups"
57
62#define SSS_SIFP_PATH "/org/freedesktop/sssd/infopipe"
63
68#define SSS_SIFP_IFACE "org.freedesktop.sssd.infopipe"
69
78
82typedef void (sss_sifp_free_func)(void *ptr, void *pvt);
83typedef void *(sss_sifp_alloc_func)(size_t size, void *pvt);
84
88typedef enum sss_sifp_error {
91
94
97
104
107
110
113
116
119
123
128
132typedef struct sss_sifp_object {
133 char *name;
134 char *object_path;
135 char *interface;
136 sss_sifp_attr **attrs;
138
146
158sss_sifp_init_ex(void *alloc_pvt,
159 sss_sifp_alloc_func *alloc_func,
160 sss_sifp_free_func *free_func,
161 sss_sifp_ctx **_ctx);
162
169const char *
171
178const char *
180
187const char *
189
201 const char *object_path,
202 const char *interface,
203 const char *name,
204 sss_sifp_attr ***_attrs);
205
216 const char *object_path,
217 const char *interface,
218 sss_sifp_attr ***_attrs);
219
230 const char *object_path,
231 const char *interface,
232 sss_sifp_object **_object);
233
243 const char *name,
244 bool *_value);
245
255 const char *name,
256 int16_t *_value);
257
267 const char *name,
268 uint16_t *_value);
269
279 const char *name,
280 int32_t *_value);
281
291 const char *name,
292 uint32_t *_value);
293
303 const char *name,
304 int64_t *_value);
305
315 const char *name,
316 uint64_t *_value);
317
327 const char *name,
328 const char **_value);
329
342 const char *name,
343 hash_table_t **_value);
344
355 const char *name,
356 unsigned int *_num_values,
357 bool **_value);
358
369 const char *name,
370 unsigned int *_num_values,
371 int16_t **_value);
372
383 const char *name,
384 unsigned int *_num_values,
385 uint16_t **_value);
386
397 const char *name,
398 unsigned int *_num_values,
399 int32_t **_value);
400
411 const char *name,
412 unsigned int *_num_values,
413 uint32_t **_value);
414
425 const char *name,
426 unsigned int *_num_values,
427 int64_t **_value);
428
439 const char *name,
440 unsigned int *_num_values,
441 uint64_t **_value);
442
453 const char *name,
454 unsigned int *_num_values,
455 const char * const **_value);
456
462void
464
471void
473 sss_sifp_attr ***_attrs);
474
481void
483 sss_sifp_object **_object);
484
491void
493 char **_str);
494
501void
503 char ***_str_array);
504
522 char ***_domains);
523
533 const char *name,
534 sss_sifp_object **_domain);
535
545 uid_t uid,
546 sss_sifp_object **_user);
547
557 const char *name,
558 sss_sifp_object **_user);
559
564#endif /* SSS_SIFP_H_ */
sss_sifp_error sss_sifp_fetch_user_by_uid(sss_sifp_ctx *ctx, uid_t uid, sss_sifp_object **_user)
Fetch all information about user by uid.
sss_sifp_error sss_sifp_fetch_user_by_name(sss_sifp_ctx *ctx, const char *name, sss_sifp_object **_user)
Fetch all information about user by name.
sss_sifp_error sss_sifp_fetch_domain_by_name(sss_sifp_ctx *ctx, const char *name, sss_sifp_object **_domain)
Fetch all information about domain by name.
sss_sifp_error sss_sifp_list_domains(sss_sifp_ctx *ctx, char ***_domains)
List names of available domains.
void sss_sifp_free(sss_sifp_ctx **_ctx)
Free sss_sifp context and set it to NULL.
void sss_sifp_free_object(sss_sifp_ctx *ctx, sss_sifp_object **_object)
Free sss_sifp object and set it to NULL.
sss_sifp_error sss_sifp_find_attr_as_int16(sss_sifp_attr **attrs, const char *name, int16_t *_value)
Find attribute in list and return its value.
sss_sifp_error sss_sifp_find_attr_as_int64(sss_sifp_attr **attrs, const char *name, int64_t *_value)
Find attribute in list and return its value.
sss_sifp_error sss_sifp_find_attr_as_string_dict(sss_sifp_attr **attrs, const char *name, hash_table_t **_value)
Find attribute in list and return its value.
sss_sifp_error sss_sifp_find_attr_as_int32(sss_sifp_attr **attrs, const char *name, int32_t *_value)
Find attribute in list and return its value.
sss_sifp_error sss_sifp_find_attr_as_uint64_array(sss_sifp_attr **attrs, const char *name, unsigned int *_num_values, uint64_t **_value)
Find attribute in list and return its values.
void sss_sifp_free_string_array(sss_sifp_ctx *ctx, char ***_str_array)
Free array of strings and set it to NULL.
sss_sifp_error sss_sifp_find_attr_as_uint64(sss_sifp_attr **attrs, const char *name, uint64_t *_value)
Find attribute in list and return its value.
void() sss_sifp_free_func(void *ptr, void *pvt)
Typedef for memory allocation functions.
Definition: sss_sifp.h:82
struct sss_sifp_ctx sss_sifp_ctx
Opaque libsss_sifp context.
Definition: sss_sifp.h:77
sss_sifp_error sss_sifp_find_attr_as_uint16(sss_sifp_attr **attrs, const char *name, uint16_t *_value)
Find attribute in list and return its value.
sss_sifp_error sss_sifp_find_attr_as_int64_array(sss_sifp_attr **attrs, const char *name, unsigned int *_num_values, int64_t **_value)
Find attribute in list and return its values.
const char * sss_sifp_strerr(sss_sifp_error error)
Translate error code into human readable message.
sss_sifp_error
Error codes used by libsss_sifp.
Definition: sss_sifp.h:88
const char * sss_sifp_get_last_io_error_name(sss_sifp_ctx *ctx)
Return last error name from underlying D-Bus communication.
sss_sifp_error sss_sifp_init(sss_sifp_ctx **_ctx)
Initialize sss_sifp context using default allocator (malloc)
void sss_sifp_free_attrs(sss_sifp_ctx *ctx, sss_sifp_attr ***_attrs)
Free attribute list and set it to NULL.
sss_sifp_error sss_sifp_find_attr_as_string(sss_sifp_attr **attrs, const char *name, const char **_value)
Find attribute in list and return its value.
sss_sifp_error sss_sifp_find_attr_as_bool(sss_sifp_attr **attrs, const char *name, bool *_value)
Find attribute in list and return its value.
const char * sss_sifp_get_last_io_error_message(sss_sifp_ctx *ctx)
Return last error message from underlying D-Bus communication.
sss_sifp_error sss_sifp_fetch_object(sss_sifp_ctx *ctx, const char *object_path, const char *interface, sss_sifp_object **_object)
Fetch D-Bus object.
sss_sifp_error sss_sifp_find_attr_as_int32_array(sss_sifp_attr **attrs, const char *name, unsigned int *_num_values, int32_t **_value)
Find attribute in list and return its values.
sss_sifp_error sss_sifp_fetch_attr(sss_sifp_ctx *ctx, const char *object_path, const char *interface, const char *name, sss_sifp_attr ***_attrs)
Fetch selected attributes of given object.
sss_sifp_error sss_sifp_fetch_all_attrs(sss_sifp_ctx *ctx, const char *object_path, const char *interface, sss_sifp_attr ***_attrs)
Fetch all attributes of given object.
sss_sifp_error sss_sifp_init_ex(void *alloc_pvt, sss_sifp_alloc_func *alloc_func, sss_sifp_free_func *free_func, sss_sifp_ctx **_ctx)
Initialize sss_sifp context.
sss_sifp_error sss_sifp_find_attr_as_uint16_array(sss_sifp_attr **attrs, const char *name, unsigned int *_num_values, uint16_t **_value)
Find attribute in list and return its values.
sss_sifp_error sss_sifp_find_attr_as_int16_array(sss_sifp_attr **attrs, const char *name, unsigned int *_num_values, int16_t **_value)
Find attribute in list and return its values.
struct sss_sifp_attr sss_sifp_attr
D-Bus object attribute.
Definition: sss_sifp.h:127
struct sss_sifp_object sss_sifp_object
D-Bus object.
sss_sifp_error sss_sifp_find_attr_as_bool_array(sss_sifp_attr **attrs, const char *name, unsigned int *_num_values, bool **_value)
Find attribute in list and return its values.
void sss_sifp_free_string(sss_sifp_ctx *ctx, char **_str)
Free string and set it to NULL.
sss_sifp_error sss_sifp_find_attr_as_uint32(sss_sifp_attr **attrs, const char *name, uint32_t *_value)
Find attribute in list and return its value.
sss_sifp_error sss_sifp_find_attr_as_string_array(sss_sifp_attr **attrs, const char *name, unsigned int *_num_values, const char *const **_value)
Find attribute in list and return its values.
sss_sifp_error sss_sifp_find_attr_as_uint32_array(sss_sifp_attr **attrs, const char *name, unsigned int *_num_values, uint32_t **_value)
Find attribute in list and return its values.
@ SSS_SIFP_ATTR_MISSING
Attribute does not exist.
Definition: sss_sifp.h:112
@ SSS_SIFP_OUT_OF_MEMORY
Ran out of memory during processing.
Definition: sss_sifp.h:93
@ SSS_SIFP_NOT_SUPPORTED
Operation not supported.
Definition: sss_sifp.h:109
@ SSS_SIFP_INTERNAL_ERROR
Internal error.
Definition: sss_sifp.h:106
@ SSS_SIFP_ATTR_NULL
Attribute does not have any value set.
Definition: sss_sifp.h:115
@ SSS_SIFP_ERROR_SENTINEL
Always last.
Definition: sss_sifp.h:121
@ SSS_SIFP_INVALID_ARGUMENT
Invalid argument.
Definition: sss_sifp.h:96
@ SSS_SIFP_IO_ERROR
Input/output error.
Definition: sss_sifp.h:103
@ SSS_SIFP_OK
Success.
Definition: sss_sifp.h:90
@ SSS_SIFP_INCORRECT_TYPE
Incorrect attribute type.
Definition: sss_sifp.h:118
D-Bus object.
Definition: sss_sifp.h:132