2 Unix SMB/CIFS implementation.
6 Copyright (C) Andrew Tridgell 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "libcli/util/asn_1.h"
24 #include "librpc/gen_ndr/nbt.h"
28 enum cldap_request_state {CLDAP_REQUEST_SEND,
34 a cldap request packet
36 struct cldap_request {
37 struct cldap_request *next, *prev;
39 struct cldap_socket *cldap;
41 enum cldap_request_state state;
44 /* where to send the request */
45 struct socket_address *dest;
47 /* timeout between retries (seconds) */
53 /* the ldap message_id */
56 struct timed_event *te;
58 /* the encoded request */
62 struct asn1_data *asn1;
64 /* information on what to do on completion */
66 void (*fn)(struct cldap_request *);
72 context structure for operations on cldap packets
75 struct socket_context *sock;
76 struct event_context *event_ctx;
81 /* a queue of outgoing requests */
82 struct cldap_request *send_queue;
84 /* mapping from message_id to pending request */
85 struct idr_context *idr;
87 /* what to do with incoming request packets */
89 void (*handler)(struct cldap_socket *, struct ldap_message *,
90 struct socket_address *);
97 a general cldap search request
101 const char *dest_address;
103 const char **attributes;
108 struct ldap_SearchResEntry *response;
109 struct ldap_Result *result;
113 struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx,
114 struct event_context *event_ctx);
115 NTSTATUS cldap_set_incoming_handler(struct cldap_socket *cldap,
116 void (*handler)(struct cldap_socket *, struct ldap_message *,
117 struct socket_address *),
119 struct cldap_request *cldap_search_send(struct cldap_socket *cldap,
120 struct cldap_search *io);
121 NTSTATUS cldap_search_recv(struct cldap_request *req, TALLOC_CTX *mem_ctx,
122 struct cldap_search *io);
123 NTSTATUS cldap_search(struct cldap_socket *cldap, TALLOC_CTX *mem_ctx,
124 struct cldap_search *io);
128 a general cldap reply
132 struct socket_address *dest;
133 struct ldap_SearchResEntry *response;
134 struct ldap_Result *result;
137 NTSTATUS cldap_reply_send(struct cldap_socket *cldap, struct cldap_reply *io);
139 NTSTATUS cldap_empty_reply(struct cldap_socket *cldap,
141 struct socket_address *src);
142 NTSTATUS cldap_error_reply(struct cldap_socket *cldap,
144 struct socket_address *src,
146 const char *errormessage);
149 a netlogon cldap request
151 struct cldap_netlogon {
153 const char *dest_address;
157 const char *domain_guid;
158 const char *domain_sid;
163 union nbt_cldap_netlogon netlogon;
167 struct cldap_request *cldap_netlogon_send(struct cldap_socket *cldap,
168 struct cldap_netlogon *io);
169 NTSTATUS cldap_netlogon_recv(struct cldap_request *req,
171 struct cldap_netlogon *io);
172 NTSTATUS cldap_netlogon(struct cldap_socket *cldap,
173 TALLOC_CTX *mem_ctx, struct cldap_netlogon *io);
174 NTSTATUS cldap_netlogon_reply(struct cldap_socket *cldap,
176 struct socket_address *src,
178 union nbt_cldap_netlogon *netlogon);