1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
/*
* fdlist.h -- include for File Descriptor book-keeping
*
* Copyright (C) 2001 by Massimiliano Ghilardi
*
*/
#ifndef _TWIN_FDLIST_H
#define _TWIN_FDLIST_H
typedef void (*handler_io_s)(int, uldat);
typedef void (*handler_io_d)(int, obj);
typedef struct fdlist fdlist; /* for compressed sockets, two fdlist's are used: */
struct fdlist { /* the uncompressed one has */
int Fd; /* Fd == GZFD and pairSlot == the compressed one; */
uldat pairSlot; /* the compressed has */
obj HandlerData; /* Fd == real fd and pairSlot == the uncompressed;*/
union {
handler_io_s S;
handler_io_d D;
} HandlerIO;
msgport MsgPort; /* other sockets just have */
byte *WQueue; /* Fd == real fd and pairSlot == NOSLOT; */
byte *RQueue;
uldat WQlen, WQmax;
uldat RQstart, RQlen, RQmax;
void (*PrivateAfterFlush)(uldat Slot); /* private enable/disable compression routine.
* it gets called after RemoteFlush() and it must
* remove itself if needed (e.g. call-once routines)
*/
byte (*PrivateFlush)(uldat Slot); /* private flush ((un)compression) routine */
void *PrivateData; /* used by (un)compression routines to hold private data */
/*
* PrivateFlush and PrivateData are used both on low-level, compressed slot and on
* uncompressed slot: in the compressed slot they are used to compress outgoing data,
* while in the uncompressed one they are used to uncompress incoming data.
*/
byte AlienMagic[9 /*TWS_highest*/];/* sizes and endianity used by slot
* instead of native sizes and endianity */
byte extern_couldntwrite;
};
enum Alien_magics {
/* these are possible values of AlienXendian(slot) */
MagicUnknown = 0, MagicNative = 1,
MagicAlien = 2, MagicAlienXendian = 3
};
#define AlienMagic(slot) (FdList[slot].AlienMagic)
#define AlienXendian(slot) AlienMagic(slot)[TWS_void /*0*/]
#define AlienSizeof(type, slot) AlienMagic(slot)[TWS_##type]
#endif /* _TWIN_FDLIST_H */
|