Back to home page

Enduro/X

 
 

    


0001 /**
0002  * @brief Generic Posix queue call
0003  *
0004  * @file gencall.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 #ifndef GENCALL_H
0035 #define GENCALL_H
0036 
0037 #ifdef  __cplusplus
0038 extern "C" {
0039 #endif
0040 
0041 /*---------------------------Includes-----------------------------------*/
0042 #include <string.h>
0043 #include <stdio.h>
0044 #include <stdlib.h>
0045 #include <memory.h>
0046 #include <sys_mqueue.h>
0047 
0048 #include <ndrstandard.h>
0049 #include <ndebug.h>
0050 
0051 #include <ndrxdcmn.h>
0052 #include <atmi_int.h>
0053 /*---------------------------Externs------------------------------------*/
0054 /*---------------------------Macros-------------------------------------*/
0055 /*---------------------------Enums--------------------------------------*/
0056 /*---------------------------Typedefs-----------------------------------*/
0057 typedef struct
0058 {
0059     int ndrxd_cmd;
0060     int (*p_rsp_process)(command_reply_t *reply, size_t reply_len);
0061     void (*p_put_output)(char *text);
0062     int need_reply;
0063 } gencall_args_t;
0064 /*---------------------------Globals------------------------------------*/
0065 /*---------------------------Statics------------------------------------*/
0066 /*---------------------------Prototypes---------------------------------*/
0067 
0068 extern NDRX_API int cmd_generic_call(int ndrxd_cmd, int msg_src, int msg_type,
0069                             command_call_t *call, size_t call_size,
0070                             char *reply_q,
0071                             mqd_t reply_queue, /* listen for answer on this! */
0072                             mqd_t admin_queue, /* this might be FAIL! */
0073                             char *admin_q_str, /* should be set! */
0074                             int argc, char **argv,
0075                             int *p_have_next,
0076                             int (*p_rsp_process)(command_reply_t *reply, size_t reply_len),
0077                             void (*p_put_output)(char *text),
0078                             int need_reply);
0079 
0080 extern NDRX_API int cmd_generic_listcall(int ndrxd_cmd, int msg_src, int msg_type,
0081                             command_call_t *call, size_t call_size,
0082                             char *reply_q,
0083                             mqd_t reply_queue, /* listen for answer on this! */
0084                             mqd_t admin_queue, /* this might be FAIL! */
0085                             char *admin_q_str, /* should be set! */
0086                             int argc, char **argv,
0087                             int *p_have_next,
0088                             gencall_args_t *arglist/* this is list of process */,
0089                             int reply_only,
0090                             long flags);
0091 
0092 extern NDRX_API int cmd_generic_callfl(int ndrxd_cmd, int msg_src, int msg_type,
0093                             command_call_t *call, size_t call_size,
0094                             char *reply_q,
0095                             mqd_t reply_queue, /* listen for answer on this! */
0096                             mqd_t admin_queue, /* this might be FAIL! */
0097                             char *admin_q_str, /* should be set! */
0098                             int argc, char **argv,
0099                             int *p_have_next,
0100                             int (*p_rsp_process)(command_reply_t *reply, size_t reply_len),
0101                             void (*p_put_output)(char *text),
0102                             int need_reply,
0103                             int flags);
0104 
0105 extern NDRX_API int cmd_generic_bufcall(int ndrxd_cmd, int msg_src, int msg_type,
0106                             command_call_t *call, size_t call_size,
0107                             char *reply_q,
0108                             mqd_t reply_queue, /* listen for answer on this! */
0109                             mqd_t admin_queue, /* this might be FAIL! */
0110                             char *admin_q_str, /* should be set! */
0111                             int argc, char **argv,
0112                             int *p_have_next,
0113                             int (*p_rsp_process)(command_reply_t *reply, size_t reply_len),
0114                             void (*p_put_output)(char *text),
0115                             int need_reply,
0116                             int reply_only,
0117                             char *rply_buf_out,             /* might be a null  */
0118                             int *rply_buf_out_len,          /* if above is set, then must not be null */
0119                             int flags,
0120                             int (*p_rply_request)(char **buf, long len));
0121 
0122 extern NDRX_API void cmd_generic_init(int ndrxd_cmd, int msg_src, int msg_type,
0123                             command_call_t *call, char *reply_q);
0124 
0125 extern NDRX_API int reply_with_failure(long flags, tp_command_call_t *last_call,
0126             char *buf, int *len, long rcode);
0127 
0128 extern NDRX_API int ndrx_get_q_attr(char *q, struct mq_attr *p_att);
0129 
0130 extern NDRX_API atmi_svc_list_t* ndrx_get_svc_list(int (*p_filter)(char *svcnm));
0131 
0132 
0133 #ifdef  __cplusplus
0134 }
0135 #endif
0136 
0137 #endif  /* GENCALL_H */
0138 
0139 /* vim: set ts=4 sw=4 et smartindent: */