libosmocore
0.9.3
Osmocom core library
|
00001 /* Generic write queue implementation */ 00002 /* 00003 * (C) 2010 by Holger Hans Peter Freyther 00004 * (C) 2010 by On-Waves 00005 * 00006 * All Rights Reserved 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License along 00019 * with this program; if not, write to the Free Software Foundation, Inc., 00020 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00021 * 00022 */ 00023 #pragma once 00024 00032 #include <osmocom/core/select.h> 00033 #include <osmocom/core/msgb.h> 00034 00036 struct osmo_wqueue { 00038 struct osmo_fd bfd; 00040 unsigned int max_length; 00042 unsigned int current_length; 00043 00045 struct llist_head msg_queue; 00046 00048 int (*read_cb)(struct osmo_fd *fd); 00050 int (*write_cb)(struct osmo_fd *fd, struct msgb *msg); 00052 int (*except_cb)(struct osmo_fd *fd); 00053 }; 00054 00055 void osmo_wqueue_init(struct osmo_wqueue *queue, int max_length); 00056 void osmo_wqueue_clear(struct osmo_wqueue *queue); 00057 int osmo_wqueue_enqueue(struct osmo_wqueue *queue, struct msgb *data); 00058 int osmo_wqueue_bfd_cb(struct osmo_fd *fd, unsigned int what); 00059