From: Andrew Tridgell Date: Thu, 10 Feb 2005 06:59:29 +0000 (+0000) Subject: r5304: removed lib/socket/socket.h from includes.h X-Git-Url: http://git.samba.org/samba.git/?p=jelmer%2Fsamba4-debian.git;a=commitdiff_plain;h=b902ea546d2d1327b23f40ddaeeaa8e7e3662454 r5304: removed lib/socket/socket.h from includes.h --- diff --git a/source/include/includes.h b/source/include/includes.h index 890491f88..cfc0a2626 100644 --- a/source/include/includes.h +++ b/source/include/includes.h @@ -122,7 +122,6 @@ extern int errno; #include "enums.h" #include "smb_macros.h" #include "smb.h" -#include "lib/socket/socket.h" #include "libcli/ldap/ldap.h" #include "byteorder.h" #include "module.h" diff --git a/source/ldap_server/ldap_server.c b/source/ldap_server/ldap_server.c index 3a0e3d1cd..7319c1c7a 100644 --- a/source/ldap_server/ldap_server.c +++ b/source/ldap_server/ldap_server.c @@ -26,6 +26,7 @@ #include "asn_1.h" #include "ldap_server/ldap_server.h" #include "smbd/service_stream.h" +#include "lib/socket/socket.h" /* close the socket and shutdown a server_context diff --git a/source/lib/messaging/messaging.c b/source/lib/messaging/messaging.c index df0216617..8127e7e8f 100644 --- a/source/lib/messaging/messaging.c +++ b/source/lib/messaging/messaging.c @@ -26,6 +26,7 @@ #include "system/time.h" #include "messages.h" #include "dlinklist.h" +#include "lib/socket/socket.h" /* change the message version with any incompatible changes in the protocol */ #define MESSAGING_VERSION 1 diff --git a/source/lib/socket/access.c b/source/lib/socket/access.c index c90bf203d..a64444d41 100644 --- a/source/lib/socket/access.c +++ b/source/lib/socket/access.c @@ -34,6 +34,7 @@ #include "includes.h" #include "system/network.h" #include "system/iconv.h" +#include "lib/socket/socket.h" #define FAIL (-1) #define ALLONES ((uint32_t)0xFFFFFFFF) diff --git a/source/lib/socket/config.mk b/source/lib/socket/config.mk index 6217fbc07..e4719c3f6 100644 --- a/source/lib/socket/config.mk +++ b/source/lib/socket/config.mk @@ -5,6 +5,7 @@ SUBSYSTEM = SOCKET INIT_OBJ_FILES = \ lib/socket/socket_ipv4.o +NOPROTO=YES # End MODULE socket_ipv4 ################################################ @@ -14,6 +15,7 @@ INIT_OBJ_FILES = \ SUBSYSTEM = SOCKET INIT_OBJ_FILES = \ lib/socket/socket_ipv6.o +NOPROTO=YES # End MODULE socket_ipv6 ################################################ @@ -23,6 +25,7 @@ INIT_OBJ_FILES = \ SUBSYSTEM = SOCKET INIT_OBJ_FILES = \ lib/socket/socket_unix.o +NOPROTO=YES # End MODULE socket_unix ################################################ @@ -33,5 +36,6 @@ INIT_OBJ_FILES = \ lib/socket/socket.o ADD_OBJ_FILES = \ lib/socket/access.o +NOPROTO=YES # End SUBSYSTEM SOCKET ################################################ diff --git a/source/lib/socket/socket.c b/source/lib/socket/socket.c index 109a7cadc..ddc2097f4 100644 --- a/source/lib/socket/socket.c +++ b/source/lib/socket/socket.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "lib/socket/socket.h" #include "system/filesys.h" /* @@ -326,6 +327,10 @@ NTSTATUS socket_dup(struct socket_context *sock) const struct socket_ops *socket_getops_byname(const char *name, enum socket_type type) { + extern const struct socket_ops *socket_ipv4_ops(enum socket_type ); + extern const struct socket_ops *socket_ipv6_ops(enum socket_type ); + extern const struct socket_ops *socket_unixdom_ops(enum socket_type ); + if (strcmp("ip", name) == 0 || strcmp("ipv4", name) == 0) { return socket_ipv4_ops(type); diff --git a/source/lib/socket/socket.h b/source/lib/socket/socket.h index 162a05cb4..b1fae9ac5 100644 --- a/source/lib/socket/socket.h +++ b/source/lib/socket/socket.h @@ -103,4 +103,39 @@ struct socket_context { const struct socket_ops *ops; }; + +/* prototypes */ +NTSTATUS socket_create(const char *name, enum socket_type type, + struct socket_context **new_sock, uint32_t flags); +void socket_destroy(struct socket_context *sock); +NTSTATUS socket_connect(struct socket_context *sock, + const char *my_address, int my_port, + const char *server_address, int server_port, + uint32_t flags); +NTSTATUS socket_connect_complete(struct socket_context *sock, uint32_t flags); +NTSTATUS socket_listen(struct socket_context *sock, const char *my_address, int port, int queue_size, uint32_t flags); +NTSTATUS socket_accept(struct socket_context *sock, struct socket_context **new_sock); +NTSTATUS socket_recv(struct socket_context *sock, void *buf, + size_t wantlen, size_t *nread, uint32_t flags); +NTSTATUS socket_recvfrom(struct socket_context *sock, void *buf, + size_t wantlen, size_t *nread, uint32_t flags, + const char **src_addr, int *src_port); +NTSTATUS socket_send(struct socket_context *sock, + const DATA_BLOB *blob, size_t *sendlen, uint32_t flags); +NTSTATUS socket_sendto(struct socket_context *sock, + const DATA_BLOB *blob, size_t *sendlen, uint32_t flags, + const char *dest_addr, int dest_port); +NTSTATUS socket_set_option(struct socket_context *sock, const char *option, const char *val); +char *socket_get_peer_name(struct socket_context *sock, TALLOC_CTX *mem_ctx); +char *socket_get_peer_addr(struct socket_context *sock, TALLOC_CTX *mem_ctx); +int socket_get_peer_port(struct socket_context *sock); +char *socket_get_my_addr(struct socket_context *sock, TALLOC_CTX *mem_ctx); +int socket_get_my_port(struct socket_context *sock); +int socket_get_fd(struct socket_context *sock); +NTSTATUS socket_dup(struct socket_context *sock); +const struct socket_ops *socket_getops_byname(const char *name, enum socket_type type); +BOOL socket_check_access(struct socket_context *sock, + const char *service_name, + const char **allow_list, const char **deny_list); + #endif /* _SAMBA_SOCKET_H */ diff --git a/source/lib/socket/socket_ipv4.c b/source/lib/socket/socket_ipv4.c index 2a212fbc9..4f8b1e6dd 100644 --- a/source/lib/socket/socket_ipv4.c +++ b/source/lib/socket/socket_ipv4.c @@ -24,6 +24,7 @@ #include "includes.h" #include "system/network.h" #include "system/filesys.h" +#include "lib/socket/socket.h" static NTSTATUS ipv4_init(struct socket_context *sock) { diff --git a/source/lib/socket/socket_ipv6.c b/source/lib/socket/socket_ipv6.c index d7241d9b3..2384e6055 100644 --- a/source/lib/socket/socket_ipv6.c +++ b/source/lib/socket/socket_ipv6.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "lib/socket/socket.h" #include "system/network.h" #include "system/filesys.h" diff --git a/source/lib/socket/socket_unix.c b/source/lib/socket/socket_unix.c index 2bcce0eb1..7cf12db4b 100644 --- a/source/lib/socket/socket_unix.c +++ b/source/lib/socket/socket_unix.c @@ -22,6 +22,8 @@ */ #include "includes.h" +#include "lib/socket/socket.h" +#include "lib/socket/socket.h" #include "system/network.h" #include "system/filesys.h" diff --git a/source/libcli/nbt/nbtsocket.c b/source/libcli/nbt/nbtsocket.c index c771d3b4f..dd14e7670 100644 --- a/source/libcli/nbt/nbtsocket.c +++ b/source/libcli/nbt/nbtsocket.c @@ -24,6 +24,7 @@ #include "lib/events/events.h" #include "dlinklist.h" #include "libcli/nbt/libnbt.h" +#include "lib/socket/socket.h" #define NBT_MAX_PACKET_SIZE 2048 #define NBT_MAX_REPLIES 1000 diff --git a/source/libcli/raw/clisocket.c b/source/libcli/raw/clisocket.c index 44c6a87e2..cbb479ca1 100644 --- a/source/libcli/raw/clisocket.c +++ b/source/libcli/raw/clisocket.c @@ -25,6 +25,7 @@ #include "lib/events/events.h" #include "libcli/raw/libcliraw.h" #include "libcli/composite/composite.h" +#include "lib/socket/socket.h" /* this private structure is used during async connection handling diff --git a/source/libcli/raw/clitransport.c b/source/libcli/raw/clitransport.c index 079783435..ee382da3c 100644 --- a/source/libcli/raw/clitransport.c +++ b/source/libcli/raw/clitransport.c @@ -22,6 +22,7 @@ #include "includes.h" #include "libcli/raw/libcliraw.h" +#include "lib/socket/socket.h" #include "system/time.h" #include "dlinklist.h" #include "lib/events/events.h" diff --git a/source/librpc/rpc/dcerpc_sock.c b/source/librpc/rpc/dcerpc_sock.c index e983c9f53..4d2a66174 100644 --- a/source/librpc/rpc/dcerpc_sock.c +++ b/source/librpc/rpc/dcerpc_sock.c @@ -25,6 +25,7 @@ #include "dlinklist.h" #include "lib/events/events.h" #include "librpc/gen_ndr/ndr_epmapper.h" +#include "lib/socket/socket.h" #define MIN_HDR_SIZE 16 diff --git a/source/nbt_server/interfaces.c b/source/nbt_server/interfaces.c index c84f63040..b2fc0ad6b 100644 --- a/source/nbt_server/interfaces.c +++ b/source/nbt_server/interfaces.c @@ -24,6 +24,7 @@ #include "dlinklist.h" #include "nbt_server/nbt_server.h" #include "smbd/service_task.h" +#include "lib/socket/socket.h" /* diff --git a/source/rpc_server/dcerpc_sock.c b/source/rpc_server/dcerpc_sock.c index 48537375d..d2ebf794b 100644 --- a/source/rpc_server/dcerpc_sock.c +++ b/source/rpc_server/dcerpc_sock.c @@ -23,6 +23,7 @@ */ #include "includes.h" +#include "lib/socket/socket.h" #include "system/filesys.h" #include "lib/events/events.h" #include "rpc_server/dcerpc_server.h" diff --git a/source/smbd/process_model.h b/source/smbd/process_model.h index 137f2add9..2575adecc 100644 --- a/source/smbd/process_model.h +++ b/source/smbd/process_model.h @@ -22,6 +22,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "lib/socket/socket.h" + /* modules can use the following to determine if the interface has changed * please increment the version number after each interface change * with a comment and maybe update struct process_model_critical_sizes. diff --git a/source/smbd/service_stream.c b/source/smbd/service_stream.c index 35a6014eb..4da4453ac 100644 --- a/source/smbd/service_stream.c +++ b/source/smbd/service_stream.c @@ -24,6 +24,7 @@ #include "includes.h" #include "process_model.h" #include "lib/events/events.h" +#include "lib/socket/socket.h" #include "smbd/service_stream.h" /* the range of ports to try for dcerpc over tcp endpoints */ diff --git a/source/torture/local/socket.c b/source/torture/local/socket.c index 6a6f867fa..3b4707b06 100644 --- a/source/torture/local/socket.c +++ b/source/torture/local/socket.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "lib/socket/socket.h" #define CHECK_STATUS(status, correct) do { \ if (!NT_STATUS_EQUAL(status, correct)) { \ diff --git a/source/torture/nbt/register.c b/source/torture/nbt/register.c index a8be5dbb9..dbbe1d3e8 100644 --- a/source/torture/nbt/register.c +++ b/source/torture/nbt/register.c @@ -23,6 +23,7 @@ #include "includes.h" #include "libcli/nbt/libnbt.h" #include "librpc/gen_ndr/ndr_nbt.h" +#include "lib/socket/socket.h" #define CHECK_VALUE(v, correct) do { \ if ((v) != (correct)) { \ diff --git a/source/torture/nbt/wins.c b/source/torture/nbt/wins.c index 62efcd3e9..313a46b02 100644 --- a/source/torture/nbt/wins.c +++ b/source/torture/nbt/wins.c @@ -23,6 +23,7 @@ #include "includes.h" #include "libcli/nbt/libnbt.h" #include "librpc/gen_ndr/ndr_nbt.h" +#include "lib/socket/socket.h" #define CHECK_VALUE(v, correct) do { \ if ((v) != (correct)) { \ diff --git a/source/utils/nmblookup.c b/source/utils/nmblookup.c index e4cf87802..5e8b59edc 100644 --- a/source/utils/nmblookup.c +++ b/source/utils/nmblookup.c @@ -27,6 +27,7 @@ #include "libcli/nbt/libnbt.h" #include "lib/cmdline/popt_common.h" #include "system/iconv.h" +#include "lib/socket/socket.h" /* command line options */ static struct { diff --git a/source/winbind/wb_server.c b/source/winbind/wb_server.c index 0513b1b12..63d186f9d 100644 --- a/source/winbind/wb_server.c +++ b/source/winbind/wb_server.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "lib/socket/socket.h" #include "system/filesys.h" #include "dlinklist.h" #include "lib/events/events.h"