diff options
author | Stefan Metzmacher <metze@samba.org> | 2009-04-03 18:08:10 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2009-05-01 17:41:53 +0200 |
commit | 8a090c4b8bb805bdc8debc8ca8ced5cd6f362d2e (patch) | |
tree | 852b29ca19d6b6b837bb479b87c55bd14f01b0b0 /lib/tsocket/tsocket_internal.h | |
parent | 182a4b30dee11286b87431db09ec198e02b347cb (diff) | |
download | samba-8a090c4b8bb805bdc8debc8ca8ced5cd6f362d2e.tar.gz samba-8a090c4b8bb805bdc8debc8ca8ced5cd6f362d2e.tar.bz2 samba-8a090c4b8bb805bdc8debc8ca8ced5cd6f362d2e.zip |
tsocket: add tstream_context infrastructure similar to tdgram_context
metze
Diffstat (limited to 'lib/tsocket/tsocket_internal.h')
-rw-r--r-- | lib/tsocket/tsocket_internal.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/tsocket/tsocket_internal.h b/lib/tsocket/tsocket_internal.h index a03dc9bde0..55bbe9f4cb 100644 --- a/lib/tsocket/tsocket_internal.h +++ b/lib/tsocket/tsocket_internal.h @@ -93,6 +93,48 @@ void *_tdgram_context_data(struct tdgram_context *dgram); #define tdgram_context_data(_req, _type) \ talloc_get_type_abort(_tdgram_context_data(_req), _type) +struct tstream_context_ops { + const char *name; + + ssize_t (*pending_bytes)(struct tstream_context *stream); + + struct tevent_req *(*readv_send)(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct tstream_context *stream, + struct iovec *vector, + size_t count); + int (*readv_recv)(struct tevent_req *req, + int *perrno); + + struct tevent_req *(*writev_send)(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct tstream_context *stream, + const struct iovec *vector, + size_t count); + int (*writev_recv)(struct tevent_req *req, + int *perrno); + + struct tevent_req *(*disconnect_send)(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct tstream_context *stream); + int (*disconnect_recv)(struct tevent_req *req, + int *perrno); +}; + +struct tstream_context *_tstream_context_create(TALLOC_CTX *mem_ctx, + const struct tstream_context_ops *ops, + void *pstate, + size_t psize, + const char *type, + const char *location); +#define tstream_context_create(mem_ctx, ops, state, type, location) \ + _tstream_context_create(mem_ctx, ops, state, sizeof(type), \ + #type, location) + +void *_tstream_context_data(struct tstream_context *stream); +#define tstream_context_data(_req, _type) \ + talloc_get_type_abort(_tstream_context_data(_req), _type) + int tsocket_simple_int_recv(struct tevent_req *req, int *perrno); #endif /* _TSOCKET_H */ |