s3:pdb_ldap: restore Samba 3.0.x behavior and use the first "uid" value.
[Samba/fernandojvsilva.git] / libcli / util / tstream.h
bloba945287985571348654104abf2de5682ba2496d3
1 /*
2 * Unix SMB/CIFS implementation.
4 * Copyright (C) Stefan Metzmacher 2009
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef _LIBCLI_UTIL_TSTREAM_H_
21 #define _LIBCLI_UTIL_TSTREAM_H_
23 /**
24 * @brief A helper function to read a full PDU from a stream
26 * This function is designed for simple PDUs and as compat layer
27 * for the Samba4 packet interface.
29 * tstream_readv_pdu_send() is a more powerful interface,
30 * which is part of the main (non samba specific) tsocket code.
32 * @param[in] mem_ctx The memory context for the result.
34 * @param[in] ev The event context the operation should work on.
36 * @param[in] stream The stream to read data from.
38 * @param[in] inital_read_size The initial byte count that is needed to workout
39 * the full pdu size.
41 * @param[in] full_fn The callback function that will report the size
42 * of the full pdu.
44 * @param[in] full_private The private data for the callback function.
46 * @return The async request handle. NULL on fatal error.
48 * @see tstream_read_pdu_blob_recv()
49 * @see tstream_readv_pdu_send()
50 * @see tstream_readv_pdu_queue_send()
53 struct tevent_req *tstream_read_pdu_blob_send(TALLOC_CTX *mem_ctx,
54 struct tevent_context *ev,
55 struct tstream_context *stream,
56 size_t inital_read_size,
57 NTSTATUS (*full_fn)(void *private_data,
58 DATA_BLOB blob,
59 size_t *packet_size),
60 void *full_private);
61 /**
62 * @brief Receive the result of the tstream_read_pdu_blob_send() call.
64 * @param[in] req The tevent request from tstream_read_pdu_blob_send().
66 * @param[in] mem_ctx The memory context for returned pdu DATA_BLOB.
68 * @param[in] pdu_blob The DATA_BLOB with the full pdu.
70 * @return The NTSTATUS result, NT_STATUS_OK on success
71 * and others on failure.
73 * @see tstream_read_pdu_blob_send()
75 NTSTATUS tstream_read_pdu_blob_recv(struct tevent_req *req,
76 TALLOC_CTX *mem_ctx,
77 DATA_BLOB *pdu_blob);
79 #endif /* _LIBCLI_UTIL_TSTREAM_H_ */