chiark / gitweb /
Remove some stray debugging code.
[mLib] / selpk.h
1 /* -*-c-*-
2  *
3  * $Id: selpk.h,v 1.1 2000/06/17 10:39:19 mdw Exp $
4  *
5  * Packet-buffering select handler
6  *
7  * (c) 1999 Straylight/Edgeware
8  */
9
10 /*----- Licensing notice --------------------------------------------------* 
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.
18  * 
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.
23  * 
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
30 /*----- Revision history --------------------------------------------------* 
31  *
32  * $Log: selpk.h,v $
33  * Revision 1.1  2000/06/17 10:39:19  mdw
34  * Experimental new support for packet buffering.
35  *
36  */
37
38 #ifndef MLIB_SELPK_H
39 #define MLIB_SELPK_H
40
41 #ifdef __cplusplus
42   extern "C" {
43 #endif
44
45 /*----- Header files ------------------------------------------------------*/
46
47 #ifndef MLIB_PKBUF_H
48 #  include "pkbuf.h"
49 #endif
50
51 #ifndef MLIB_SEL_H
52 #  include "sel.h"
53 #endif
54
55 /*----- Data structures ---------------------------------------------------*/
56
57 typedef struct selpk {
58   sel_file reader;                      /* File selection object */
59   pkbuf pk;                             /* Packet buffering object */
60 } selpk;
61
62 /*----- Functions provided ------------------------------------------------*/
63
64 /* --- @selpk_enable@ --- *
65  *
66  * Arguments:   @selpk *pk@ = pointer to buffer block
67  *
68  * Returns:     ---
69  *
70  * Use:         Enables a buffer for reading, and emits any queued packets
71  *              to the buffer's owner.
72  */
73
74 extern void selpk_enable(selpk */*pk*/);
75
76 /* --- @selpk_disable@ --- *
77  *
78  * Arguments:   @selpk *pk@ = pointer to a buffer block
79  *
80  * Returns:     ---
81  *
82  * Use:         Disables a buffer.  It won't be read from until it's
83  *              enabled again.
84  */
85
86 extern void selpk_disable(selpk */*pk*/);
87
88 /* --- @selpk_want@ --- *
89  *
90  * Arguments:   @selpk *pk@ = pointer to buffer block
91  *              @size_t want@ = size of packet to read
92  *
93  * Returns:     ---
94  *
95  * Use:         Sets the size of the packet to be read next.
96  */
97
98 extern void selpk_setsize(selpk */*pk*/, size_t /*sz*/);
99
100 /* --- @selpk_init@ --- *
101  *
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
107  *
108  * Returns:     ---
109  *
110  * Use:         Initializes a buffer block.
111  */
112
113 extern void selpk_init(selpk */*pk*/,
114                        sel_state */*s*/,
115                        int /*fd*/,
116                        void (*/*func*/)(octet */*b*/, size_t /*sz*/,
117                                         pkbuf */*pk*/, size_t */*keep*/,
118                                         void */*p*/),
119                        void */*p*/);
120
121 /* --- @selpk_destroy@ --- *
122  *
123  * Arguments:   @lbuf *b@ = pointer to buffer block
124  *
125  * Returns:     ---
126  *
127  * Use:         Deallocates a packet buffer and frees any resources it owned.
128  */
129
130 extern void selpk_destroy(selpk */*pk*/);
131
132 /*----- That's all, folks -------------------------------------------------*/
133
134 #ifdef __cplusplus
135   }
136 #endif
137
138 #endif