3 * $Id: selpk.h,v 1.1 2000/06/17 10:39:19 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.1 2000/06/17 10:39:19 mdw
34 * Experimental new support for packet buffering.
45 /*----- Header files ------------------------------------------------------*/
55 /*----- Data structures ---------------------------------------------------*/
57 typedef struct selpk {
58 sel_file reader; /* File selection object */
59 pkbuf pk; /* Packet buffering object */
62 /*----- Functions provided ------------------------------------------------*/
64 /* --- @selpk_enable@ --- *
66 * Arguments: @selpk *pk@ = pointer to buffer block
70 * Use: Enables a buffer for reading, and emits any queued packets
71 * to the buffer's owner.
74 extern void selpk_enable(selpk */*pk*/);
76 /* --- @selpk_disable@ --- *
78 * Arguments: @selpk *pk@ = pointer to a buffer block
82 * Use: Disables a buffer. It won't be read from until it's
86 extern void selpk_disable(selpk */*pk*/);
88 /* --- @selpk_want@ --- *
90 * Arguments: @selpk *pk@ = pointer to buffer block
91 * @size_t want@ = size of packet to read
95 * Use: Sets the size of the packet to be read next.
98 extern void selpk_setsize(selpk */*pk*/, size_t /*sz*/);
100 /* --- @selpk_init@ --- *
102 * Arguments: @selpk *pk@ = pointer to buffer block
103 * @sel_state *s@ = pointer to select state to attach to
104 * @int fd@ = file descriptor to listen to
105 * @void (*func)(...)@ = function to call
106 * @void *p@ = argument for function
110 * Use: Initializes a buffer block.
113 extern void selpk_init(selpk */*pk*/,
116 void (*/*func*/)(octet */*b*/, size_t /*sz*/,
117 pkbuf */*pk*/, size_t */*keep*/,
121 /* --- @selpk_destroy@ --- *
123 * Arguments: @lbuf *b@ = pointer to buffer block
127 * Use: Deallocates a packet buffer and frees any resources it owned.
130 extern void selpk_destroy(selpk */*pk*/);
132 /*----- That's all, folks -------------------------------------------------*/