fe.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /** BEGIN COPYRIGHT BLOCK
  2. * This Program is free software; you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation; version 2 of the License.
  5. *
  6. * This Program is distributed in the hope that it will be useful, but WITHOUT
  7. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. *
  10. * You should have received a copy of the GNU General Public License along with
  11. * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
  12. * Place, Suite 330, Boston, MA 02111-1307 USA.
  13. *
  14. * In addition, as a special exception, Red Hat, Inc. gives You the additional
  15. * right to link the code of this Program with code not covered under the GNU
  16. * General Public License ("Non-GPL Code") and to distribute linked combinations
  17. * including the two, subject to the limitations in this paragraph. Non-GPL Code
  18. * permitted under this exception must only link to the code of this Program
  19. * through those well defined interfaces identified in the file named EXCEPTION
  20. * found in the source code files (the "Approved Interfaces"). The files of
  21. * Non-GPL Code may instantiate templates or use macros or inline functions from
  22. * the Approved Interfaces without causing the resulting work to be covered by
  23. * the GNU General Public License. Only Red Hat, Inc. may make changes or
  24. * additions to the list of Approved Interfaces. You must obey the GNU General
  25. * Public License in all respects for all of the Program code and other code used
  26. * in conjunction with the Program except the Non-GPL Code covered by this
  27. * exception. If you modify this file, you may extend this exception to your
  28. * version of the file, but you are not obligated to do so. If you do not wish to
  29. * provide this exception without modification, you must delete this exception
  30. * statement from your version and license this file solely under the GPL without
  31. * exception.
  32. *
  33. *
  34. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  35. * Copyright (C) 2005 Red Hat, Inc.
  36. * All rights reserved.
  37. * END COPYRIGHT BLOCK **/
  38. #ifdef HAVE_CONFIG_H
  39. # include <config.h>
  40. #endif
  41. #ifndef _SLAPD_FE_H_
  42. #define _SLAPD_FE_H_
  43. #include <prio.h>
  44. #include "slap.h"
  45. /*
  46. * Global Variables...
  47. */
  48. #ifdef LDAP_DEBUG
  49. #if defined( _WIN32 )
  50. #ifndef DONT_DECLARE_SLAPD_LDAP_DEBUG
  51. extern __declspec(dllimport) int slapd_ldap_debug;
  52. #endif /* DONT_DECLARE_SLAPD_LDAP_DEBUG */
  53. #endif
  54. #endif
  55. extern Slapi_Counter *ops_initiated;
  56. extern Slapi_Counter *ops_completed;
  57. extern PRThread *listener_tid;
  58. extern PRThread *listener_tid;
  59. extern Slapi_Counter *num_conns;
  60. extern char *pid_file;
  61. extern char *start_pid_file;
  62. extern int should_detach;
  63. extern int connection_type; /* JCM - Evil. Solve by creating a real connection constructor & destructor */
  64. #ifndef HAVE_TIME_R
  65. extern PRLock *time_func_mutex;
  66. #endif /* HAVE_TIME_R */
  67. extern PRLock *currenttime_mutex;
  68. extern time_t starttime;
  69. extern char *configfile;
  70. #if defined( _WIN32 )
  71. extern LPTSTR pszServerName;
  72. #endif
  73. #if defined( _WIN32 )
  74. /* String constants (no change for international) */
  75. extern HANDLE hSlapdEventSource;
  76. extern SERVICE_STATUS LDAPServerStatus;
  77. extern SERVICE_STATUS_HANDLE hLDAPServerServiceStatus;
  78. #endif
  79. /*
  80. * auth.c
  81. *
  82. */
  83. void client_auth_init();
  84. void handle_handshake_done (PRFileDesc *prfd, void* clientData);
  85. int handle_bad_certificate (void* clientData, PRFileDesc *prfd);
  86. /*
  87. * connection.c
  88. */
  89. void op_thread_cleanup();
  90. /*
  91. * ntuserpin.c - Prompts for the key database passphrase.
  92. */
  93. #include "svrcore.h"
  94. typedef struct SVRCORENTUserPinObj SVRCORENTUserPinObj;
  95. SVRCOREError SVRCORE_CreateNTUserPinObj(SVRCORENTUserPinObj **out);
  96. void SVRCORE_SetNTUserPinInteractive(SVRCORENTUserPinObj *obj, PRBool interactive);
  97. void SVRCORE_DestroyNTUserPinObj(SVRCORENTUserPinObj *obj);
  98. /*
  99. * connection.c
  100. */
  101. void connection_abandon_operations( Connection *conn );
  102. int connection_activity( Connection *conn );
  103. void init_op_threads();
  104. int connection_new_private(Connection *conn);
  105. void connection_remove_operation( Connection *conn, Operation *op );
  106. int connection_operations_pending( Connection *conn, Operation *op2ignore,
  107. int test_resultsent );
  108. void connection_done(Connection *conn);
  109. void connection_cleanup(Connection *conn);
  110. void connection_reset(Connection* conn, int ns, PRNetAddr * from, int fromLen, int is_SSL);
  111. /*
  112. * conntable.c
  113. */
  114. /*
  115. * Note: the correct order to use when acquiring multiple locks is
  116. * c[i]->c_mutex followed by table_mutex.
  117. */
  118. struct connection_table
  119. {
  120. int size;
  121. /* An array of connections, file descriptors, and a mapping between them. */
  122. Connection *c;
  123. struct POLL_STRUCT *fd;
  124. int n_tcps; /* standard socket start index in fd */
  125. int n_tcpe; /* standard socket last ( +1 ) index in fd */
  126. int s_tcps; /* ssl socket start index in fd */
  127. int s_tcpe; /* ssl socket last ( +1 ) in fd */
  128. #ifndef XP_WIN32
  129. #if defined(ENABLE_LDAPI)
  130. int i_unixs; /* unix socket start index in fd */
  131. int i_unixe; /* unix socket last ( +1 ) in fd */
  132. #endif /* ENABLE_LDAPI */
  133. #endif
  134. PRLock *table_mutex;
  135. };
  136. typedef struct connection_table Connection_Table;
  137. extern Connection_Table *the_connection_table; /* JCM - Exported from globals.c for daemon.c, monitor.c, puke, gag, etc */
  138. Connection_Table *connection_table_new(int table_size);
  139. void connection_table_free(Connection_Table *ct);
  140. void connection_table_abandon_all_operations(Connection_Table *ct);
  141. Connection *connection_table_get_connection(Connection_Table *ct, int sd);
  142. void connection_table_move_connection_out_of_active_list(Connection_Table *ct, Connection *c);
  143. void connection_table_move_connection_on_to_active_list(Connection_Table *ct, Connection *c);
  144. void connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e);
  145. void connection_table_dump_activity_to_errors_log(Connection_Table *ct);
  146. Connection* connection_table_get_first_active_connection (Connection_Table *ct);
  147. Connection* connection_table_get_next_active_connection (Connection_Table *ct, Connection *c);
  148. typedef int (*Connection_Table_Iterate_Function)(Connection *c, void *arg);
  149. int connection_table_iterate_active_connections(Connection_Table *ct, void* arg, Connection_Table_Iterate_Function f);
  150. #if defined( _WIN32 )
  151. Connection* connection_table_get_connection_from_fd(Connection_Table *ct,PRFileDesc *prfd);
  152. #endif
  153. #if 0
  154. void connection_table_dump(Connection_Table *ct);
  155. #endif
  156. /*
  157. * daemon.c
  158. */
  159. int signal_listner();
  160. int daemon_pre_setuid_init(daemon_ports_t *ports);
  161. void slapd_daemon( daemon_ports_t *ports );
  162. void daemon_register_connection();
  163. int slapd_listenhost2addr( const char *listenhost, PRNetAddr ***addr );
  164. int daemon_register_reslimits( void );
  165. PRFileDesc * get_ssl_listener_fd();
  166. int configure_pr_socket( PRFileDesc **pr_socket, int secure, int local );
  167. void configure_ns_socket( int * ns );
  168. /*
  169. * sasl_io.c
  170. */
  171. int sasl_io_enable(Connection *c);
  172. /*
  173. * sasl_map.c
  174. */
  175. int sasl_map_config_add(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode, char *returntext, void *arg);
  176. int sasl_map_config_delete(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode, char *returntext, void *arg);
  177. int sasl_map_domap(char *sasl_user, char *sasl_realm, char **ldap_search_base, char **ldap_search_filter);
  178. int sasl_map_init();
  179. int sasl_map_done();
  180. #endif