1 /*
2  * Portions of this file Copyright 1999-2005 University of Chicago
3  * Portions of this file Copyright 1999-2005 The University of Southern California.
4  *
5  * This file or a portion of this file is licensed under the
6  * terms of the Globus Toolkit Public License, found at
7  * http://www.globus.org/toolkit/download/license.html.
8  * If you redistribute this file, with or without
9  * modifications, you must include this notice in the file.
10  */
11
12 #include "globus_i_xsd.h"
13 #include "globus_i_xsd_type_info.h"
14 #include "globus_soap_message.h"
15
16 GLOBUS_I_XSD_DEFINE_QNAME(xsd, base64Binary);
17 GLOBUS_I_XSD_DEFINE_TYPE_INFO(xsd_base64Binary);
18 0 GLOBUS_I_XSD_DEFINE_TYPE_FUNCTIONS(xsd_base64Binary);
19 0 GLOBUS_I_XSD_DEFINE_ATTR_FUNCTIONS(xsd_base64Binary, base64Binary);
20
21 0 GLOBUS_I_XSD_DEFINE_INIT_CONTENTS_GENERIC(xsd_base64Binary);
22
23 void
24 xsd_base64Binary_destroy_contents(
25     xsd_base64Binary *                  instance)
26 {
27 0     GlobusFuncName(xsd_base64Binary_destroy_contents);
28 0     GlobusSoapMessageDebugEnter();
29
30 0     if(instance)
31     {
32 0         if(instance->value)
33         {
34 0             free(instance->value);
35 0             instance->value = NULL;
36         }
37     }
38
39 0     GlobusSoapMessageDebugExit();
40 }
41
42 globus_result_t
43 xsd_base64Binary_copy_contents(
44     xsd_base64Binary *                  dest,
45     const xsd_base64Binary *            src)
46 0 {
47 0     globus_result_t                     result = GLOBUS_SUCCESS;
48 0     GlobusFuncName(xsd_base64Binary_copy_contents);
49 0     GlobusSoapMessageDebugEnter();
50
51 0     if(dest && src)
52     {
53 0         dest->length = src->length;
54 0         dest->value = globus_libc_malloc(src->length);
55 0         if(!dest->value)
56         {
57 0             result = GlobusSoapMessageErrorOutOfMemory;
58         }
59         else
60         {
61 0             memcpy(dest->value, src->value, src->length);
62         }
63     }
64
65 0     GlobusSoapMessageDebugExit();
66
67 0     return result;
68 }
69
70 globus_result_t
71 xsd_base64Binary_serialize_contents(
72     xsd_QName *                         element_qname,
73     xsd_base64Binary *                  instance,
74     globus_soap_message_handle_t        soap_message_handle,
75     globus_xsd_element_options_t        options)
76 0 {
77 0     globus_result_t                     result = GLOBUS_SUCCESS;
78 0     GlobusFuncName(xsd_base64Binary_serialize_contents);
79 0     GlobusSoapMessageDebugEnter();
80
81     /* serialize contents of type */
82 0     result = globus_soap_message_serialize_base64Binary(
83         soap_message_handle, instance);
84
85 0     GlobusSoapMessageDebugExit();
86 0     return result;
87 }
88
89 globus_result_t
90 xsd_base64Binary_deserialize_contents(
91     xsd_QName *                         element_qn,
92     xsd_base64Binary *                  instance,
93     globus_soap_message_handle_t        soap_message_handle,
94     globus_xsd_element_options_t        options)
95 0 {
96 0     globus_result_t                     result = GLOBUS_SUCCESS;
97 0     GlobusFuncName(xsd_base64Binary_deserialize_contents);
98 0     GlobusSoapMessageDebugEnter();
99     
100 0     result = globus_soap_message_deserialize_base64Binary(
101         soap_message_handle, instance);
102
103 0     GlobusSoapMessageDebugExit();
104 0     return result;