ld_session.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * $Id$
  3. *
  4. * Kamailio LDAP Module
  5. *
  6. * Copyright (C) 2007 University of North Carolina
  7. *
  8. * Original author: Christian Schlatter, [email protected]
  9. *
  10. *
  11. * This file is part of Kamailio, a free SIP server.
  12. *
  13. * Kamailio is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License as published by
  15. * the Free Software Foundation; either version 2 of the License, or
  16. * (at your option) any later version
  17. *
  18. * Kamailio is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  26. *
  27. * History:
  28. * --------
  29. * 2007-02-18: Initial version
  30. */
  31. #ifndef LD_SESSION_H
  32. #define LD_SESSION_H
  33. #include <ldap.h>
  34. #include "iniparser.h"
  35. struct ld_session {
  36. char name[256];
  37. LDAP* handle;
  38. char* host_name;
  39. int version;
  40. int server_search_timeout;
  41. struct timeval client_search_timeout;
  42. struct timeval client_bind_timeout;
  43. struct timeval network_timeout;
  44. char* bind_dn;
  45. char* bind_pwd;
  46. int calculate_ha1;
  47. struct ld_session* next;
  48. };
  49. #define CFG_N_LDAP_HOST "ldap_server_url"
  50. #define CFG_N_LDAP_VERSION "ldap_version"
  51. #define CFG_N_LDAP_SERVER_SEARCH_TIMEOUT "ldap_server_search_timeout"
  52. #define CFG_N_LDAP_CLIENT_SEARCH_TIMEOUT "ldap_client_search_timeout"
  53. #define CFG_N_LDAP_CLIENT_BIND_TIMEOUT "ldap_client_bind_timeout"
  54. #define CFG_N_LDAP_NETWORK_TIMEOUT "ldap_network_timeout"
  55. #define CFG_N_LDAP_BIND_DN "ldap_bind_dn"
  56. #define CFG_N_LDAP_BIND_PWD "ldap_bind_password"
  57. #define CFG_N_CALCULATE_HA1 "calculate_ha1"
  58. #define CFG_DEF_HOST_NAME ""
  59. #define CFG_DEF_LDAP_SERVER_URL NULL
  60. #define CFG_DEF_LDAP_VERSION 3
  61. #define CFG_DEF_LDAP_CLIENT_BIND_TIMEOUT 1000
  62. #define CFG_DEF_LDAP_CLIENT_SEARCH_TIMEOUT 5000
  63. #define CFG_DEF_LDAP_NETWORK_TIMEOUT 1000
  64. #define CFG_DEF_LDAP_BIND_DN ""
  65. #define CFG_DEF_LDAP_BIND_PWD ""
  66. #define CFG_DEF_CALCULATE_HA1 1
  67. #define CFG_LDAP_CLIENT_SEARCH_TIMEOUT_MIN 2000
  68. extern int add_ld_session(char* _name, LDAP* _ldh, dictionary* _d);
  69. extern struct ld_session* get_ld_session(char* _name);
  70. extern int free_ld_sessions(void);
  71. extern char* get_ini_key_name(char* _section, char* _key);
  72. #endif /* LD_SESSION_H */