14 #include "../config.h" 16 #define OSMO_IO_DEFAULT_MSGB_SIZE 1024 17 #define OSMO_IO_DEFAULT_MSGB_HEADROOM 128 20 #define OSMO_IO_BACKEND_DEFAULT "POLL" 22 #if defined(HAVE_URING) 36 #define IOFD_FLAG_CLOSED (1<<0) 37 #define IOFD_FLAG_IN_CALLBACK (1<<1) 38 #define IOFD_FLAG_TO_FREE (1<<2) 39 #define IOFD_FLAG_NOTIFY_CONNECTED (1<<3) 41 #define IOFD_FLAG_SET(iofd, flag) \ 42 (iofd)->flags |= (flag) 44 #define IOFD_FLAG_UNSET(iofd, flag) \ 45 (iofd)->flags &= ~(flag) 47 #define IOFD_FLAG_ISSET(iofd, flag) ((iofd)->flags & (flag)) Definition: osmo_io_internal.h:108
void(* read_enable)(struct osmo_io_fd *iofd)
Definition: osmo_io_internal.h:32
osmo_io_fd_mode
Definition: osmo_io.h:19
struct msgb * msgb_alloc(uint16_t size, const char *name)
Allocate a new message buffer from tall_msgb_ctx.
Definition: msgb.c:108
void iofd_msghdr_free(struct iofd_msghdr *msghdr)
void(* write_disable)(struct osmo_io_fd *iofd)
Definition: osmo_io_internal.h:31
io(_uring) abstraction osmo fd compatibility
Definition: osmo_io_internal.h:109
struct msgb * pending
Pending msgb to keep partial data during segmentation.
Definition: osmo_io_internal.h:66
Osmocom message buffer.
Definition: msgb.h:31
Definition: osmo_io_internal.h:115
const void * ctx
talloc context from which to allocate msgb when reading
Definition: osmo_io_internal.h:75
unsigned int size
size of msgb to allocate (excluding headroom)
Definition: osmo_io_internal.h:77
bool write_enabled
Definition: osmo_io_internal.h:97
uint32_t flags
flags to guard closing/freeing of iofd
Definition: osmo_io_internal.h:58
int(* unregister_fd)(struct osmo_io_fd *iofd)
Definition: osmo_io_internal.h:28
struct msgb * iofd_msgb_alloc(struct osmo_io_fd *iofd)
iofd_msg_action
Definition: osmo_io_internal.h:105
unsigned int current_length
current length of write queue
Definition: osmo_io_internal.h:86
Definition: osmo_io_internal.h:128
int(* close)(struct osmo_io_fd *iofd)
Definition: osmo_io_internal.h:29
struct iofd_msghdr * iofd_msghdr_alloc(struct osmo_io_fd *iofd, enum iofd_msg_action action, struct msgb *msg)
bool read_enabled
Definition: osmo_io_internal.h:96
struct iofd_msghdr * iofd_txqueue_dequeue(struct osmo_io_fd *iofd)
void * data
data pointer passed through to call-back function
Definition: osmo_io_internal.h:69
Definition: osmo_io_internal.h:49
Simple doubly linked list implementation.
(double) linked list header structure
Definition: linuxlist.h:46
struct msgb * msg
Definition: osmo_io_internal.h:123
char * name
human-readable name to associte with fd
Definition: osmo_io_internal.h:61
int fd
actual operating-system level file decriptor
Definition: osmo_io_internal.h:53
struct osmo_io_fd * iofd
Definition: osmo_io_internal.h:124
struct msgb * iofd_msgb_pending_or_alloc(struct osmo_io_fd *iofd)
Definition: osmo_io_internal.h:26
enum iofd_msg_action action
Definition: osmo_io_internal.h:117
void * read_msghdr
Definition: osmo_io_internal.h:98
const struct iofd_backend_ops iofd_poll_ops
iofd_seg_act
Definition: osmo_io_internal.h:127
Definition: osmo_io_internal.h:107
unsigned int max_length
maximum length of write queue
Definition: osmo_io_internal.h:84
void(* write_enable)(struct osmo_io_fd *iofd)
Definition: osmo_io_internal.h:30
Definition: osmo_io_internal.h:130
unsigned int headroom
headroom to allocate when allocating msgb's
Definition: osmo_io_internal.h:79
int(* register_fd)(struct osmo_io_fd *iofd)
Definition: osmo_io_internal.h:27
Definition: osmo_io_internal.h:106
int iofd_txqueue_enqueue(struct osmo_io_fd *iofd, struct iofd_msghdr *msghdr)
Structure representing a file dsecriptor.
Definition: select.h:31
void iofd_handle_segmented_read(struct osmo_io_fd *iofd, struct msgb *msg, int rc)
Osmocom socket convenience functions.
void iofd_txqueue_enqueue_front(struct osmo_io_fd *iofd, struct iofd_msghdr *msghdr)
void(* read_disable)(struct osmo_io_fd *iofd)
Definition: osmo_io_internal.h:33
int flags
Definition: osmo_io_internal.h:121
void iofd_handle_recv(struct osmo_io_fd *iofd, struct msgb *msg, int rc, struct iofd_msghdr *msghdr)
void * write_msghdr
Definition: osmo_io_internal.h:99
Definition: osmo_io_internal.h:129
struct msgb * iofd_msgb_pending(struct osmo_io_fd *iofd)
unsigned int priv_nr
private number, extending data
Definition: osmo_io_internal.h:71