#include <cms_xup.hh>
Inheritance diagram for CMS_XDR_UPDATER:


Public Methods | |
| CMS_STATUS | update (char &x) |
| CMS_STATUS | update (unsigned char &x) |
| CMS_STATUS | update (short int &x) |
| CMS_STATUS | update (unsigned short int &x) |
| CMS_STATUS | update (int &x) |
| CMS_STATUS | update (unsigned int &x) |
| CMS_STATUS | update (long int &x) |
| CMS_STATUS | update (unsigned long int &x) |
| CMS_STATUS | update (float &x) |
| CMS_STATUS | update (double &x) |
| CMS_STATUS | update (long double &x) |
| CMS_STATUS | update (char *x, unsigned int len) |
| CMS_STATUS | update (unsigned char *x, unsigned int len) |
| CMS_STATUS | update (short *x, unsigned int len) |
| CMS_STATUS | update (unsigned short *x, unsigned int len) |
| CMS_STATUS | update (int *x, unsigned int len) |
| CMS_STATUS | update (unsigned int *x, unsigned int len) |
| CMS_STATUS | update (long *x, unsigned int len) |
| CMS_STATUS | update (unsigned long *x, unsigned int len) |
| CMS_STATUS | update (float *x, unsigned int len) |
| CMS_STATUS | update (double *x, unsigned int len) |
| CMS_STATUS | update (long double *x, unsigned int len) |
| int | set_mode (CMS_UPDATER_MODE) |
| void | rewind () |
| int | get_encoded_msg_size () |
| void | set_encoded_data (void *, long _encoded_data_size) |
Protected Methods | |
| int | check_pointer (char RCS_HUGE *, long) |
| CMS_XDR_UPDATER (CMS *) | |
| virtual | ~CMS_XDR_UPDATER () |
Protected Attributes | |
| XDR * | encode_data_stream |
| XDR * | decode_data_stream |
| XDR * | encode_header_stream |
| XDR * | decode_header_stream |
| XDR * | encode_queuing_header_stream |
| XDR * | decode_queuing_header_stream |
| XDR * | current_stream |
Friends | |
| class RCS_EXPORT | CMS |
|
|
Definition at line 86 of file cms_xup.cc. 00086 :CMS_UPDATER (_cms_parent, 00087 0, 2) 00088 { 00089 /* Set pointers to NULL. */ 00090 encode_data_stream = (XDR *) NULL; 00091 decode_data_stream = (XDR *) NULL; 00092 encode_header_stream = (XDR *) NULL; 00093 decode_header_stream = (XDR *) NULL; 00094 encode_queuing_header_stream = (XDR *) NULL; 00095 decode_queuing_header_stream = (XDR *) NULL; 00096 encoded_header = NULL; 00097 encoded_queuing_header = NULL; 00098 00099 if (!cms_parent->isserver) 00100 { 00101 encoded_data = NULL; 00102 } 00103 using_external_encoded_data = 0; 00104 00105 #if 0 00106 if (load_rpc_interface () < 0) 00107 { 00108 rcs_print_error 00109 ("CMS_XDR_UPDATER requires the rpc interface and it failed to load.\n"); 00110 status = CMS_UPDATE_ERROR; 00111 return; 00112 } 00113 #endif 00114 /* Store and validate constructors arguments. */ 00115 cms_parent = _cms_parent; 00116 if (NULL == cms_parent) 00117 { 00118 rcs_print_error ("CMS parent for updater is NULL.\n"); 00119 status = CMS_UPDATE_ERROR; 00120 return; 00121 } 00122 00123 /* Allocate memory for: */ 00124 /* - encoded copies of the global buffer and the header */ 00125 /* - XDR streams. */ 00126 /* (Also initialize the XDR streams.) */ 00127 00128 /* Allocate the encoded header too large, */ 00129 /* and find out what size it really is. */ 00130 encoded_header = DEBUG_MALLOC (neutral_size_factor * sizeof (CMS_HEADER)); 00131 if (encoded_header == NULL) 00132 { 00133 rcs_print_error ("CMS:can't malloc encoded_header"); 00134 status = CMS_CREATE_ERROR; 00135 return; 00136 } 00137 00138 encode_header_stream = (XDR *) DEBUG_MALLOC (sizeof (XDR)); 00139 if (encode_header_stream == NULL) 00140 { 00141 cms_parent->status = CMS_CREATE_ERROR; 00142 rcs_print_error ("CMS:can't malloc encode_header_stream"); 00143 return; 00144 } 00145 xdrmem_create ((XDR *) encode_header_stream, (char *) encoded_header, 00146 (int) neutral_size_factor * sizeof (CMS_HEADER), XDR_ENCODE); 00147 00148 decode_header_stream = (XDR *) DEBUG_MALLOC (sizeof (XDR)); 00149 if (decode_header_stream == NULL) 00150 { 00151 rcs_print_error ("CMS:can't malloc decode_header_stream"); 00152 status = CMS_CREATE_ERROR; 00153 return; 00154 } 00155 xdrmem_create ((XDR *) decode_header_stream, (char *) encoded_header, 00156 (int) neutral_size_factor * sizeof (CMS_HEADER), XDR_DECODE); 00157 00158 /* If queuing is enabled, then initialize streams for */ 00159 /* encoding and decoding the header with the queue information. */ 00160 if (cms_parent->queuing_enabled) 00161 { 00162 /* Allocate the encoded header too large, */ 00163 /* and find out what size it really is. */ 00164 encoded_queuing_header = 00165 DEBUG_MALLOC (neutral_size_factor * sizeof (CMS_QUEUING_HEADER)); 00166 if (encoded_queuing_header == NULL) 00167 { 00168 rcs_print_error ("CMS:can't malloc encoded_queuing_header"); 00169 status = CMS_CREATE_ERROR; 00170 return; 00171 } 00172 encode_queuing_header_stream = (XDR *) DEBUG_MALLOC (sizeof (XDR)); 00173 if (encode_queuing_header_stream == NULL) 00174 { 00175 status = CMS_CREATE_ERROR; 00176 rcs_print_error ("CMS:can't malloc encode_queuing_header_stream"); 00177 return; 00178 } 00179 xdrmem_create ((XDR *) encode_queuing_header_stream, 00180 (char *) encoded_queuing_header, 00181 (int) neutral_size_factor * sizeof (CMS_QUEUING_HEADER), 00182 XDR_ENCODE); 00183 00184 decode_queuing_header_stream = (XDR *) DEBUG_MALLOC (sizeof (XDR)); 00185 if (decode_queuing_header_stream == NULL) 00186 { 00187 rcs_print_error ("CMS:can't malloc decode_queuing_header_stream"); 00188 status = CMS_CREATE_ERROR; 00189 return; 00190 } 00191 xdrmem_create ((XDR *) decode_queuing_header_stream, 00192 (char *) encoded_queuing_header, 00193 (int) neutral_size_factor * sizeof (CMS_QUEUING_HEADER), 00194 XDR_DECODE); 00195 } 00196 if (!cms_parent->isserver) 00197 { 00198 if (cms_parent->enc_max_size > 0 00199 && cms_parent->enc_max_size < neutral_size_factor * size) 00200 { 00201 set_encoded_data (DEBUG_MALLOC (cms_parent->enc_max_size), 00202 cms_parent->enc_max_size); 00203 } 00204 else 00205 { 00206 set_encoded_data (DEBUG_MALLOC (neutral_size_factor * size), 00207 neutral_size_factor * size); 00208 } 00209 } 00210 using_external_encoded_data = 0; 00211 } |
|
|
Definition at line 213 of file cms_xup.cc. 00214 {
00215 /* If encoded buffers were used destroy the xdr streams and free */
00216 /* memory used for encoded buffers. */
00217 if (NULL != encode_data_stream)
00218 {
00219 xdr_destroy (encode_data_stream);
00220 corrected_free (encode_data_stream);
00221 encode_data_stream = (XDR *) NULL;
00222 }
00223 if (NULL != decode_data_stream)
00224 {
00225 xdr_destroy (decode_data_stream);
00226 corrected_free (decode_data_stream);
00227 decode_data_stream = (XDR *) NULL;
00228 }
00229 if (NULL != encode_header_stream)
00230 {
00231 xdr_destroy (((XDR *) encode_header_stream));
00232 corrected_free (encode_header_stream);
00233 encode_header_stream = (XDR *) NULL;
00234 }
00235 if (NULL != decode_header_stream)
00236 {
00237 xdr_destroy (((XDR *) decode_header_stream));
00238 corrected_free (decode_header_stream);
00239 decode_header_stream = (XDR *) NULL;
00240 }
00241 if (NULL != encode_queuing_header_stream)
00242 {
00243 xdr_destroy (((XDR *) encode_queuing_header_stream));
00244 corrected_free (encode_queuing_header_stream);
00245 encode_queuing_header_stream = (XDR *) NULL;
00246 }
00247 if (NULL != decode_queuing_header_stream)
00248 {
00249 xdr_destroy (((XDR *) decode_queuing_header_stream));
00250 corrected_free (decode_queuing_header_stream);
00251 decode_queuing_header_stream = (XDR *) NULL;
00252 }
00253 if (NULL != encoded_data && !using_external_encoded_data)
00254 {
00255 corrected_free (encoded_data);
00256 encoded_data = NULL;
00257 }
00258 if (NULL != encoded_header)
00259 {
00260 corrected_free (encoded_header);
00261 encoded_header = NULL;
00262 }
00263 if (NULL != encoded_queuing_header)
00264 {
00265 corrected_free (encoded_queuing_header);
00266 encoded_queuing_header = NULL;
00267 }
00268 #if 0
00269 unload_rpc_interface ();
00270 #endif
00271 }
|
|
|
Reimplemented from CMS_UPDATER. Definition at line 445 of file cms_xup.cc. 00446 {
00447 /* Check to see if the pointers are in the proper range. */
00448 if (-1 == check_pointer ((char RCS_HUGE *) &x, sizeof (char)))
00449 {
00450 return (CMS_UPDATE_ERROR);
00451 }
00452 if (xdr_char (current_stream, &x) != TRUE)
00453 {
00454 rcs_print_error ("CMS_XDR_UPDATER: xdr_char failed.\n");
00455 return (status = CMS_UPDATE_ERROR);
00456 }
00457 return (status);
00458 }
|
|
|
Reimplemented from CMS_UPDATER. Definition at line 478 of file cms_xup.cc. 00479 {
00480 /* Check to see if the pointers are in the proper range. */
00481 if (-1 == check_pointer ((char RCS_HUGE *) &x, sizeof (char)))
00482 {
00483 return (CMS_UPDATE_ERROR);
00484 }
00485 if (xdr_u_char (current_stream, (unsigned char *) &x) != TRUE)
00486 {
00487 rcs_print_error ("CMS_XDR_UPDATER: xdr_u_char failed.\n");
00488 return (status = CMS_UPDATE_ERROR);
00489 }
00490 return (status);
00491 }
|
|
|
Reimplemented from CMS_UPDATER. |
|
|
Reimplemented from CMS_UPDATER. |
|
|
Reimplemented from CMS_UPDATER. Definition at line 588 of file cms_xup.cc. 00589 {
00590 if (-1 == check_pointer ((char RCS_HUGE *) &x, sizeof (int)))
00591 {
00592 return (CMS_UPDATE_ERROR);
00593 }
00594
00595 if (xdr_int (current_stream, &x) != TRUE)
00596 {
00597 rcs_print_error ("CMS_XDR_UPDATER: xdr_int failed.\n");
00598 return (status = CMS_UPDATE_ERROR);
00599 }
00600 return (status);
00601 }
|
|
|
Reimplemented from CMS_UPDATER. Definition at line 620 of file cms_xup.cc. 00621 {
00622 if (-1 == check_pointer ((char RCS_HUGE *) &x, sizeof (unsigned int)))
00623 {
00624 return (CMS_UPDATE_ERROR);
00625 }
00626
00627 if (xdr_u_int (current_stream, &x) != TRUE)
00628 {
00629 rcs_print_error ("CMS_XDR_UPDATER: xdr_u_int failed.\n");
00630 return (status = CMS_UPDATE_ERROR);
00631 }
00632 return (status);
00633 }
|
|
|
Reimplemented from CMS_UPDATER. |
|
|
Reimplemented from CMS_UPDATER. |
|
|
Reimplemented from CMS_UPDATER. Definition at line 729 of file cms_xup.cc. 00730 {
00731 if (-1 == check_pointer ((char RCS_HUGE *) &x, sizeof (float)))
00732 {
00733 return (CMS_UPDATE_ERROR);
00734 }
00735
00736 if (xdr_float (current_stream, &x) != TRUE)
00737 {
00738 rcs_print_error ("CMS_XDR_UPDATER: xdr_float failed.\n");
00739 return (status = CMS_UPDATE_ERROR);
00740 }
00741 return (status);
00742 }
|
|
|
Reimplemented from CMS_UPDATER. Definition at line 763 of file cms_xup.cc. 00764 {
00765 if (-1 == check_pointer ((char RCS_HUGE *) &x, sizeof (double)))
00766 {
00767 return (CMS_UPDATE_ERROR);
00768 }
00769
00770 if (xdr_double (current_stream, &x) != TRUE)
00771 {
00772 rcs_print_error ("CMS_XDR_UPDATER: xdr_double failed.\n");
00773 return (status = CMS_UPDATE_ERROR);
00774 }
00775 return (status);
00776 }
|
|
|
Reimplemented from CMS_UPDATER. Definition at line 802 of file cms_xup.cc. 00803 {
00804 if (-1 == check_pointer ((char RCS_HUGE *) &x, sizeof (long double)))
00805 {
00806 return (CMS_UPDATE_ERROR);
00807 }
00808
00809 double y;
00810 #ifdef __BORLANDC__
00811 /* The Borland C++ compiler seems to need a little help in converting */
00812 /* long doubles to ordinary doubles. */
00813 if (x > 1E308)
00814 x = 1E308;
00815 if (x < -1E308)
00816 x = -1E308;
00817 if ((-2E-308 < x) && (x < 2E-308))
00818 x = 0.0;
00819 #endif
00820
00821 y = (double) x;
00822
00823
00824 if (xdr_double (current_stream, &y) != TRUE)
00825 {
00826 rcs_print_error ("CMS_XDR_UPDATER: xdr_double failed.\n");
00827 return (status = CMS_UPDATE_ERROR);
00828 }
00829 x = (long double) y;
00830 return (status);
00831 }
|
|
||||||||||||
|
Reimplemented from CMS_UPDATER. Definition at line 461 of file cms_xup.cc. 00462 {
00463 /* Check to see if the pointers are in the proper range. */
00464 if (-1 == check_pointer ((char RCS_HUGE *) x, len * sizeof (char)))
00465 {
00466 return (CMS_UPDATE_ERROR);
00467 }
00468
00469 if (xdr_bytes (current_stream, (char **) &x, &len, len) != TRUE)
00470 {
00471 rcs_print_error ("CMS_XDR_UPDATER: xdr_bytes failed.\n");
00472 return (status = CMS_UPDATE_ERROR);
00473 }
00474 return (status);
00475 }
|
|
||||||||||||
|
Reimplemented from CMS_UPDATER. Definition at line 494 of file cms_xup.cc. 00495 {
00496 /* Check to see if the pointers are in the proper range. */
00497 if (-1 == check_pointer ((char RCS_HUGE *) x, len * sizeof (unsigned char)))
00498 {
00499 return (CMS_UPDATE_ERROR);
00500 }
00501
00502 if (xdr_bytes (current_stream, (char **) &x, &len, len) != TRUE)
00503 {
00504 rcs_print_error ("CMS_XDR_UPDATER: xdr_bytes failed.\n");
00505 return (status = CMS_UPDATE_ERROR);
00506 }
00507 return (status);
00508 }
|
|
||||||||||||
|
Reimplemented from CMS_UPDATER. Definition at line 530 of file cms_xup.cc. 00531 {
00532 /* Check to see if the pointers are in the proper range. */
00533 if (-1 == check_pointer ((char RCS_HUGE *) x, len * sizeof (short)))
00534 {
00535 return (CMS_UPDATE_ERROR);
00536 }
00537
00538 if (xdr_vector (current_stream, (char *) x, len, sizeof (short),
00539 (xdrproc_t) xdr_short) != TRUE)
00540 {
00541 rcs_print_error
00542 ("CMS_XDR_UPDATER: xdr_vector(... xdr_short) failed.\n");
00543 return (status = CMS_UPDATE_ERROR);
00544 }
00545 return (status);
00546 }
|
|
||||||||||||
|
Reimplemented from CMS_UPDATER. Definition at line 566 of file cms_xup.cc. 00567 {
00568 if (-1 ==
00569 check_pointer ((char RCS_HUGE *) x, len * sizeof (unsigned short)))
00570 {
00571 return (CMS_UPDATE_ERROR);
00572 }
00573
00574 if (xdr_vector (current_stream,
00575 (char *) x, len,
00576 sizeof (unsigned short), (xdrproc_t) xdr_u_short) != TRUE)
00577 {
00578 rcs_print_error
00579 ("CMS_XDR_UPDATER: xdr_vector(... xdr_u_short) failed.\n");
00580 return (status = CMS_UPDATE_ERROR);
00581 }
00582 return (status);
00583 }
|
|
||||||||||||
|
Reimplemented from CMS_UPDATER. Definition at line 604 of file cms_xup.cc. 00605 {
00606 if (-1 == check_pointer ((char RCS_HUGE *) x, len * sizeof (int)))
00607 {
00608 return (CMS_UPDATE_ERROR);
00609 }
00610 if (xdr_vector (current_stream, (char *) x, len, sizeof (int),
00611 (xdrproc_t) xdr_int) != TRUE)
00612 {
00613 rcs_print_error ("CMS_XDR_UPDATER: xdr_vector( ... xdr_int) failed.\n");
00614 return (status = CMS_UPDATE_ERROR);
00615 }
00616 return (status);
00617 }
|
|
||||||||||||
|
Reimplemented from CMS_UPDATER. Definition at line 636 of file cms_xup.cc. 00637 {
00638 if (-1 == check_pointer ((char RCS_HUGE *) x, len * sizeof (unsigned int)))
00639 {
00640 return (CMS_UPDATE_ERROR);
00641 }
00642
00643 if (xdr_vector (current_stream,
00644 (char *) x, len,
00645 sizeof (unsigned int), (xdrproc_t) xdr_u_int) != TRUE)
00646 {
00647 rcs_print_error
00648 ("CMS_XDR_UPDATER: xdr_vector(... xdr_u_int) failed.\n");
00649 return (status = CMS_UPDATE_ERROR);
00650 }
00651 return (status);
00652 }
|
|
||||||||||||
|
Reimplemented from CMS_UPDATER. Definition at line 674 of file cms_xup.cc. 00675 {
00676 if (-1 == check_pointer ((char RCS_HUGE *) x, len * sizeof (long)))
00677 {
00678 return (CMS_UPDATE_ERROR);
00679 }
00680
00681 if (xdr_vector (current_stream, (char *) x, len, sizeof (long),
00682 (xdrproc_t) xdr_long) != TRUE)
00683 {
00684 rcs_print_error ("CMS_XDR_UPDATER: xdr_vector(... xdr_long) failed.\n");
00685 return (status = CMS_UPDATE_ERROR);
00686 }
00687 return (status);
00688 }
|
|
||||||||||||
|
Reimplemented from CMS_UPDATER. Definition at line 708 of file cms_xup.cc. 00709 {
00710 if (-1 == check_pointer ((char RCS_HUGE *) x, len * sizeof (unsigned long)))
00711 {
00712 return (CMS_UPDATE_ERROR);
00713 }
00714
00715 if (xdr_vector (current_stream,
00716 (char *) x, len, sizeof (unsigned long),
00717 (xdrproc_t) xdr_u_long) != TRUE)
00718 {
00719 rcs_print_error
00720 ("CMS_XDR_UPDATER: xdr_vector(... xdr_u_long) failed.\n");
00721 return (status = CMS_UPDATE_ERROR);
00722 }
00723 return (status);
00724 }
|
|
||||||||||||
|
Reimplemented from CMS_UPDATER. Definition at line 745 of file cms_xup.cc. 00746 {
00747 if (-1 == check_pointer ((char RCS_HUGE *) x, len * sizeof (float)))
00748 {
00749 return (CMS_UPDATE_ERROR);
00750 }
00751
00752 if (xdr_vector (current_stream, (char *) x, len, sizeof (float),
00753 (xdrproc_t) xdr_float) != TRUE)
00754 {
00755 rcs_print_error
00756 ("CMS_XDR_UPDATER: xdr_vector(... xdr_float) failed.\n");
00757 return (status = CMS_UPDATE_ERROR);
00758 }
00759 return (status);
00760 }
|
|
||||||||||||
|
Reimplemented from CMS_UPDATER. Definition at line 779 of file cms_xup.cc. 00780 {
00781 if (-1 == check_pointer ((char RCS_HUGE *) x, len * sizeof (double)))
00782 {
00783 return (CMS_UPDATE_ERROR);
00784 }
00785
00786 if (xdr_vector (current_stream, (char *) x, len, sizeof (double),
00787 (xdrproc_t) xdr_double) != TRUE)
00788 {
00789 rcs_print_error
00790 ("CMS_XDR_UPDATER: xdr_vector(... xdr_double) failed.\n");
00791 return (status = CMS_UPDATE_ERROR);
00792 }
00793
00794 return (status);
00795 }
|
|
||||||||||||
|
Reimplemented from CMS_UPDATER. Definition at line 834 of file cms_xup.cc. 00835 {
00836 if (-1 == check_pointer ((char RCS_HUGE *) x, len * sizeof (long double)))
00837 {
00838 return (CMS_UPDATE_ERROR);
00839 }
00840
00841 unsigned int i;
00842 double *y;
00843 y = (double *) DEBUG_MALLOC (sizeof (double) * len);
00844 for (i = 0; i < len; i++)
00845 {
00846 #ifdef __BORLANDC__
00847 /* The Borland C++ compiler seems to need a little help in converting */
00848 /* long doubles to ordinary doubles. */
00849 if (x[i] > 1E308)
00850 x[i] = 1E308;
00851 if (x[i] < -1E308)
00852 x[i] = -1E308;
00853 if ((-2E-308 < x[i]) && (x[i] < 2E-308))
00854 x[i] = 0.0;
00855 #endif
00856 y[i] = (double) x[i];
00857 }
00858
00859
00860 if (xdr_vector (current_stream, (char *) y, len, sizeof (double),
00861 (xdrproc_t) xdr_double) != TRUE)
00862 {
00863 rcs_print_error
00864 ("CMS_XDR_UPDATER: xdr_vector(... xdr_double) failed.\n");
00865 return (status = CMS_UPDATE_ERROR);
00866 }
00867
00868 for (i = 0; i < len; i++)
00869 {
00870 x[i] = (long double) y[i];
00871 }
00872 corrected_free (y);
00873 return (status);
00874 }
|
|
|
Reimplemented from CMS_UPDATER. Definition at line 342 of file cms_xup.cc. 00343 {
00344 mode = _mode;
00345 CMS_UPDATER::set_mode (_mode);
00346 switch (mode)
00347 {
00348 case CMS_NO_UPDATE:
00349 current_stream = (XDR *) NULL;
00350 break;
00351
00352 case CMS_ENCODE_DATA:
00353 current_stream = encode_data_stream;
00354 break;
00355
00356 case CMS_DECODE_DATA:
00357 current_stream = decode_data_stream;
00358 break;
00359
00360 case CMS_ENCODE_HEADER:
00361 current_stream = encode_header_stream;
00362 break;
00363
00364 case CMS_DECODE_HEADER:
00365 current_stream = decode_header_stream;
00366 break;
00367
00368 case CMS_ENCODE_QUEUING_HEADER:
00369 current_stream = encode_queuing_header_stream;
00370 break;
00371
00372 case CMS_DECODE_QUEUING_HEADER:
00373 current_stream = decode_queuing_header_stream;
00374 break;
00375
00376 default:
00377 rcs_print_error ("CMS updater in invalid mode.(%d)\n", mode);
00378 return (-1);
00379 }
00380 return (0);
00381 }
|
|
|
Reimplemented from CMS_UPDATER. Definition at line 410 of file cms_xup.cc. 00411 {
00412 CMS_UPDATER::rewind ();
00413 if (NULL != current_stream)
00414 {
00415 xdr_setpos (current_stream, 0);
00416 }
00417 else
00418 {
00419 rcs_print_error
00420 ("CMS_XDR_UPDATER: Can't rewind because current_stream is NULL.\n");
00421 }
00422 if (NULL != cms_parent)
00423 {
00424 cms_parent->format_size = 0;
00425 }
00426 }
|
|
|
Reimplemented from CMS_UPDATER. Definition at line 430 of file cms_xup.cc. 00431 {
00432 if (NULL == current_stream)
00433 {
00434 rcs_print_error
00435 ("CMS_XDR_UPDATER can not provide encoded_msg_size because the current stream is NULL.\n");
00436 return (-1);
00437 }
00438 return (xdr_getpos (current_stream));
00439 }
|
|
||||||||||||
|
Reimplemented from CMS_UPDATER. Definition at line 274 of file cms_xup.cc. Referenced by CMS_XDR_UPDATER().
00276 {
00277 /* If the encoded data area has already been setup then release it. */
00278 if (NULL != encoded_data && !using_external_encoded_data)
00279 {
00280 corrected_free (encoded_data);
00281 encoded_data = NULL;
00282 }
00283
00284 encoded_data_size = _encoded_data_size;
00285 encoded_data = _encoded_data;
00286 using_external_encoded_data = 1;
00287 if (encoded_data == NULL)
00288 {
00289 rcs_print_error ("CMS: Attempt to set encoded_data buffer to NULL.\n");
00290 status = CMS_MISC_ERROR;
00291 return;
00292 }
00293 /* Allocate memory for XDR structures. */
00294 if (NULL == encode_data_stream)
00295 {
00296 encode_data_stream = (XDR *) DEBUG_MALLOC (sizeof (XDR));
00297 }
00298 else
00299 {
00300 xdr_destroy (encode_data_stream);
00301 }
00302 if (NULL == encode_data_stream)
00303 {
00304 rcs_print_error ("CMS:can't malloc encode_data_stream");
00305 status = CMS_CREATE_ERROR;
00306 return;
00307 }
00308 if (NULL == decode_data_stream)
00309 {
00310 decode_data_stream = (XDR *) DEBUG_MALLOC (sizeof (XDR));
00311 }
00312 else
00313 {
00314 xdr_destroy (decode_data_stream);
00315 }
00316 if (NULL == decode_data_stream)
00317 {
00318 rcs_print_error ("CMS:can't malloc decode_data_stream");
00319 status = CMS_CREATE_ERROR;
00320 return;
00321 }
00322
00323 /* Initialize the XDR streams. */
00324 int nsize = (int) (neutral_size_factor * size);
00325 if (nsize > cms_parent->max_encoded_message_size
00326 && cms_parent->max_encoded_message_size > 0)
00327 {
00328 nsize = cms_parent->max_encoded_message_size;
00329 }
00330 if (nsize > cms_parent->enc_max_size && cms_parent->enc_max_size > 0)
00331 {
00332 nsize = cms_parent->enc_max_size;
00333 }
00334 xdrmem_create (encode_data_stream, (char *) encoded_data, nsize,
00335 XDR_ENCODE);
00336 xdrmem_create (decode_data_stream, (char *) encoded_data, nsize,
00337 XDR_DECODE);
00338
00339 }
|
|
||||||||||||
|
Reimplemented from CMS_UPDATER. Definition at line 384 of file cms_xup.cc. Referenced by update().
00385 {
00386 if (NULL == cms_parent || NULL == current_stream)
00387 {
00388 rcs_print_error ("CMS_XDR_UPDATER: Required pointer is NULL.\n");
00389 return (-1);
00390 }
00391 if (
00392 (current_stream == encode_data_stream) ||
00393 (current_stream == decode_data_stream) ||
00394 (mode == CMS_ENCODE_DATA) || (mode == CMS_DECODE_DATA))
00395 {
00396 int xdr_pos = xdr_getpos (current_stream);
00397 if (xdr_pos + _bytes > encoded_data_size)
00398 {
00399 rcs_print_error
00400 ("Encoded message buffer full. (xdr_pos=%d,_bytes=%d,(xdr_pos+_bytes)=%d,encoded_data_size=%d)\n",
00401 xdr_pos, _bytes, (xdr_pos + _bytes), encoded_data_size);
00402 return -1;
00403 }
00404 }
00405 return (cms_parent->check_pointer (_pointer, _bytes));
00406 }
|
|
|
Reimplemented from CMS_UPDATER. Definition at line 57 of file cms_xup.hh. |
|
|
Definition at line 58 of file cms_xup.hh. |
|
|
Definition at line 59 of file cms_xup.hh. |
|
|
Definition at line 60 of file cms_xup.hh. |
|
|
Definition at line 61 of file cms_xup.hh. |
|
|
Definition at line 62 of file cms_xup.hh. |
|
|
Definition at line 63 of file cms_xup.hh. |
|
|
Definition at line 64 of file cms_xup.hh. |
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001