3 * Packet-buffering select handler
5 * (c) 1999 Straylight/Edgeware
8 /*----- Licensing notice --------------------------------------------------*
10 * This file is part of the mLib utilities library.
12 * mLib is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Library General Public License as
14 * published by the Free Software Foundation; either version 2 of the
15 * License, or (at your option) any later version.
17 * mLib is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with mLib; if not, write to the Free
24 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
35 /*----- Header files ------------------------------------------------------*/
45 /*----- Data structures ---------------------------------------------------*/
47 typedef struct selpk {
48 sel_file reader; /* File selection object */
49 pkbuf pk; /* Packet buffering object */
52 /*----- Functions provided ------------------------------------------------*/
54 /* --- @selpk_enable@ --- *
56 * Arguments: @selpk *pk@ = pointer to buffer block
60 * Use: Enables a buffer for reading, and emits any queued packets
61 * to the buffer's owner.
64 extern void selpk_enable(selpk */*pk*/);
66 /* --- @selpk_disable@ --- *
68 * Arguments: @selpk *pk@ = pointer to a buffer block
72 * Use: Disables a buffer. It won't be read from until it's
76 extern void selpk_disable(selpk */*pk*/);
78 /* --- @selpk_want@ --- *
80 * Arguments: @selpk *pk@ = pointer to buffer block
81 * @size_t want@ = size of packet to read
85 * Use: Sets the size of the packet to be read next.
88 extern void selpk_want(selpk */*pk*/, size_t /*sz*/);
90 /* --- @selpk_init@ --- *
92 * Arguments: @selpk *pk@ = pointer to buffer block
93 * @sel_state *s@ = pointer to select state to attach to
94 * @int fd@ = file descriptor to listen to
95 * @pkbuf_func *func@ = function to call
96 * @void *p@ = argument for function
100 * Use: Initializes a buffer block.
103 extern void selpk_init(selpk */*pk*/, sel_state */*s*/, int /*fd*/,
104 pkbuf_func */*func*/, void */*p*/);
106 /* --- @selpk_destroy@ --- *
108 * Arguments: @lbuf *b@ = pointer to buffer block
112 * Use: Deallocates a packet buffer and frees any resources it owned.
115 extern void selpk_destroy(selpk */*pk*/);
117 /*----- That's all, folks -------------------------------------------------*/