summaryrefslogtreecommitdiff
path: root/source4/libcli/raw/libcliraw.h
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-15 10:38:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:50 -0500
commite89fd49df7e63dcf37ee1aa7e2f50965851725c9 (patch)
tree8484d3930707d1e8f97496f5b58ca3c1a8291dba /source4/libcli/raw/libcliraw.h
parentd327eb01bdc5ae196ece3707510629d95a8857b4 (diff)
downloadsamba-e89fd49df7e63dcf37ee1aa7e2f50965851725c9.tar.gz
samba-e89fd49df7e63dcf37ee1aa7e2f50965851725c9.tar.bz2
samba-e89fd49df7e63dcf37ee1aa7e2f50965851725c9.zip
r4757: added the ability of the clisocket level of libcli to handle async
socket connections. This was complicated by a few factors: - it meant moving the event context from clitransport to clisocket, so lots of structures changed - we need to asynchronously handle connection to lists of port numbers, not just one port number. The code internally tries each port in the list in turn, without ever blocking - the man page on how connect() is supposed to work asynchronously doesn't work in practice (now why doesn't this surprise me?). The getsockopt() for SOL_ERROR is supposed to retrieve the error, but in fact the next (unrelated) connect() call on the same socket also gets an error, though not the right error. To work around this I need to tear down the whole socket between each attempted port. I hate posix. Note that clisocket.c still does a blocking name resolution call in smbcli_sock_connect_byname(). That will be fixed when we add the async NBT resolution code. Also note that I arranged things so that every SMB connection is now async internally, so using plain smbclient or smbtorture tests all the async features of this new code. (This used to be commit 468f8ebbfdbdf37c757fdc4863626aa9946a8870)
Diffstat (limited to 'source4/libcli/raw/libcliraw.h')
-rw-r--r--source4/libcli/raw/libcliraw.h31
1 files changed, 10 insertions, 21 deletions
diff --git a/source4/libcli/raw/libcliraw.h b/source4/libcli/raw/libcliraw.h
index 51b50fdcb9..4047a5d369 100644
--- a/source4/libcli/raw/libcliraw.h
+++ b/source4/libcli/raw/libcliraw.h
@@ -61,24 +61,20 @@ struct smbcli_negotiate {
/* this is the context for a SMB socket associated with the socket itself */
struct smbcli_socket {
- struct ipv4_addr dest_ip;
- /* dest hostname (which may or may not be a DNS name) */
- char *hostname;
+ struct socket_context *sock;
- /* the port used */
+ /* what port we ended up connected to */
int port;
-
- struct socket_context *sock;
- /* a count of the number of packets we have received. We
- * actually only care about zero/non-zero at this stage */
- uint_t pkt_count;
+ /* the hostname we connected to */
+ const char *hostname;
- /* the network address of the client */
- char *client_addr;
-
- /* timeout for socket operations in milliseconds. */
- int timeout;
+ /* the event handle for waiting for socket IO */
+ struct {
+ struct event_context *ctx;
+ struct fd_event *fde;
+ struct timed_event *te;
+ } event;
};
/*
@@ -164,13 +160,6 @@ struct smbcli_transport {
size_t received;
uint8_t *buffer;
} recv_buffer;
-
- /* the event handle for waiting for socket IO */
- struct {
- struct event_context *ctx;
- struct fd_event *fde;
- struct timed_event *te;
- } event;
};
/* this is the context for the user */