media/mtransport/third_party/nrappkit/src/util/p_buf.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /**
     2    p_buf.h
     5    Copyright (C) 2003, Network Resonance, Inc.
     6    Copyright (C) 2006, Network Resonance, Inc.
     7    All Rights Reserved
     9    Redistribution and use in source and binary forms, with or without
    10    modification, are permitted provided that the following conditions
    11    are met:
    13    1. Redistributions of source code must retain the above copyright
    14       notice, this list of conditions and the following disclaimer.
    15    2. Redistributions in binary form must reproduce the above copyright
    16       notice, this list of conditions and the following disclaimer in the
    17       documentation and/or other materials provided with the distribution.
    18    3. Neither the name of Network Resonance, Inc. nor the name of any
    19       contributors to this software may be used to endorse or promote
    20       products derived from this software without specific prior written
    21       permission.
    23    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
    24    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    25    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    26    ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
    27    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    28    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    29    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    30    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    31    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    32    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    33    POSSIBILITY OF SUCH DAMAGE.
    36    ekr@rtfm.com  Tue Nov 25 15:58:37 2003
    37  */
    40 #ifndef _p_buf_h
    41 #define _p_buf_h
    43 typedef struct nr_p_buf_ {
    44      UCHAR *data;     /*The pointer to the buffer where the data lives */
    45      UINT4 size;      /*The size of the buffer */
    46      UINT4 r_offset;  /*The offset into the buffer where the data starts
    47                         when reading */
    48      UINT4 length;    /*The length of the data portion */
    50      STAILQ_ENTRY(nr_p_buf_) entry;
    51 } nr_p_buf;
    53 typedef STAILQ_HEAD(nr_p_buf_head_,nr_p_buf_) nr_p_buf_head;
    56 typedef struct nr_p_buf_ctx_ {
    57      int buf_size;
    59      nr_p_buf_head free_list;
    60 } nr_p_buf_ctx;
    62 int nr_p_buf_ctx_create(int size,nr_p_buf_ctx **ctxp);
    63 int nr_p_buf_ctx_destroy(nr_p_buf_ctx **ctxp);
    64 int nr_p_buf_alloc(nr_p_buf_ctx *ctx,nr_p_buf **bufp);
    65 int nr_p_buf_free(nr_p_buf_ctx *ctx,nr_p_buf *buf);
    66 int nr_p_buf_free_chain(nr_p_buf_ctx *ctx,nr_p_buf_head *chain);
    67 int nr_p_buf_write_to_chain(nr_p_buf_ctx *ctx,
    68                                        nr_p_buf_head *chain,
    69                                        UCHAR *data,UINT4 len);
    71 #endif

mercurial