1 /*============================================================================
3 ==============================================================================
4 This header file defines the interface between modules inside
7 Use this in addition to xmlrpc.h, which defines the external
10 Copyright information is at the end of the file.
11 ============================================================================*/
14 #ifndef XMLRPC_C_BASE_INT_H_INCLUDED
15 #define XMLRPC_C_BASE_INT_H_INCLUDED
17 #include "xmlrpc_config.h"
20 #include <xmlrpc-c/base.h>
21 #include <xmlrpc-c/util_int.h>
28 struct _xmlrpc_value {
32 /* Certain data types store their data directly in the xmlrpc_value. */
41 /* Other data types use a memory block.
43 For a string, this is the characters of the string in UTF-8, plus
44 a NUL added to the end.
46 xmlrpc_mem_block _block;
48 xmlrpc_mem_block *_wcs_block;
49 /* This is a copy of the string value in _block, but in UTF-16
50 instead of UTF-8. This member is not always present. If NULL,
53 We keep this copy for convenience. The value is totally
54 redundant with _block.
56 This member is always NULL when the data type is not string.
58 This member is always NULL on a system that does not have
59 Unicode wchar functions.
63 #define XMLRPC_ASSERT_VALUE_OK(val) \
64 XMLRPC_ASSERT((val) != NULL && (val)->_type != XMLRPC_TYPE_DEAD)
66 /* A handy type-checking routine. */
67 #define XMLRPC_TYPE_CHECK(env,v,t) \
69 if ((v)->_type != (t)) \
70 XMLRPC_FAIL(env, XMLRPC_TYPE_ERROR, "Expected " #t); \
75 unsigned char key_hash;
82 xmlrpc_createXmlrpcValue(xmlrpc_env * const envP,
83 xmlrpc_value ** const valPP);
86 xmlrpc_typeName(xmlrpc_type const type);
89 xmlrpc_traceXml(const char * const label,
90 const char * const xml,
91 unsigned int const xmlLength);
94 xmlrpc_destroyStruct(xmlrpc_value * const structP);
97 xmlrpc_destroyArrayContents(xmlrpc_value * const arrayP);
99 /*----------------------------------------------------------------------------
100 The following are for use by the legacy xmlrpc_parse_value(). They don't
101 do proper memory management, so they aren't appropriate for general use,
102 but there are old users that do xmlrpc_parse_value() and compensate for
103 the memory management, so we have to continue to offer this style of
106 In particular, the functions that return xmlrpc_values don't increment
107 the reference count, and the functions that return strings don't allocate
109 -----------------------------------------------------------------------------*/
112 xmlrpc_read_datetime_str_old(xmlrpc_env * const envP,
113 const xmlrpc_value * const valueP,
114 const char ** const stringValueP);
117 xmlrpc_read_string_old(xmlrpc_env * const envP,
118 const xmlrpc_value * const valueP,
119 const char ** const stringValueP);
122 xmlrpc_read_string_lp_old(xmlrpc_env * const envP,
123 const xmlrpc_value * const valueP,
124 size_t * const lengthP,
125 const char ** const stringValueP);
127 #if XMLRPC_HAVE_WCHAR
129 xmlrpc_read_string_w_old(xmlrpc_env * const envP,
130 xmlrpc_value * const valueP,
131 const wchar_t ** const stringValueP);
134 xmlrpc_read_string_w_lp_old(xmlrpc_env * const envP,
135 xmlrpc_value * const valueP,
136 size_t * const lengthP,
137 const wchar_t ** const stringValueP);
141 xmlrpc_read_base64_old(xmlrpc_env * const envP,
142 const xmlrpc_value * const valueP,
143 size_t * const lengthP,
144 const unsigned char ** const byteStringValueP);
147 /* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
149 ** Redistribution and use in source and binary forms, with or without
150 ** modification, are permitted provided that the following conditions
152 ** 1. Redistributions of source code must retain the above copyright
153 ** notice, this list of conditions and the following disclaimer.
154 ** 2. Redistributions in binary form must reproduce the above copyright
155 ** notice, this list of conditions and the following disclaimer in the
156 ** documentation and/or other materials provided with the distribution.
157 ** 3. The name of the author may not be used to endorse or promote products
158 ** derived from this software without specific prior written permission.
160 ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
161 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
162 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
163 ** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
164 ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
165 ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
166 ** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
167 ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
168 ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
169 ** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF