s4:ldap_server: rewrite to socket layer to use tstream
[amitay/samba.git] / source4 / ldap_server / ldap_server.h
1 /* 
2    Unix SMB/CIFS implementation.
3    LDAP server
4    Copyright (C) Volker Lendecke 2004
5    Copyright (C) Stefan Metzmacher 2004
6    
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "libcli/ldap/libcli_ldap.h"
22 #include "lib/socket/socket.h"
23 #include "lib/stream/packet.h"
24 #include "system/network.h"
25
26 struct ldapsrv_connection {
27         struct loadparm_context *lp_ctx;
28         struct stream_connection *connection;
29         struct gensec_security *gensec;
30         struct auth_session_info *session_info;
31         struct ldapsrv_service *service;
32         struct cli_credentials *server_credentials;
33         struct ldb_context *ldb;
34
35         struct {
36                 struct tevent_queue *send_queue;
37                 struct tstream_context *raw;
38                 struct tstream_context *tls;
39                 struct tstream_context *sasl;
40                 struct tstream_context *active;
41         } sockets;
42
43         bool global_catalog;
44
45         struct {
46                 int initial_timeout;
47                 int conn_idle_time;
48                 int max_page_size;
49                 int search_timeout;
50                 struct timeval endtime;
51                 const char *reason;
52         } limits;
53
54         struct tevent_req *active_call;
55 };
56
57 struct ldapsrv_call {
58         struct ldapsrv_connection *conn;
59         struct ldap_message *request;
60         struct ldapsrv_reply {
61                 struct ldapsrv_reply *prev, *next;
62                 struct ldap_message *msg;
63         } *replies;
64         struct iovec out_iov;
65
66         struct tevent_req *(*postprocess_send)(TALLOC_CTX *mem_ctx,
67                                                struct tevent_context *ev,
68                                                void *private_data);
69         NTSTATUS (*postprocess_recv)(struct tevent_req *req);
70         void *postprocess_private;
71 };
72
73 struct ldapsrv_service {
74         struct tstream_tls_params *tls_params;
75         struct task_server *task;
76         struct tevent_queue *call_queue;
77 };
78
79 #include "ldap_server/proto.h"