home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / mint / netlib / include / buf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-27  |  1.2 KB  |  52 lines

  1. #ifndef _BUF_H
  2. #define _BUF_H
  3.  
  4. #include "kerbind.h"
  5.  
  6. #define BUF_NORMAL        0
  7. #define BUF_ATOMIC        1
  8.  
  9. #define BUF_BLOCK_SIZE        (1024*32L)
  10. #define BUF_NSPLIT        7
  11. #define BUF_MAGIC        0x73ec5a13ul
  12.  
  13. #define BUF_RESERVE_START    1
  14. #define BUF_RESERVE_END        2
  15.  
  16. typedef struct buf {
  17.     unsigned long    buflen;        /* buffer len, including header */
  18.     char        *dstart;    /* start of data */
  19.     char        *dend;        /* end of data */
  20.     struct buf    *next;        /* next message */
  21.     struct buf    *prev;        /* previous message */
  22.     struct buf    *link3;        /* another next pointer */
  23.     short        links;        /* usage counter */
  24.     long        info;        /* aux info */
  25.  
  26.     struct buf    *_n;        /* next buf in memory */
  27.     struct buf    *_p;        /* previous buf memory */
  28.     struct buf    *_nfree;    /* next free buf of same size */
  29.     struct buf    *_pfree;    /* previous free buf of same size */
  30.     char        data[0];
  31. } BUF;
  32.  
  33. #ifndef NOEXTERNS
  34. extern long    buf_init (void);
  35. extern BUF    *buf_alloc (unsigned long, unsigned long, short);
  36. extern void    buf_free (BUF *, short);
  37. extern BUF    *buf_reserve (BUF *, long, short);
  38. extern void    buf_deref (BUF *, short);
  39. extern BUF    *buf_clone (BUF *, short);
  40. #endif
  41.  
  42. static void    buf_ref (BUF *);
  43.  
  44. static inline void
  45. buf_ref (buf)
  46.     BUF *buf;
  47. {
  48.     ++buf->links;
  49. }
  50.  
  51. #endif /* _BUF_H */
  52.