return "<unknown>";
}
}
+
+int fr_bio_cb_set(fr_bio_t *bio, fr_bio_cb_funcs_t const *cb)
+{
+ fr_bio_common_t *my = (fr_bio_common_t *) bio;
+
+ if (!cb) cb = &(fr_bio_cb_funcs_t) { };
+
+ my->cb = *cb;
+
+ return 0;
+}
int fr_bio_free(fr_bio_t *bio) CC_HINT(nonnull);
char const *fr_bio_strerror(ssize_t error);
+
+int fr_bio_cb_set(fr_bio_t *bio, fr_bio_cb_funcs_t const *cb) CC_HINT(nonnull(1));
* If a read returns EOF, then the FD remains open until talloc_free(bio) or fr_bio_fd_close() is called.
*
* @param ctx the talloc ctx
- * @param cb callbacks
* @param cfg structure holding configuration information
* @param offset only for unconnected datagram sockets, where #fr_bio_fd_packet_ctx_t is stored
* @return
* - NULL on error, memory allocation failed
* - !NULL the bio
*/
-fr_bio_t *fr_bio_fd_alloc(TALLOC_CTX *ctx, fr_bio_cb_funcs_t *cb, fr_bio_fd_config_t const *cfg, size_t offset)
+fr_bio_t *fr_bio_fd_alloc(TALLOC_CTX *ctx, fr_bio_fd_config_t const *cfg, size_t offset)
{
fr_bio_fd_t *my;
my = talloc_zero(ctx, fr_bio_fd_t);
if (!my) return NULL;
- if (cb) my->cb = *cb;
my->max_tries = 4;
my->offset = offset;
fr_bio_fd_config_t const *cfg; //!< so we know what was asked, vs what was granted.
} fr_bio_fd_info_t;
-fr_bio_t *fr_bio_fd_alloc(TALLOC_CTX *ctx, fr_bio_cb_funcs_t *cb, fr_bio_fd_config_t const *cfg, size_t offset) CC_HINT(nonnull(1));
+fr_bio_t *fr_bio_fd_alloc(TALLOC_CTX *ctx, fr_bio_fd_config_t const *cfg, size_t offset) CC_HINT(nonnull(1));
int fr_bio_fd_close(fr_bio_t *bio) CC_HINT(nonnull);
.async = true,
};
- thread->fd_bio = fr_bio_fd_alloc(thread, NULL, &cfg, 0);
+ thread->fd_bio = fr_bio_fd_alloc(thread, &cfg, 0);
if (!thread->fd_bio) {
PERROR("Failed allocating UNIX path %s", inst->filename);
return -1;
if (!my->codes[i]) goto fail;
}
- my->fd = fr_bio_fd_alloc(my, NULL, fd_cfg, 0);
+ my->fd = fr_bio_fd_alloc(my, fd_cfg, 0);
if (!my->fd) {
fail:
talloc_free(my);