|
|
1.1 ! root 1: /*********************************************************** ! 2: Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, ! 3: and the Massachusetts Institute of Technology, Cambridge, Massachusetts. ! 4: ! 5: All Rights Reserved ! 6: ! 7: Permission to use, copy, modify, and distribute this software and its ! 8: documentation for any purpose and without fee is hereby granted, ! 9: provided that the above copyright notice appear in all copies and that ! 10: both that copyright notice and this permission notice appear in ! 11: supporting documentation, and that the names of Digital or MIT not be ! 12: used in advertising or publicity pertaining to distribution of the ! 13: software without specific, written prior permission. ! 14: ! 15: DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ! 16: ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ! 17: DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ! 18: ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, ! 19: WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ! 20: ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ! 21: SOFTWARE. ! 22: ! 23: ******************************************************************/ ! 24: /* $Header: osdep.h,v 1.8 87/09/01 17:24:02 toddb Exp $ */ ! 25: ! 26: #define NULL 0 ! 27: ! 28: #undef BUFSIZE ! 29: #define BUFSIZE 4096 ! 30: #define MAXBUFSIZE (1<<17) ! 31: #if (NOFILE <= 128) /* 128 is value of MAXCLIENTS in dix layer */ ! 32: #define MAXSOCKS (NOFILE - 1) ! 33: #else ! 34: #define MAXSOCKS 128 ! 35: #endif ! 36: #define mskcnt ((MAXSOCKS + 31) / 32) /* size of bit array */ ! 37: ! 38: #if (mskcnt==1) ! 39: #define BITMASK(i) (1 << (i)) ! 40: #define MASKIDX(i) 0 ! 41: #endif ! 42: #if (mskcnt>1) ! 43: #define BITMASK(i) (1 << ((i) & 31)) ! 44: #define MASKIDX(i) ((i) >> 5) ! 45: #endif ! 46: ! 47: #define MASKWORD(buf, i) buf[MASKIDX(i)] ! 48: #define BITSET(buf, i) MASKWORD(buf, i) |= BITMASK(i) ! 49: #define BITCLEAR(buf, i) MASKWORD(buf, i) &= ~BITMASK(i) ! 50: #define GETBIT(buf, i) (MASKWORD(buf, i) & BITMASK(i)) ! 51: ! 52: int cri; ! 53: ! 54: #if (mskcnt==1) ! 55: #define COPYBITS(src, dst) dst[0] = src[0] ! 56: #define CLEARBITS(buf) buf[0] = 0 ! 57: #define MASKANDSETBITS(dst, b1, b2) dst[0] = (b1[0] & b2[0]) ! 58: #define ORBITS(dst, b1, b2) dst[0] = (b1[0] | b2[0]) ! 59: #define UNSETBITS(dst, b1) (dst[0] &= ~b1[0]) ! 60: #define ANYSET(src) (src[0]) ! 61: #endif ! 62: #if (mskcnt==2) ! 63: #define COPYBITS(src, dst) dst[0] = src[0]; dst[1] = src[1] ! 64: #define CLEARBITS(buf) buf[0] = 0; buf[1] = 0 ! 65: #define MASKANDSETBITS(dst, b1, b2) \ ! 66: dst[0] = (b1[0] & b2[0]);\ ! 67: dst[1] = (b1[1] & b2[1]) ! 68: #define ORBITS(dst, b1, b2) \ ! 69: dst[0] = (b1[0] | b2[0]);\ ! 70: dst[1] = (b1[1] | b2[1]) ! 71: #define UNSETBITS(dst, b1) \ ! 72: dst[0] &= ~b1[0]; \ ! 73: dst[1] &= ~b1[1] ! 74: #define ANYSET(src) (src[0] || src[1]) ! 75: #endif ! 76: #if (mskcnt==3) ! 77: #define COPYBITS(src, dst) dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; ! 78: #define CLEARBITS(buf) buf[0] = 0; buf[1] = 0; buf[2] = 0 ! 79: #define MASKANDSETBITS(dst, b1, b2) \ ! 80: dst[0] = (b1[0] & b2[0]);\ ! 81: dst[1] = (b1[1] & b2[1]);\ ! 82: dst[2] = (b1[2] & b2[2]) ! 83: #define ORBITS(dst, b1, b2) \ ! 84: dst[0] = (b1[0] | b2[0]);\ ! 85: dst[1] = (b1[1] | b2[1]);\ ! 86: dst[2] = (b1[2] | b2[2]) ! 87: #define UNSETBITS(dst, b1) \ ! 88: dst[0] &= ~b1[0]; \ ! 89: dst[1] &= ~b1[1]; \ ! 90: dst[2] &= ~b1[2] ! 91: #define ANYSET(src) (src[0] || src[1] || src[2]) ! 92: #endif ! 93: #if (mskcnt==4) ! 94: #define COPYBITS(src, dst) dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2];\ ! 95: dst[3] = src[3] ! 96: #define CLEARBITS(buf) buf[0] = 0; buf[1] = 0; buf[2] = 0; buf[3] = 0 ! 97: #define MASKANDSETBITS(dst, b1, b2) \ ! 98: dst[0] = (b1[0] & b2[0]);\ ! 99: dst[1] = (b1[1] & b2[1]);\ ! 100: dst[2] = (b1[2] & b2[2]);\ ! 101: dst[3] = (b1[3] & b2[3]) ! 102: #define ORBITS(dst, b1, b2) \ ! 103: dst[0] = (b1[0] | b2[0]);\ ! 104: dst[1] = (b1[1] | b2[1]);\ ! 105: dst[2] = (b1[2] | b2[2]);\ ! 106: dst[3] = (b1[3] | b2[3]) ! 107: #define UNSETBITS(dst, b1) \ ! 108: dst[0] &= ~b1[0]; \ ! 109: dst[1] &= ~b1[1]; \ ! 110: dst[2] &= ~b1[2]; \ ! 111: dst[3] &= ~b1[3] ! 112: #define ANYSET(src) (src[0] || src[1] || src[2] || src[3]) ! 113: #endif ! 114: ! 115: #if (mskcnt>4) ! 116: #define COPYBITS(src, dst) bcopy((caddr_t) src, (caddr_t) dst,\ ! 117: mskcnt*sizeof(long)) ! 118: #define CLEARBITS(buf) bzero((caddr_t) buf, mskcnt*sizeof(long)) ! 119: #define MASKANDSETBITS(dst, b1, b2) \ ! 120: for (cri=0; cri<mskcnt; cri++) \ ! 121: dst[cri] = (b1[cri] & b2[cri]) ! 122: #define ORBITS(dst, b1, b2) \ ! 123: for (cri=0; cri<mskcnt; cri++) \ ! 124: dst[cri] = (b1[cri] | b2[cri]) ! 125: #define UNSETBITS(dst, b1) \ ! 126: for (cri=0; cri<mskcnt; cri++) \ ! 127: dst[cri] &= ~b1[cri]; ! 128: #define ANYSET(src) (src[0] || src[1] || src[2] || src[3]) ! 129: #endif ! 130: ! 131: typedef struct _connectionInput { ! 132: int used; /* is this client connected */ ! 133: char *buffer; /* contains current client input */ ! 134: char *bufptr; /* pointer to current start of data */ ! 135: int bufcnt; /* count of bytes in buffer */ ! 136: int lenLastReq; ! 137: int size; ! 138: } ConnectionInput; ! 139: ! 140: typedef struct _osPriv { ! 141: int fd; ! 142: } osPrivRec, *osPrivPtr;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.