3 * $Id: selpk.h,v 1.2 2000/07/16 18:56:00 mdw Exp $
5 * Packet-buffering select handler
7 * (c) 1999 Straylight/Edgeware
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of the mLib utilities library.
14 * mLib is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
19 * mLib is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with mLib; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30 /*----- Revision history --------------------------------------------------*
33 * Revision 1.2 2000/07/16 18:56:00 mdw
34 * Fix a function declaration which slipped through the net.
36 * Revision 1.1 2000/06/17 10:39:19 mdw
37 * Experimental new support for packet buffering.
48 /*----- Header files ------------------------------------------------------*/
58 /*----- Data structures ---------------------------------------------------*/
60 typedef struct selpk {
61 sel_file reader; /* File selection object */
62 pkbuf pk; /* Packet buffering object */
65 /*----- Functions provided ------------------------------------------------*/
67 /* --- @selpk_enable@ --- *
69 * Arguments: @selpk *pk@ = pointer to buffer block
73 * Use: Enables a buffer for reading, and emits any queued packets
74 * to the buffer's owner.
77 extern void selpk_enable(selpk */*pk*/);
79 /* --- @selpk_disable@ --- *
81 * Arguments: @selpk *pk@ = pointer to a buffer block
85 * Use: Disables a buffer. It won't be read from until it's
89 extern void selpk_disable(selpk */*pk*/);
91 /* --- @selpk_want@ --- *
93 * Arguments: @selpk *pk@ = pointer to buffer block
94 * @size_t want@ = size of packet to read
98 * Use: Sets the size of the packet to be read next.
101 extern void selpk_want(selpk */*pk*/, size_t /*sz*/);
103 /* --- @selpk_init@ --- *
105 * Arguments: @selpk *pk@ = pointer to buffer block
106 * @sel_state *s@ = pointer to select state to attach to
107 * @int fd@ = file descriptor to listen to
108 * @void (*func)(...)@ = function to call
109 * @void *p@ = argument for function
113 * Use: Initializes a buffer block.
116 extern void selpk_init(selpk */*pk*/,
119 void (*/*func*/)(octet */*b*/, size_t /*sz*/,
120 pkbuf */*pk*/, size_t */*keep*/,
124 /* --- @selpk_destroy@ --- *
126 * Arguments: @lbuf *b@ = pointer to buffer block
130 * Use: Deallocates a packet buffer and frees any resources it owned.
133 extern void selpk_destroy(selpk */*pk*/);
135 /*----- That's all, folks -------------------------------------------------*/