Back to home page

Enduro/X

 
 

    


0001 /**
0002  * @brief Conversation functions
0003  *
0004  * @file cf.h
0005  */
0006 /* -----------------------------------------------------------------------------
0007  * Enduro/X Middleware Platform for Distributed Transaction Processing
0008  * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0009  * Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0010  * This software is released under one of the following licenses:
0011  * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0012  * See LICENSE file for full text.
0013  * -----------------------------------------------------------------------------
0014  * AGPL license:
0015  *
0016  * This program is free software; you can redistribute it and/or modify it under
0017  * the terms of the GNU Affero General Public License, version 3 as published
0018  * by the Free Software Foundation;
0019  *
0020  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
0021  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0022  * PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0023  * for more details.
0024  *
0025  * You should have received a copy of the GNU Affero General Public License along 
0026  * with this program; if not, write to the Free Software Foundation, Inc.,
0027  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0028  *
0029  * -----------------------------------------------------------------------------
0030  * A commercial use license is available from Mavimax, Ltd
0031  * contact@mavimax.com
0032  * -----------------------------------------------------------------------------
0033  */
0034 
0035 #ifndef CF_H
0036 #define CF_H
0037 
0038 #ifdef  __cplusplus
0039 extern "C" {
0040 #endif
0041 
0042 /* In this case data is being passed in. I.e. Data is not provided buffer
0043  * and target is UBF buffer. In this case *carr* operations may assumes that
0044  * EOS at the end is OK - buffer length is OK (so that standard str functions )
0045  * could be reused */
0046 #define CNV_DIR_IN   0
0047 /* In this case data is being passed out. Data is in FB, and target is user buffer
0048  * in this case for CARR operations EOS at the end could not be allowed!
0049  * also buffer length checks must be made!
0050  */
0051 #define CNV_DIR_OUT  1
0052 struct conv_type {
0053     _UBF_SHORT from_type;
0054     _UBF_SHORT to_type;
0055     char * (*conv_fn) (struct conv_type *t, int cnv_dir, char *input_buf, int in_len,
0056                         char *output_buf, int *out_len);
0057 };
0058 
0059 typedef struct conv_type conv_type_t;
0060 
0061 /* The main conversation function. This will not work in multi threaded mode! */
0062 extern char * ndrx_ubf_convert(int cnv_dir, int from_type, char *input_buf, int in_len,
0063                         int to_type, char *output_buf , int *out_len);
0064 
0065 extern char * ndrx_ubf_get_cbuf(int in_from_type, int in_to_type,
0066                         char *in_temp_buf, char *in_data, int in_len,
0067                         char **out_alloc_buf, int *alloc_size, int mode,
0068                         int extra_len);
0069 
0070 #ifdef  __cplusplus
0071 }
0072 #endif
0073 
0074 #endif  /* CF_H */
0075 
0076 /* vim: set ts=4 sw=4 et smartindent: */