1 /*
2 * Copyright 1999-2006 University of Chicago
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18 /*
19 * This file is automatically generated from source-type-builtin.tmpl
20 */
21
22 #include "globus_common.h"
23 #include "globus_xsd_types.h"
24 #include "globus_soap_message.h"
25 #include "globus_xsd_type_info.h"
26 #include "globus_xml_buffer.h"
27 #include "globus_xsd_generic.h"
28 #include "globus_xsd_generic_array.h"
29 #include "globus_i_soap_message.h"
30 #include "xsd_QName.h"
31 #include "libxml/schemasInternals.h"
32 #include "libxml/xmlschemastypes.h"
33
34 /**
35 * QName of the globus_xml_buffer builtin type
36 * @ingroup globus_xml_buffer
37 */
38 xsd_QName globus_xml_buffer_qname =
39 {
40 "GLOBUS_XML_BUFFER",
41 "GLOBUS_XML_BUFFER"
42
43 };
44
45 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
46 static
47 globus_result_t
48 globus_xml_buffer_serialize_wrapper(
49 const xsd_QName * element_qname,
50 const void * instance,
51 globus_soap_message_handle_t message_handle,
52 globus_xsd_element_options_t options)
53 171 {
54 171 return globus_xml_buffer_serialize(
55 element_qname,
56 (globus_xml_buffer *) instance,
57 message_handle, options);
58 }
59 /* globus_xml_buffer_serialize_wrapper() */
60
61 static
62 globus_result_t
63 globus_xml_buffer_deserialize_pointer_wrapper(
64 const xsd_QName * element_qname,
65 void ** ip,
66 globus_soap_message_handle_t message_handle,
67 globus_xsd_element_options_t options)
68 111 {
69 111 return globus_xml_buffer_deserialize_pointer(
70 element_qname,
71 (globus_xml_buffer **) ip,
72 message_handle, options);
73 }
74 /* globus_xml_buffer_deserialize_pointer_wrapper() */
75
76 static
77 globus_result_t
78 globus_xml_buffer_init_wrapper(void **object)
79 111 {
80 111 return globus_xml_buffer_init(
81 (globus_xml_buffer **) object);
82 }
83 /* globus_xml_buffer_init_wrapper() */
84
85 static
86 void
87 globus_xml_buffer_destroy_wrapper(
88 void * object)
89 68167 {
90 68167 globus_xml_buffer_destroy(
91 (globus_xml_buffer *) object);
92 68167 }
93 /* globus_xml_buffer_destroy_wrapper() */
94
95 static
96 globus_result_t
97 globus_xml_buffer_copy_wrapper(
98 void ** dest_obj,
99 const void * src_obj)
100 42155 {
101 42155 return globus_xml_buffer_copy(
102 (globus_xml_buffer **) dest_obj,
103 (const globus_xml_buffer *) src_obj);
104 }
105 /* globus_xml_buffer_copy_wrapper() */
106
107 static
108 globus_result_t
109 globus_xml_buffer_init_contents_wrapper(void *object)
110 0 {
111 0 return globus_xml_buffer_init_contents(
112 (globus_xml_buffer *) object);
113 }
114 /* globus_xml_buffer_init_contents_wrapper() */
115
116 static
117 void
118 globus_xml_buffer_destroy_contents_wrapper(
119 void * object)
120 10635 {
121 10635 globus_xml_buffer_destroy_contents(
122 (globus_xml_buffer *) object);
123 10635 }
124 /* globus_xml_buffer_destroy_contents_wrapper() */
125
126 static
127 globus_result_t
128 globus_xml_buffer_copy_contents_wrapper(
129 void * dest_obj,
130 const void * src_obj)
131 0 {
132 0 return globus_xml_buffer_copy_contents(
133 (globus_xml_buffer *) dest_obj,
134 (const globus_xml_buffer *) src_obj);
135 }
136 /* globus_xml_buffer_copy_contents_wrapper() */
137
138 static
139 globus_result_t
140 globus_xml_buffer_serialize_contents_wrapper(
141 const xsd_QName * element_qname,
142 const void * instance,
143 globus_soap_message_handle_t message_handle,
144 globus_xsd_element_options_t options)
145 21321 {
146 21321 return globus_xml_buffer_serialize_contents(
147 element_qname,
148 (globus_xml_buffer *) instance,
149 message_handle, options);
150 }
151 /* globus_xml_buffer_serialize_contents_wrapper() */
152
153 static
154 globus_result_t
155 globus_xml_buffer_deserialize_contents_wrapper(
156 const xsd_QName * element_qname,
157 void ** instance,
158 globus_soap_message_handle_t message_handle,
159 globus_xsd_element_options_t options)
160 34331 {
161 globus_result_t result;
162 34331 globus_bool_t allocated = GLOBUS_FALSE;
163 GlobusFuncName(globus_xml_buffer_deserialize_contents_wrapper);
164 34331 GlobusSoapMessageDebugEnter();
165
166 34331 if(!*instance)
167 {
168 23585 result = globus_xml_buffer_init(
169 (globus_xml_buffer **)instance);
170 23585 if(result != GLOBUS_SUCCESS)
171 {
172 0 goto error;
173 }
174 23585 allocated = GLOBUS_TRUE;
175 }
176
177 34331 result = globus_xml_buffer_deserialize_contents(
178 element_qname,
179 *(globus_xml_buffer **)instance,
180 message_handle, options);
181 34331 error:
182 34331 if (result != GLOBUS_SUCCESS && allocated)
183 {
184 0 globus_xml_buffer_destroy(*(globus_xml_buffer **)instance);
185 0 *instance = NULL;
186 }
187 34331 GlobusSoapMessageDebugExit();
188 34331 return result;
189 }
190 /* globus_xml_buffer_deserialize_contents_wrapper() */
191
192 static
193 globus_result_t
194 globus_xml_buffer_array_serialize_wrapper(
195 const xsd_QName * element,
196 const void * instance,
197 globus_soap_message_handle_t message,
198 globus_xsd_element_options_t options)
199 0 {
200 0 return globus_xml_buffer_array_serialize(
201 element,
202 (globus_xml_buffer_array *) instance,
203 message, options);
204 }
205 /* globus_xml_buffer_array_serialize_wrapper() */
206
207 static
208 globus_result_t
209 globus_xml_buffer_array_deserialize_wrapper(
210 const xsd_QName * element_qname,
211 void ** inst,
212 globus_soap_message_handle_t message,
213 globus_xsd_element_options_t options)
214 0 {
215 0 globus_bool_t allocated = GLOBUS_FALSE;
216
217 globus_result_t result;
218 0 if(!*inst)
219 {
220 0 result = globus_xml_buffer_array_init(
221 (globus_xml_buffer_array **)inst);
222 0 if(result != GLOBUS_SUCCESS)
223 {
224 0 return result;
225 }
226 0 allocated = GLOBUS_TRUE;
227 }
228
229 0 result = globus_xml_buffer_array_deserialize(
230 element_qname,
231 *(globus_xml_buffer_array **) inst,
232 message, options);
233 0 if (result != GLOBUS_SUCCESS && allocated)
234 {
235 0 globus_xml_buffer_array_destroy(*(globus_xml_buffer_array **) inst);
236 0 *inst = NULL;
237 }
238 0 return result;
239 }
240 /* globus_xml_buffer_array_deserialize_wrapper() */
241
242 static
243 globus_result_t
244 globus_xml_buffer_array_init_wrapper(
245 void ** arr)
246 0 {
247 0 return globus_xml_buffer_array_init(
248 (globus_xml_buffer_array **) arr);
249 }
250 /* globus_xml_buffer_array_init_wrapper() */
251
252 static
253 void
254 globus_xml_buffer_array_destroy_wrapper(
255 void * arr)
256 0 {
257 0 globus_xml_buffer_array_destroy(
258 (globus_xml_buffer_array *) arr);
259 0 }
260 /* globus_xml_buffer_array_destroy_wrapper() */
261
262 static
263 globus_result_t
264 globus_xml_buffer_array_copy_wrapper(
265 void ** dest_arr,
266 const void * src_arr)
267 0 {
268 0 return globus_xml_buffer_array_copy(
269 (globus_xml_buffer_array **) dest_arr,
270 (const globus_xml_buffer_array *) src_arr);
271 }
272 /* globus_xml_buffer_array_copy_wrapper() */
273
274 static
275 globus_result_t
276 globus_xml_buffer_array_init_contents_wrapper(
277 void * arr)
278 0 {
279 0 return globus_xml_buffer_array_init_contents(
280 (globus_xml_buffer_array *) arr);
281 }
282 /* globus_xml_buffer_array_init_contents_wrapper() */
283
284 static
285 void
286 globus_xml_buffer_array_destroy_contents_wrapper(
287 void * arr)
288 0 {
289 0 globus_xml_buffer_array_destroy_contents(
290 (globus_xml_buffer_array *) arr);
291 0 }
292 /* globus_xml_buffer_array_destroy_contents_wrapper() */
293
294 static
295 globus_result_t
296 globus_xml_buffer_array_copy_contents_wrapper(
297 void * dest_arr,
298 const void * src_arr)
299 0 {
300 0 return globus_xml_buffer_array_copy_contents(
301 (globus_xml_buffer_array *) dest_arr,
302 (const globus_xml_buffer_array *) src_arr);
303 }
304 /* globus_xml_buffer_array_copy_contents_wrapper() */
305
306 static
307 void *
308 globus_xml_buffer_array_push_wrapper(
309 void * array)
310 0 {
311 0 return (void *) globus_xml_buffer_array_push((globus_xml_buffer_array *) array);
312 }
313 /* globus_xml_buffer_array_push_wrapper() */
314 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
315
316 /**
317 * Type info for globus_xml_buffer
318 * @ingroup globus_xml_buffer
319 * This type info is used when serializing/deserializing an xsd:any
320 * which contains array values of this type.
321 */
322 struct globus_xsd_type_info_s globus_xml_buffer_array_info =
323 {
324 &globus_xml_buffer_qname,
325 globus_xml_buffer_array_serialize_wrapper,
326 globus_xml_buffer_array_deserialize_wrapper,
327 globus_xml_buffer_array_init_wrapper,
328 globus_xml_buffer_array_destroy_wrapper,
329 globus_xml_buffer_array_copy_wrapper,
330 globus_xml_buffer_array_init_contents_wrapper,
331 globus_xml_buffer_array_destroy_contents_wrapper,
332 globus_xml_buffer_array_copy_contents_wrapper,
333 sizeof(globus_xml_buffer),
334 globus_xml_buffer_array_push_wrapper,
335 NULL,
336 NULL
337 };
338
339 /**
340 * Type info for globus_xml_buffer
341 * @ingroup globus_xml_buffer
342 * This type info is used when serializing/deserializing an xsd:anyType
343 * which contains values of this type.
344 */
345 struct globus_xsd_type_info_s globus_xml_buffer_contents_info =
346 {
347 &globus_xml_buffer_qname,
348 globus_xml_buffer_serialize_contents_wrapper,
349 globus_xml_buffer_deserialize_contents_wrapper,
350 globus_xml_buffer_init_wrapper,
351 globus_xml_buffer_destroy_wrapper,
352 globus_xml_buffer_copy_wrapper,
353 globus_xml_buffer_init_contents_wrapper,
354 globus_xml_buffer_destroy_contents_wrapper,
355 globus_xml_buffer_copy_contents_wrapper,
356 sizeof(globus_xml_buffer),
357 NULL,
358 NULL,
359 NULL
360 };
361
362 /**
363 * Type info for globus_xml_buffer
364 * @ingroup globus_xml_buffer
365 * This type info is used when serializing/deserializing an xsd:any
366 * which contains values of this type.
367 */
368 struct globus_xsd_type_info_s globus_xml_buffer_info =
369 {
370 &globus_xml_buffer_qname,
371 globus_xml_buffer_serialize_wrapper,
372 globus_xml_buffer_deserialize_pointer_wrapper,
373 globus_xml_buffer_init_wrapper,
374 globus_xml_buffer_destroy_wrapper,
375 globus_xml_buffer_copy_wrapper,
376 globus_xml_buffer_init_contents_wrapper,
377 globus_xml_buffer_destroy_contents_wrapper,
378 globus_xml_buffer_copy_contents_wrapper,
379 sizeof(globus_xml_buffer),
380 NULL,
381 &globus_xml_buffer_contents_info,
382 &globus_xml_buffer_array_info
383 };
384
385
386 /**
387 * Initialize the contents of a globus_xml_buffer
388 * @ingroup globus_xml_buffer
389 *
390 * Initialize the contents of a globus_xml_buffer. This should be used
391 * when the structure is allocated on the stack or by a some allocator besides
392 * globus_xml_buffer_init(). The contents may be freed
393 * by calling globus_xml_buffer_destroy_contents().
394 *
395 * @param instance
396 * Pointer to an allocated but uninitialized globus_xml_buffer.
397 */
398 globus_result_t
399 globus_xml_buffer_init_contents(
400 globus_xml_buffer * instance)
401 24036 {
402 24036 globus_result_t result = GLOBUS_SUCCESS;
403 GlobusFuncName(globus_xml_buffer_init_contents);
404 24036 GlobusSoapMessageDebugEnter();
405
406 24036 memset(instance, 0, sizeof(globus_xml_buffer));
407
408 24036 GlobusSoapMessageDebugExit();
409 24036 return result;
410 }
411
412
413
414 /**
415 * Initialize a globus_xml_buffer
416 * @ingroup globus_xml_buffer
417 *
418 * Allocates a new globus_xml_buffer and initializes its contents. When the
419 * structure is no longer needed, it should be freed by calling
420 * globus_xml_buffer_destroy().
421 *
422 * @param object
423 * Pointer to set to a newly allocated instance.
424 */
425 globus_result_t
426 globus_xml_buffer_init(
427 globus_xml_buffer ** object)
428 24036 {
429 24036 globus_result_t result = GLOBUS_SUCCESS;
430 GlobusFuncName(globus_xml_buffer_init);
431 24036 GlobusSoapMessageDebugEnter();
432
433 24036 *object = malloc(sizeof(globus_xml_buffer));
434 24036 if (*object == NULL)
435 {
436 0 result = GlobusSoapMessageErrorOutOfMemory;
437
438 0 goto exit;
439 }
440 24036 result = globus_xml_buffer_init_contents(*object);
441 24036 if (result != GLOBUS_SUCCESS)
442 {
443 0 free(*object);
444 0 *object = NULL;
445 }
446 24036 exit:
447 24036 GlobusSoapMessageDebugExit();
448 24036 return result;
449 }
450 /* globus_xml_buffer_init() */
451
452
453
454 /**
455 * Destroy a globus_xml_buffer
456 * @ingroup globus_xml_buffer
457 *
458 * Frees a globus_xml_buffer.
459 *
460 * @param instance
461 * Pointer to the instance to destroy.
462 */
463 void
464 globus_xml_buffer_destroy(
465 globus_xml_buffer * instance)
466 68167 {
467 GlobusFuncName(globus_xml_buffer_destroy);
468 68167 GlobusSoapMessageDebugEnter();
469
470 68167 if(!instance)
471 {
472 0 goto exit;
473 }
474
475 68167 globus_xml_buffer_destroy_contents(instance);
476 68167 free(instance);
477
478 68167 exit:
479
480 68167 GlobusSoapMessageDebugExit();
481 68167 }
482 /* globus_xml_buffer_destroy() */
483
484
485
486
487
488
489 /**
490 * Copy a globus_xml_buffer
491 * @ingroup globus_xml_buffer
492 *
493 * Perform a copy of a globus_xml_buffer.
494 * The @a dest_obj will be allocated, and then a copy of the contents
495 * of @a src to it. The caller is responsible for destroying @a dest_objb
496 *
497 * @param dest_obj
498 * The globus_xml_buffer to be initialized with a copy of the
499 * contents of the @a src_obj structure.
500 * @param src_obj
501 * Source globus_xml_buffer to be copied.
502 */
503 globus_result_t
504 globus_xml_buffer_copy(
505 globus_xml_buffer ** dest_obj,
506 const globus_xml_buffer * src_obj)
507 42155 {
508 42155 globus_result_t result = GLOBUS_SUCCESS;
509 globus_xml_buffer * instance;
510 GlobusFuncName(globus_xml_buffer_copy);
511
512 42155 GlobusSoapMessageDebugEnter();
513
514 42155 instance = malloc(sizeof(globus_xml_buffer));
515 42155 if (instance == NULL)
516 {
517 0 GlobusSoapMessageDebugExit();
518 0 return GlobusSoapMessageErrorOutOfMemory;
519 }
520
521 42155 result = globus_xml_buffer_copy_contents(instance, src_obj);
522 42155 if(result != GLOBUS_SUCCESS)
523 {
524 0 free(instance);
525 0 instance = NULL;
526 0 result = GlobusSoapMessageErrorOutOfMemory;
527 }
528
529 42155 *dest_obj = instance;
530 42155 GlobusSoapMessageDebugExit();
531 42155 return result;
532 }
533 /* globus_xml_buffer_copy() */
534
535
536
537
538 /**
539 * @fn globus_result_t globus_xml_buffer_serialize_contents(const xsd_QName *element_qname, const globus_xml_buffer * inst, globus_soap_message_handle_t message_handle, globus_xsd_element_options_t options)
540 * Serialize the contents of a globus_xml_buffer
541 * @ingroup globus_xml_buffer
542 * Serialize a globus_xml_buffer without an enclosing element.
543 *
544 * @param element_qname
545 * Ignored parameter.
546 * @param inst
547 * The globus_xml_buffer to serialize.
548 * @param message_handle
549 * The handle to serialize the contents on.
550 * @param options
551 * Serialization options.
552 */
553
554
555
556
557
558
559
560 globus_result_t
561 globus_xml_buffer_deserialize_pointer(
562 const xsd_QName * element_qname,
563 globus_xml_buffer ** ip,
564 globus_soap_message_handle_t message_handle,
565 globus_xsd_element_options_t options)
566 111 {
567 111 globus_result_t result = GLOBUS_SUCCESS;
568 GlobusFuncName(globus_xml_buffer_deserialize_pointer);
569 111 GlobusSoapMessageDebugEnter();
570
571 111 result = globus_xsd_generic_deserialize_pointer(
572 element_qname,
573 &globus_xml_buffer_info,
574 (void **)ip,
575 message_handle,
576 options);
577
578 111 return result;
579 }
580 /* globus_xml_buffer_deserialize_pointer() */
581
582
583
584 globus_result_t
585 globus_xml_buffer_array_init_contents(
586 globus_xml_buffer_array * array)
587 0 {
588 GlobusFuncName(globus_xml_buffer_array_init_contents);
589 0 GlobusSoapMessageDebugEnter();
590
591 0 array->elements = NULL;
592 0 array->length = 0;
593 0 array->type_info = &globus_xml_buffer_info;
594
595 0 GlobusSoapMessageDebugExit();
596 0 return GLOBUS_SUCCESS;
597 }
598 /* globus_xml_buffer_array_init_contents() */
599
600
601
602 globus_result_t
603 globus_xml_buffer_array_init(
604 globus_xml_buffer_array ** arr)
605 0 {
606 0 return globus_xsd_generic_array_init(
607 (globus_xsd_generic_array_t **) arr,
608 &globus_xml_buffer_info);
609 }
610 /* globus_xml_buffer_array_init() */
611
612
613
614 void
615 globus_xml_buffer_array_destroy_contents(
616 globus_xml_buffer_array * array)
617 0 {
618 0 globus_xsd_generic_array_destroy_contents(
619 (globus_xsd_generic_array_t *) array);
620 0 }
621 /* globus_xml_buffer_array_destroy_contents() */
622
623
624
625 void
626 globus_xml_buffer_array_destroy(
627 globus_xml_buffer_array * array)
628 0 {
629
630 0 globus_xsd_generic_array_destroy(
631 (globus_xsd_generic_array_t *) array);
632 0 }
633 /* globus_xml_buffer_array_destroy() */
634
635
636
637
638 globus_result_t
639 globus_xml_buffer_array_copy(
640 globus_xml_buffer_array ** dest_arr,
641 const globus_xml_buffer_array * src_arr)
642 0 {
643 0 return globus_xsd_generic_array_copy(
644 (globus_xsd_generic_array_t **) dest_arr,
645 (const globus_xsd_generic_array_t *) src_arr);
646 }
647 /* globus_xml_buffer_array_copy() */
648
649
650
651 globus_result_t
652 globus_xml_buffer_array_copy_contents(
653 globus_xml_buffer_array * dest_arr,
654 const globus_xml_buffer_array * src_arr)
655 0 {
656 0 return globus_xsd_generic_array_copy_contents(
657 (globus_xsd_generic_array_t *) dest_arr,
658 (const globus_xsd_generic_array_t *) src_arr);
659 }
660 /* globus_xml_buffer_array_copy_contents() */
661
662
663
664 globus_xml_buffer *
665 globus_xml_buffer_array_push(
666 globus_xml_buffer_array * array)
667 0 {
668 /* Some contents initializers don't initialize subelments but to set their
669 * values to be NULL
670 */
671 0 if (array->type_info == NULL)
672 {
673 0 array->type_info = &globus_xml_buffer_info;
674 }
675 0 return globus_xsd_generic_array_push(
676 (globus_xsd_generic_array_t *) array);
677 }
678 /* globus_xml_buffer_array_push() */
679
680
681
682 globus_result_t
683 globus_xml_buffer_array_serialize(
684 const xsd_QName * element_qname,
685 const globus_xml_buffer_array * array,
686 globus_soap_message_handle_t message,
687 globus_xsd_element_options_t options)
688 0 {
689 0 return globus_xsd_generic_array_serialize(
690 element_qname,
691 (const globus_xsd_generic_array_t *) array,
692 message,
693 options);
694 }
695 /* globus_xml_buffer_array_serialize() */
696
697
698
699
700 globus_result_t
701 globus_xml_buffer_array_deserialize(
702 const xsd_QName * element_qname,
703 globus_xml_buffer_array * array,
704 globus_soap_message_handle_t message,
705 globus_xsd_element_options_t options)
706 0 {
707 /* Some initializers set the array contents to NULL */
708 0 if (array->type_info == NULL)
709 {
710 0 array->type_info = &globus_xml_buffer_info;
711 }
712
713 0 return globus_xsd_generic_array_deserialize(
714 element_qname,
715 (globus_xsd_generic_array_t *) array,
716 message,
717 options);
718 }