libosmocore 1.9.0.196-9975
Osmocom core library
write_queue.h
Go to the documentation of this file.
1
3/*
4 * (C) 2010 by Holger Hans Peter Freyther
5 * (C) 2010 by On-Waves
6 *
7 * All Rights Reserved
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 */
20#pragma once
21
26#include <osmocom/core/select.h>
27#include <osmocom/core/msgb.h>
28
32 struct osmo_fd bfd;
34 unsigned int max_length;
36 unsigned int current_length;
37
40
42 int (*read_cb)(struct osmo_fd *fd);
44 int (*write_cb)(struct osmo_fd *fd, struct msgb *msg);
46 int (*except_cb)(struct osmo_fd *fd);
47};
48
49void osmo_wqueue_init(struct osmo_wqueue *queue, int max_length);
50void osmo_wqueue_clear(struct osmo_wqueue *queue);
51int osmo_wqueue_enqueue(struct osmo_wqueue *queue, struct msgb *data);
52int osmo_wqueue_enqueue_quiet(struct osmo_wqueue *queue, struct msgb *data);
53size_t osmo_wqueue_set_maxlen(struct osmo_wqueue *queue, unsigned int len);
54int osmo_wqueue_bfd_cb(struct osmo_fd *fd, unsigned int what);
55
static size_t len(const char *str)
uint8_t data[0]
int osmo_wqueue_bfd_cb(struct osmo_fd *fd, unsigned int what)
Select loop function for write queue handling.
Definition: write_queue.c:39
size_t osmo_wqueue_set_maxlen(struct osmo_wqueue *queue, unsigned int len)
Update write queue length & drop excess messages.
Definition: write_queue.c:157
int osmo_wqueue_enqueue_quiet(struct osmo_wqueue *queue, struct msgb *data)
Enqueue a new Message buffers into a write queue (without logging full queue events)
Definition: write_queue.c:107
void osmo_wqueue_clear(struct osmo_wqueue *queue)
Clear a osmo_wqueue.
Definition: write_queue.c:139
int osmo_wqueue_enqueue(struct osmo_wqueue *queue, struct msgb *data)
Enqueue a new Message buffers into a write queue.
Definition: write_queue.c:123
void osmo_wqueue_init(struct osmo_wqueue *queue, int max_length)
Initialize a osmo_wqueue structure.
Definition: write_queue.c:91
uint8_t msg[0]
libmnl integration
(double) linked list header structure
Definition: linuxlist.h:46
Osmocom message buffer.
Definition: msgb.h:31
Structure representing a file dsecriptor.
Definition: select.h:31
int fd
actual operating-system level file decriptor
Definition: select.h:35
write queue instance
Definition: write_queue.h:30
struct llist_head msg_queue
actual linked list implementing the queue
Definition: write_queue.h:39
unsigned int max_length
maximum length of write queue
Definition: write_queue.h:34
struct osmo_fd bfd
osmocom file descriptor
Definition: write_queue.h:32
unsigned int current_length
current length of write queue
Definition: write_queue.h:36
int(* except_cb)(struct osmo_fd *fd)
call-back in case qeueue has exceptions.
Definition: write_queue.h:46
int(* write_cb)(struct osmo_fd *fd, struct msgb *msg)
call-back in case qeueue is writable.
Definition: write_queue.h:44
int(* read_cb)(struct osmo_fd *fd)
call-back in case qeueue is readable.
Definition: write_queue.h:42