libUPnP
1.6.17
|
00001 /************************************************************************** 00002 * 00003 * Copyright (c) 2000-2003 Intel Corporation 00004 * All rights reserved. 00005 * Copyright (c) 2012 France Telecom All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions are met: 00009 * 00010 * - Redistributions of source code must retain the above copyright notice, 00011 * this list of conditions and the following disclaimer. 00012 * - Redistributions in binary form must reproduce the above copyright notice, 00013 * this list of conditions and the following disclaimer in the documentation 00014 * and/or other materials provided with the distribution. 00015 * - Neither name of Intel Corporation nor the names of its contributors 00016 * may be used to endorse or promote products derived from this software 00017 * without specific prior written permission. 00018 * 00019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00020 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00021 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00022 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR 00023 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00024 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00025 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00026 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00027 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00028 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 * 00031 **************************************************************************/ 00032 00033 00034 #ifndef IXML_MEMBUF_H 00035 #define IXML_MEMBUF_H 00036 00037 00043 #include "ixml.h" 00044 00045 00046 #include <stdlib.h> /* for size_t */ 00047 00048 00049 #define MINVAL(a, b) ( (a) < (b) ? (a) : (b) ) 00050 #define MAXVAL(a, b) ( (a) > (b) ? (a) : (b) ) 00051 00052 00053 #define MEMBUF_DEF_SIZE_INC 20u 00054 00055 00059 typedef struct 00060 { 00061 char *buf; 00062 size_t length; 00063 size_t capacity; 00064 size_t size_inc; 00065 } ixml_membuf; 00066 00067 00071 void ixml_membuf_init( 00073 ixml_membuf *m); 00074 00075 00082 void ixml_membuf_destroy( 00084 ixml_membuf *m); 00085 00086 00097 int ixml_membuf_assign( 00099 ixml_membuf *m, 00101 const void *buf, 00103 size_t buf_len); 00104 00114 int ixml_membuf_assign_str( 00116 ixml_membuf *m, 00118 const char *c_str); 00119 00129 int ixml_membuf_append( 00131 ixml_membuf *m, 00133 const void *buf); 00134 00145 int ixml_membuf_append_str( 00147 ixml_membuf *m, 00149 const char *c_str); 00150 00161 int ixml_membuf_insert( 00163 ixml_membuf *m, 00165 const void *buf, 00167 size_t buf_len, 00170 size_t index); 00171 00172 00173 #endif /* IXML_MEMBUF_H */ 00174