| 1 |
/** BEGIN COPYRIGHT BLOCK |
| 2 |
* Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. |
| 3 |
* Copyright (C) 2005 Red Hat, Inc. |
| 4 |
* All rights reserved. |
| 5 |
* |
| 6 |
* License: GPL (version 3 or any later version). |
| 7 |
* See LICENSE for details. |
| 8 |
* END COPYRIGHT BLOCK **/ |
| 9 |
|
| 10 |
#ifdef HAVE_CONFIG_H |
| 11 |
#include <config.h> |
| 12 |
#endif |
| 13 |
|
| 14 |
#ifndef _LDAPU_DBCONF_H |
| 15 |
#define _LDAPU_DBCONF_H |
| 16 |
|
| 17 |
#include <stdio.h> |
| 18 |
|
| 19 |
#ifndef NSAPI_PUBLIC |
| 20 |
#define NSAPI_PUBLIC |
| 21 |
#endif |
| 22 |
|
| 23 |
typedef struct dbconf_propval |
| 24 |
{ |
| 25 |
char *prop; /* Property name */ |
| 26 |
char *val; /* Property value */ |
| 27 |
struct dbconf_propval *next; /* Pointer to the next prop-val pair */ |
| 28 |
} DBPropVal_t; |
| 29 |
|
| 30 |
typedef struct dbconf_dbinfo |
| 31 |
{ |
| 32 |
char *dbname; /* Database name */ |
| 33 |
char *url; /* Database URL */ |
| 34 |
DBPropVal_t *firstprop; /* pointer to first property-value pair */ |
| 35 |
DBPropVal_t *lastprop; /* pointer to last property-value pair */ |
| 36 |
struct dbconf_dbinfo *next; /* pointer to next db info */ |
| 37 |
} DBConfDBInfo_t; |
| 38 |
|
| 39 |
typedef struct |
| 40 |
{ |
| 41 |
DBConfDBInfo_t *firstdb; /* pointer to first db info */ |
| 42 |
DBConfDBInfo_t *lastdb; /* pointer to last db info */ |
| 43 |
} DBConfInfo_t; |
| 44 |
|
| 45 |
#define DBCONF_DEFAULT_DBNAME "default" |
| 46 |
|
| 47 |
#ifdef __cplusplus |
| 48 |
extern "C" { |
| 49 |
#endif |
| 50 |
|
| 51 |
NSAPI_PUBLIC extern int dbconf_read_default_dbinfo(const char *file, |
| 52 |
DBConfDBInfo_t **db_info); |
| 53 |
NSAPI_PUBLIC extern int dbconf_read_config_file(const char *file, |
| 54 |
DBConfInfo_t **conf_info); |
| 55 |
|
| 56 |
NSAPI_PUBLIC extern int ldapu_dbinfo_attrval(DBConfDBInfo_t *db_info, |
| 57 |
const char *attr, |
| 58 |
char **val); |
| 59 |
|
| 60 |
NSAPI_PUBLIC extern void dbconf_free_confinfo(DBConfInfo_t *conf_info); |
| 61 |
NSAPI_PUBLIC extern void dbconf_free_dbinfo(DBConfDBInfo_t *db_info); |
| 62 |
|
| 63 |
extern void dbconf_free_propval(DBPropVal_t *propval); |
| 64 |
|
| 65 |
extern void dbconf_print_confinfo(DBConfInfo_t *conf_info); |
| 66 |
extern void dbconf_print_dbinfo(DBConfDBInfo_t *db_info); |
| 67 |
extern void dbconf_print_propval(DBPropVal_t *propval); |
| 68 |
|
| 69 |
|
| 70 |
NSAPI_PUBLIC int dbconf_output_db_directive(FILE *fp, const char *dbname, const char *url); |
| 71 |
|
| 72 |
NSAPI_PUBLIC int dbconf_output_propval(FILE *fp, const char *dbname, const char *prop, const char *val, const int encoded); |
| 73 |
|
| 74 |
/* Following functions are required by certmap.c file */ |
| 75 |
extern int dbconf_read_config_file_sub(const char *file, |
| 76 |
const char *directive, |
| 77 |
const int directive_len, |
| 78 |
DBConfInfo_t **conf_info_out); |
| 79 |
|
| 80 |
extern int dbconf_read_default_dbinfo_sub(const char *file, |
| 81 |
const char *directive, |
| 82 |
const int directive_len, |
| 83 |
DBConfDBInfo_t **db_info_out); |
| 84 |
|
| 85 |
NSAPI_PUBLIC int dbconf_get_dbnames(const char *dbmap, char ***dbnames, int *cnt); |
| 86 |
|
| 87 |
NSAPI_PUBLIC int dbconf_free_dbnames(char **dbnames); |
| 88 |
|
| 89 |
|
| 90 |
extern int ldapu_strcasecmp(const char *s1, const char *s2); |
| 91 |
|
| 92 |
#ifdef __cplusplus |
| 93 |
} |
| 94 |
#endif |
| 95 |
|
| 96 |
#endif /* _LDAPU_DBCONF_H */ |