Annotation of 43BSDTahoe/ucb/telnet/Source/ring.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1988 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms are permitted
        !             6:  * provided that this notice is preserved and that due credit is given
        !             7:  * to the University of California at Berkeley. The name of the University
        !             8:  * may not be used to endorse or promote products derived from this
        !             9:  * software without specific prior written permission. This software
        !            10:  * is provided ``as is'' without express or implied warranty.
        !            11:  *
        !            12:  *     @(#)ring.h      1.6 (Berkeley) 3/8/88
        !            13:  */
        !            14: 
        !            15: /*
        !            16:  * This defines a structure for a ring buffer.
        !            17:  *
        !            18:  * The circular buffer has two parts:
        !            19:  *(((
        !            20:  *     full:   [consume, supply)
        !            21:  *     empty:  [supply, consume)
        !            22:  *]]]
        !            23:  *
        !            24:  */
        !            25: typedef struct {
        !            26:     char       *consume,       /* where data comes out of */
        !            27:                *supply,        /* where data comes in to */
        !            28:                *bottom,        /* lowest address in buffer */
        !            29:                *top,           /* highest address+1 in buffer */
        !            30:                *mark;          /* marker (user defined) */
        !            31:     int                size;           /* size in bytes of buffer */
        !            32:     u_long     consumetime,    /* help us keep straight full, empty, etc. */
        !            33:                supplytime;
        !            34: } Ring;
        !            35: 
        !            36: /* Here are some functions and macros to deal with the ring buffer */
        !            37: 
        !            38: 
        !            39: #if    defined(LINT_ARGS)
        !            40: 
        !            41: /* Initialization routine */
        !            42: extern int
        !            43:        ring_init(Ring *ring, char *buffer, int count);
        !            44: 
        !            45: /* Data movement routines */
        !            46: extern void
        !            47:        ring_supply_data(Ring *ring, char *buffer, int count),
        !            48:        ring_consume_data(Ring *ring, char *buffer, int count);
        !            49: 
        !            50: /* Buffer state transition routines */
        !            51: extern void
        !            52:        ring_supplied(Ring *ring, int count),
        !            53:        ring_consumed(Ring *ring, int count);
        !            54: 
        !            55: /* Buffer state query routines */
        !            56: extern int
        !            57:        ring_empty_count(Ring *ring),
        !            58:        ring_empty_consecutive(Ring *ring),
        !            59:        ring_full_count(Ring *ring),
        !            60:        ring_full_consecutive(Ring *ring);
        !            61: 
        !            62: #endif /* defined(LINT_ARGS) */

unix.superglobalmegacorp.com

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