dbconf.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. #ifdef HAVE_CONFIG_H
  10. # include <config.h>
  11. #endif
  12. #ifndef _LDAPU_DBCONF_H
  13. #define _LDAPU_DBCONF_H
  14. #include <stdio.h>
  15. #ifndef NSAPI_PUBLIC
  16. #define NSAPI_PUBLIC
  17. #endif
  18. typedef struct dbconf_propval {
  19. char *prop; /* Property name */
  20. char *val; /* Property value */
  21. struct dbconf_propval *next; /* Pointer to the next prop-val pair */
  22. } DBPropVal_t;
  23. typedef struct dbconf_dbinfo {
  24. char *dbname; /* Database name */
  25. char *url; /* Database URL */
  26. DBPropVal_t *firstprop; /* pointer to first property-value pair */
  27. DBPropVal_t *lastprop; /* pointer to last property-value pair */
  28. struct dbconf_dbinfo *next; /* pointer to next db info */
  29. } DBConfDBInfo_t;
  30. typedef struct {
  31. DBConfDBInfo_t *firstdb; /* pointer to first db info */
  32. DBConfDBInfo_t *lastdb; /* pointer to last db info */
  33. } DBConfInfo_t;
  34. #define DBCONF_DEFAULT_DBNAME "default"
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38. NSAPI_PUBLIC extern int dbconf_read_default_dbinfo (const char *file,
  39. DBConfDBInfo_t **db_info);
  40. NSAPI_PUBLIC extern int dbconf_read_config_file (const char *file,
  41. DBConfInfo_t **conf_info);
  42. NSAPI_PUBLIC extern int ldapu_dbinfo_attrval (DBConfDBInfo_t *db_info,
  43. const char *attr, char **val);
  44. NSAPI_PUBLIC extern void dbconf_free_confinfo (DBConfInfo_t *conf_info);
  45. NSAPI_PUBLIC extern void dbconf_free_dbinfo (DBConfDBInfo_t *db_info);
  46. extern void dbconf_free_propval (DBPropVal_t *propval);
  47. extern void dbconf_print_confinfo (DBConfInfo_t *conf_info);
  48. extern void dbconf_print_dbinfo (DBConfDBInfo_t *db_info);
  49. extern void dbconf_print_propval (DBPropVal_t *propval);
  50. NSAPI_PUBLIC int dbconf_output_db_directive (FILE *fp, const char *dbname,
  51. const char *url);
  52. NSAPI_PUBLIC int dbconf_output_propval (FILE *fp, const char *dbname,
  53. const char *prop, const char *val,
  54. const int encoded);
  55. /* Following functions are required by certmap.c file */
  56. extern int dbconf_read_config_file_sub (const char *file,
  57. const char *directive,
  58. const int directive_len,
  59. DBConfInfo_t **conf_info_out);
  60. extern int dbconf_read_default_dbinfo_sub (const char *file,
  61. const char *directive,
  62. const int directive_len,
  63. DBConfDBInfo_t **db_info_out);
  64. NSAPI_PUBLIC int dbconf_get_dbnames (const char *dbmap, char ***dbnames, int *cnt);
  65. NSAPI_PUBLIC int dbconf_free_dbnames (char **dbnames);
  66. extern int ldapu_strcasecmp (const char *s1, const char *s2);
  67. #ifdef __cplusplus
  68. }
  69. #endif
  70. #endif /* _LDAPU_DBCONF_H */