[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-587-g18b4925

Stefan Metzmacher metze at samba.org
Thu Mar 19 16:00:28 GMT 2009


The branch, master has been updated
       via  18b4925031f7b378fdd3cde0cb90d48ff967cdc3 (commit)
       via  4508152282758bfa60b5ab55038359fc837a2609 (commit)
       via  84a140f18722518eb0f40737085dd3b3958a3a02 (commit)
       via  c600e8ef42c3cb71c03330782f96bfdf71870e0f (commit)
       via  b69e72dedac5792d8c191850ea3bd4b3ff976526 (commit)
       via  4e18c24e2e4cf567bf5c07978c9881e47cec95d0 (commit)
       via  f6efec5dd423b54f6b9b8cf8d47e644481b0aea2 (commit)
       via  b900e9242512e35f7f805ba4f4ce1624c2677d8b (commit)
       via  235a7a420b72068403d38b47b123faf4481bef08 (commit)
       via  a27c6eb8e23db924e0dc67aa71c832be54cda98f (commit)
       via  6c8bd1005d7440c929d5b70f9faba09e0838b12a (commit)
       via  2e44ceaea858a611bcb7018df80a6a00096449ab (commit)
       via  a140823cc9d7a47e2fc2ffdb80d63b402f7664c0 (commit)
       via  4002b7bdc132988b44aa83b3d0cd8af54a55fe08 (commit)
       via  9ed7a45c88d9daeedf818b56ecefd6ce58fcce36 (commit)
       via  ccfd6a6e39ab999df0eba0d9e94cc22f1aa6e000 (commit)
       via  6c88d61bdd7333c671f440ada23bca7169cd60fc (commit)
       via  c00126e60913f8777e5ba87db464a5b4b9b8b886 (commit)
       via  d848d517b54074ae6b0e2349383554302b85109c (commit)
       via  2e0e416676f5d67e716f272d3923386c3f0c9524 (commit)
      from  011ad7245d53a716c4c766f5ef8d317bb3a53d0f (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 18b4925031f7b378fdd3cde0cb90d48ff967cdc3
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Feb 24 19:05:33 2009 +0100

    s3:libads: use libcli/cldap code
    
    metze

commit 4508152282758bfa60b5ab55038359fc837a2609
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Feb 24 18:27:45 2009 +0100

    s3:build: compile lib/tsocket and libcli/cldap
    
    metze

commit 84a140f18722518eb0f40737085dd3b3958a3a02
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Mar 18 17:43:11 2009 +0100

    move source4/libcli/cldap => libcli/cldap
    
    metze

commit c600e8ef42c3cb71c03330782f96bfdf71870e0f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 13 13:13:54 2009 +0100

    s4:cldap: rewrite the cldap library based on tsocket
    
    metze

commit b69e72dedac5792d8c191850ea3bd4b3ff976526
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 26 14:33:52 2009 +0100

    lib/util: build tevent_unix.o and tevent_ntstatus.o as UTIL_TEVENT subsystem
    
    metze

commit 4e18c24e2e4cf567bf5c07978c9881e47cec95d0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Mar 18 15:59:36 2009 +0100

    lib/tsocket: add tsocket_guide.txt section with specific details about bsd style sockets
    
    metze

commit f6efec5dd423b54f6b9b8cf8d47e644481b0aea2
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Mar 11 17:27:03 2009 +0100

    lib/tsocket: add a fast path to tsocket_writev_send/recv()
    
    This is similar to the tsocket_sendto_send/recv() fast path.
    
    metze

commit b900e9242512e35f7f805ba4f4ce1624c2677d8b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Mar 11 17:11:22 2009 +0100

    lib/tsocket: add a fast path to tsocket_sendto_send/recv()
    
    By first trying to send data without waiting for the socket
    to become writeable we gain about 10-20% performance in the
    LDAP-BENCH-CLDAP test.
    
    metze

commit 235a7a420b72068403d38b47b123faf4481bef08
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Mar 18 11:14:38 2009 +0100

    lib/tsocket: add tsocket_guide.txt section about the async _send/recv() helper functions
    
    metze

commit a27c6eb8e23db924e0dc67aa71c832be54cda98f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Mar 11 15:51:07 2009 +0100

    lib/tsocket: add tsocket_readv_send/recv()
    
    metze

commit 6c8bd1005d7440c929d5b70f9faba09e0838b12a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Mar 11 14:26:15 2009 +0100

    lib/tsocket: add tsocket_writev_queue_send/recv()
    
    metze

commit 2e44ceaea858a611bcb7018df80a6a00096449ab
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Mar 11 14:10:47 2009 +0100

    lib/tsocket: add tsocket_writev_send/recv()
    
    metze

commit a140823cc9d7a47e2fc2ffdb80d63b402f7664c0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 18 09:19:09 2009 +0100

    lib/tsocket: add tsocket_connect_send/recv()
    
    metze

commit 4002b7bdc132988b44aa83b3d0cd8af54a55fe08
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 18 10:00:50 2009 +0100

    lib/tsocket: add tsocket_sendto_queue_send/recv()
    
    metze

commit 9ed7a45c88d9daeedf818b56ecefd6ce58fcce36
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Mar 10 21:12:31 2009 +0100

    lib/tsocket: add tsocket_sendto_send/recv()
    
    metze

commit ccfd6a6e39ab999df0eba0d9e94cc22f1aa6e000
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 18 09:23:32 2009 +0100

    lib/tsocket: add tsocket_recvfrom_send/recv()
    
    metze

commit 6c88d61bdd7333c671f440ada23bca7169cd60fc
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 26 15:37:44 2009 +0100

    lib/tsocket: add an implementation for bsd style sockets.
    
    metze

commit c00126e60913f8777e5ba87db464a5b4b9b8b886
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Mar 11 10:25:07 2009 +0100

    lib/tsocket: add a tsocket_guide.txt with a description of the design
    
    metze

commit d848d517b54074ae6b0e2349383554302b85109c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 18 09:14:26 2009 +0100

    lib/tsocket: add some useful helper functions
    
    metze

commit 2e0e416676f5d67e716f272d3923386c3f0c9524
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 18 09:10:54 2009 +0100

    lib/tsocket: add generic socket abstraction layer
    
    This will replace source4/lib/socket/.
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 lib/tsocket/config.mk               |   17 +
 lib/tsocket/tsocket.c               |  231 +++++++
 lib/tsocket/tsocket.h               |  220 +++++++
 lib/tsocket/tsocket_bsd.c           | 1126 +++++++++++++++++++++++++++++++++++
 lib/tsocket/tsocket_connect.c       |  122 ++++
 lib/tsocket/tsocket_guide.txt       |  503 ++++++++++++++++
 lib/tsocket/tsocket_helpers.c       |  177 ++++++
 lib/tsocket/tsocket_internal.h      |  157 +++++
 lib/tsocket/tsocket_readv.c         |  222 +++++++
 lib/tsocket/tsocket_recvfrom.c      |  164 +++++
 lib/tsocket/tsocket_sendto.c        |  271 +++++++++
 lib/tsocket/tsocket_writev.c        |  316 ++++++++++
 lib/util/config.mk                  |    9 +-
 libcli/cldap/cldap.c                | 1125 ++++++++++++++++++++++++++++++++++
 libcli/cldap/cldap.h                |  133 ++++
 libcli/cldap/config.mk              |    7 +
 source3/Makefile.in                 |   14 +-
 source3/libads/cldap.c              |  296 ++-------
 source4/cldap_server/cldap_server.c |   96 ++--
 source4/cldap_server/netlogon.c     |   23 +-
 source4/cldap_server/rootdse.c      |   13 +-
 source4/headermap.txt               |    4 +-
 source4/libcli/cldap/cldap.c        |  738 -----------------------
 source4/libcli/cldap/cldap.h        |  182 ------
 source4/libcli/config.mk            |    7 -
 source4/libnet/libnet_become_dc.c   |   24 +-
 source4/libnet/libnet_site.c        |   10 +-
 source4/libnet/libnet_unbecome_dc.c |   24 +-
 source4/main.mk                     |    1 +
 source4/torture/ldap/cldap.c        |   75 ++-
 source4/torture/ldap/cldapbench.c   |   46 +-
 source4/torture/rpc/dssync.c        |    9 +-
 32 files changed, 5073 insertions(+), 1289 deletions(-)
 create mode 100644 lib/tsocket/config.mk
 create mode 100644 lib/tsocket/tsocket.c
 create mode 100644 lib/tsocket/tsocket.h
 create mode 100644 lib/tsocket/tsocket_bsd.c
 create mode 100644 lib/tsocket/tsocket_connect.c
 create mode 100644 lib/tsocket/tsocket_guide.txt
 create mode 100644 lib/tsocket/tsocket_helpers.c
 create mode 100644 lib/tsocket/tsocket_internal.h
 create mode 100644 lib/tsocket/tsocket_readv.c
 create mode 100644 lib/tsocket/tsocket_recvfrom.c
 create mode 100644 lib/tsocket/tsocket_sendto.c
 create mode 100644 lib/tsocket/tsocket_writev.c
 create mode 100644 libcli/cldap/cldap.c
 create mode 100644 libcli/cldap/cldap.h
 create mode 100644 libcli/cldap/config.mk
 delete mode 100644 source4/libcli/cldap/cldap.c
 delete mode 100644 source4/libcli/cldap/cldap.h


Changeset truncated at 500 lines:

diff --git a/lib/tsocket/config.mk b/lib/tsocket/config.mk
new file mode 100644
index 0000000..c35f0af
--- /dev/null
+++ b/lib/tsocket/config.mk
@@ -0,0 +1,17 @@
+[SUBSYSTEM::LIBTSOCKET]
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBTEVENT LIBREPLACE_NETWORK
+
+LIBTSOCKET_OBJ_FILES = $(addprefix ../lib/tsocket/, \
+					tsocket.o \
+					tsocket_helpers.o \
+					tsocket_bsd.o \
+					tsocket_recvfrom.o \
+					tsocket_sendto.o \
+					tsocket_connect.o \
+					tsocket_writev.o \
+					tsocket_readv.o)
+
+PUBLIC_HEADERS += $(addprefix ../lib/tsocket/, \
+				 tsocket.h\
+				 tsocket_internal.h)
+
diff --git a/lib/tsocket/tsocket.c b/lib/tsocket/tsocket.c
new file mode 100644
index 0000000..1a12e69
--- /dev/null
+++ b/lib/tsocket/tsocket.c
@@ -0,0 +1,231 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   Copyright (C) Stefan Metzmacher 2009
+
+     ** NOTE! The following LGPL license applies to the tevent
+     ** library. This does NOT imply that all of Samba is released
+     ** under the LGPL
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "replace.h"
+#include "system/network.h"
+#include "tsocket.h"
+#include "tsocket_internal.h"
+
+static int tsocket_context_destructor(struct tsocket_context *sock)
+{
+	tsocket_disconnect(sock);
+	return 0;
+}
+
+struct tsocket_context *_tsocket_context_create(TALLOC_CTX *mem_ctx,
+						const struct tsocket_context_ops *ops,
+						void *pstate,
+						size_t psize,
+						const char *type,
+						const char *location)
+{
+	void **ppstate = (void **)pstate;
+	struct tsocket_context *sock;
+
+	sock = talloc_zero(mem_ctx, struct tsocket_context);
+	if (!sock) {
+		return NULL;
+	}
+	sock->ops = ops;
+	sock->location = location;
+	sock->private_data = talloc_size(sock, psize);
+	if (!sock->private_data) {
+		talloc_free(sock);
+		return NULL;
+	}
+	talloc_set_name_const(sock->private_data, type);
+
+	talloc_set_destructor(sock, tsocket_context_destructor);
+
+	*ppstate = sock->private_data;
+	return sock;
+}
+
+int tsocket_set_event_context(struct tsocket_context *sock,
+			      struct tevent_context *ev)
+{
+	return sock->ops->set_event_context(sock, ev);
+}
+
+int tsocket_set_readable_handler(struct tsocket_context *sock,
+				 tsocket_event_handler_t handler,
+				 void *private_data)
+{
+	return sock->ops->set_read_handler(sock, handler, private_data);
+}
+
+int tsocket_set_writeable_handler(struct tsocket_context *sock,
+				  tsocket_event_handler_t handler,
+				  void *private_data)
+{
+	return sock->ops->set_write_handler(sock, handler, private_data);
+}
+
+int tsocket_connect(struct tsocket_context *sock,
+		    const struct tsocket_address *remote_addr)
+{
+	return sock->ops->connect_to(sock, remote_addr);
+}
+
+int tsocket_listen(struct tsocket_context *sock,
+		   int queue_size)
+{
+	return sock->ops->listen_on(sock, queue_size);
+}
+
+int _tsocket_accept(struct tsocket_context *sock,
+		    TALLOC_CTX *mem_ctx,
+		    struct tsocket_context **new_sock,
+		    const char *location)
+{
+	return sock->ops->accept_new(sock, mem_ctx, new_sock, location);
+}
+
+ssize_t tsocket_pending(struct tsocket_context *sock)
+{
+	return sock->ops->pending_data(sock);
+}
+
+int tsocket_readv(struct tsocket_context *sock,
+		  const struct iovec *vector, size_t count)
+{
+	return sock->ops->readv_data(sock, vector, count);
+}
+
+int tsocket_writev(struct tsocket_context *sock,
+		   const struct iovec *vector, size_t count)
+{
+	return sock->ops->writev_data(sock, vector, count);
+}
+
+ssize_t tsocket_recvfrom(struct tsocket_context *sock,
+			 uint8_t *data, size_t len,
+			 TALLOC_CTX *addr_ctx,
+			 struct tsocket_address **src_addr)
+{
+	return sock->ops->recvfrom_data(sock, data, len, addr_ctx, src_addr);
+}
+
+ssize_t tsocket_sendto(struct tsocket_context *sock,
+		       const uint8_t *data, size_t len,
+		       const struct tsocket_address *dest_addr)
+{
+	return sock->ops->sendto_data(sock, data, len, dest_addr);
+}
+
+int tsocket_get_status(const struct tsocket_context *sock)
+{
+	return sock->ops->get_status(sock);
+}
+
+int _tsocket_get_local_address(const struct tsocket_context *sock,
+			       TALLOC_CTX *mem_ctx,
+			       struct tsocket_address **local_addr,
+			       const char *location)
+{
+	return sock->ops->get_local_address(sock, mem_ctx,
+					    local_addr, location);
+}
+
+int _tsocket_get_remote_address(const struct tsocket_context *sock,
+				TALLOC_CTX *mem_ctx,
+				struct tsocket_address **remote_addr,
+				const char *location)
+{
+	return sock->ops->get_remote_address(sock, mem_ctx,
+					     remote_addr, location);
+}
+
+int tsocket_get_option(const struct tsocket_context *sock,
+		       const char *option,
+		       TALLOC_CTX *mem_ctx,
+		       char **value)
+{
+	return sock->ops->get_option(sock, option, mem_ctx, value);
+}
+
+int tsocket_set_option(const struct tsocket_context *sock,
+		       const char *option,
+		       bool force,
+		       const char *value)
+{
+	return sock->ops->set_option(sock, option, force, value);
+}
+
+void tsocket_disconnect(struct tsocket_context *sock)
+{
+	sock->ops->disconnect(sock);
+}
+
+struct tsocket_address *_tsocket_address_create(TALLOC_CTX *mem_ctx,
+						const struct tsocket_address_ops *ops,
+						void *pstate,
+						size_t psize,
+						const char *type,
+						const char *location)
+{
+	void **ppstate = (void **)pstate;
+	struct tsocket_address *addr;
+
+	addr = talloc_zero(mem_ctx, struct tsocket_address);
+	if (!addr) {
+		return NULL;
+	}
+	addr->ops = ops;
+	addr->location = location;
+	addr->private_data = talloc_size(addr, psize);
+	if (!addr->private_data) {
+		talloc_free(addr);
+		return NULL;
+	}
+	talloc_set_name_const(addr->private_data, type);
+
+	*ppstate = addr->private_data;
+	return addr;
+}
+
+char *tsocket_address_string(const struct tsocket_address *addr,
+			     TALLOC_CTX *mem_ctx)
+{
+	if (!addr) {
+		return talloc_strdup(mem_ctx, "NULL");
+	}
+	return addr->ops->string(addr, mem_ctx);
+}
+
+struct tsocket_address *_tsocket_address_copy(const struct tsocket_address *addr,
+					      TALLOC_CTX *mem_ctx,
+					      const char *location)
+{
+	return addr->ops->copy(addr, mem_ctx, location);
+}
+
+int _tsocket_address_create_socket(const struct tsocket_address *addr,
+				   enum tsocket_type type,
+				   TALLOC_CTX *mem_ctx,
+				   struct tsocket_context **sock,
+				   const char *location)
+{
+	return addr->ops->create_socket(addr, type, mem_ctx, sock, location);
+}
+
diff --git a/lib/tsocket/tsocket.h b/lib/tsocket/tsocket.h
new file mode 100644
index 0000000..9bcfb5c
--- /dev/null
+++ b/lib/tsocket/tsocket.h
@@ -0,0 +1,220 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   Copyright (C) Stefan Metzmacher 2009
+
+     ** NOTE! The following LGPL license applies to the tevent
+     ** library. This does NOT imply that all of Samba is released
+     ** under the LGPL
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _TSOCKET_H
+#define _TSOCKET_H
+
+#include <talloc.h>
+#include <tevent.h>
+
+struct tsocket_context;
+struct tsocket_address;
+struct iovec;
+
+enum tsocket_type {
+	TSOCKET_TYPE_STREAM = 1,
+	TSOCKET_TYPE_DGRAM,
+	TSOCKET_TYPE_MESSAGE
+};
+
+typedef void (*tsocket_event_handler_t)(struct tsocket_context *, void *);
+int tsocket_set_event_context(struct tsocket_context *sock,
+			      struct tevent_context *ev);
+int tsocket_set_readable_handler(struct tsocket_context *sock,
+				 tsocket_event_handler_t handler,
+				 void *private_data);
+int tsocket_set_writeable_handler(struct tsocket_context *sock,
+				  tsocket_event_handler_t handler,
+				  void *private_data);
+
+int tsocket_connect(struct tsocket_context *sock,
+		    const struct tsocket_address *remote_addr);
+
+int tsocket_listen(struct tsocket_context *sock,
+		   int queue_size);
+
+int _tsocket_accept(struct tsocket_context *sock,
+		    TALLOC_CTX *mem_ctx,
+		    struct tsocket_context **new_sock,
+		    const char *location);
+#define tsocket_accept(sock, mem_ctx, new_sock) \
+	_tsocket_accept(sock, mem_ctx, new_sock, __location__)
+
+ssize_t tsocket_pending(struct tsocket_context *sock);
+
+int tsocket_readv(struct tsocket_context *sock,
+		  const struct iovec *vector, size_t count);
+int tsocket_writev(struct tsocket_context *sock,
+		   const struct iovec *vector, size_t count);
+
+ssize_t tsocket_recvfrom(struct tsocket_context *sock,
+			 uint8_t *data, size_t len,
+			 TALLOC_CTX *addr_ctx,
+			 struct tsocket_address **src_addr);
+ssize_t tsocket_sendto(struct tsocket_context *sock,
+		       const uint8_t *data, size_t len,
+		       const struct tsocket_address *dest_addr);
+
+int tsocket_get_status(const struct tsocket_context *sock);
+
+int _tsocket_get_local_address(const struct tsocket_context *sock,
+			       TALLOC_CTX *mem_ctx,
+			       struct tsocket_address **local_addr,
+			       const char *location);
+#define tsocket_get_local_address(sock, mem_ctx, local_addr) \
+	_tsocket_get_local_address(sock, mem_ctx, local_addr, __location__)
+int _tsocket_get_remote_address(const struct tsocket_context *sock,
+				TALLOC_CTX *mem_ctx,
+				struct tsocket_address **remote_addr,
+				const char *location);
+#define tsocket_get_remote_address(sock, mem_ctx, remote_addr) \
+	_tsocket_get_remote_address(sock, mem_ctx, remote_addr, __location__)
+
+int tsocket_get_option(const struct tsocket_context *sock,
+		       const char *option,
+		       TALLOC_CTX *mem_ctx,
+		       char **value);
+int tsocket_set_option(const struct tsocket_context *sock,
+		       const char *option,
+		       bool force,
+		       const char *value);
+
+void tsocket_disconnect(struct tsocket_context *sock);
+
+char *tsocket_address_string(const struct tsocket_address *addr,
+			     TALLOC_CTX *mem_ctx);
+
+struct tsocket_address *_tsocket_address_copy(const struct tsocket_address *addr,
+					      TALLOC_CTX *mem_ctx,
+					      const char *location);
+
+#define tsocket_address_copy(addr, mem_ctx) \
+	_tsocket_address_copy(addr, mem_ctx, __location__)
+
+int _tsocket_address_create_socket(const struct tsocket_address *addr,
+				   enum tsocket_type type,
+				   TALLOC_CTX *mem_ctx,
+				   struct tsocket_context **sock,
+				   const char *location);
+#define tsocket_address_create_socket(addr, type, mem_ctx, sock) \
+	_tsocket_address_create_socket(addr, type, mem_ctx, sock,\
+				       __location__)
+
+/*
+ * BSD sockets: inet, inet6 and unix
+ */
+
+int _tsocket_address_inet_from_strings(TALLOC_CTX *mem_ctx,
+				       const char *fam,
+				       const char *addr,
+				       uint16_t port,
+				       struct tsocket_address **_addr,
+				       const char *location);
+#define tsocket_address_inet_from_strings(mem_ctx, fam, addr, port, _addr) \
+	_tsocket_address_inet_from_strings(mem_ctx, fam, addr, port, _addr, \
+					   __location__)
+
+char *tsocket_address_inet_addr_string(const struct tsocket_address *addr,
+				       TALLOC_CTX *mem_ctx);
+uint16_t tsocket_address_inet_port(const struct tsocket_address *addr);
+int tsocket_address_inet_set_port(struct tsocket_address *addr,
+				  uint16_t port);
+void tsocket_address_inet_set_broadcast(struct tsocket_address *addr,
+					bool broadcast);
+
+int _tsocket_address_unix_from_path(TALLOC_CTX *mem_ctx,
+				    const char *path,
+				    struct tsocket_address **_addr,
+				    const char *location);
+#define tsocket_address_unix_from_path(mem_ctx, path, _addr) \
+	_tsocket_address_unix_from_path(mem_ctx, path, _addr, \
+					__location__)
+char *tsocket_address_unix_path(const struct tsocket_address *addr,
+				TALLOC_CTX *mem_ctx);
+
+int _tsocket_context_bsd_wrap_existing(TALLOC_CTX *mem_ctx,
+				       int fd, bool close_on_disconnect,
+				       struct tsocket_context **_sock,
+				       const char *location);
+#define tsocket_context_bsd_wrap_existing(mem_ctx, fd, cod, _sock) \
+	_tsocket_context_bsd_wrap_existing(mem_ctx, fd, cod, _sock, \
+					   __location__)
+
+/*
+ * Async helpers
+ */
+
+struct tevent_req *tsocket_recvfrom_send(struct tsocket_context *sock,
+					 TALLOC_CTX *mem_ctx);
+ssize_t tsocket_recvfrom_recv(struct tevent_req *req,
+			      int *perrno,
+			      TALLOC_CTX *mem_ctx,
+			      uint8_t **buf,
+			      struct tsocket_address **src);
+
+struct tevent_req *tsocket_sendto_send(struct tsocket_context *sock,
+				       TALLOC_CTX *mem_ctx,
+				       const uint8_t *buf,
+				       size_t len,
+				       const struct tsocket_address *dst);
+ssize_t tsocket_sendto_recv(struct tevent_req *req, int *perrno);
+
+struct tevent_req *tsocket_sendto_queue_send(TALLOC_CTX *mem_ctx,
+					     struct tsocket_context *sock,
+					     struct tevent_queue *queue,
+					     const uint8_t *buf,
+					     size_t len,
+					     struct tsocket_address *dst);
+ssize_t tsocket_sendto_queue_recv(struct tevent_req *req, int *perrno);
+
+struct tevent_req *tsocket_connect_send(struct tsocket_context *sock,
+					TALLOC_CTX *mem_ctx,
+					const struct tsocket_address *dst);
+int tsocket_connect_recv(struct tevent_req *req, int *perrno);
+
+struct tevent_req *tsocket_writev_send(struct tsocket_context *sock,
+				       TALLOC_CTX *mem_ctx,
+				       const struct iovec *vector,
+				       size_t count);
+int tsocket_writev_recv(struct tevent_req *req, int *perrno);
+
+struct tevent_req *tsocket_writev_queue_send(TALLOC_CTX *mem_ctx,
+					     struct tsocket_context *sock,
+					     struct tevent_queue *queue,
+					     const struct iovec *vector,
+					     size_t count);
+int tsocket_writev_queue_recv(struct tevent_req *req, int *perrno);
+
+typedef int (*tsocket_readv_next_iovec_t)(struct tsocket_context *sock,
+					  void *private_data,
+					  TALLOC_CTX *mem_ctx,
+					  struct iovec **vector,
+					  size_t *count);
+struct tevent_req *tsocket_readv_send(struct tsocket_context *sock,
+				      TALLOC_CTX *mem_ctx,
+				      tsocket_readv_next_iovec_t next_iovec_fn,
+				      void *private_data);
+int tsocket_readv_recv(struct tevent_req *req, int *perrno);
+
+#endif /* _TSOCKET_H */
+
diff --git a/lib/tsocket/tsocket_bsd.c b/lib/tsocket/tsocket_bsd.c
new file mode 100644
index 0000000..2811882
--- /dev/null
+++ b/lib/tsocket/tsocket_bsd.c
@@ -0,0 +1,1126 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   Copyright (C) Stefan Metzmacher 2009
+
+     ** NOTE! The following LGPL license applies to the tevent
+     ** library. This does NOT imply that all of Samba is released
+     ** under the LGPL


-- 
Samba Shared Repository


More information about the samba-cvs mailing list