+int connection_client_setup(
+ ber_socket_t s,
+ Listener *l,
+ ldap_pvt_thread_start_t *func,
+ void *arg )
+{
+ Connection *c;
+
+ if ( connection_init( s, l, "", "", CONN_IS_CLIENT, 0, "" ) < 0 ) {
+ return -1;
+ }
+
+ c = connection_get( s );
+ c->c_clientfunc = func;
+ c->c_clientarg = arg;
+ connection_return( c );
+ slapd_add_internal( s, 0 );
+ slapd_set_read( s, 1 );
+ return 0;
+}
+
+void connection_client_enable(
+ ber_socket_t s
+)
+{
+ slapd_set_read( s, 1 );
+}
+
+void connection_client_stop(
+ ber_socket_t s
+)
+{
+ Connection *c;
+
+ /* get (locked) connection */
+ c = connection_get( s );
+
+ assert( c->c_conn_state == SLAP_C_CLIENT );
+
+ c->c_listener = NULL;
+ c->c_conn_state = SLAP_C_INVALID;
+ c->c_struct_state = SLAP_C_UNUSED;
+ connection_return( c );
+ slapd_remove( s, 0, 1 );
+}
+