diff options
author | Volker Lendecke <vl@samba.org> | 2009-03-08 09:34:35 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-03-08 11:20:59 +0100 |
commit | f5ee31602c7880b11dff82258764eb9a76cdc83b (patch) | |
tree | 97d3ca0ec51e8e7e294c2527c833465748a10a6b /source3/lib | |
parent | fe486d7b9f580a17d23dd57582087c7d28cb738d (diff) | |
download | samba-f5ee31602c7880b11dff82258764eb9a76cdc83b.tar.gz samba-f5ee31602c7880b11dff82258764eb9a76cdc83b.tar.bz2 samba-f5ee31602c7880b11dff82258764eb9a76cdc83b.zip |
Add tevent_req wbc helpers
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/wb_reqtrans.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/source3/lib/wb_reqtrans.c b/source3/lib/wb_reqtrans.c index 26dfb783ab..2051696a02 100644 --- a/source3/lib/wb_reqtrans.c +++ b/source3/lib/wb_reqtrans.c @@ -81,6 +81,43 @@ wbcErr async_req_simple_recv_wbcerr(struct async_req *req) return WBC_ERR_SUCCESS; } +bool tevent_req_is_wbcerr(struct tevent_req *req, wbcErr *pwbc_err) +{ + enum tevent_req_state state; + uint64_t error; + if (!tevent_req_is_error(req, &state, &error)) { + *pwbc_err = WBC_ERR_SUCCESS; + return false; + } + + switch (state) { + case TEVENT_REQ_USER_ERROR: + *pwbc_err = error; + break; + case TEVENT_REQ_TIMED_OUT: + *pwbc_err = WBC_ERR_UNKNOWN_FAILURE; + break; + case TEVENT_REQ_NO_MEMORY: + *pwbc_err = WBC_ERR_NO_MEMORY; + break; + default: + *pwbc_err = WBC_ERR_UNKNOWN_FAILURE; + break; + } + return true; +} + +wbcErr tevent_req_simple_recv_wbcerr(struct tevent_req *req) +{ + wbcErr wbc_err; + + if (tevent_req_is_wbcerr(req, &wbc_err)) { + return wbc_err; + } + + return WBC_ERR_SUCCESS; +} + static ssize_t wb_req_more(uint8_t *buf, size_t buflen, void *private_data); static void wb_req_read_done(struct tevent_req *subreq); |