1
0
mirror of https://github.com/samba-team/samba.git synced 2025-11-20 08:23:50 +03:00

r4831: added udp support to our generic sockets library.

I decided to incorporate the udp support into the socket_ipv4.c
backend (and later in socket_ipv6.c) rather than doing a separate
backend, as so much of the code is shareable. Basically this adds a
socket_sendto() and a socket_recvfrom() call and not much all.

For udp servers, I decided to keep the call as socket_listen(), even
though dgram servers don't actually call listen(). This keeps the API
consistent.

I also added a simple local sockets testsuite in smbtorture,
LOCAL-SOCKET
This commit is contained in:
Andrew Tridgell
2005-01-19 03:20:20 +00:00
committed by Gerald (Jerry) Carter
parent 37a133c817
commit 9f12a45a05
8 changed files with 342 additions and 76 deletions

View File

@@ -24,12 +24,12 @@
struct socket_context;
enum socket_type {
SOCKET_TYPE_STREAM
SOCKET_TYPE_STREAM,
SOCKET_TYPE_DGRAM
};
struct socket_ops {
const char *name;
enum socket_type type;
NTSTATUS (*fn_init)(struct socket_context *sock);
@@ -50,9 +50,16 @@ struct socket_ops {
/* general ops */
NTSTATUS (*fn_recv)(struct socket_context *sock, void *buf,
size_t wantlen, size_t *nread, uint32_t flags);
size_t wantlen, size_t *nread, uint32_t flags);
NTSTATUS (*fn_send)(struct socket_context *sock,
const DATA_BLOB *blob, size_t *sendlen, uint32_t flags);
const DATA_BLOB *blob, size_t *sendlen, uint32_t flags);
NTSTATUS (*fn_sendto)(struct socket_context *sock,
const DATA_BLOB *blob, size_t *sendlen, uint32_t flags,
const char *dest_addr, int dest_port);
NTSTATUS (*fn_recvfrom)(struct socket_context *sock,
void *buf, size_t wantlen, size_t *nread, uint32_t flags,
const char **src_addr, int *src_port);
void (*fn_close)(struct socket_context *sock);