0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 #ifndef ATMI_INT_H
0036 #define ATMI_INT_H
0037
0038 #ifdef __cplusplus
0039 extern "C" {
0040 #endif
0041
0042
0043 #include <sys_mqueue.h>
0044 #include <xa.h>
0045 #include <atmi.h>
0046 #include <ndrxdcmn.h>
0047 #include <stdint.h>
0048 #include <nstopwatch.h>
0049 #include <sys/sem.h>
0050 #include <exhash.h>
0051 #include <ndrstandard.h>
0052 #include <userlog.h>
0053 #include <tperror.h>
0054 #include <exparson.h>
0055 #include <tmenv.h>
0056 #include <nstdutil.h>
0057
0058
0059
0060 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
0061 #define NDRX_API_EXPORT __declspec(dllexport)
0062 #else
0063 #define NDRX_API_EXPORT
0064 #endif
0065
0066
0067
0068
0069 #define GEN_QUEUE_ERR_NO_DATA -2
0070
0071
0072
0073 #define ATMI_SRV_ADMIN_Q 0
0074 #define ATMI_SRV_REPLY_Q 1
0075 #define ATMI_SRV_Q_ADJUST 2
0076 #define ATMI_SRV_SVC 3
0077
0078
0079
0080
0081 #define ATMI_COMMAND_UNKNOWN 0
0082 #define ATMI_COMMAND_TPCALL 1
0083 #define ATMI_COMMAND_TPREPLY 2
0084 #define ATMI_COMMAND_TPFORWARD 3
0085 #define ATMI_COMMAND_CONNECT 4
0086 #define ATMI_COMMAND_CONVDATA 5
0087 #define ATMI_COMMAND_CONNRPLY 6
0088 #define ATMI_COMMAND_DISCONN 7
0089 #define ATMI_COMMAND_CONNUNSOL 8
0090 #define ATMI_COMMAND_CONVACK 9
0091 #define ATMI_COMMAND_SHUTDOWN 10
0092
0093 #define ATMI_COMMAND_SELF_SD 12
0094 #define ATMI_COMMAND_TPNOTIFY 13
0095 #define ATMI_COMMAND_BROADCAST 14
0096
0097
0098 #define CALL_NOT_ISSUED 0
0099 #define CALL_WAITING_FOR_ANS 1
0100 #define CALL_CANCELED 2
0101
0102
0103
0104 #define CONV_NO_INITATED 0
0105 #define CONV_IN_CONVERSATION 1
0106
0107
0108 #define CONV_ERROR_CODE(_ret, _err) \
0109 if (EINTR==_ret)\
0110 {\
0111 _err=TPGOTSIG;\
0112 }\
0113 else if (ETIMEDOUT==_ret)\
0114 {\
0115 _err=TPETIME;\
0116 }\
0117 else if (EAGAIN==_ret)\
0118 {\
0119 _err=TPEBLOCK;\
0120 }\
0121 else\
0122 {\
0123 _err=TPEOS;\
0124 }
0125
0126 #define TPEXIT_ENOENT 150
0127
0128 #define Q_SEND_GRACE 10
0129
0130
0131 #define EV_TPEVSUBS "TPEVSUBS%03hd"
0132 #define EV_TPEVUNSUBS "TPEVUNSUBS%03hd"
0133 #define EV_TPEVPOST "TPEVPOST%03hd"
0134 #define EV_TPEVDOPOST "TPEVDOPOST%03hd"
0135
0136
0137 #define TPRECOVERSVC "TPRECOVER"
0138
0139
0140 #define TPCALL_EVPOST 0x0001
0141 #define TPCALL_BRCALL 0x0002
0142 #define TPCALL_BROADCAST 0x0004
0143
0144
0145
0146
0147
0148 #define NDRX_XA_ERSN_BASE 2000
0149 #define NDRX_XA_ERSN_NONE 0
0150 #define NDRX_XA_ERSN_LOGFAIL 2001
0151 #define NDRX_XA_ERSN_INVPARAM 2002
0152 #define NDRX_XA_ERSN_NOTX 2003
0153 #define NDRX_XA_ERSN_PREPFAIL 2004
0154 #define NDRX_XA_ERSN_RMLOGFAIL 2005
0155 #define NDRX_XA_ERSN_RMCOMMITFAIL 2006
0156 #define NDRX_XA_ERSN_UBFERR 2007
0157 #define NDRX_XA_ERSN_RMERR 2008
0158 #define NDRX_XA_ERSN_TPENOENT 2009
0159 #define NDRX_XA_ERSN_INPROGRESS 2010
0160 #define NDRX_XA_ERSN_LOCK 2011
0161
0162
0163 #define NDRX_XID_FORMAT_ID 0x6194f7a1L
0164 #define NDRX_XID_TRID_LEN sizeof(exuuid_t)
0165 #define NDRX_XID_BQUAL_LEN sizeof(unsigned char) + sizeof(short) + sizeof(short)
0166
0167
0168 #define XA_IS_DYNAMIC_REG (G_atmi_env.xa_sw->flags & TMREGISTER)
0169 #define NDRX_CONF_MSGSEQ_START 4294967294
0170
0171
0172
0173
0174
0175
0176 #define NDRX_SYSBUF_MALLOC_WERR_OUT(__buf, __p_bufsz, __ret) \
0177 {\
0178 int __buf_size__ = NDRX_MSGSIZEMAX;\
0179 __buf = NDRX_FPMALLOC(__buf_size__, NDRX_FPSYSBUF);\
0180 if (NULL==__buf)\
0181 {\
0182 int err = errno;\
0183 ndrx_TPset_error_fmt(TPEOS, "%s: failed to allocate sysbuf: %s", __func__, strerror(errno));\
0184 NDRX_LOG(log_error, "%s: failed to allocate sysbuf: %s", __func__, strerror(errno));\
0185 userlog("%s: failed to allocate sysbuf: %s", __func__, strerror(errno));\
0186 errno = err;\
0187 EXFAIL_OUT(__ret);\
0188 }\
0189 __p_bufsz = __buf_size__;\
0190 }
0191
0192 #define NDRX_XA_FLAG_NOJOIN "NOJOIN"
0193 #define NDRX_XA_FLAG_NOSTARTXID "NOSTARTXID"
0194 #define NDRX_XA_FLAG_NOSUSPEND "NOSUSPEND"
0195 #define NDRX_XA_FLAG_RECON "RECON"
0196 #define NDRX_XA_FLAG_RECON_TEST "RECON:"
0197 #define NDRX_XA_FLAGS_RECON_RETCODES_BUFSZ 32
0198 #define NDRX_XA_FLAG_FSYNC "FSYNC"
0199 #define NDRX_XA_FLAG_FDATASYNC "FDATASYNC"
0200 #define NDRX_XA_FLAG_DSYNC "DSYNC"
0201 #define NDRX_XA_FLAG_BTIGHT "BTIGHT"
0202
0203
0204
0205
0206
0207
0208 #define NDRX_XA_FLAG_SYS_NOAPISUSP 0x00000001
0209 #define NDRX_XA_FLAG_SYS_NOJOIN 0x00000002
0210 #define NDRX_XA_FLAG_SYS_NOSTARTXID 0x00000004
0211 #define NDRX_XA_FLAG_SYS_NOSUSPEND 0x00000008
0212 #define NDRX_XA_FLAG_SYS_BTIGHT 0x00000010
0213
0214
0215
0216
0217
0218
0219 #define NDRX_EMPTY_DEBUG do {\
0220 \
0221 if (NULL==getenv("NDRX_DEBUG_CONF"))\
0222 {\
0223 setenv("NDRX_DEBUG_CONF", "", 1);\
0224 }\
0225 }\
0226 while (0)
0227
0228
0229
0230
0231 #define NDRX_BANNER(X) \
0232 if (NULL==getenv(CONF_NDRX_SILENT)) \
0233 {\
0234 if (X[0])\
0235 {\
0236 fprintf(stderr, "%s\n\n", X);\
0237 }\
0238 fprintf(stderr, "%s, build %s %s, using %s for %s (%ld bits)\n\n", NDRX_VERSION, \
0239 __DATE__, __TIME__, ndrx_epoll_mode(), NDRX_BUILD_OS_NAME, sizeof(void *)*8);\
0240 fprintf(stderr, "Enduro/X Middleware Platform for Distributed Transaction Processing\n");\
0241 fprintf(stderr, "Copyright (C) 2009-2016 ATR Baltic Ltd.\n");\
0242 fprintf(stderr, "Copyright (C) 2017-2023 Mavimax Ltd. All Rights Reserved.\n\n");\
0243 fprintf(stderr, "This software is released under one of the following licenses:\n");\
0244 fprintf(stderr, "AGPLv3 (exceptions for Java, Go) or Mavimax license for commercial use.\n\n");\
0245 }
0246
0247
0248 #define NDRX_PRC_SYSFLAGS_FULLSTART 0x00000001
0249
0250
0251 #define NDRX_XADMIN_ERR_FMT_PFX "ERROR ! "
0252
0253
0254 #define NDRX_QERR_MSG_EINVAL NDRX_XADMIN_ERR_FMT_PFX \
0255 "Invalid queue config, see \"Enduro/X Administration Manual\" (ex_adminman), chapter 2."
0256
0257
0258 #define NDRX_QERR_MSG_ENOSPC NDRX_XADMIN_ERR_FMT_PFX \
0259 "Insufficient space for the creation of a new message queue"
0260
0261
0262 #define NDRX_QERR_MSG_SYSERR NDRX_XADMIN_ERR_FMT_PFX \
0263 "Queue error, check logs"
0264
0265
0266 #define NDRX_CONV_SRVMASK 0x40000000
0267
0268
0269 #define NDRX_MBUF_FLAG_NOCALLINFO 0x00000001
0270
0271
0272
0273
0274
0275 #define SYS_FLAG_REPLY_ERROR 0x00000001
0276 #define SYS_CONVERSATION 0x00000002
0277
0278 #define NDRX_SYS_SRV_THREAD SYS_SRV_THREAD
0279 #define SYS_SRV_CVT_JSON2UBF 0x00000008
0280 #define SYS_SRV_CVT_UBF2JSON 0x00000010
0281
0282 #define SYS_SRV_CVT_JSON2VIEW 0x00000020
0283 #define SYS_SRV_CVT_VIEW2JSON 0x00000040
0284 #define SYS_FLAG_AUTOTRAN 0x00000100
0285
0286 #define SYS_SRV_CVT_ANY_SET(X) (X & SYS_SRV_CVT_JSON2UBF || X & SYS_SRV_CVT_UBF2JSON ||\
0287 X & SYS_SRV_CVT_JSON2VIEW || X & SYS_SRV_CVT_VIEW2JSON)
0288
0289
0290
0291
0292
0293 #define NDRX_ABORT_START(IS_ABORT_ONLY) \
0294 \
0295 \
0296 if ( !(flags & TPNOTRAN) && !(flags & TPNOABORT) && \
0297 G_atmi_tls->G_atmi_xa_curtx.txinfo && \
0298 \
0299 !(G_atmi_tls->G_atmi_xa_curtx.txinfo->tmtxflags & TMTXFLAGS_IS_ABORT_ONLY) && \
0300 (EXSUCCEED!=ret || IS_ABORT_ONLY)) \
0301 { \
0302 int abort_needed = EXTRUE; \
0303 switch (tperrno) \
0304 { \
0305 case TPENOENT: \
0306 case TPEBADDESC: \
0307 case TPEINVAL: \
0308 case TPEITYPE: \
0309 case TPEBLOCK: \
0310 NDRX_LOG(log_info, "No abort marking needed"); \
0311 abort_needed=EXFALSE; \
0312 break; \
0313 }
0314
0315
0316 #define NDRX_ABORT_END(IS_ABORT_ONLY) \
0317 if (abort_needed) \
0318 { \
0319 NDRX_LOG(log_warn, "Marking current transaction as abort only!"); \
0320 \
0321 G_atmi_tls->G_atmi_xa_curtx.txinfo->tmtxflags |= TMTXFLAGS_IS_ABORT_ONLY; \
0322 } \
0323 }
0324
0325 #define NDRX_SGCMD_VERIFY "VERIFY"
0326 #define NDRX_SGCMD_QUERY "QUERY"
0327 #define NDRX_SGMAX_CMDLEN 16
0328
0329
0330
0331
0332
0333
0334 typedef struct buffer_obj buffer_obj_t;
0335 struct buffer_obj
0336 {
0337 int type_id;
0338
0339 char subtype[XATMI_SUBTYPE_LEN+1];
0340 short autoalloc;
0341 char *buf;
0342 long size;
0343 char *callinfobuf;
0344 long callinfobuf_len;
0345
0346
0347 EX_hash_handle hh;
0348 };
0349
0350
0351
0352
0353 typedef struct typed_buffer_descr typed_buffer_descr_t;
0354
0355
0356
0357
0358 struct typed_buffer_descr
0359 {
0360 int type_id;
0361 char *type;
0362 char *alias;
0363 char *subtype;
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373 int (*pf_prepare_outgoing) (typed_buffer_descr_t *descr, char *idata,
0374 long ilen, char *obuf, long *olen, long flags);
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385 int (*pf_prepare_incoming) (typed_buffer_descr_t *descr, char *rcv_data,
0386 long rcv_len, char **odata, long *olen, long flags);
0387
0388
0389
0390
0391
0392
0393 char *(*pf_alloc) (typed_buffer_descr_t *descr, char *subtype, long *len);
0394
0395
0396
0397
0398
0399
0400
0401
0402
0403 char *(*pf_realloc) (typed_buffer_descr_t *descr, char *cur_ptr, long len);
0404
0405
0406
0407
0408 void (*pf_free)(typed_buffer_descr_t *descr, char *buf);
0409
0410 int (*pf_test)(typed_buffer_descr_t *descr, char *buf, BFLDLEN len, char *expr);
0411 };
0412
0413
0414
0415
0416 struct call_descriptor_state
0417 {
0418 int cd;
0419 short status;
0420 time_t timestamp;
0421 unsigned callseq;
0422 long flags;
0423 int tout_eff;
0424 };
0425 typedef struct call_descriptor_state call_descriptor_state_t;
0426
0427
0428
0429
0430
0431
0432
0433
0434 struct atmi_lib_conf
0435 {
0436
0437 int is_client;
0438
0439 char reply_q_str[NDRX_MAX_Q_SIZE+1];
0440
0441 mqd_t reply_q;
0442
0443 struct mq_attr reply_q_attr;
0444
0445
0446
0447
0448
0449
0450 char my_id[NDRX_MAX_ID_SIZE+1];
0451
0452
0453 char q_prefix[NDRX_MAX_Q_SIZE+1];
0454
0455
0456 char ndrxd_q_str[NDRX_MAX_Q_SIZE+1];
0457
0458
0459 long contextid;
0460
0461 };
0462
0463 typedef struct atmi_lib_conf atmi_lib_conf_t;
0464
0465
0466
0467
0468 struct atmi_lib_env
0469 {
0470
0471 int max_servers;
0472 int max_svcs;
0473 int max_clts;
0474 char rnd_key[NDRX_MAX_KEY_SIZE];
0475 int msg_max;
0476 int msgsize_max;
0477 key_t ipckey;
0478 int time_out;
0479 int our_nodeid;
0480 int ldbal;
0481 int is_clustered;
0482
0483 int rtcrtmax;
0484 int rtsvcmax;
0485
0486
0487
0488
0489
0490 short xa_rmid;
0491 char xa_open_str[PATH_MAX];
0492 char xa_close_str[PATH_MAX];
0493 char xa_driverlib[PATH_MAX];
0494 char xa_rmlib[PATH_MAX];
0495 int xa_lazy_init;
0496 char xa_flags[PATH_MAX];
0497 long xa_flags_sys;
0498 struct xa_switch_t * xa_sw;
0499
0500
0501 char xa_recon_retcodes[NDRX_XA_FLAGS_RECON_RETCODES_BUFSZ];
0502
0503
0504 char xa_recon_retcodes_other[NDRX_XA_FLAGS_RECON_RETCODES_BUFSZ];
0505
0506 int xa_recon_times;
0507 long xa_recon_usleep;
0508
0509 int (*pf_xa_loctxabort)(XID *xid, long flags);
0510
0511 void* (*pf_getconn)(void);
0512
0513
0514
0515 int nrsems;
0516 int maxsvcsrvs;
0517 int max_normwait;
0518 char qprefix[NDRX_MAX_Q_SIZE+1];
0519 char qprefix_match[NDRX_MAX_Q_SIZE+1];
0520 int qprefix_match_len;
0521 char qpath[PATH_MAX+1];
0522 char ndrxd_pidfile[PATH_MAX];
0523 ndrx_env_priv_t integpriv;
0524 char rtgrp[NDRX_DDR_GRP_MAX+1];
0525
0526
0527
0528
0529
0530
0531 int test_qdisk_write_fail;
0532 int test_tmsrv_write_fail;
0533 int test_tmsrv_commit_crash;
0534 void (*test_advertise_crash)(void);
0535
0536
0537
0538 int procgrp_no;
0539
0540
0541
0542
0543
0544
0545 long sglockinc;
0546
0547 long xa_fsync_flags;
0548 };
0549 typedef struct atmi_lib_env atmi_lib_env_t;
0550
0551
0552
0553
0554 struct tp_command_generic
0555 {
0556
0557 #if defined(EX_USE_SYSVQ) || defined(EX_USE_SVAPOLL)
0558 long mtype;
0559 #endif
0560 short command_id;
0561 char proto_ver[4];
0562 int proto_magic;
0563
0564 };
0565 typedef struct tp_command_generic tp_command_generic_t;
0566
0567
0568
0569
0570
0571
0572
0573
0574 struct tp_command_call
0575 {
0576
0577 #if defined(EX_USE_SYSVQ) || defined(EX_USE_SVAPOLL)
0578 long mtype;
0579 #endif
0580 short command_id;
0581 char proto_ver[4];
0582 int proto_magic;
0583
0584 char name[XATMI_SERVICE_NAME_LENGTH+1];
0585 char reply_to[NDRX_MAX_Q_SIZE+1];
0586
0587 char callstack[CONF_NDRX_NODEID_COUNT+1];
0588 char my_id[NDRX_MAX_ID_SIZE+1];
0589 long sysflags;
0590 int cd;
0591
0592 int rval;
0593
0594 long rcode;
0595 int user3;
0596 unsigned callseq;
0597 long user4;
0598 int clttout;
0599
0600
0601
0602
0603
0604
0605 char extradata[XATMI_EVENT_MAX+1];
0606 long flags;
0607 time_t timestamp;
0608
0609 unsigned msgseq;
0610
0611
0612 ATMI_XA_TX_INFO_FIELDS;
0613
0614
0615
0616 ndrx_stopwatch_t timer;
0617
0618
0619 buffer_obj_t * autobuf;
0620
0621 #if EX_SIZEOF_LONG == 4
0622
0623 long padding1;
0624 #endif
0625
0626
0627 long data_len;
0628 char data[0];
0629 };
0630 typedef struct tp_command_call tp_command_call_t;
0631
0632
0633
0634
0635 struct tp_notif_call
0636 {
0637
0638 #if defined(EX_USE_SYSVQ) || defined(EX_USE_SVAPOLL)
0639 long mtype;
0640 #endif
0641 short command_id;
0642 char proto_ver[4];
0643 int proto_magic;
0644
0645
0646
0647 char destclient[NDRX_MAX_ID_SIZE+1];
0648
0649
0650 char nodeid[MAXTIDENT*2];
0651 int nodeid_isnull;
0652 char usrname[MAXTIDENT*2];
0653 int usrname_isnull;
0654 char cltname[MAXTIDENT*2];
0655 int cltname_isnull;
0656
0657
0658 char reply_to[NDRX_MAX_Q_SIZE+1];
0659
0660 char callstack[CONF_NDRX_NODEID_COUNT+1];
0661 char my_id[NDRX_MAX_ID_SIZE+1];
0662 long sysflags;
0663 int cd;
0664 int rval;
0665 long rcode;
0666 long flags;
0667 time_t timestamp;
0668 unsigned callseq;
0669
0670 unsigned msgseq;
0671
0672 ndrx_stopwatch_t timer;
0673
0674 buffer_obj_t * autobuf;
0675
0676 long destnodeid;
0677
0678 #if EX_SIZEOF_LONG == 4
0679
0680 long padding1;
0681 #endif
0682
0683 long data_len;
0684 char data[0];
0685 };
0686 typedef struct tp_notif_call tp_notif_call_t;
0687
0688
0689
0690
0691
0692
0693 typedef struct tpconv_buffer tpconv_buffer_t;
0694 struct tpconv_buffer
0695 {
0696 unsigned msgseq;
0697 char *buf;
0698 size_t size;
0699
0700 EX_hash_handle hh;
0701 };
0702
0703
0704
0705
0706
0707 struct tp_conversation_control
0708 {
0709 int status;
0710 int cd;
0711 long flags;
0712
0713 char reply_q_str[NDRX_MAX_Q_SIZE+1];
0714 mqd_t reply_q;
0715 struct mq_attr reply_q_attr;
0716
0717 char my_listen_q_str[NDRX_MAX_Q_SIZE+1];
0718 mqd_t my_listen_q;
0719 struct mq_attr my_q_attr;
0720 time_t timestamp;
0721 unsigned callseq;
0722
0723
0724
0725
0726
0727
0728 unsigned msgseqout;
0729 unsigned msgseqin;
0730 int rval;
0731 long rcode;
0732 long revent;
0733 short handshaked;
0734
0735 tpconv_buffer_t *out_of_order_msgs;
0736
0737 };
0738 typedef struct tp_conversation_control tp_conversation_control_t;
0739
0740
0741
0742 struct tp_conv_ack
0743 {
0744 short command_id;
0745 int cd;
0746 };
0747 typedef struct tp_conv_ack tp_conv_ack_t;
0748
0749
0750
0751
0752
0753 typedef struct pollextension_rec pollextension_rec_t;
0754 struct pollextension_rec
0755 {
0756 int fd;
0757 void *ptr1;
0758 int (*p_pollevent)(int fd, uint32_t events, void *ptr1);
0759 uint32_t events;
0760 pollextension_rec_t *prev, *next;
0761 };
0762
0763
0764
0765
0766 typedef struct atmi_svc_list atmi_svc_list_t;
0767 struct atmi_svc_list
0768 {
0769
0770 char svcnm[XATMI_SERVICE_NAME_LENGTH+1];
0771
0772
0773 atmi_svc_list_t *next;
0774 };
0775
0776
0777
0778
0779
0780
0781
0782
0783 struct ndrx_qdet
0784 {
0785 int qtype;
0786 char qprefix[NDRX_MAX_Q_SIZE+1];
0787 char binary_name[MAXTIDENT+2];
0788 pid_t pid;
0789 long contextid;
0790 };
0791
0792 typedef struct ndrx_qdet ndrx_qdet_t;
0793
0794
0795
0796
0797
0798
0799
0800
0801
0802 struct ndrx_tpcall_cache_ctl
0803 {
0804 int should_cache;
0805 int cached_rsp;
0806 int saved_tperrno;
0807 long saved_tpurcode;
0808 long *olen;
0809 char **odata;
0810 };
0811 typedef struct ndrx_tpcall_cache_ctl ndrx_tpcall_cache_ctl_t;
0812
0813
0814
0815
0816 #define MAX_CALL_DATA_SIZE (NDRX_MSGSIZEMAX-sizeof(tp_command_call_t))
0817
0818
0819
0820 struct ndrx_expbufctl
0821 {
0822 char buftype[XATMI_TYPE_LEN+1];
0823 short buftype_ind;
0824
0825 char subtype[XATMI_SUBTYPE_LEN+1];
0826 short subtype_ind;
0827
0828 double version;
0829 short version_ind;
0830
0831 char svcnm[XATMI_SERVICE_NAME_LENGTH+1];
0832 short svcnm_ind;
0833
0834 int rval;
0835 short rval_ind;
0836
0837 long rcode;
0838 short rcode_ind;
0839
0840 int tperror;
0841 short tperror_ind;
0842
0843 char tpstrerror[MAX_TP_ERROR_LEN+1];
0844 short tpstrerror_ind;
0845 };
0846
0847 typedef struct ndrx_expbufctl ndrx_expbufctl_t;
0848
0849
0850
0851
0852 struct ndrx_thread_server
0853 {
0854 char *context_data;
0855 int cd;
0856 char *buffer;
0857 };
0858 typedef struct ndrx_thread_server ndrx_thread_server_t;
0859
0860
0861 extern NDRX_API atmi_lib_env_t G_atmi_env;
0862 extern NDRX_API int G_srv_id;
0863 extern NDRX_API pollextension_rec_t * ndrx_G_pollext;
0864
0865
0866
0867
0868 extern NDRX_API int ndrx_load_common_env(void);
0869 extern NDRX_API long ndrx_ctxid_op(int make_free, long ctxid);
0870 extern NDRX_API int ndrx_load_new_env(char *file);
0871 extern NDRX_API int ndrx_generic_q_send(char *queue, char *data, long len, long flags, int msg_prio);
0872 extern NDRX_API int ndrx_generic_q_send_2(char *queue, char *data, long len, long flags, long tout, int msg_prio);
0873 extern NDRX_API int ndrx_generic_qfd_send(mqd_t q_descr, char *data, long len, long flags);
0874 extern NDRX_API ssize_t ndrx_generic_q_receive(mqd_t q_descr, char *q_str,
0875 struct mq_attr *reply_q_attr,
0876 char *buf, long buf_max,
0877 unsigned *prio, long flags);
0878
0879 extern NDRX_API int ndrx_get_q_attr(char *q, struct mq_attr *p_att);
0880 extern NDRX_API int ndrx_setup_queue_attrs(struct mq_attr *p_q_attr,
0881 mqd_t listen_q,
0882 char *listen_q_str,
0883 long flags);
0884 extern NDRX_API mqd_t ndrx_mq_open_at(char *name, int oflag, mode_t mode, struct mq_attr *attr);
0885 extern NDRX_API mqd_t ndrx_mq_open_at_wrp(char *name, int oflag);
0886 extern NDRX_API void ndrx_tptoutset(int tout);
0887 extern NDRX_API int ndrx_tptoutget();
0888 extern NDRX_API int ndrx_tptoutget_eff(void);
0889 extern NDRX_API void ndrx_mq_fix_mass_send(int *cntr);
0890 extern NDRX_API int ndrx_q_setblock(mqd_t q_descr, int blocked);
0891
0892 extern NDRX_API void br_dump_nodestack(char *stack, char *msg);
0893 extern NDRX_API int fill_reply_queue(char *nodestack,
0894 char *org_reply_to, char *reply_to);
0895
0896 extern NDRX_API int ndrx_cvnq_parse_client(char *qname, TPMYID *p_myid);
0897 extern NDRX_API int ndrx_cvnq_parse_server(char *qname, TPMYID *p_myid_first,
0898 TPMYID *p_myid_second);
0899 extern NDRX_API int ndrx_myid_parse(char *my_id, TPMYID *out, int iscnv_initator);
0900 extern NDRX_API int ndrx_myid_parse_clt(char *my_id, TPMYID *out, int iscnv_initator);
0901 extern NDRX_API int ndrx_myid_parse_srv(char *my_id, TPMYID *out, int iscnv_initator);
0902 extern NDRX_API int ndrx_myid_is_alive(TPMYID *p_myid);
0903 extern NDRX_API void ndrx_myid_dump(int lev, TPMYID *p_myid, char *msg);
0904 extern NDRX_API int ndrx_myid_convert_to_q(TPMYID *p_myid, char *rply_q, int rply_q_buflen);
0905
0906 extern NDRX_API int ndrx_myid_convert_from_qdet(TPMYID *p_myid, ndrx_qdet_t *qdet, long nodeid);
0907 extern NDRX_API void ndrx_myid_to_my_id_str(TPMYID *p_myid, char *my_id);
0908 extern NDRX_API int ndrx_qdet_parse_cltqstr(ndrx_qdet_t *qdet, char *qstr);
0909 extern NDRX_API void ndrx_qdet_dump(int lev, ndrx_qdet_t *qdet, char *msg);
0910 extern NDRX_API int ndrx_q_type_get(char *q);
0911
0912 extern NDRX_API int ndrx_atmiutil_init(void);
0913
0914
0915 extern NDRX_API int ndrx_tpacall (char *svc, char *data,
0916 long len, long flags, char *extradata, int dest_node, int ex_flags,
0917 TPTRANID *p_tran, int user1, long user2, int user3, long user4,
0918 ndrx_tpcall_cache_ctl_t *p_cachectl);
0919 extern NDRX_API int ndrx_tpnotify(CLIENTID *clientid, TPMYID *p_clientid_myid,
0920 char *cltq,
0921 char *data, long len, long flags,
0922 int dest_node, char *nodeid, char *usrname, char *cltname,
0923 int ex_flags);
0924 extern NDRX_API int ndrx_tpchkunsol(long flags);
0925 extern NDRX_API int ndrx_add_to_memq(char **pbuf, size_t pbuf_len, ssize_t rply_len);
0926 extern NDRX_API int ndrx_tpbroadcast_local(char *nodeid, char *usrname, char *cltname,
0927 char *data, long len, long flags, int dispatch_local);
0928 extern NDRX_API void ndrx_process_notif(char *buf, ssize_t len);
0929 extern NDRX_API char * ndrx_tprealloc (char *buf, long len);
0930 extern NDRX_API long ndrx_tptypes (char *ptr, char *type, char *subtype);
0931 extern NDRX_API char * ndrx_tpalloc (typed_buffer_descr_t *known_type,
0932 char *type, char *subtype, long len);
0933 extern NDRX_API void free_auto_buffers(void);
0934 extern NDRX_API int tp_internal_init(atmi_lib_conf_t *init_data);
0935 extern NDRX_API void ndrx_libatmi_deinit(void);
0936 extern NDRX_API int tp_internal_init_upd_replyq(mqd_t reply_q, char *reply_q_str);
0937 extern NDRX_API void tp_thread_shutdown(void *ptr, int *p_finish_off);
0938 extern NDRX_API void ndrx_dump_call_struct(int lev, tp_command_call_t *call);
0939 extern NDRX_API int ndrx_tpcall_init_once(void);
0940 extern NDRX_API unsigned ndrx_get_next_callseq_shared(void);
0941
0942 extern NDRX_API int ndrx_tpsend (int cd, char *data, long len, long flags, long *revent,
0943 short command_id);
0944 extern NDRX_API void ndrx_tpfree (char *buf, buffer_obj_t *known_buffer);
0945 extern NDRX_API int ndrx_tpisautobuf (char *buf);
0946 extern NDRX_API void cancel_if_expected(tp_command_call_t *call);
0947
0948 extern NDRX_API int accept_connection(void);
0949 extern NDRX_API int ndrx_reject_connection(int err);
0950 extern NDRX_API int svc_fail_to_start(void);
0951 extern NDRX_API int normal_connection_shutdown(tp_conversation_control_t *conv,
0952 int killq, char *dbgmsg);
0953 extern NDRX_API int close_open_client_connections(void);
0954 extern NDRX_API int have_open_connection(void);
0955 extern NDRX_API int ndrx_get_ack(tp_conversation_control_t *conv, long flags);
0956
0957
0958 extern NDRX_API int tpcallex (char *svc, char *idata, long ilen,
0959 char * *odata, long *olen, long flags,
0960 char *extradata, int dest_node, int ex_flags,
0961 int user1, long user2, int user3, long user4);
0962
0963 extern NDRX_API int tpacallex (char *svc, char *data,
0964 long len, long flags, char *extradata, int dest_node, int is_evpost,
0965 int user1, long user2, int user3, long user4);
0966
0967 extern NDRX_API long ndrx_tpunsubscribe(long subscription, long flags);
0968 extern NDRX_API long ndrx_tpsubscribe(char *eventexpr, char *filter, TPEVCTL *ctl, long flags);
0969 extern NDRX_API int ndrx_tppost(char *eventname, char *data, long len, long flags,
0970 int user1, long user2, int user3, long user4);
0971
0972 extern NDRX_API void tpext_configbrige
0973 (int nodeid, int flags, int (*p_qmsg)(char **buf, int len, char msg_type));
0974 extern NDRX_API void tpext_configprocgrp_lp(int singlegrp);
0975
0976 extern NDRX_API int ndrx_tpjsontoubf(UBFH *p_ub, char *buffer, EXJSON_Object *data_object);
0977 extern NDRX_API int ndrx_tpubftojson(UBFH *p_ub, char *buffer, int bufsize, EXJSON_Object *data_object);
0978 extern NDRX_API int ndrx_tpcall (char *svc, char *idata, long ilen,
0979 char * *odata, long *olen, long flags,
0980 char *extradata, int dest_node, int ex_flags,
0981 int user1, long user2, int user3, long user4);
0982 extern NDRX_API int ndrx_tpgetrply (int *cd,
0983 int cd_exp,
0984 char * *data ,
0985 long *len, long flags,
0986 TPTRANID *p_tranid);
0987 extern NDRX_API int ndrx_tpcancel (int cd);
0988 extern NDRX_API int ndrx_tpterm (void);
0989 extern NDRX_API int ndrx_tpconnect (char *svc, char *data, long len, long flags);
0990 extern NDRX_API int ndrx_tprecv (int cd, char * *data,
0991 long *len, long flags, long *revent,
0992 short *command_id, int ign_blkerr);
0993 extern NDRX_API int ndrx_tpdiscon (int cd);
0994 extern NDRX_API int ndrx_tpenqueue (char *qspace, short nodeid, short srvid, char *qname, TPQCTL *ctl,
0995 char *data, long len, long flags);
0996 extern NDRX_API int ndrx_tpdequeue (char *qspace, short nodeid, short srvid, char *qname, TPQCTL *ctl,
0997 char **data, long *len, long flags);
0998
0999 extern NDRX_API void ndrx_tpfreectxt(TPCONTEXT_T context);
1000 extern NDRX_API int ndrx_tpconvert(char *str, char *bin, long flags);
1001
1002
1003 extern NDRX_API int ndrx_tplogsetreqfile(char **data, char *filename, char *filesvc);
1004 extern NDRX_API int ndrx_tploggetbufreqfile(char *data, char *filename, int bufsize);
1005 extern NDRX_API int ndrx_tplogdelbufreqfile(char *data);
1006 extern NDRX_API void ndrx_tplogprintubf(int lev, char *title, UBFH *p_ub);
1007
1008
1009 extern NDRX_API int ndrx_chk_server(char *procname, short srvid);
1010 extern NDRX_API int ndrx_chk_ndrxd(void);
1011 extern NDRX_API pid_t ndrx_ndrxd_pid_get(void);
1012 extern NDRX_API int ndrx_down_sys(char *qprefix, char *qpath, int is_force, int user_res);
1013 extern NDRX_API void ndrx_down_userres(void);
1014 extern NDRX_API int ndrx_killall(char *mask);
1015 extern NDRX_API int ndrx_q_exists(char *qpath);
1016 extern NDRX_API int ndrx_get_cached_svc_q(char *q);
1017 extern NDRX_API int ndrx_ndrxd_ping(int *p_seq, long *p_time_msec,
1018 mqd_t listen_q, char * listen_q_str);
1019
1020
1021
1022 extern NDRX_API tp_command_call_t *ndrx_get_G_last_call(void);
1023 extern NDRX_API atmi_lib_conf_t *ndrx_get_G_atmi_conf(void);
1024 extern NDRX_API atmi_lib_env_t *ndrx_get_G_atmi_env(void);
1025 extern NDRX_API tp_conversation_control_t *ndrx_get_G_accepted_connection(void);
1026
1027
1028 extern NDRX_API int tpimportex(ndrx_expbufctl_t *bufctl, char *istr, long ilen, char **obuf, long *olen, long flags);
1029 extern NDRX_API int ndrx_tpimportex(ndrx_expbufctl_t *bufctl, char *istr, long ilen, char **obuf, long *olen, long flags, EXJSON_Object *parent_root_object);
1030
1031
1032 extern NDRX_API int tpexportex(ndrx_expbufctl_t *bufctl, char *ibuf, long ilen, char *ostr, long *olen, long flags);
1033 extern NDRX_API int ndrx_tpexportex(ndrx_expbufctl_t *bufctl, char *ibuf, long ilen, char *ostr, long *olen, long flags, EXJSON_Object *parent_root_object);
1034
1035
1036 extern NDRX_API struct xa_switch_t * ndrx_xa_builtin_get(void);
1037
1038 extern NDRX_API int ndrx_tpgetcallinfo(const char *msg, UBFH **obuf, long flags);
1039 extern NDRX_API int ndrx_tpsetcallinfo(const char *msg, UBFH *obuf, long flags);
1040
1041
1042 extern NDRX_API int tpencrypt_int(char *input, long ilen, char *output, long *olen, long flags);
1043 extern NDRX_API int tpdecrypt_int(char *input, long ilen, char *output, long *olen, long flags);
1044
1045 extern NDRX_API void ndrx_mbuf_tlv_debug (char *rcv_data, long rcv_len);
1046 extern NDRX_API int ndrx_mbuf_prepare_outgoing (char *idata, long ilen, char *obuf, long *olen,
1047 long flags, long mflags);
1048 extern NDRX_API int ndrx_mbuf_prepare_incoming (char *rcv_data, long rcv_len, char **odata,
1049 long *olen, long flags, long mflags);
1050
1051 extern NDRX_API void ndrx_mbuf_Bnext_ptr_first(UBFH *p_ub, Bnext_state_t *state);
1052 extern NDRX_API long ndrx_tpsgislocked(int grpno, long flags, long *grp_flags);
1053
1054
1055 #ifdef __cplusplus
1056 }
1057 #endif
1058
1059 #endif
1060
1061