ld_cfg.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * LDAP module - Configuration file parser
  3. *
  4. * Copyright (C) 2001-2003 FhG FOKUS
  5. * Copyright (C) 2004,2005 Free Software Foundation, Inc.
  6. * Copyright (C) 2005,2006 iptelorg GmbH
  7. *
  8. * This file is part of SER, a free SIP server.
  9. *
  10. * SER is free software; you can redistribute it and/or modify it under the
  11. * terms of the GNU General Public License as published by the Free Software
  12. * Foundation; either version 2 of the License, or (at your option) any later
  13. * version.
  14. *
  15. * SER is distributed in the hope that it will be useful, but WITHOUT ANY
  16. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  17. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  18. * details.
  19. *
  20. * You should have received a copy of the GNU General Public License along
  21. * with this program; if not, write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  23. */
  24. #ifndef _LD_CFG_H
  25. #define _LD_CFG_H
  26. #include "ld_fld.h"
  27. #include "../../str.h"
  28. #include <sys/time.h>
  29. /* RFC 2251: maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) -- */
  30. #define LD_MAXINT (2147483647)
  31. struct ld_cfg {
  32. str table; /**< Name of the db api table */
  33. str base; /**< The search base to be used with the table, zero terminated */
  34. int scope; /**< LDAP scope */
  35. str filter; /**< The search filter, zero terminated */
  36. str* field; /**< An array of DB API fields, zero terminated */
  37. str* attr; /**< An array of LDAP attribute names, zero terminated */
  38. enum ld_syntax* syntax; /**< An array of configured LDAP syntaxes */
  39. int n; /**< Number of fields in the arrays */
  40. int sizelimit; /**< retrieve at most sizelimit entries for a search */
  41. int timelimit; /**< wait at most timelimit seconds for a search to complete */
  42. int chase_references; /**< dereference option for LDAP library */
  43. int chase_referrals; /**< follow referrals option for LDAP library */
  44. struct ld_cfg* next; /**< The next table in the list */
  45. };
  46. struct ld_con_info {
  47. str id;
  48. str host;
  49. unsigned int port;
  50. str username;
  51. str password;
  52. int authmech;
  53. int tls; /**< TLS encryption enabled */
  54. str ca_list; /**< Path of the file that contains certificates of the CAs */
  55. str req_cert; /**< LDAP level of certificate request behaviour */
  56. struct ld_con_info* next;
  57. };
  58. struct ld_cfg* ld_find_cfg(str* table);
  59. char* ld_find_attr_name(enum ld_syntax* syntax, struct ld_cfg* cfg, char* fld_name);
  60. struct ld_con_info* ld_find_conn_info(str* conn_id);
  61. int ld_load_cfg(str* filename);
  62. void ld_cfg_free(void);
  63. #endif /* _LD_CFG_H */