Hey, the typedef came in handy :) Ok bcook@
> On Sep 5, 2016, at 11:52 AM, Bob Beck <[email protected]> wrote: > > I am in agreement in principle, but please coordinate with bcook@ and/or > jsing@ who were possibly doing > some related adjustments. > > > >> On Mon, Sep 5, 2016 at 4:44 AM, Ted Unangst <[email protected]> wrote: >> Bob Beck wrote: >> > > >> > > Agreed, I was also a bit unclear on payload at first (though it grew on >> > > me over time, so I didn't change it). Here's an update with the >> > > parameter renamed and better documented. >> > > >> > > ok? >> > >> > Yeah. I'm good with this >> > >> > IMO get it in so we can tweak it in tree. >> >> first tweak: the context has a type: struct tls *, so use it. >> >> Index: tls.h >> =================================================================== >> RCS file: /cvs/src/lib/libtls/tls.h,v >> retrieving revision 1.37 >> diff -u -p -r1.37 tls.h >> --- tls.h 4 Sep 2016 14:15:44 -0000 1.37 >> +++ tls.h 5 Sep 2016 10:42:50 -0000 >> @@ -44,9 +44,9 @@ extern "C" { >> struct tls; >> struct tls_config; >> >> -typedef ssize_t (*tls_read_cb)(void *_ctx, void *_buf, size_t _buflen, >> +typedef ssize_t (*tls_read_cb)(struct tls *_ctx, void *_buf, size_t _buflen, >> void *_cb_arg); >> -typedef ssize_t (*tls_write_cb)(void *_ctx, const void *_buf, >> +typedef ssize_t (*tls_write_cb)(struct tls *_ctx, const void *_buf, >> size_t _buflen, void *_cb_arg); >> >> int tls_init(void); >> Index: tls_init.3 >> =================================================================== >> RCS file: /cvs/src/lib/libtls/tls_init.3,v >> retrieving revision 1.71 >> diff -u -p -r1.71 tls_init.3 >> --- tls_init.3 4 Sep 2016 16:37:18 -0000 1.71 >> +++ tls_init.3 5 Sep 2016 10:43:43 -0000 >> @@ -189,13 +189,13 @@ >> .Ft "int" >> .Fn tls_connect_socket "struct tls *ctx" "int s" "const char *servername" >> .Ft "int" >> -.Fn tls_connect_cbs "struct tls *ctx" "ssize_t (*tls_read_cb)(void *ctx, >> void *buf, size_t buflen, void *cb_arg)" "ssize_t (*tls_write_cb)(void *ctx, >> const void *buf, size_t buflen, void *cb_arg)" "void *cb_arg" "const char >> *servername" >> +.Fn tls_connect_cbs "struct tls *ctx" "ssize_t (*tls_read_cb)(struct tls >> *ctx, void *buf, size_t buflen, void *cb_arg)" "ssize_t >> (*tls_write_cb)(struct tls *ctx, const void *buf, size_t buflen, void >> *cb_arg)" "void *cb_arg" "const char *servername" >> .Ft "int" >> .Fn tls_accept_fds "struct tls *tls" "struct tls **cctx" "int fd_read" "int >> fd_write" >> .Ft "int" >> .Fn tls_accept_socket "struct tls *tls" "struct tls **cctx" "int socket" >> .Ft "int" >> -.Fn tls_accept_cbs "struct tls *ctx" "struct tls **cctx" "ssize_t >> (*tls_read_cb)(void *ctx, void *buf, size_t buflen, void *cb_arg)" "ssize_t >> (*tls_write_cb)(void *ctx, const void *buf, size_t buflen, void *cb_arg)" >> "void *cb_arg" >> +.Fn tls_accept_cbs "struct tls *ctx" "struct tls **cctx" "ssize_t >> (*tls_read_cb)(struct *ctx, void *buf, size_t buflen, void *cb_arg)" >> "ssize_t (*tls_write_cb)(struct tls *ctx, const void *buf, size_t buflen, >> void *cb_arg)" "void *cb_arg" >> .Ft "int" >> .Fn tls_handshake "struct tls *ctx" >> .Ft "ssize_t" >
