NetBurner 3.5.0
PDF Version
 
iointernal.h
Go to the documentation of this file.
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4
24#ifndef _NB_IOINTERNALS_H
25#define _NB_IOINTERNALS_H
26
27/*
28 ******************************************************************************
29 *
30 * Definitions
31 *
32 ******************************************************************************
33 */
34#define IOINTERNALS_FRAMEWORK_TAG ((unsigned int)0x10127EB6)
35
36/*
37 ******************************************************************************
38 *
39 * Structures
40 *
41 ******************************************************************************
42 */
43/*
44 * Extra FD Framework
45 * tag - Unique tag (Must be IOINTERNALS_FRAMEWORK_TAG)
46 * ioSocketNumber - I/O socket number
47 * extraSocketNumber - Extra socket number
48 *
49 * Notes:
50 * Must be at the very beginning of any extra data passed to GetExtraFD
51 */
52typedef struct _IoFrameworkStruct
53{
54 unsigned int tag;
55 int ioSocketNumber;
56 int extraSocketNumber;
57
58} __attribute__((packed)) IoFrameworkStruct;
59
60/*
61 * I/O Expansion Structure
62 * read - read function
63 * write - write function
64 * close - close function
65 * extra - Control struct starts with IoFrameworkStruct
66 *
67 * Notes:
68 * Expanded routines for library read, write and close
69 */
70struct IoExpandStruct
71{
72 int (*read)(int fd, char *buf, int nbytes);
73 int (*write)(int fd, const char *buf, int nbytes);
74 int (*close)(int fd);
75 int (*peek)(int fd, char *buf);
76 void *extra;
77} __attribute__((packed));
78
79/****************************************************************************
80
81 Acquire/Release/Access expansion file descriptor
82
83 Parameters:
84 extra_data - Control data structure beginning with
85 IoFrameworkStruct
86 pFuncs - Expanded I/O routines
87
88 fd - Expanded file descriptor
89
90 Return:
91 Acquired fd > EXTRA_IO_OFFSET OK, else -1 for none
92
93 ****************************************************************************/
94
105int GetExtraFD(void *extra_data, struct IoExpandStruct *pFuncs);
106
114void *GetExtraData(int fd);
115
122void FreeExtraFd(int fd);
123
131
139
140/*
141 ***************************************************************************
142
143 I/O subsystem notification support for use by expanded I/O routines
144
145 Parameters:
146 fd - Expanded file descriptor
147
148 Return:
149 None
150
151 ***************************************************************************
152 */
153void SetDataAvail(int fd);
154void ClrDataAvail(int fd);
155
156void SetWriteAvail(int fd);
157void ClrWriteAvail(int fd);
158
159void SetHaveError(int fd);
160void ClrHaveError(int fd);
161
162void Closing(int fd);
163
164#endif
165
int GetFreeExtraFDCount()
Returns the number of free file descriptors.
int GetExtraFD(void *extra_data, struct IoExpandStruct *pFuncs)
Returns a file descriptor for the structure passed as the IoExpandStruct. FreeExtraFd( ) will release...
void FreeExtraFd(int fd)
Free a file descriptor and associated resources.
void * GetExtraData(int fd)
Returns the extra structure value from IoExpandStruct associated with the file descriptor.
int GetFreeSocketCount(void)
Returns the number of free sockets.