diff options
author | Stefan Metzmacher <metze@samba.org> | 2009-03-26 14:27:45 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2009-04-02 21:53:03 +0200 |
commit | 8d98070a9f0a1a17d05e381b8e4c5a8f7a7e8233 (patch) | |
tree | 655bbd1f6b1d388472f07bf893fab75cf0bad728 /lib/tsocket/tsocket.h | |
parent | 37aff885a62cdc5c3298e6f44165f9d9a22729c5 (diff) | |
download | samba-8d98070a9f0a1a17d05e381b8e4c5a8f7a7e8233.tar.gz samba-8d98070a9f0a1a17d05e381b8e4c5a8f7a7e8233.tar.bz2 samba-8d98070a9f0a1a17d05e381b8e4c5a8f7a7e8233.zip |
tsocket: split out a smaller tdgram_context abstraction
The idea is to have a tdgram and a tstream abstraction
which only provide tevent_req based io functions.
metze
Diffstat (limited to 'lib/tsocket/tsocket.h')
-rw-r--r-- | lib/tsocket/tsocket.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/tsocket/tsocket.h b/lib/tsocket/tsocket.h index 9bcfb5cb7e..077fd1ef35 100644 --- a/lib/tsocket/tsocket.h +++ b/lib/tsocket/tsocket.h @@ -29,6 +29,7 @@ struct tsocket_context; struct tsocket_address; +struct tdgram_context; struct iovec; enum tsocket_type { @@ -121,6 +122,32 @@ int _tsocket_address_create_socket(const struct tsocket_address *addr, __location__) /* + * tdgram_context related functions + */ +struct tevent_req *tdgram_recvfrom_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct tdgram_context *dgram); +ssize_t tdgram_recvfrom_recv(struct tevent_req *req, + int *perrno, + TALLOC_CTX *mem_ctx, + uint8_t **buf, + struct tsocket_address **src); + +struct tevent_req *tdgram_sendto_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct tdgram_context *dgram, + const uint8_t *buf, size_t len, + const struct tsocket_address *dst); +ssize_t tdgram_sendto_recv(struct tevent_req *req, + int *perrno); + +struct tevent_req *tdgram_disconnect_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct tdgram_context *dgram); +int tdgram_disconnect_recv(struct tevent_req *req, + int *perrno); + +/* * BSD sockets: inet, inet6 and unix */ @@ -160,6 +187,22 @@ int _tsocket_context_bsd_wrap_existing(TALLOC_CTX *mem_ctx, _tsocket_context_bsd_wrap_existing(mem_ctx, fd, cod, _sock, \ __location__) +int _tdgram_inet_udp_socket(const struct tsocket_address *local, + const struct tsocket_address *remote, + TALLOC_CTX *mem_ctx, + struct tdgram_context **dgram, + const char *location); +#define tdgram_inet_udp_socket(local, remote, mem_ctx, dgram) \ + _tdgram_inet_udp_socket(local, remote, mem_ctx, dgram, __location__) + +int _tdgram_unix_dgram_socket(const struct tsocket_address *local, + const struct tsocket_address *remote, + TALLOC_CTX *mem_ctx, + struct tdgram_context **dgram, + const char *location); +#define tdgram_unix_dgram_socket(local, remote, mem_ctx, dgram) \ + _tdgram_unix_dgram_socket(local, remote, mem_ctx, dgram, __location__) + /* * Async helpers */ |