home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilss / sockets / include / sys / h / mbuf < prev    next >
Encoding:
Text File  |  1995-01-11  |  19.7 KB  |  711 lines

  1. /*
  2.  * mbuf.h
  3.  *
  4.  * $Header: /ax/networking:include/sys/mbuf.h:networking  1.1  $
  5.  * $Source: /ax/networking:include/sys/mbuf.h: $
  6.  *
  7.  * Mbuf manager reference C header file. Client's definitions.
  8.  *
  9.  * $Log:    mbuf.h,v $
  10.  * Revision 1.1  95/01/11  10:19:21  kwelton
  11.  * Initial revision
  12.  * 
  13.  *
  14.  * (C) Copyright ANT Limited, 1994. All rights reserved.
  15.  *
  16.  * Contacts:
  17.  *
  18.  * Postal:  ANT Ltd., PO BOX 300, Cambridge, CB1 2EG, UK.
  19.  * Voice:   01223 567808
  20.  * Fax:        01223 567801
  21.  * Email:   Support@ant.co.uk
  22.  *
  23.  * This header file provides a reference C header file for the
  24.  * facilities offered by the mbuf manager. Three #define's control
  25.  * the precise definitions generated:
  26.  *
  27.  * __STDC__
  28.  *    ANSI C defined facilities are used. This is the encouraged
  29.  *    mode of use.
  30.  *
  31.  * SUPPORT_TRADITIONAL_MBUFS
  32.  *    Additional presentation to existing source code already
  33.  *    written for traditional mbufs.
  34.  *
  35.  * MBCTL_NAME
  36.  *    Defining this macro causes additional #defines to be
  37.  *    elaborated that provide some convenience wrappers. If
  38.  *    the macro is empty, then "mbctl" is assumed. The user
  39.  *    is expected to have defined something very much like:
  40.  *
  41.  *        struct mbctl MBCTL_NAME;
  42.  *
  43.  *    Of course, the struct mbctl referenced should that which
  44.  *    was used during the opening of the mbuf manager session.
  45.  */
  46. /*
  47.  * Copyright (C) 1994 ANT Limited., PO BOX 300, Cambridge, England.
  48.  * All rights reserved.
  49.  * 
  50.  * Redistribution and use in source code and executable binary forms are
  51.  * permitted provided that: (1) source distributions retain this entire
  52.  * copyright notice and comment, and (2) distributions including
  53.  * executable binaries contain the following acknowledgement:
  54.  * 
  55.  * ``This product includes software developed by ANT Limited and its
  56.  * contributors.  Copyright (C) ANT Limited 1994.''
  57.  * 
  58.  * and also in the documentation and other materials provided with the
  59.  * distribution and in all advertising materials mentioning features or
  60.  * use of this software. Neither the name of ANT Limited nor the names of
  61.  * its contributors may be used to endorse or promote products derived
  62.  * from this software without specific prior written permission.
  63.  * 
  64.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  65.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  66.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSER.
  67.  * 
  68.  * NOT INTENDED FOR USE IN LIFE CRITICAL APPLICATIONS.
  69.  *
  70.  */
  71.  
  72. #ifndef __included_mbuf_h
  73. #define __included_mbuf_h
  74.  
  75. #define MBUF_MANAGER_VERSION    (1 * 100 + 0)
  76.  
  77. /*
  78.  * define what we expect to be the minimum
  79.  * contiguous amount of memory in an mbuf
  80.  */
  81. #define MINCONTIG        (112)
  82.  
  83. /*
  84.  * Additional controls added for use
  85.  * with Acorn's TCP/IP sources
  86.  */
  87. #ifdef INET
  88. /*
  89.  * use a #define for the name of the mbuf control
  90.  * structure - MBCTL_NAME would be the ideal candidate
  91.  * but this has already been used by Borris, and 
  92.  * defining it here would bring in unwanted material
  93.  */
  94. #define MBCTL        mbctl
  95.  
  96. /*
  97.  * TRACE
  98.  *
  99.  * dummy definitions for various mbuf.c
  100.  * routines to catch all references
  101.  */
  102. #define m_get(w,t)    #error("m_get")
  103. #define m_getclr(w,t)    #error("m_getclr")
  104. #define MGET(m,w,t)    #error("MGET")
  105.  
  106. #define m_free(m)    #error("m_free")
  107. #define m_freem(m)    #error("m_freem")
  108.  
  109. #define dtom(m)        #error("dtom")
  110. #define m_adj(m,l)    #error("m_adj")
  111. #define m_cat(m,p)    #error("m_cat")
  112.  
  113. /*
  114.  * utility macros - use new names, to allow
  115.  * catching and checking of all uses
  116.  */
  117. #define MMINOFF(m)    #error("MMINOFF");
  118. #define MMAXOFF(m)    #error("MMAXOFF");
  119.  
  120. #define MINOFF(m)    ((m)->m_inioff)
  121. #define MAXOFF(m)    ((m)->m_inioff + (m)->m_inilen)
  122.  
  123. /*
  124.  * MLEN used to be a constant, but not any longer
  125.  */
  126. #define MLEN(m)        ((m)->m_inilen)
  127.  
  128. /*
  129.  * macros for calling into mbuf manager
  130.  * module - allocation routines
  131.  */
  132. #define ALLOC_G(l, p, f)    ((MBCTL.alloc_g)(&MBCTL, (l), (p), (f)))
  133. #define ALLOC(l, p)        ((MBCTL.alloc)(&MBCTL, (l), (p)))
  134. #define ALLOC_S(l, p)        ((MBCTL.alloc_s)(&MBCTL, (l), (p)))
  135. #define ALLOC_U(l, p)        ((MBCTL.alloc_u)(&MBCTL, (l), (p)))
  136. #define ALLOC_C(l, p)        ((MBCTL.alloc_c)(&MBCTL, (l), (p)))
  137.  
  138. /*
  139.  * although they take the same parameters, we cannot
  140.  * call the free routines m_free() and m_freem()
  141.  * because the functionality is differennt (no
  142.  * pointers are returned in the new world)
  143.  */
  144. #define FREE(m)            ((MBCTL.free)(&MBCTL, (m)))
  145. #define FREEM(m)        ((MBCTL.freem)(&MBCTL, (m)))
  146. #define DTOM_FREE(m)        ((MBCTL.dtom_free)(&MBCTL, (m)))
  147. #define DTOM_FREEM(m)        ((MBCTL.dtom_freem)(&MBCTL, (m)))
  148.  
  149. /*
  150.  * This is a hangover from the BSD Unix mbuf world
  151.  */
  152. #define MFREE(m, n)        ((n) = (m)->m_next, FREE(m))
  153.  
  154. /*
  155.  * utility routines
  156.  */
  157. #define PULLUP(m, n)        ((MBCTL.ensure_contig)(&MBCTL, (m), (n)))
  158. #define CAT(m, n)        ((MBCTL.cat)(&MBCTL, (m), (n)))
  159. #define TRIM(m, l, p)        ((MBCTL.trim)(&MBCTL, (m), (l), (p)))
  160. #define COPY(m, o, l)        ((MBCTL.copy)(&MBCTL, (m), (o), (l)))
  161. #define COPY_P(m, o, l)        ((MBCTL.copy_p)(&MBCTL, (m), (o), (l)))
  162. #define COPY_U(m, o, l)        ((MBCTL.copy_u)(&MBCTL, (m), (o), (l)))
  163. #define DTOM(p)            ((MBCTL.dtom)(&MBCTL, (p)))
  164. #define IMPORT(m, l, p)        ((MBCTL.import)(&MBCTL, (m), (l), (p)))
  165. #define EXPORT(m, l, p)        ((MBCTL.export)(&MBCTL, (m), (l), (p)))
  166.  
  167. #define ENSURE_SAFE(m)        ((MBCTL.ensure_safe)(&MBCTL, (m)))
  168.  
  169. /*
  170.  * mbuf control structure - defined here for convenience
  171.  */
  172. extern struct mbctl MBCTL;
  173.  
  174. /*
  175.  * function prototypes for mbuf.c routines.  A slight hack: only
  176.  * declare them if kernel.h has been included (i.e. if a module
  177.  * knows about the necessary structures
  178.  */
  179. #ifdef __kernel_h
  180. extern _kernel_oserror *mb_entryinit(void);
  181. extern _kernel_oserror *mb_closesession(void);
  182. #endif
  183.  
  184. #endif /* INET */
  185.  
  186. /*****************************************************************************
  187.  *
  188.  * This structure describes portions of memory being manipulated.
  189.  */
  190.  
  191. #ifdef __STDC__
  192.  
  193. #include <stddef.h>
  194.  
  195. typedef struct mbuf
  196. {
  197.     struct  mbuf       *m_next;        /* next mbuf in chain */
  198.     struct  mbuf       *m_list;        /* next mbuf in list (clients only) */
  199.  
  200.     ptrdiff_t        m_off;        /* current offset to data from mbuf itself */
  201.     size_t        m_len;        /* current byte count */
  202.     const ptrdiff_t    m_inioff;    /* original offset to data from mbuf itself */
  203.     const size_t    m_inilen;    /* original byte count (for underlying data) */
  204.  
  205.     unsigned char    m_type;        /* client use only */
  206.     const unsigned char m_sys1;        /* mbuf manager use only */
  207.     const unsigned char m_sys2;        /* mbuf manager use only */
  208.     const unsigned char m_sys3;        /* mbuf manager use only */
  209. } dci4_mbuf;
  210.  
  211. #else /* __STDC__ */
  212.  
  213. /* RO indicates a field that is read-only */
  214.  
  215. struct mbuf
  216. {
  217.     struct  mbuf       *m_next;        /* next mbuf in chain */
  218.     struct  mbuf       *m_list;        /* next mbuf in list (clients only) */
  219.  
  220.     int            m_off;        /* current offset to data from mbuf itself */
  221.     unsigned int    m_len;        /* current byte count */
  222.     int            m_inioff;    /* RO: original offset to data from mbuf itself */
  223.     unsigned int    m_inilen;    /* RO: original byte count (for underlying data) */
  224.  
  225.     unsigned char    m_type;        /* client use only */
  226.     unsigned char    m_sys1;        /* mbuf manager use only */
  227.     unsigned char    m_sys2;        /* mbuf manager use only */
  228.     unsigned char    m_sys3;        /* mbuf manager use only */
  229. };
  230.  
  231. #endif /* __STDC__ */
  232.  
  233. /*****************************************************************************
  234.  *
  235.  * Some macros for convenience.
  236.  *
  237.  * mtod:
  238.  *
  239.  * Convert the address of an mbuf to the address of the first byte of
  240.  * data that it describes, performing a type conversion for convenience.
  241.  *
  242.  * dtoo:
  243.  *
  244.  * Set the first byte described by an mbuf to the pointer supplied.
  245.  * Typically used when initialising unsafe mbufs.
  246.  *
  247.  * MRESET:
  248.  *
  249.  * Restore an mbuf to its underlying state.
  250.  */
  251.  
  252.  
  253. #ifdef __STDC__
  254.  
  255. #define mtod(mp, type)        ( (type) ( (ptrdiff_t)(mp) + (mp)->m_off ) )
  256. #define dtoo(mp, ptr)        (mp)->m_off = (ptrdiff_t)(mp) - (ptrdiff_t)(ptr)
  257. #define MRESET(mp)        (mp)->m_off = (mp)->m_inioff, (mp)->m_len = (mp)->m_inilen
  258.  
  259. #else /* __STDC__ */
  260.  
  261. #define mtod(mp, type)        ( (type) ( (int)mp + (mp)->m_off ) )
  262. #define dtoo(mp, ptr)        (mp)->m_off = (int)(mp) - (int)(ptr)
  263. #define MRESET(mp)        (mp)->m_off = (mp)->m_inioff, (mp)->m_len = (mp)->m_inilen
  264.  
  265. #endif /* __STDC__ */
  266.  
  267.  
  268. /*****************************************************************************
  269.  *
  270.  * Structure used to perform most of the communication and interaction
  271.  * between a client and the mbuf manager.
  272.  */
  273.  
  274. #ifdef __STDC__
  275.  
  276. typedef struct mbctl
  277. {
  278.     /* Reserved for mbuf manager use in establishing context */
  279.  
  280.     int            opaque;        /* mbuf manager use only */
  281.  
  282.  
  283.     /* Client initialises before session is established */
  284.  
  285.     size_t        mbcsize;    /* size of mbctl structure from client */
  286.     unsigned int    mbcvers;    /* client version of mbuf manager spec */
  287.     unsigned long    flags;        /* */
  288.     size_t        advminubs;    /* Advisory desired minimum underlying block size */
  289.     size_t        advmaxubs;    /* Advisory desired maximum underlying block size */
  290.     size_t        mincontig;    /* client required min ensure_contig value */
  291.     unsigned long    spare1;        /* Must be set to zero on initialisation */
  292.  
  293.  
  294.     /* Mbuf manager initialises during session establishment */
  295.  
  296.     size_t        minubs;        /* Minimum underlying block size */
  297.     size_t        maxubs;        /* Maximum underlying block size */
  298.     size_t        maxcontig;    /* Maximum contiguify block size */
  299.     unsigned long    spare2;        /* Reserved for future use */
  300.  
  301.  
  302.     /* Allocation routines */
  303.  
  304.     struct mbuf *            /* MBC_DEFAULT */
  305.     (* alloc)
  306.         (struct mbctl *, size_t bytes, void *ptr);
  307.  
  308.     struct mbuf *            /* Parameter driven */
  309.     (* alloc_g)
  310.         (struct mbctl *, size_t bytes, void *ptr, unsigned long flags);
  311.  
  312.     struct mbuf *            /* MBC_UNSAFE */
  313.     (* alloc_u)
  314.         (struct mbctl *, size_t bytes, void *ptr);
  315.  
  316.     struct mbuf *            /* MBC_SINGLE */
  317.     (* alloc_s)
  318.         (struct mbctl *, size_t bytes, void *ptr);
  319.  
  320.     struct mbuf *            /* MBC_CLEAR */
  321.     (* alloc_c)
  322.         (struct mbctl *, size_t bytes, void *ptr);
  323.  
  324.  
  325.     /* Ensuring routines */
  326.  
  327.     struct mbuf *
  328.     (* ensure_safe)
  329.         (struct mbctl *, struct mbuf *mp);
  330.  
  331.     struct mbuf *
  332.     (* ensure_contig)
  333.         (struct mbctl *, struct mbuf *mp, size_t bytes);
  334.  
  335.  
  336.     /* Freeing routines */
  337.  
  338.     void
  339.     (* free)
  340.         (struct mbctl *, struct mbuf *mp);
  341.  
  342.     void
  343.     (* freem)
  344.         (struct mbctl *, struct mbuf *mp);
  345.  
  346.     void
  347.     (* dtom_free)
  348.         (struct mbctl *, struct mbuf *mp);
  349.  
  350.     void
  351.     (* dtom_freem)
  352.         (struct mbctl *, struct mbuf *mp);
  353.  
  354.  
  355.     /* Support routines */
  356.  
  357.     struct mbuf *            /* No ownership transfer though */
  358.     (* dtom)
  359.         (struct mbctl *, void *ptr);
  360.  
  361.     int                    /* Client retains mp ownership */
  362.     (* any_unsafe)
  363.         (struct mbctl *, struct mbuf *mp);
  364.  
  365.     int                    /* Client retains mp ownership */
  366.     (* this_unsafe)
  367.         (struct mbctl *, struct mbuf *mp);
  368.  
  369.     size_t                /* Client retains mp ownership */
  370.     (* count_bytes)
  371.         (struct mbctl *, struct mbuf *mp);
  372.  
  373.     struct mbuf *            /* Client retains old, new ownership */
  374.     (* cat)
  375.         (struct mbctl *, struct mbuf *old, struct mbuf *new);
  376.  
  377.     struct mbuf *            /* Client retains mp ownership */
  378.     (* trim)
  379.         (struct mbctl *, struct mbuf *mp, int bytes, void *ptr);
  380.  
  381.     struct mbuf *            /* Client retains mp ownership */
  382.     (* copy)
  383.         (struct mbctl *, struct mbuf *mp, size_t off, size_t len);
  384.  
  385.     struct mbuf *            /* Client retains mp ownership */
  386.     (* copy_p)
  387.         (struct mbctl *, struct mbuf *mp, size_t off, size_t len);
  388.  
  389.     struct mbuf *            /* Client retains mp ownership */
  390.     (* copy_u)
  391.         (struct mbctl *, struct mbuf *mp, size_t off, size_t len);
  392.  
  393.     struct mbuf *            /* Client retains mp ownership */
  394.     (* import)
  395.         (struct mbctl *, struct mbuf *mp, size_t bytes, void *ptr);
  396.  
  397.     struct mbuf *            /* Client retains mp ownership */
  398.     (* export)
  399.         (struct mbctl *, struct mbuf *mp, size_t bytes, void *ptr);
  400. } dci4_mbctl;
  401.  
  402.  
  403. #else /* __STDC__ */
  404.  
  405.  
  406. struct mbctl
  407. {
  408.     /* Reserved for mbuf manager use in establishing context */
  409.  
  410.     int            opaque;        /* mbuf manager use only */
  411.  
  412.  
  413.     /* Client initialises before session is established */
  414.  
  415.     unsigned int    mbcsize;    /* size of mbctl structure from client */
  416.     unsigned int    mbcvers;    /* client version of mbuf manager spec */
  417.     unsigned long    flags;        /* */
  418.     unsigned int    advminubs;    /* Advisory desired minimum underlying block size */
  419.     unsigned int    advmaxubs;    /* Advisory desired maximum underlying block size */
  420.     unsigned int    mincontig;    /* client required min ensure_contig value */
  421.     unsigned long    spare1;        /* Must be set to zero on initialisation */
  422.  
  423.  
  424.     /* Mbuf manager initialises during session establishment */
  425.  
  426.     unsigned int    minubs;        /* Minimum underlying block size */
  427.     unsigned int    maxubs;        /* Maximum underlying block size */
  428.     unsigned int    maxcontig;    /* Maximum contiguify block size */
  429.     unsigned long    spare2;        /* Reserved for future use */
  430.  
  431.  
  432.     /* Allocation routines */
  433.  
  434.     struct mbuf *            /* MBC_DEFAULT */
  435.     (* alloc)
  436.         ( /* struct mbctl *, unsigned int bytes, char *ptr */ );
  437.  
  438.     struct mbuf *            /* Parameter driven */
  439.     (* alloc_g)
  440.         ( /* struct mbctl *, unsigned int bytes, char *ptr, unsigned long flags */ );
  441.  
  442.     struct mbuf *            /* MBC_UNSAFE */
  443.     (* alloc_u)
  444.         ( /* struct mbctl *, unsigned int bytes, char *ptr */ );
  445.  
  446.     struct mbuf *            /* MBC_SINGLE */
  447.     (* alloc_s)
  448.         ( /* struct mbctl *, unsigned int bytes, char *ptr */ );
  449.  
  450.     struct mbuf *            /* MBC_CLEAR */
  451.     (* alloc_c)
  452.         ( /* struct mbctl *, unsigned int bytes, char *ptr */ );
  453.  
  454.  
  455.     /* Ensuring routines */
  456.  
  457.     struct mbuf *
  458.     (* ensure_safe)
  459.         ( /* struct mbctl *, struct mbuf *mp */ );
  460.  
  461.     struct mbuf *
  462.     (* ensure_contig)
  463.         ( /* struct mbctl *, struct mbuf *mp, unsigned int bytes */ );
  464.  
  465.  
  466.     /* Freeing routines */
  467.  
  468.     void
  469.     (* free)
  470.         ( /* struct mbctl *, struct mbuf *mp */ );
  471.  
  472.     void
  473.     (* freem)
  474.         ( /* struct mbctl *, struct mbuf *mp */ );
  475.  
  476.     void
  477.     (* dtom_free)
  478.         ( /* struct mbctl *, struct mbuf *mp */ );
  479.  
  480.     void
  481.     (* dtom_freem)
  482.         ( /* struct mbctl *, struct mbuf *mp */ );
  483.  
  484.  
  485.     /* Support routines */
  486.  
  487.     struct mbuf *            /* No ownership transfer though */
  488.     (* dtom)
  489.         ( /* struct mbctl *, char *ptr */ );
  490.  
  491.     int                    /* Client retains mp ownership */
  492.     (* any_unsafe)
  493.         ( /* struct mbctl *, struct mbuf *mp */ );
  494.  
  495.     int                    /* Client retains mp ownership */
  496.     (* this_unsafe)
  497.         ( /* struct mbctl *, struct mbuf *mp */ );
  498.  
  499.     unsigned int              /* Client retains mp ownership */
  500.     (* count_bytes)
  501.         ( /* struct mbctl *, struct mbuf *mp */ );
  502.  
  503.     struct mbuf *            /* Client retains old, new ownership */
  504.     (* cat)
  505.         ( /* struct mbctl *, struct mbuf *old, struct mbuf *new */ );
  506.  
  507.     struct mbuf *            /* Client retains mp ownership */
  508.     (* trim)
  509.         ( /* struct mbctl *, struct mbuf *mp, int bytes, char *ptr */ );
  510.  
  511.     struct mbuf *            /* Client retains mp ownership */
  512.     (* copy)
  513.         ( /* struct mbctl *, struct mbuf *mp, unsigned int off, unsigned int len */ );
  514.  
  515.     struct mbuf *            /* Client retains mp ownership */
  516.     (* copy_p)
  517.         ( /* struct mbctl *, struct mbuf *mp, unsigned int off, unsigned int len */ );
  518.  
  519.     struct mbuf *            /* Client retains mp ownership */
  520.     (* copy_u)
  521.         ( /* struct mbctl *, struct mbuf *mp, unsigned int off, unsigned int len */ );
  522.  
  523.     struct mbuf *            /* Client retains mp ownership */
  524.     (* import)
  525.         ( /* struct mbctl *, struct mbuf *mp, unsigned int bytes, char *ptr */ );
  526.  
  527.     struct mbuf *            /* Client retains mp ownership */
  528.     (* export)
  529.         ( /* struct mbctl *, struct mbuf *mp, unsigned int bytes, char *ptr */ );
  530. };
  531.  
  532. #endif /* __STDC__ */
  533.  
  534. /*****************************************************************************
  535.  *
  536.  * Values of bits used as a bitset to the alloc_g allocator routine.
  537.  */
  538.  
  539. #define MBC_DEFAULT        0x00000000ul
  540. #define MBC_UNSAFE        0x00000001ul
  541. #define MBC_SINGLE        0x00000002ul
  542. #define MBC_CLEAR        0x00000004ul
  543. #define MBC_DTOMABLE        0x00000008ul    /* not used */
  544. #define MBC_DONTWAIT        0x00000010ul    /* not used */
  545.  
  546. /* In flags field of mbctl during session opening */
  547.  
  548. #define MBC_USERMODE        0x80000000ul
  549.  
  550.  
  551. /* See specification for uses */
  552. /* Huge and easily testable */
  553.  
  554. #define M_COPYALL        0x7f000000
  555.  
  556. /*****************************************************************************
  557.  *
  558.  * SWI interface
  559.  */
  560.  
  561. #define Mbuf_SWI       0x4a580
  562.  
  563. #define Mbuf_OpenSession   (Mbuf_SWI + 0)
  564. #define Mbuf_CloseSession  (Mbuf_SWI + 1)
  565. #define Mbuf_Memory       (Mbuf_SWI + 2)
  566. #define Mbuf_Statistic       (Mbuf_SWI + 3)
  567. #define Mbuf_Control       (Mbuf_SWI + 4)
  568.  
  569. /* Statistic SWI uses the statistic interface from "dci4stat.h" */
  570.  
  571. /* Notification of arrival and depature of Mbuf Manager */
  572.  
  573. #define Service_MbufManagerStatus    0xA2
  574.  
  575. #define MbufManagerStatus_Started    0
  576. #define MbufManagerStatus_Stopping    1
  577. #define MbufManagerStatus_Scavenge    2
  578.  
  579. /*****************************************************************************
  580.  *
  581.  * Support for users of traditional mbufs
  582.  */
  583.  
  584. /* Traditional BSD mbuf types */
  585. /* Types 1 and 2 are used by DCI4 in general */
  586.  
  587. #define MT_FREE        0
  588. #define MT_DATA        1    /* driver to protocol */
  589. #define MT_HEADER    2    /* driver to protocol */
  590. #define MT_SOCKET    3
  591. #define MT_PCB        4
  592. #define MT_RTABLE    5
  593. #define MT_HTABLE    6
  594. #define MT_ATABLE    7
  595. #define MT_SONAME    8
  596. #define MT_ZOMBIE    9
  597. #define MT_SOOPTS    10
  598. #define MT_FTABLE    11
  599. #define MT_RIGHTS    12
  600. #define MT_IFADDR    13
  601.  
  602. #ifdef SUPPORT_TRADITIONAL_MBUFS
  603.  
  604.  
  605. #include "bsdmbuf.h"
  606.  
  607.  
  608. #endif /* SUPPORT_TRADITIONAL_MBUFS */
  609.  
  610. /*****************************************************************************
  611.  *
  612.  * Some optional macros. These are purely to provide a more convenient
  613.  * accessed to the defined facilities. Invdivivual definitions can be
  614.  * prevented by pre-defining the relevant macro name before including
  615.  * this file.
  616.  */
  617.  
  618. #if defined(MBCTL_NAME) && ! defined(SUPPORT_TRADITIONAL_MBUFS)
  619.  
  620. #ifndef m_alloc
  621. #define m_alloc(b,p)        (*MBCTL_NAME.alloc) (&MBCTL_NAME, (b), (p))
  622. #endif
  623. #ifndef m_alloc_g
  624. #define m_alloc_g(b,p,f)    (*MBCTL_NAME.alloc_g) (&MBCTL_NAME, (b), (p), (f))
  625. #endif
  626. #ifndef m_alloc_s
  627. #define m_alloc_s(b,p)        (*MBCTL_NAME.alloc_s) (&MBCTL_NAME, (b), (p))
  628. #endif
  629. #ifndef m_alloc_c
  630. #define m_alloc_c(b,p)        (*MBCTL_NAME.alloc_c) (&MBCTL_NAME, (b), (p))
  631. #endif
  632. #ifndef m_alloc_u
  633. #define m_alloc_u(b,p)        (*MBCTL_NAME.alloc_u) (&MBCTL_NAME, (b), (p))
  634. #endif
  635.  
  636. #ifndef m_ensure_safe
  637. #define m_ensure_safe(m)    (*MBCTL_NAME.ensure_safe) (&MBCTL_NAME, (m))
  638. #endif
  639. #ifndef m_ensure_contig
  640. #define m_ensure_contig(m,n)    (*MBCTL_NAME.ensure_contig) (&MBCTL_NAME, (m), (n))
  641. #endif
  642.  
  643. #ifndef m_free
  644. #define m_free(m)        (*MBCTL_NAME.free) (&MBCTL_NAME, (m))
  645. #endif
  646. #ifndef m_freem
  647. #define m_freem(m)        (*MBCTL_NAME.freem) (&MBCTL_NAME, (m))
  648. #endif
  649. #ifndef m_dtom_free
  650. #define m_dtom_free(m)        (*MBCTL_NAME.dtom_free) (&MBCTL_NAME, (m))
  651. #endif
  652. #ifndef m_dtom_freem
  653. #define m_dtom_freem(m)        (*MBCTL_NAME.dtom_freem) (&MBCTL_NAME, (m))
  654. #endif
  655.  
  656. #ifndef m_dtom
  657. #define m_dtom(d)        (*MBCTL_NAME.dtom) (&MBCTL_NAME, (d))
  658. #endif
  659. #ifndef m_any_unsafe
  660. #define m_any_unsafe(m)        (*MBCTL_NAME.any_unsafe) (&MBCTL_NAME, (m))
  661. #endif
  662. #ifndef m_this_unsafe
  663. #define m_this_unsafe(m)    (*MBCTL_NAME.this_unsafe) (&MBCTL_NAME, (m))
  664. #endif
  665. #ifndef m_count_bytes
  666. #define m_count_bytes(m)    (*MBCTL_NAME.count_bytes) (&MBCTL_NAME, (m))
  667. #endif
  668. #ifndef m_cat
  669. #define m_cat(m,n)        (*MBCTL_NAME.cat) (&MBCTL_NAME, (m), (n))
  670. #endif
  671. #ifndef m_trim
  672. #define m_trim(m,n,p)        (*MBCTL_NAME.trim) (&MBCTL_NAME, (m), (n), (p))
  673. #endif
  674.  
  675. #ifndef m_copy
  676. #define m_copy(m,o,l)        (*MBCTL_NAME.copy) (&MBCTL_NAME, (m), (o), (l))
  677. #endif
  678. #ifndef m_copy_p
  679. #define m_copy_p(m,o,l)        (*MBCTL_NAME.copy_p) (&MBCTL_NAME, (m), (o), (l))
  680. #endif
  681. #ifndef m_copy_u
  682. #define m_copy_u(m,o,l)        (*MBCTL_NAME.copy_u) (&MBCTL_NAME, (m), (o), (l))
  683. #endif
  684.  
  685. #ifndef m_import
  686. #define m_import(m,n,p)        (*MBCTL_NAME.import) (&MBCTL_NAME, (m), (n), (p))
  687. #endif
  688. #ifndef m_export
  689. #define m_export(m,n,p)        (*MBCTL_NAME.export) (&MBCTL_NAME, (m), (n), (p))
  690. #endif
  691.  
  692. #ifndef dtom
  693. #define dtom(d)            m_dtom(d)
  694. #endif
  695.  
  696. #endif /* defined(MBCTL_NAME) && ! defined(SUPPORT_TRADITIONAL_MBUFS) */
  697.  
  698.  
  699. #ifdef MBCTL_NAME
  700.  
  701. extern struct mbctl MBCTL_NAME;
  702.  
  703. #endif
  704.  
  705. /*****************************************************************************/
  706.  
  707.  
  708. #endif /* __included_mbuf_h */
  709.  
  710. /* EOF mbuf.h */
  711.