Annotation of ntddk/src/network/streams/inc/sys/stream.h, revision 1.1

1.1     ! root        1: /*++
        !             2: 
        !             3: Copyright (c) 1991  Microsoft Corporation
        !             4: 
        !             5: Module Name:
        !             6: 
        !             7:     stream.h
        !             8: 
        !             9: Abstract:
        !            10: 
        !            11:     This module declares the data types and functions available to
        !            12:     STREAMS drivers and modules.
        !            13: 
        !            14: Author:
        !            15: 
        !            16:     Eric Chin (ericc)           August 9, 1991
        !            17: 
        !            18: Revision History:
        !            19: 
        !            20:     Who          When          What
        !            21:     --------   --------   -----------------------------------------------------
        !            22:     sampa      09-19-91   pulled kernel level stuff from stream.h
        !            23:     mikemas    01-18-92   removed redefinition of STREAMS functions and
        !            24:                           reorganized file.
        !            25:     mikemas    01-20-92   integrated private\inc\stream.h into this file.
        !            26:                           moved to streams\inc\stream.h from ntstream.h
        !            27: 
        !            28: --*/
        !            29: 
        !            30: /******************************************************************
        !            31:  *
        !            32:  *  SpiderSTREAMS - STREAMS Package
        !            33:  *
        !            34:  *  Copyright 1987  Spider Systems Limited
        !            35:  *
        !            36:  *  STREAM.H
        !            37:  *
        !            38:  *    Main STREAMS definitions
        !            39:  *
        !            40:  ******************************************************************/
        !            41: 
        !            42: /*
        !            43:  *   /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/stremul/include/sys/114/s.stream.h
        !            44:  *  @(#)stream.h    1.36
        !            45:  *
        !            46:  *  Last delta created  12:37:24 12/4/91
        !            47:  *  This file extracted 16:45:56 12/23/91
        !            48:  *
        !            49:  *  Modifications:
        !            50:  *
        !            51:  */
        !            52: 
        !            53: 
        !            54: #ifndef _SYS_STREAM_INCLUDED
        !            55: #define _SYS_STREAM_INCLUDED
        !            56: 
        !            57: 
        !            58: 
        !            59: /********************************************************/
        !            60: /*          Streams message and queue types     */
        !            61: /********************************************************/
        !            62: 
        !            63: /*
        !            64:  * Message block descriptor
        !            65:  */
        !            66: struct msgb {
        !            67:     struct msgb    *b_next;     /* next message on queue */
        !            68:     struct msgb    *b_prev;     /* previous message on queue */
        !            69:     struct msgb    *b_cont;     /* next message block of message */
        !            70:     unsigned char  *b_rptr;     /* first unread data byte in buffer */
        !            71:     unsigned char  *b_wptr;     /* first unwritten data byte in buffer */
        !            72:     struct datab   *b_datap;    /* data block */
        !            73:     unsigned char   b_rsvd;     /* in SVR4, this is b_band */
        !            74:     unsigned char   b_pad1;
        !            75:     unsigned short  b_flag;     /* message flag field */
        !            76:     long            b_pad2;
        !            77: };
        !            78: 
        !            79: 
        !            80: /*
        !            81:  * Message flags.  These are interpreted by the Stream Head.
        !            82:  */
        !            83: #define MSGMARK     0x01        /* marked block - for I_ATMARK */
        !            84: #define MSGNLOOP    0x02        /* don't loop message to write queue */
        !            85: #define MSGDELIM    0x04        /* message is delimited */
        !            86: 
        !            87: 
        !            88: /*
        !            89:  * structure containing function to call and argument when freeing
        !            90:  * an extended buffer
        !            91:  */
        !            92: struct free_rtn {
        !            93:     void (*free_func)(char *);  /* free routine of user */
        !            94:     char *free_arg;             /* argument to free routine */
        !            95: };
        !            96: 
        !            97: 
        !            98: /*
        !            99:  *  Data block descriptor
        !           100:  *
        !           101:  */
        !           102: struct datab {
        !           103:     struct datab   *db_freep;   /* used internally */
        !           104:     unsigned char  *db_base;    /* first byte of buffer */
        !           105:     unsigned char  *db_lim;     /* last byte + 1 of buffer */
        !           106:     unsigned long   db_ref;     /* count of msgs pointing to block */
        !           107:     unsigned char   db_type;    /* message type */
        !           108:     unsigned char   db_class;   /* used internally. In SVR4, is db_iswhat */
        !           109:     KSPIN_LOCK      db_lock;    /* protects db_ref */
        !           110: 
        !           111:                                 /* unused SVR4 fields, for future expansion */
        !           112:     unsigned int    db_rsvd1;   /* db_size */
        !           113:     char           *db_rsvd2;   /* db_msgaddr */
        !           114:     long            db_filler;  /* reserved for future use */
        !           115: 
        !           116:                                 /* unique to SpiderSTREAMS */
        !           117:     struct free_rtn db_discard; /* call routine & arg to free buffer */
        !           118: };
        !           119: 
        !           120: 
        !           121: struct queue;    // define queue name so the MIPS compiler will recognize it
        !           122:                  // in the following definition as being the same as the
        !           123:                  // queue structure definition that will follow later.
        !           124: 
        !           125: 
        !           126: /*
        !           127:  * Queue Information Structure
        !           128:  *
        !           129:  */
        !           130: struct qinit {                                  /* declares a queue */
        !           131:     int               (*qi_putp)(               /*  put procedure */
        !           132:                             struct queue *q,
        !           133:                             struct msgb *mp
        !           134:                         );
        !           135:     int               (*qi_srvp)(               /*  service procedure */
        !           136:                             struct queue *
        !           137:                         );
        !           138:     int               (*qi_qopen)(              /*  open procedure */
        !           139:                             struct queue *,
        !           140:                             dev_t *,
        !           141:                             int,
        !           142:                             int,
        !           143:                             void *
        !           144:                         );
        !           145:     int               (*qi_qclose)(             /*  close procedure */
        !           146:                             struct queue *,
        !           147:                             int,
        !           148:                             void *
        !           149:                         );
        !           150:     int               (*qi_qadmin)();           /*  unused */
        !           151:     struct module_info *qi_minfo;               /*  module information */
        !           152:     struct module_stat *qi_mstat;               /*  module statistics */
        !           153:     int                 qi_mplevel;             /*  level of parallelism */
        !           154: };
        !           155: 
        !           156: 
        !           157: #define FULL_PARALLEL   -1      /* fully parallelised */
        !           158: #define STREAM_PARALLEL -2      /* streams parallel: NOT SUPPORTED */
        !           159: 
        !           160: 
        !           161: /*
        !           162:  * Module information structure
        !           163:  */
        !           164: struct module_info {
        !           165:     unsigned short  mi_idnum;   /* module id number */
        !           166:     char           *mi_idname;  /* module name */
        !           167:     long            mi_minpsz;  /* min packet size accepted */
        !           168:     long            mi_maxpsz;  /* max packet size accepted */
        !           169:     unsigned long   mi_hiwat;   /* hi-water mark */
        !           170:     unsigned long   mi_lowat;   /* lo-water mark */
        !           171: };
        !           172: 
        !           173: 
        !           174: /*
        !           175:  * Module statistics structure (not used in current implementation)
        !           176:  */
        !           177: struct module_stat {
        !           178:     long    ms_pcnt;      /* count of calls to put proc */
        !           179:     long    ms_scnt;      /* count of calls to service proc */
        !           180:     long    ms_ocnt;      /* count of calls to open proc */
        !           181:     long    ms_ccnt;      /* count of calls to close proc */
        !           182:     long    ms_acnt;      /* count of calls to admin proc */
        !           183:     char   *ms_xptr;      /* pointer to private statistics */
        !           184:     short   ms_xsize;     /* length of private statistics buffer */
        !           185: };
        !           186: 
        !           187: 
        !           188: /*
        !           189:  * Streamtab (used in cdevsw and fmodsw to point to module or driver)
        !           190:  */
        !           191: struct streamtab {
        !           192:     struct qinit *st_rdinit;   /* defines read QUEUE */
        !           193:     struct qinit *st_wrinit;   /* defines write QUEUE */
        !           194:     struct qinit *st_muxrinit; /* for multiplexing drivers only */
        !           195:     struct qinit *st_muxwinit; /* for multiplexing drivers only */
        !           196: };
        !           197: 
        !           198: 
        !           199: struct mpctl;                                   /* for ANSI c */
        !           200: 
        !           201: 
        !           202: /*
        !           203:  * data queue
        !           204:  */
        !           205: struct queue {                                  /* internal representation */
        !           206:     struct queue       *q_next;                 /*  next in stream */
        !           207:     struct qinit       *q_qinfo;                /*  queue procedures, limits */
        !           208:     struct msgb        *q_first;                /*  first data block */
        !           209:     struct msgb        *q_last;                 /*  last data block */
        !           210:     struct queue       *q_link;                 /*  next queue for scheduling */
        !           211:     char               *q_ptr;                  /*  private data */
        !           212:     unsigned long       q_count;                /*  bytes of data on queue */
        !           213:     unsigned long       q_flag;                 /*  queue state */
        !           214:     long                q_minpsz;               /*  min packet size accepted */
        !           215:     long                q_maxpsz;               /*  max packet size accepted */
        !           216:     unsigned long       q_hiwat;                /*  queue high water mark */
        !           217:     unsigned long       q_lowat;                /*  queue low water mark */
        !           218: 
        !           219:                                                 /*  unique to SpiderSTREAMS */
        !           220:     struct queue       *q_other;                /*  other queue of pair */
        !           221:     struct queue       *q_can;                  /*  queue canput() looks at */
        !           222:     struct queue       *q_back;                 /*  queue to back-enable */
        !           223:     struct mpctl       *q_mpctl;                /*  multiprocessor queue info */
        !           224:     int                 q_active;               /*  # srv/put procs running */
        !           225:     KEVENT              q_disableproc;          /*  for disable_procs() */
        !           226:     char               *q_strmptr;              /*  at stream head only */
        !           227: 
        !           228:                                                 /*  unused SVR4 fields */
        !           229:     void               *q_rsvd1;                /*  q_bandp */
        !           230:     unsigned char       q_rsvd2;                /*  q_nband */
        !           231:     unsigned char       q_pad1[3];              /*  reserved for future use */
        !           232:     long                q_pad2[2];              /*  reserved for future use */
        !           233: };
        !           234: 
        !           235: 
        !           236: /*
        !           237:  * Typedefs for important structures
        !           238:  */
        !           239: typedef struct msgb   mblk_t;
        !           240: typedef struct datab  dblk_t;
        !           241: typedef struct free_rtn frtn_t;
        !           242: typedef struct queue  queue_t;
        !           243: 
        !           244: 
        !           245: /*
        !           246:  * Priority definitions for block allocation.
        !           247:  */
        !           248: #define NPRI        3   /* Number of priority values */
        !           249: 
        !           250: #define BPRI_LO     0
        !           251: #define BPRI_MED    1
        !           252: #define BPRI_HI     2
        !           253: 
        !           254: 
        !           255: /*
        !           256:  * Queue flags
        !           257:  */
        !           258: #define QSTATE      0x000F    /* Queue state mask (see below for values) */
        !           259: #define QREADR      0x0010    /* This is the reader (first) Q */
        !           260: #define QSERV       0x0020    /* This queue has a service proc */
        !           261: #define QEND        0x0040    /* This queue is this stream side end */
        !           262: #define QENABL      0x0100    /* Queue is already enabled to run */
        !           263: #define QNOENB      0x0200    /* Don't enable Q via putq */
        !           264: #define QUSE        0x0400    /* Queue is used */
        !           265: #define QDISABL     0x0800    /* Disable procs can be called */
        !           266: 
        !           267: /*
        !           268:  * Queue state values (in LS 4 bits of flags)
        !           269:  */
        !           270: #define QPRIMED     0x0000    /* Queue was read when empty */
        !           271: #define QEMPTY      0x0001    /* Queue empty but not primed */
        !           272: #define QACTIVE     0x0002    /* Queue not empty and not blocked */
        !           273: #define QBLOCKED    0x0003    /* Queue blocked (canput failed) */
        !           274: #define QFULL       QBLOCKED  /* Just so it's defined */
        !           275: 
        !           276: /*
        !           277:  * Finding related queues
        !           278:  */
        !           279: #define OTHERQ(Q)   ((Q)->q_other)
        !           280: #define WR(Q)       ((Q)->q_other)
        !           281: #define RD(Q)       ((Q)->q_other)
        !           282: 
        !           283: 
        !           284: /*
        !           285:  *  IOCTL structure - this structure is the format of the M_IOCTL message type.
        !           286:  *
        !           287:  */
        !           288: struct iocblk {
        !           289:     int             ioc_cmd;        /* ioctl command type */
        !           290:     unsigned short  ioc_uid;        /* effective uid of user { *ioc_cr } */
        !           291:     unsigned short  ioc_gid;        /* effective gid of user { in SVR4 } */
        !           292:     unsigned int    ioc_id;         /* ioctl id */
        !           293:     unsigned int    ioc_count;      /* count of bytes in data field */
        !           294:     int             ioc_error;      /* error code */
        !           295:     int             ioc_rval;       /* return value  */
        !           296: };
        !           297:                                     /* unprovided SVR4 fields */
        !           298:                                     /* ioc_filler[4] */
        !           299: 
        !           300: 
        !           301: /*
        !           302:  * Link structure for I_LINK and I_UNLINK ioctl's
        !           303:  *
        !           304:  */
        !           305: struct linkblk {
        !           306:     queue_t *l_qtop;   /* lowest level write queue of upper stream */
        !           307:     queue_t *l_qbot;   /* highest level write queue of lower stream */
        !           308:     int      l_index;  /* link index for lower stream */
        !           309: };
        !           310:                        /* unprovided SVR4 fields */
        !           311:                        /* l_pad[5] */
        !           312: 
        !           313: 
        !           314: /*
        !           315:  * Options structure for M_SETOPTS message.  This is sent upstream
        !           316:  * by driver to set stream head options.
        !           317:  */
        !           318: struct stroptions {
        !           319:     unsigned long   so_flags;      /* options to set */
        !           320:     short           so_readopt;    /* read option */
        !           321:     unsigned short  so_wroff;      /* write offset */
        !           322:     long            so_minpsz;     /* minimum read packet size */
        !           323:     long            so_maxpsz;     /* maximum read packet size */
        !           324:     unsigned long   so_hiwat;      /* read queue high water mark */
        !           325:     unsigned long   so_lowat;      /* read queue low water mark */
        !           326:     unsigned char   so_band;       /* update water marks for this band */
        !           327: };
        !           328: 
        !           329: 
        !           330: /*
        !           331:  * enumeration for strqset/strqget
        !           332:  */
        !           333: typedef enum qfields {
        !           334:     QHIWAT = 0,         /* q_hiwat or qb_hiwat */
        !           335:     QLOWAT = 1,         /* q_lowat or qb_lowat */
        !           336:     QMAXPSZ = 2,        /* q_maxpsz */
        !           337:     QMINPSZ = 3,        /* q_minpsz */
        !           338:     QCOUNT = 4,         /* q_count or qb_count */
        !           339:     QFIRST = 5,         /* q_first or qb_first */
        !           340:     QLAST = 6,          /* q_last or qb_last */
        !           341:     QFLAG = 7,          /* q_flag or qb_flag */
        !           342:     QBAD = 8
        !           343: } qfields_t;
        !           344: 
        !           345: 
        !           346: /*
        !           347:  * Flags for stream options set message
        !           348:  */
        !           349: #define SO_ALL      077     /* set all options */
        !           350: #define SO_READOPT  01      /* set read option */
        !           351: #define SO_WROFF    02      /* set write offset */
        !           352: #define SO_MINPSZ   04      /* set min packet size */
        !           353: #define SO_MAXPSZ   010     /* set max packet size */
        !           354: #define SO_HIWAT    020     /* set high water mark */
        !           355: #define SO_LOWAT    040     /* set low water mark */
        !           356: #define SO_MREADON  0100    /* enable M_READ generation */
        !           357: #define SO_MREADOFF 0200    /* disable M_READ generation */
        !           358: #define SO_NDELON   0400    /* select non-STREAMS tty O_NDELAY semantics */
        !           359: #define SO_NDELOFF  01000   /* select STREAMS O_NDELAY semantics */
        !           360: #define SO_BAND     02000   /* set water marks in a band (unsupported) */
        !           361: #define SO_ISTTY    04000   /* acting as a controlling terminal */
        !           362: #define SO_ISNTTY   010000  /* not acting as a controlling terminal */
        !           363: #define SO_TOSTOP   020000  /* stop on background writes (unsupported) */
        !           364: #define SO_TONSTOP  040000  /* no stop on background writes (unsupported) */
        !           365: 
        !           366: 
        !           367: /*
        !           368:  * SpiderStreams Specific flag - to enable the sending down of an
        !           369:  * I_CLOSE ioctl just before calling a drivers close routine
        !           370:  */
        !           371: #define SO_I_CLOSE  0100000 /* send I_CLOSE */
        !           372: 
        !           373: 
        !           374: /*
        !           375:  * Data and protocol messages (regular priority)
        !           376:  */
        !           377: #define M_DATA      00  /* regular data */
        !           378: #define M_PROTO     01  /* protocol control */
        !           379: #define M_DELAY     014 /* real-time xmit delay (1 param) */
        !           380: 
        !           381: 
        !           382: /*
        !           383:  * Control messages (regular priority)
        !           384:  */
        !           385: #define M_BREAK     010 /* line break */
        !           386: #define M_PASSFP    011 /* pass file pointer */
        !           387: #define M_SIG       013 /* generate process signal */
        !           388: #define M_CTL       015 /* device-specific control message */
        !           389: #define M_IOCTL     016 /* ioctl; set/get params */
        !           390: #define M_SETOPTS   020 /* set various stream head options */
        !           391: #define M_RSE       021 /* reserved for internal use */
        !           392: 
        !           393: 
        !           394: /*
        !           395:  * Control messages (high priority; go to head of queue)
        !           396:  */
        !           397: #define M_IOCACK    0201    /* acknowledge ioctl */
        !           398: #define M_IOCNAK    0202    /* negative ioctl acknowledge */
        !           399: #define M_PCPROTO   0203    /* priority proto message */
        !           400: #define M_PCSIG     0204    /* generate process signal */
        !           401: #define M_FLUSH     0206    /* flush your queues */
        !           402: #define M_STOP      0207    /* stop transmission immediately */
        !           403: #define M_START     0210    /* restart transmission after stop */
        !           404: #define M_HANGUP    0211    /* line disconnect */
        !           405: #define M_ERROR     0212    /* fatal error used to set u.u_error */
        !           406: #define M_READ      0213    /* sent on read call, if no messages waiting */
        !           407: #define M_STOPI     0214    /* stop input request */
        !           408: #define M_STARTI    0215    /* start input request */
        !           409: #define M_PCRSE     0216    /* reserved for internel use */
        !           410: 
        !           411: 
        !           412: /*
        !           413:  * Queue message class definitions.
        !           414:  */
        !           415: #define QNORM       0       /* normal messages */
        !           416: #define QPCTL       0200    /* priority cntrl messages */
        !           417: 
        !           418: 
        !           419: /*
        !           420:  * Define for 2-byte M_ERROR message
        !           421:  */
        !           422: #define NOERROR     255
        !           423: 
        !           424: /************************************************************/
        !           425: /*        Miscellaneous parameters and flags            */
        !           426: /************************************************************/
        !           427: 
        !           428: /*
        !           429:  * Stream head default high/low water marks
        !           430:  */
        !           431: 
        !           432: #define STRHIGH     5120
        !           433: #define STRLOW      1024
        !           434: 
        !           435: 
        !           436: /*
        !           437:  * Block allocation parameters
        !           438:  */
        !           439: #define QBSIZE      65      /* min size for block allocation retries */
        !           440: #define MAXBSIZE    4096    /* max block size */
        !           441: #define MAXIOCBSZ   1024    /* max ioctl data block size */
        !           442: 
        !           443: 
        !           444: /*
        !           445:  * Values for stream flag in open to indicate module open, clone open;
        !           446:  * return value for failure.
        !           447:  */
        !           448: #define MODOPEN     1   /* open as a module */
        !           449: #define CLONEOPEN   2   /* open for clone, pick own minor device */
        !           450: #define OPENFAIL    -1  /* returned for open failure */
        !           451: 
        !           452: 
        !           453: /*
        !           454:  * Value for packet size that denotes infinity
        !           455:  */
        !           456: #define INFPSZ      -1
        !           457: 
        !           458: 
        !           459: /*
        !           460:  * Flags for flushq()
        !           461:  */
        !           462: #define FLUSHALL    1   /* flush all messages */
        !           463: #define FLUSHDATA   0   /* don't flush control messages */
        !           464: 
        !           465: 
        !           466: /*
        !           467:  * Default ioctl/close timeout (seconds)
        !           468:  */
        !           469: 
        !           470: #define STRTIMOUT   15
        !           471: 
        !           472: 
        !           473: /************************************************************************/
        !           474: /*    Definitions of Streams macros and function interfaces.            */
        !           475: /************************************************************************/
        !           476: 
        !           477: /*
        !           478:  * extract queue class of message block
        !           479:  */
        !           480: #define queclass(bp)    (bp->b_datap->db_type & QPCTL)
        !           481: 
        !           482: 
        !           483: /*
        !           484:  * Align address on next lower word boundary
        !           485:  */
        !           486: #define straln(a)   (char *)((long)(a) & ~(sizeof(int)-1))
        !           487: 
        !           488: 
        !           489: 
        !           490: /*
        !           491:  * NT-specific definitions for STREAMS Drivers
        !           492:  */
        !           493: typedef struct {
        !           494:     KSPIN_LOCK    spinlock;
        !           495:     KIRQL         oldlevel;
        !           496: } lock_t;
        !           497: 
        !           498: 
        !           499: /*
        !           500:  *  STREAMS <-> TDI interface variable types
        !           501:  */
        !           502: 
        !           503: #define SHTDI_ADDRESS_COMPARE_BIND    0
        !           504: #define SHTDI_ADDRESS_COMPARE_RECEIVE 1
        !           505: 
        !           506: typedef struct {
        !           507:     long ADDR_length;           // length of broadcast address for this type
        !           508:     USHORT AddressType;         // Tdi address type
        !           509:     BOOLEAN DirectedRouted;     // TRUE if a directed message will go farther
        !           510:                                 // than a broadcast or multicast message.
        !           511:     PVOID ADDR_ptr;             // pointer to broadcast address.  NULL if there
        !           512:                                 // isn't one.
        !           513:     BOOLEAN (*AddressCompare)(char *, int, char *, int, int);
        !           514:                                 // Function to call to compare two addresses to
        !           515:                                 // see if the provider treats them as equal.
        !           516:                                 // returns TRUE if the addresses are equal.
        !           517: } STREAMS_TDI_ADDRESS_INFO, *PSTREAMS_TDI_ADDRESS_INFO;
        !           518: 
        !           519: typedef struct {
        !           520:     long SERV_type;
        !           521:     struct streamtab * Partner;
        !           522:     long PSERV_type;
        !           523:     long OPT_length;            // length of option string to pass to turn
        !           524:                                 // on TO_REUSE_ADDR
        !           525:     PVOID OPT_ptr;              // ptr to option string
        !           526:     BOOLEAN ReuseAddr;          // TRUE if TO_REUSE_ADDR is on by default
        !           527:     int AddressInfoCount;       // Number of address info structures in the
        !           528:                                 // AddressInfo array.
        !           529: 
        !           530:     PSTREAMS_TDI_ADDRESS_INFO AddressInfo;
        !           531:                                 // Pointer to the AddressInfo array.  There is
        !           532:                                 // one for each address type the provider
        !           533:                                 // supports.
        !           534: 
        !           535: } STREAMS_TDI_INFO, *PSTREAMS_TDI_INFO;
        !           536: 
        !           537: 
        !           538: 
        !           539: /*
        !           540:  * Definitions for Unix system call and kernel variable emulation
        !           541:  *
        !           542:  */
        !           543: 
        !           544: //
        !           545: // In SVR4, HZ is defined in <sys/param.h> and lbolt declared in <sys\systm.h>.
        !           546: //
        !           547: // However, on NT, we define it here since the value of HZ is intimately tied
        !           548: // to the function, StrmQuerySecondsSince1970Time().
        !           549: //
        !           550: #define HZ        100
        !           551: #define lbolt     StrmQueryLbolt()
        !           552: 
        !           553: 
        !           554: 
        !           555: #define bcopy(src, dest, bcount)    RtlMoveMemory(          \
        !           556:                                         (PVOID) (dest),     \
        !           557:                                         (PVOID) (src),      \
        !           558:                                         (ULONG) (bcount)    \
        !           559:                                         )
        !           560: 
        !           561: #define bzero(addr, bcount)         RtlZeroMemory(          \
        !           562:                                         (PVOID) (addr),     \
        !           563:                                         (ULONG) (bcount)    \
        !           564:                                         )
        !           565: 
        !           566: 
        !           567: //
        !           568: // SAMESTR() is not defined in the SVR4 STREAMS Programmer's Guide, but is
        !           569: // a macro in SVR4's <sys/streams.h>.  In SpiderSTREAMS it is a function.
        !           570: //
        !           571: int
        !           572: SAMESTR(
        !           573:     IN queue_t *q
        !           574:     );
        !           575: 
        !           576: 
        !           577: /*
        !           578:  *  Definitions for the STREAMS error logging facility
        !           579:  */
        !           580: #include <ntiologc.h>
        !           581: 
        !           582:     /*
        !           583:      *  Maximum amount of data (binary dump data plus insertion strings) that
        !           584:      *  can be added to an error log entry.
        !           585:      */
        !           586: #define STRM_MAX_ERROR_LOG_DATA_SIZE     \
        !           587:     ( (ERROR_LOG_MAXIMUM_SIZE - sizeof(IO_ERROR_LOG_PACKET) + 4) & 0xFFFFFFFC )
        !           588: 
        !           589: 
        !           590: 
        !           591: //
        !           592: // NT STREAMS Extensions to the Regular SVR4 STREAMS Utilities
        !           593: //
        !           594: 
        !           595: typedef struct _U_UERROR {
        !           596:     LIST_ENTRY p_list;
        !           597:     struct _KTHREAD * ThreadHandle;
        !           598:     char u_error;
        !           599: 
        !           600: } U_UERROR, *PU_UERROR;
        !           601: 
        !           602: 
        !           603: LARGE_INTEGER
        !           604: StrmConvertCentisecondsToRelativeTimeout(
        !           605:     unsigned long Centiseconds
        !           606:     );
        !           607: 
        !           608: 
        !           609: NTSTATUS
        !           610: StrmDeregisterDriver(
        !           611:     IN PDRIVER_OBJECT driverobject,
        !           612:     IN struct streamtab *streamtab
        !           613:     );
        !           614: 
        !           615: NTSTATUS
        !           616: StrmDeregisterModule(
        !           617:     IN PDRIVER_OBJECT driverobject,
        !           618:     IN struct streamtab *streamtab
        !           619:     );
        !           620: 
        !           621: dev_t
        !           622: StrmFindDevno(
        !           623:     IN struct streamtab *stab
        !           624:     );
        !           625: 
        !           626: char
        !           627: StrmGetError(
        !           628:     void
        !           629:     );
        !           630: 
        !           631: time_t
        !           632: StrmQueryLbolt(
        !           633:     void
        !           634:     );
        !           635: 
        !           636: time_t
        !           637: StrmQuerySecondsSince1970Time(
        !           638:     void
        !           639:     );
        !           640: 
        !           641: NTSTATUS
        !           642: StrmRegisterDriver(
        !           643:     IN PDRIVER_OBJECT driverobject,
        !           644:     IN struct streamtab *streamtab,
        !           645:     IN char *subysname OPTIONAL,
        !           646:     IN PSTREAMS_TDI_INFO ptdiinfo OPTIONAL
        !           647:     );
        !           648: 
        !           649: NTSTATUS
        !           650: StrmRegisterModule(
        !           651:     IN PDRIVER_OBJECT driverobject,
        !           652:     IN struct streamtab *streamtab,
        !           653:     IN char *subysname OPTIONAL
        !           654:     );
        !           655: 
        !           656: VOID
        !           657: StrmSetError(
        !           658:     char
        !           659:     );
        !           660: 
        !           661: int
        !           662: suser(
        !           663:     void
        !           664:     );
        !           665: 
        !           666: NTSTATUS
        !           667: StrmLogEvent(
        !           668:     IN PDRIVER_OBJECT DriverObject OPTIONAL,
        !           669:     IN NTSTATUS EventCode,
        !           670:     IN ULONG UniqueEventValue,
        !           671:     IN USHORT NumStrings,
        !           672:     IN PCHAR *Strings OPTIONAL,
        !           673:     IN ULONG DataSize,
        !           674:     IN PVOID Data OPTIONAL
        !           675:     );
        !           676: 
        !           677: NTSTATUS
        !           678: StrmWaitForMultipleObjects(
        !           679:     IN queue_t *Queue,
        !           680:     IN CCHAR Count,
        !           681:     IN PVOID Object[],
        !           682:     IN WAIT_TYPE WaitType,
        !           683:     IN KWAIT_REASON WaitReason,
        !           684:     IN KPROCESSOR_MODE WaitMode,
        !           685:     IN BOOLEAN Alertable,
        !           686:     IN PLARGE_INTEGER Timeout OPTIONAL,
        !           687:     IN PKWAIT_BLOCK WaitBlockArray OPTIONAL
        !           688:     );
        !           689: 
        !           690: NTSTATUS
        !           691: StrmWaitForMutexObject(
        !           692:     IN queue_t *Queue,
        !           693:     IN PKMUTEX Mutex,
        !           694:     IN KWAIT_REASON WaitReason,
        !           695:     IN KPROCESSOR_MODE WaitMode,
        !           696:     IN BOOLEAN Alertable,
        !           697:     IN PLARGE_INTEGER Timeout OPTIONAL
        !           698:     );
        !           699: 
        !           700: NTSTATUS
        !           701: StrmWaitForSingleObject(
        !           702:     IN queue_t *Queue,
        !           703:     IN PVOID Object,
        !           704:     IN KWAIT_REASON WaitReason,
        !           705:     IN KPROCESSOR_MODE WaitMode,
        !           706:     IN BOOLEAN Alertable,
        !           707:     IN PLARGE_INTEGER Timeout OPTIONAL
        !           708:     );
        !           709: 
        !           710: 
        !           711: NTSTATUS
        !           712: StrmOpenRegKey(
        !           713:     PHANDLE HandlePtr,
        !           714:     PUCHAR KeyName
        !           715:     );
        !           716: 
        !           717: NTSTATUS
        !           718: StrmGetRegValue(
        !           719:     HANDLE KeyHandle,
        !           720:     PUCHAR ValueName,
        !           721:     PUCHAR ValueData,
        !           722:     ULONG ValueLength,
        !           723:     PULONG ValueType
        !           724:     );
        !           725: 
        !           726: 
        !           727: 
        !           728: /*
        !           729:  * General STREAMS functions exported for use by drivers.
        !           730:  *
        !           731:  *     Some of these functions have been renamed and redefined with additional
        !           732:  *     parameters for debugging purposes. Macros which call the new functions
        !           733:  *     appear in place of the old ones.
        !           734:  */
        !           735: 
        !           736: int
        !           737: adjmsg(
        !           738:     IN mblk_t *mp,
        !           739:     IN int len
        !           740:     );
        !           741: 
        !           742: mblk_t *
        !           743: allocb(
        !           744:     IN int size,
        !           745:     IN unsigned int pri
        !           746:     );
        !           747: 
        !           748: queue_t *
        !           749: backq(
        !           750:     IN queue_t *q
        !           751:     );
        !           752: 
        !           753: int
        !           754: bufcall(
        !           755:     IN int size,
        !           756:     IN int pri,
        !           757:     IN int (*func)(long),
        !           758:     IN long arg
        !           759:     );
        !           760: 
        !           761: int
        !           762: canput(
        !           763:     IN queue_t *q
        !           764:     );
        !           765: 
        !           766: int
        !           767: canputnext(
        !           768:     IN queue_t *q
        !           769:     );
        !           770: 
        !           771: mblk_t *
        !           772: copyb(
        !           773:     IN mblk_t *bp
        !           774:     );
        !           775: 
        !           776: mblk_t *
        !           777: copymsg(
        !           778:     IN mblk_t *bp
        !           779:     );
        !           780: 
        !           781: //
        !           782: // Test if data block type is one of the data messages (i.e. not a
        !           783: // control message).
        !           784: //
        !           785: #define datamsg(type)   ((type) == M_DATA || (type) == M_PROTO || \
        !           786:                          (type) == M_PCPROTO || (type) == M_DELAY)
        !           787: 
        !           788: int
        !           789: disable_procs(
        !           790:     IN queue_t *q
        !           791:     );
        !           792: 
        !           793: mblk_t *
        !           794: dupb(
        !           795:     IN mblk_t *bp
        !           796:     );
        !           797: 
        !           798: mblk_t *
        !           799: dupmsg(
        !           800:     IN mblk_t *bp
        !           801:     );
        !           802: 
        !           803: int
        !           804: enable_procs(
        !           805:     IN queue_t *q
        !           806:     );
        !           807: 
        !           808: void
        !           809: enableok(
        !           810:     IN queue_t *q
        !           811:     );
        !           812: 
        !           813: mblk_t *
        !           814: esballoc(
        !           815:     IN unsigned char *base,
        !           816:     IN int size,
        !           817:     IN int pri,
        !           818:     IN frtn_t *fr_rtn
        !           819:     );
        !           820: 
        !           821: int
        !           822: esbbcall(
        !           823:     IN int pri,
        !           824:     IN int (*func)(long),
        !           825:     IN long arg
        !           826:     );
        !           827: 
        !           828: void
        !           829: flushq(
        !           830:     IN queue_t *q,
        !           831:     IN int flag
        !           832:     );
        !           833: 
        !           834: void
        !           835: freeb(
        !           836:     IN mblk_t *bp
        !           837:     );
        !           838: 
        !           839: void
        !           840: freemsg(
        !           841:     IN mblk_t *bp
        !           842:     );
        !           843: 
        !           844: int (*
        !           845: getadmin(
        !           846:     IN unsigned short mid
        !           847:     ))();
        !           848: 
        !           849: unsigned short
        !           850: getmid(
        !           851:     IN char *name
        !           852:     );
        !           853: 
        !           854: mblk_t *
        !           855: getq(
        !           856:     IN queue_t *q
        !           857:     );
        !           858: 
        !           859: /*
        !           860:  * void
        !           861:  * init_lock(
        !           862:  *    IN lock_t *lockp
        !           863:  *    );
        !           864:  */
        !           865: 
        !           866: #define init_lock(lockp)    KeInitializeSpinLock(&((lockp)->spinlock))
        !           867: 
        !           868: 
        !           869: int
        !           870: insq(
        !           871:     IN queue_t *q,
        !           872:     IN mblk_t *emp,
        !           873:     IN mblk_t *mp
        !           874:     );
        !           875: 
        !           876: void
        !           877: linkb(
        !           878:     IN mblk_t *mp,
        !           879:     IN mblk_t *bp
        !           880:     );
        !           881: 
        !           882: int
        !           883: msgdsize(
        !           884:     IN mblk_t *bp
        !           885:     );
        !           886: 
        !           887: void
        !           888: noenable(
        !           889:     IN queue_t *q
        !           890:     );
        !           891: 
        !           892: /*
        !           893:  * int
        !           894:  * p_lock (
        !           895:  *    IN lock_t *lockp,
        !           896:  *    IN int level
        !           897:  *    );
        !           898:  */
        !           899: 
        !           900: #define p_lock(lockp, ignored)              \
        !           901:             ( KeAcquireSpinLock(            \
        !           902:                  &((lockp)->spinlock),     \
        !           903:                  &((lockp)->oldlevel)      \
        !           904:                  ),                        \
        !           905:              ((int) (lockp)->oldlevel)     \
        !           906:            )
        !           907: 
        !           908: int
        !           909: pullupmsg(
        !           910:     IN mblk_t *mp,
        !           911:     IN int len
        !           912:     );
        !           913: 
        !           914: int
        !           915: put(
        !           916:     IN queue_t *q,
        !           917:     IN mblk_t *mp
        !           918:     );
        !           919: 
        !           920: int
        !           921: putbq(
        !           922:     IN queue_t *q,
        !           923:     IN mblk_t *bp
        !           924:     );
        !           925: 
        !           926: int
        !           927: putctl(
        !           928:     IN queue_t *q,
        !           929:     IN int type
        !           930:     );
        !           931: 
        !           932: int
        !           933: putctl1(
        !           934:     IN queue_t *q,
        !           935:     IN int type,
        !           936:     IN int param
        !           937:     );
        !           938: 
        !           939: int
        !           940: putnext(
        !           941:     IN queue_t *q,
        !           942:     IN mblk_t *mp
        !           943:     );
        !           944: 
        !           945: int
        !           946: putnextctl(
        !           947:     IN queue_t *q,
        !           948:     IN int type
        !           949:     );
        !           950: 
        !           951: int
        !           952: putnextctl1(
        !           953:     IN queue_t *q,
        !           954:     IN int type,
        !           955:     IN int p
        !           956:     );
        !           957: 
        !           958: int
        !           959: putq(
        !           960:     IN queue_t *q,
        !           961:     IN mblk_t *bp
        !           962:     );
        !           963: 
        !           964: void
        !           965: qenable(
        !           966:     IN queue_t *q
        !           967:     );
        !           968: 
        !           969: void
        !           970: qreply(
        !           971:     IN queue_t *q,
        !           972:     IN mblk_t *bp
        !           973:     );
        !           974: 
        !           975: int
        !           976: qsize(
        !           977:     IN queue_t *qp
        !           978:     );
        !           979: 
        !           980: mblk_t *
        !           981: rmvb(
        !           982:     IN mblk_t *mp,
        !           983:     IN mblk_t *bp
        !           984:     );
        !           985: 
        !           986: void
        !           987: rmvq(
        !           988:     IN queue_t *q,
        !           989:     IN mblk_t *mp
        !           990:     );
        !           991: 
        !           992: int
        !           993: strlog(
        !           994:     IN short mid,
        !           995:     IN short sid,
        !           996:     IN char level,
        !           997:     IN unsigned short  flags,
        !           998:     IN char *fmt,
        !           999:     ...
        !          1000:     );
        !          1001: 
        !          1002: int
        !          1003: strqget(
        !          1004:     IN queue_t *q,
        !          1005:     IN qfields_t what,
        !          1006:     IN unsigned char band,
        !          1007:     IN long *valp
        !          1008:     );
        !          1009: 
        !          1010: int
        !          1011: strqset(
        !          1012:     IN queue_t *q,
        !          1013:     IN qfields_t what,
        !          1014:     IN unsigned char band,
        !          1015:     IN long *val
        !          1016:     );
        !          1017: 
        !          1018: int
        !          1019: testb(
        !          1020:     IN int size,
        !          1021:     IN unsigned int pri
        !          1022:     );
        !          1023: 
        !          1024: int
        !          1025: timeout(
        !          1026:     IN int (*ftn)(char *),
        !          1027:     IN char *arg,
        !          1028:     IN long tim
        !          1029:     );
        !          1030: 
        !          1031: int
        !          1032: unbufcall(
        !          1033:     IN int id
        !          1034:     );
        !          1035: 
        !          1036: mblk_t *
        !          1037: unlinkb(
        !          1038:     IN mblk_t *mp
        !          1039:     );
        !          1040: 
        !          1041: int
        !          1042: untimeout(
        !          1043:     IN int seq
        !          1044:     );
        !          1045: 
        !          1046: /* void
        !          1047:  * v_lock (
        !          1048:  *     IN lock_t *lockp,
        !          1049:  *     IN int level
        !          1050:  *     );
        !          1051:  *
        !          1052:  */
        !          1053: 
        !          1054: #define v_lock(lockp, level)   \
        !          1055:             KeReleaseSpinLock(&((lockp)->spinlock), (KIRQL) (level))
        !          1056: 
        !          1057: 
        !          1058: 
        !          1059: //
        !          1060: // BUGBUG - this include needs to be removed for the final product.
        !          1061: //
        !          1062: #include <debugapi.h>
        !          1063: 
        !          1064: 
        !          1065: 
        !          1066: #endif  // _SYS_STREAM_INCLUDED
        !          1067: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.