summaryrefslogtreecommitdiff
path: root/source4/libcli/cldap/cldap.h
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli/cldap/cldap.h')
-rw-r--r--source4/libcli/cldap/cldap.h139
1 files changed, 45 insertions, 94 deletions
diff --git a/source4/libcli/cldap/cldap.h b/source4/libcli/cldap/cldap.h
index 8951daa775..111fa2cfc4 100644
--- a/source4/libcli/cldap/cldap.h
+++ b/source4/libcli/cldap/cldap.h
@@ -19,89 +19,29 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../lib/util/asn1.h"
#include "../libcli/netlogon.h"
struct ldap_message;
-
-enum cldap_request_state {CLDAP_REQUEST_SEND,
- CLDAP_REQUEST_WAIT,
- CLDAP_REQUEST_DONE,
- CLDAP_REQUEST_ERROR};
-
-/*
- a cldap request packet
-*/
-struct cldap_request {
- struct cldap_request *next, *prev;
-
- struct cldap_socket *cldap;
-
- enum cldap_request_state state;
- NTSTATUS status;
-
- /* where to send the request */
- struct socket_address *dest;
-
- /* timeout between retries (seconds) */
- int timeout;
- int num_retries;
-
- bool is_reply;
-
- /* the ldap message_id */
- int message_id;
-
- struct tevent_timer *te;
-
- /* the encoded request */
- DATA_BLOB encoded;
-
- /* the reply data */
- struct asn1_data *asn1;
-
- /* information on what to do on completion */
- struct {
- void (*fn)(struct cldap_request *);
- void *private_data;
- } async;
+struct tsocket_address;
+struct cldap_socket;
+
+struct cldap_incoming {
+ int recv_errno;
+ uint8_t *buf;
+ size_t len;
+ struct tsocket_address *src;
+ struct ldap_message *ldap_msg;
};
/*
- context structure for operations on cldap packets
-*/
-struct cldap_socket {
- struct socket_context *sock;
- struct tevent_context *event_ctx;
- struct smb_iconv_convenience *iconv_convenience;
-
- /* the fd event */
- struct tevent_fd *fde;
-
- /* a queue of outgoing requests */
- struct cldap_request *send_queue;
-
- /* mapping from message_id to pending request */
- struct idr_context *idr;
-
- /* what to do with incoming request packets */
- struct {
- void (*handler)(struct cldap_socket *, struct ldap_message *,
- struct socket_address *);
- void *private_data;
- } incoming;
-};
-
-
-/*
- a general cldap search request
+ a general cldap search request
*/
struct cldap_search {
struct {
const char *dest_address;
uint16_t dest_port;
const char *filter;
- const char **attributes;
+ const char * const *attributes;
int timeout;
int retries;
} in;
@@ -111,39 +51,43 @@ struct cldap_search {
} out;
};
-struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx,
- struct tevent_context *event_ctx,
- struct smb_iconv_convenience *iconv_convenience);
+NTSTATUS cldap_socket_init(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ const struct tsocket_address *local_addr,
+ const struct tsocket_address *remote_addr,
+ struct cldap_socket **_cldap);
+
NTSTATUS cldap_set_incoming_handler(struct cldap_socket *cldap,
- void (*handler)(struct cldap_socket *, struct ldap_message *,
- struct socket_address *),
+ void (*handler)(struct cldap_socket *,
+ void *private_data,
+ struct cldap_incoming *),
void *private_data);
-struct cldap_request *cldap_search_send(struct cldap_socket *cldap,
- struct cldap_search *io);
-NTSTATUS cldap_search_recv(struct cldap_request *req, TALLOC_CTX *mem_ctx,
+struct tevent_req *cldap_search_send(TALLOC_CTX *mem_ctx,
+ struct cldap_socket *cldap,
+ const struct cldap_search *io);
+NTSTATUS cldap_search_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
struct cldap_search *io);
-NTSTATUS cldap_search(struct cldap_socket *cldap, TALLOC_CTX *mem_ctx,
+NTSTATUS cldap_search(struct cldap_socket *cldap, TALLOC_CTX *mem_ctx,
struct cldap_search *io);
-
/*
a general cldap reply
*/
struct cldap_reply {
uint32_t messageid;
- struct socket_address *dest;
+ struct tsocket_address *dest;
struct ldap_SearchResEntry *response;
struct ldap_Result *result;
};
NTSTATUS cldap_reply_send(struct cldap_socket *cldap, struct cldap_reply *io);
-NTSTATUS cldap_empty_reply(struct cldap_socket *cldap,
+NTSTATUS cldap_empty_reply(struct cldap_socket *cldap,
uint32_t message_id,
- struct socket_address *src);
-NTSTATUS cldap_error_reply(struct cldap_socket *cldap,
+ struct tsocket_address *dst);
+NTSTATUS cldap_error_reply(struct cldap_socket *cldap,
uint32_t message_id,
- struct socket_address *src,
+ struct tsocket_address *dst,
int resultcode,
const char *errormessage);
@@ -168,15 +112,22 @@ struct cldap_netlogon {
} out;
};
-struct cldap_request *cldap_netlogon_send(struct cldap_socket *cldap,
- struct cldap_netlogon *io);
-NTSTATUS cldap_netlogon_recv(struct cldap_request *req,
- TALLOC_CTX *mem_ctx,
+struct tevent_req *cldap_netlogon_send(TALLOC_CTX *mem_ctx,
+ struct cldap_socket *cldap,
+ const struct cldap_netlogon *io);
+NTSTATUS cldap_netlogon_recv(struct tevent_req *req,
+ struct smb_iconv_convenience *iconv_convenience,
+ TALLOC_CTX *mem_ctx,
struct cldap_netlogon *io);
-NTSTATUS cldap_netlogon(struct cldap_socket *cldap,
- TALLOC_CTX *mem_ctx, struct cldap_netlogon *io);
-NTSTATUS cldap_netlogon_reply(struct cldap_socket *cldap,
+NTSTATUS cldap_netlogon(struct cldap_socket *cldap,
+ struct smb_iconv_convenience *iconv_convenience,
+ TALLOC_CTX *mem_ctx,
+ struct cldap_netlogon *io);
+
+NTSTATUS cldap_netlogon_reply(struct cldap_socket *cldap,
+ struct smb_iconv_convenience *iconv_convenience,
uint32_t message_id,
- struct socket_address *src,
+ struct tsocket_address *dst,
uint32_t version,
struct netlogon_samlogon_response *netlogon);
+