24#ifndef _NB_IOINTERNALS_H
25#define _NB_IOINTERNALS_H
30extern int null_read(
int fd,
char *buf,
int nbytes);
31extern int null_write(
int fd,
const char *buf,
int nbytes);
32extern int null_close(
int fd);
33extern FDInfo unknowninfo;
49 int (*read)(
int fd,
char *buf,
int nbytes);
50 int (*write)(
int fd,
const char *buf,
int nbytes);
52 int (*peek)(
int fd,
char *buf);
58inline IoExpandStruct(
int (*io_read)(
int fd,
char *buf,
int nbytes)=null_read,
59 int (*io_write)(
int fd,
const char *buf,
int nbytes)=null_write,
60 int (*io_close)(
int fd)=null_close,
61 int (*io_peek)(
int fd,
char *buf)=0,
62 FDInfo *io_pInfo=&unknowninfo,
74} __attribute__((packed));
102int GetExtraFD(
void *extra_data,
struct IoExpandStruct *pFuncs);
159void SetDataAvail(
int fd);
160void ClrDataAvail(
int fd);
162void SetWriteAvail(
int fd);
163void ClrWriteAvail(
int fd);
165void SetHaveError(
int fd);
166void ClrHaveError(
int fd);
176 FDInfo (
const char * name=0)
180 virtual bool IsMyFd(
int fd)
183 if(pio && (pio->pInfoStruct==
this))
188 virtual const char * GetFdTypeName(
int fd);
190 virtual int GetFdBelow(
int fd);
191 FDInfo * GetInfoBelow(
int fd);
193 virtual int RxBuffer_SpaceUsed(
int fd);
194 virtual int RxBuffer_SpaceAvail(
int fd);
195 virtual int TxBuffer_SpaceUsed(
int fd);
196 virtual int TxBuffer_SpaceAvail(
int fd);
198 virtual bool AllTxSent(
int fd);
200 virtual int RxBuffer_GetMaxSize(
int fd);
201 virtual int RxBuffer_SetMaxSize(
int fd,
int space);
202 virtual int TxBuffer_GetMaxSize(
int fd);
203 virtual int TxBuffer_SetMaxSize(
int fd,
int space);
206 virtual void SetFlush(
int fd,
bool bDoFlush){};
209 virtual int doIoctl(
int fd,
int cmd) {
return -1;};
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.
IoExpandStruct * GetIoExpandStruct(int fd)
Returns the pointer to the IoExpandStruct associated with the file descriptor.
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.