|
|
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: #define BUFSIZE 4096 ! 29: #define MAXBUFSIZE (1<<17) ! 30: #if (NOFILE <= 128) /* 128 is value of MAXCLIENTS in dix layer */ ! 31: #define MAXSOCKS (NOFILE - 1) ! 32: #else ! 33: #define MAXSOCKS 128 ! 34: #endif ! 35: #define mskcnt ((MAXSOCKS + 31) / 32) /* size of bit array */ ! 36: ! 37: #if (mskcnt==1) ! 38: #define BITMASK(i) (1 << (i)) ! 39: #define MASKIDX(i) 0 ! 40: #endif ! 41: #if (mskcnt>1) ! 42: #define BITMASK(i) (1 << ((i) & 31)) ! 43: #define MASKIDX(i) ((i) >> 5) ! 44: #endif ! 45: ! 46: #define MASKWORD(buf, i) buf[MASKIDX(i)] ! 47: #define BITSET(buf, i) MASKWORD(buf, i) |= BITMASK(i) ! 48: #define BITCLEAR(buf, i) MASKWORD(buf, i) &= ~BITMASK(i) ! 49: #define GETBIT(buf, i) (MASKWORD(buf, i) & BITMASK(i)) ! 50: ! 51: int cri; ! 52: ! 53: #if (mskcnt==1) ! 54: #define COPYBITS(src, dst) dst[0] = src[0] ! 55: #define CLEARBITS(buf) buf[0] = 0 ! 56: #define MASKANDSETBITS(dst, b1, b2) dst[0] = (b1[0] & b2[0]) ! 57: #define ORBITS(dst, b1, b2) dst[0] = (b1[0] | b2[0]) ! 58: #define UNSETBITS(dst, b1) (dst[0] &= ~b1[0]) ! 59: #define ANYSET(src) (src[0]) ! 60: #endif ! 61: #if (mskcnt==2) ! 62: #define COPYBITS(src, dst) dst[0] = src[0]; dst[1] = src[1] ! 63: #define CLEARBITS(buf) buf[0] = 0; buf[1] = 0 ! 64: #define MASKANDSETBITS(dst, b1, b2) \ ! 65: dst[0] = (b1[0] & b2[0]);\ ! 66: dst[1] = (b1[1] & b2[1]) ! 67: #define ORBITS(dst, b1, b2) \ ! 68: dst[0] = (b1[0] | b2[0]);\ ! 69: dst[1] = (b1[1] | b2[1]) ! 70: #define UNSETBITS(dst, b1) \ ! 71: dst[0] &= ~b1[0]; \ ! 72: dst[1] &= ~b1[1] ! 73: #define ANYSET(src) (src[0] || src[1]) ! 74: #endif ! 75: #if (mskcnt==3) ! 76: #define COPYBITS(src, dst) dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; ! 77: #define CLEARBITS(buf) buf[0] = 0; buf[1] = 0; buf[2] = 0 ! 78: #define MASKANDSETBITS(dst, b1, b2) \ ! 79: dst[0] = (b1[0] & b2[0]);\ ! 80: dst[1] = (b1[1] & b2[1]);\ ! 81: dst[2] = (b1[2] & b2[2]) ! 82: #define ORBITS(dst, b1, b2) \ ! 83: dst[0] = (b1[0] | b2[0]);\ ! 84: dst[1] = (b1[1] | b2[1]);\ ! 85: dst[2] = (b1[2] | b2[2]) ! 86: #define UNSETBITS(dst, b1) \ ! 87: dst[0] &= ~b1[0]; \ ! 88: dst[1] &= ~b1[1]; \ ! 89: dst[2] &= ~b1[2] ! 90: #define ANYSET(src) (src[0] || src[1] || src[2]) ! 91: #endif ! 92: #if (mskcnt==4) ! 93: #define COPYBITS(src, dst) dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2];\ ! 94: dst[3] = src[3] ! 95: #define CLEARBITS(buf) buf[0] = 0; buf[1] = 0; buf[2] = 0; buf[3] = 0 ! 96: #define MASKANDSETBITS(dst, b1, b2) \ ! 97: dst[0] = (b1[0] & b2[0]);\ ! 98: dst[1] = (b1[1] & b2[1]);\ ! 99: dst[2] = (b1[2] & b2[2]);\ ! 100: dst[3] = (b1[3] & b2[3]) ! 101: #define ORBITS(dst, b1, b2) \ ! 102: dst[0] = (b1[0] | b2[0]);\ ! 103: dst[1] = (b1[1] | b2[1]);\ ! 104: dst[2] = (b1[2] | b2[2]);\ ! 105: dst[3] = (b1[3] | b2[3]) ! 106: #define UNSETBITS(dst, b1) \ ! 107: dst[0] &= ~b1[0]; \ ! 108: dst[1] &= ~b1[1]; \ ! 109: dst[2] &= ~b1[2]; \ ! 110: dst[3] &= ~b1[3] ! 111: #define ANYSET(src) (src[0] || src[1] || src[2] || src[3]) ! 112: #endif ! 113: ! 114: #if (mskcnt>4) ! 115: #define COPYBITS(src, dst) bcopy((caddr_t) src, (caddr_t) dst,\ ! 116: mskcnt*sizeof(long)) ! 117: #define CLEARBITS(buf) bzero((caddr_t) buf, mskcnt*sizeof(long)) ! 118: #define MASKANDSETBITS(dst, b1, b2) \ ! 119: for (cri=0; cri<mskcnt; cri++) \ ! 120: dst[cri] = (b1[cri] & b2[cri]) ! 121: #define ORBITS(dst, b1, b2) \ ! 122: for (cri=0; cri<mskcnt; cri++) \ ! 123: dst[cri] = (b1[cri] | b2[cri]) ! 124: #define UNSETBITS(dst, b1) \ ! 125: for (cri=0; cri<mskcnt; cri++) \ ! 126: dst[cri] &= ~b1[cri]; ! 127: #define ANYSET(src) (src[0] || src[1] || src[2] || src[3]) ! 128: #endif ! 129: ! 130: typedef struct _connectionInput { ! 131: int used; /* is this client connected */ ! 132: char *buffer; /* contains current client input */ ! 133: char *bufptr; /* pointer to current start of data */ ! 134: int bufcnt; /* count of bytes in buffer */ ! 135: int lenLastReq; ! 136: int size; ! 137: } ConnectionInput; ! 138: ! 139: typedef struct _osPriv { ! 140: int fd; ! 141: } osPrivRec, *osPrivPtr;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.