#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "lib/socket/socket.h"
#include "lib/util/dlinklist.h"
#include "lib/events/events.h"
#include "lib/stream/packet.h"
#include "librpc/gen_ndr/ndr_nbt.h"
#include "param/param.h"
+#include "../libcli/nbt/libnbt.h"
/*
setup the idle handler for a transport
the period is in microseconds
*/
-void smbcli_transport_idle_handler(struct smbcli_transport *transport,
+_PUBLIC_ void smbcli_transport_idle_handler(struct smbcli_transport *transport,
void (*idle_func)(struct smbcli_transport *, void *),
uint64_t period,
void *private)
/* if this request has an async handler then call that to
notify that the reply has been received. This might destroy
the request so it must happen last */
- DLIST_REMOVE(transport->pending_recv, req);
+
req->state = SMBCLI_REQUEST_DONE;
+
+ if (req->recv_helper.fn) {
+ /*
+ * let the recv helper decide in
+ * what state the request really is
+ */
+ req->state = req->recv_helper.fn(req);
+
+ /* if more parts are needed, wait for them */
+ if (req->state <= SMBCLI_REQUEST_RECV) {
+ return NT_STATUS_OK;
+ }
+ }
+ DLIST_REMOVE(transport->pending_recv, req);
if (req->async.fn) {
req->async.fn(req);
}
process some read/write requests that are pending
return false if the socket is dead
*/
-bool smbcli_transport_process(struct smbcli_transport *transport)
+_PUBLIC_ bool smbcli_transport_process(struct smbcli_transport *transport)
{
NTSTATUS status;
size_t npending;
/****************************************************************************
Send an SMBecho (async send)
*****************************************************************************/
-struct smbcli_request *smb_raw_echo_send(struct smbcli_transport *transport,
+_PUBLIC_ struct smbcli_request *smb_raw_echo_send(struct smbcli_transport *transport,
struct smb_echo *p)
{
struct smbcli_request *req;