Back to home page

Enduro/X

 
 

    


0001 /**
0002  * @brief Few FML api specific handling
0003  *
0004  * @file fml.c
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 /*---------------------------Includes-----------------------------------*/
0036 #include <string.h>
0037 #include <stdio.h>
0038 #include <stdlib.h>
0039 #include <memory.h>
0040 #include <errno.h>
0041 
0042 #include <ubf.h>
0043 #include <ubf_int.h>    /* Internal headers for UBF... */
0044 #include <fdatatype.h>
0045 #include <ferror.h>
0046 #include <fieldtable.h>
0047 #include <ndrstandard.h>
0048 #include <ndebug.h>
0049 #include <cf.h>
0050 
0051 #include "userlog.h"
0052 /*---------------------------Externs------------------------------------*/
0053 /*---------------------------Macros-------------------------------------*/
0054 /*---------------------------Enums--------------------------------------*/
0055 /*---------------------------Typedefs-----------------------------------*/
0056 /*---------------------------Globals------------------------------------*/
0057 /*---------------------------Statics------------------------------------*/
0058 /*---------------------------Prototypes---------------------------------*/
0059 
0060 /**
0061  * FML kind of field change
0062  * @param p_ub UBF buffer
0063  * @param bfldid field id
0064  * @param occ occurrence
0065  * @param buf btr to data. In case of FLD_PTR this contains the actual address
0066  * @param len buffer len (used for carray)
0067  * @return EXSUCCEED/EXFAIL
0068  */
0069 expublic int ndrx_Fchg (UBFH *p_ub, BFLDID bfldid, BFLDOCC occ, char * buf, BFLDLEN len)
0070 {
0071    char *ptr = buf;
0072    
0073    /* UBF requires a double ptr for PTR type */
0074    if (BFLD_PTR==Bfldtype (bfldid))
0075    {
0076        ptr = (char *)&buf;
0077    }
0078    
0079    return Bchg (p_ub, bfldid, occ, ptr, len);
0080 }
0081 
0082 /**
0083  * Add field to UBF, FML specifics
0084  * @param p_ub UBF buffer
0085  * @param bfldid field id
0086  * @param buf buffer, for FLD_PTR actually contains the address that must be loaded
0087  * @param len data len, used for FLD_CARRAY
0088  * @return EXSUCCEED/EXFAIL
0089  */
0090 expublic int ndrx_Fadd (UBFH *p_ub, BFLDID bfldid, char *buf, BFLDLEN len)
0091 {
0092     char *ptr = buf;
0093    
0094    /* UBF requires a double ptr for PTR type */
0095    if (BFLD_PTR==Bfldtype (bfldid))
0096    {
0097        ptr = (char *)&buf;
0098    }
0099    
0100    return Badd (p_ub, bfldid, ptr, len);
0101 }
0102 
0103 /* vim: set ts=4 sw=4 et smartindent: */