chiark / gitweb /
Manpages: Move manpages (back?) into the top-level directory.
[mLib] / selpk.h
CommitLineData
436fddaa 1/* -*-c-*-
2 *
8656dc50 3 * $Id: selpk.h,v 1.4 2004/04/08 01:36:13 mdw Exp $
436fddaa 4 *
5 * Packet-buffering select handler
6 *
7 * (c) 1999 Straylight/Edgeware
8 */
9
d4efbcd9 10/*----- Licensing notice --------------------------------------------------*
436fddaa 11 *
12 * This file is part of the mLib utilities library.
13 *
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.
d4efbcd9 18 *
436fddaa 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.
d4efbcd9 23 *
436fddaa 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,
27 * MA 02111-1307, USA.
28 */
29
436fddaa 30#ifndef MLIB_SELPK_H
31#define MLIB_SELPK_H
32
33#ifdef __cplusplus
34 extern "C" {
35#endif
36
37/*----- Header files ------------------------------------------------------*/
38
39#ifndef MLIB_PKBUF_H
40# include "pkbuf.h"
41#endif
42
43#ifndef MLIB_SEL_H
44# include "sel.h"
45#endif
46
47/*----- Data structures ---------------------------------------------------*/
48
49typedef struct selpk {
50 sel_file reader; /* File selection object */
51 pkbuf pk; /* Packet buffering object */
52} selpk;
53
54/*----- Functions provided ------------------------------------------------*/
55
56/* --- @selpk_enable@ --- *
57 *
58 * Arguments: @selpk *pk@ = pointer to buffer block
59 *
60 * Returns: ---
61 *
62 * Use: Enables a buffer for reading, and emits any queued packets
63 * to the buffer's owner.
64 */
65
66extern void selpk_enable(selpk */*pk*/);
67
68/* --- @selpk_disable@ --- *
69 *
70 * Arguments: @selpk *pk@ = pointer to a buffer block
71 *
72 * Returns: ---
73 *
74 * Use: Disables a buffer. It won't be read from until it's
75 * enabled again.
76 */
77
78extern void selpk_disable(selpk */*pk*/);
79
80/* --- @selpk_want@ --- *
81 *
82 * Arguments: @selpk *pk@ = pointer to buffer block
83 * @size_t want@ = size of packet to read
84 *
85 * Returns: ---
86 *
87 * Use: Sets the size of the packet to be read next.
88 */
89
2d79c883 90extern void selpk_want(selpk */*pk*/, size_t /*sz*/);
436fddaa 91
92/* --- @selpk_init@ --- *
93 *
94 * Arguments: @selpk *pk@ = pointer to buffer block
95 * @sel_state *s@ = pointer to select state to attach to
96 * @int fd@ = file descriptor to listen to
0daaeb18 97 * @pkbuf_func *func@ = function to call
436fddaa 98 * @void *p@ = argument for function
99 *
100 * Returns: ---
101 *
102 * Use: Initializes a buffer block.
103 */
104
0daaeb18 105extern void selpk_init(selpk */*pk*/, sel_state */*s*/, int /*fd*/,
106 pkbuf_func */*func*/, void */*p*/);
436fddaa 107
108/* --- @selpk_destroy@ --- *
109 *
110 * Arguments: @lbuf *b@ = pointer to buffer block
111 *
112 * Returns: ---
113 *
114 * Use: Deallocates a packet buffer and frees any resources it owned.
115 */
116
117extern void selpk_destroy(selpk */*pk*/);
118
119/*----- That's all, folks -------------------------------------------------*/
120
121#ifdef __cplusplus
122 }
123#endif
124
125#endif