Browse Source

Add faux_async_ibuf(), faux_async_obuf()

Serj Kalichev 11 months ago
parent
commit
99c9cf7b95
3 changed files with 34 additions and 0 deletions
  1. 2 0
      faux/async.h
  2. 30 0
      faux/async/async.c
  3. 2 0
      faux/faux.map

+ 2 - 0
faux/async.h

@@ -32,6 +32,8 @@ C_DECL_BEGIN
 faux_async_t *faux_async_new(int fd);
 void faux_async_free(faux_async_t *async);
 int faux_async_fd(const faux_async_t *async);
+faux_buf_t *faux_async_ibuf(const faux_async_t *async);
+faux_buf_t *faux_async_obuf(const faux_async_t *async);
 void faux_async_set_read_cb(faux_async_t *async,
 	faux_async_read_cb_fn read_cb, void *user_data);
 bool_t faux_async_set_read_limits(faux_async_t *async, size_t min, size_t max);

+ 30 - 0
faux/async/async.c

@@ -125,6 +125,36 @@ int faux_async_fd(const faux_async_t *async)
 }
 
 
+/** @brief Get input buffer from async I/O object.
+ *
+ * @param [in] async Allocated and initialized async I/O object.
+ * @return faux_buf_t object.
+ */
+faux_buf_t *faux_async_ibuf(const faux_async_t *async)
+{
+	assert(async);
+	if (!async)
+		return NULL;
+
+	return async->ibuf;
+}
+
+
+/** @brief Get output buffer from async I/O object.
+ *
+ * @param [in] async Allocated and initialized async I/O object.
+ * @return faux_buf_t object.
+ */
+faux_buf_t *faux_async_obuf(const faux_async_t *async)
+{
+	assert(async);
+	if (!async)
+		return NULL;
+
+	return async->obuf;
+}
+
+
 /** @brief Set read callback and associated user data.
  *
  * If callback function pointer is NULL then class will drop all readed data.

+ 2 - 0
faux/faux.map

@@ -25,6 +25,8 @@ FAUX_2.0 {
 		faux_async_new;
 		faux_async_free;
 		faux_async_fd;
+		faux_async_ibuf;
+		faux_async_obuf;
 		faux_async_set_read_cb;
 		faux_async_set_read_limits;
 		faux_async_set_stall_cb;