diff options
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/messaging/messaging.c | 1 | ||||
-rw-r--r-- | source4/lib/socket/access.c | 1 | ||||
-rw-r--r-- | source4/lib/socket/config.mk | 4 | ||||
-rw-r--r-- | source4/lib/socket/socket.c | 5 | ||||
-rw-r--r-- | source4/lib/socket/socket.h | 35 | ||||
-rw-r--r-- | source4/lib/socket/socket_ipv4.c | 1 | ||||
-rw-r--r-- | source4/lib/socket/socket_ipv6.c | 1 | ||||
-rw-r--r-- | source4/lib/socket/socket_unix.c | 2 |
8 files changed, 50 insertions, 0 deletions
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index df0216617d..8127e7e8fc 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/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/source4/lib/socket/access.c b/source4/lib/socket/access.c index c90bf203dd..a64444d41c 100644 --- a/source4/lib/socket/access.c +++ b/source4/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/source4/lib/socket/config.mk b/source4/lib/socket/config.mk index 6217fbc079..e4719c3f67 100644 --- a/source4/lib/socket/config.mk +++ b/source4/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/source4/lib/socket/socket.c b/source4/lib/socket/socket.c index 109a7cadc0..ddc2097f42 100644 --- a/source4/lib/socket/socket.c +++ b/source4/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/source4/lib/socket/socket.h b/source4/lib/socket/socket.h index 162a05cb40..b1fae9ac56 100644 --- a/source4/lib/socket/socket.h +++ b/source4/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/source4/lib/socket/socket_ipv4.c b/source4/lib/socket/socket_ipv4.c index 2a212fbc94..4f8b1e6dd6 100644 --- a/source4/lib/socket/socket_ipv4.c +++ b/source4/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/source4/lib/socket/socket_ipv6.c b/source4/lib/socket/socket_ipv6.c index d7241d9b38..2384e60550 100644 --- a/source4/lib/socket/socket_ipv6.c +++ b/source4/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/source4/lib/socket/socket_unix.c b/source4/lib/socket/socket_unix.c index 2bcce0eb11..7cf12db4b2 100644 --- a/source4/lib/socket/socket_unix.c +++ b/source4/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" |