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 #include <string.h>
0035 #include <stdio.h>
0036 #include <stdint.h>
0037 #include <stdlib.h>
0038 #include <memory.h>
0039 #include <errno.h>
0040 #include <dlfcn.h>
0041
0042 #include <atmi.h>
0043 #include <atmi_tls.h>
0044 #include <ndrstandard.h>
0045 #include <ndebug.h>
0046 #include <ndrxdcmn.h>
0047 #include <userlog.h>
0048 #include <xa_cmn.h>
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 expublic int Otpacall(TPCONTEXT_T *p_ctxt, char *svc, char *data, long len, long flags)
0061 {
0062 int ret = EXSUCCEED;
0063 int did_set = EXFALSE;
0064
0065
0066 #ifdef NDRX_OAPI_DEBUG
0067 NDRX_LOG(log_debug, "ENTRY: tpacall() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0068 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0069 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0070
0071 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0072 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
0073
0074 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0075 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
0076
0077 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0078 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
0079
0080 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0081 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
0082
0083 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0084 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
0085
0086 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0087 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
0088 #endif
0089
0090
0091
0092
0093 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0094 {
0095 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0096 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0097 {
0098 userlog("ERROR! tpacall() failed to set context");
0099 EXFAIL_OUT(ret);
0100 }
0101 did_set = EXTRUE;
0102 }
0103 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0104 {
0105 userlog("WARNING! tpacall() context %p thinks that it is assocated "
0106 "with current thread, but thread is associated with %p context!",
0107 p_ctxt, G_atmi_tls);
0108 }
0109
0110 ret = tpacall(svc, data, len, flags);
0111
0112 if (did_set)
0113 {
0114 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0115 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0116 {
0117 userlog("ERROR! tpacall() failed to get context");
0118 EXFAIL_OUT(ret);
0119 }
0120 }
0121 out:
0122
0123 #ifdef NDRX_OAPI_DEBUG
0124 NDRX_LOG(log_debug, "RETURN: tpacall() returns, context: %p, current: %p",
0125 *p_ctxt, G_atmi_tls);
0126 #endif
0127
0128
0129 return ret;
0130 }
0131
0132
0133
0134
0135
0136 expublic char * Otpalloc(TPCONTEXT_T *p_ctxt, char *type, char *subtype, long size)
0137 {
0138 int did_set = EXFALSE;
0139 char * ret = NULL;
0140
0141
0142 #ifdef NDRX_OAPI_DEBUG
0143 NDRX_LOG(log_debug, "ENTRY: tpalloc() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0144 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0145 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0146
0147 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0148 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0149
0150 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0151 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0152
0153 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0154 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0155
0156 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0157 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0158
0159 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0160 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0161
0162 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0163 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0164 #endif
0165
0166
0167
0168 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0169 {
0170
0171 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0172 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0173 {
0174 userlog("ERROR! tpalloc() failed to set context");
0175 ret = NULL;
0176 goto out;
0177 }
0178 did_set = EXTRUE;
0179 }
0180 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0181 {
0182 userlog("WARNING! tpalloc() context %p thinks that it is assocated "
0183 "with current thread, but thread is associated with %p context!",
0184 p_ctxt, G_atmi_tls);
0185 }
0186
0187 ret = tpalloc(type, subtype, size);
0188
0189 if (did_set)
0190 {
0191 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0192 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0193 {
0194 userlog("ERROR! tpalloc() failed to get context");
0195 ret = NULL;
0196 goto out;
0197 }
0198 }
0199 out:
0200
0201 #ifdef NDRX_OAPI_DEBUG
0202 NDRX_LOG(log_debug, "RETURN: tpalloc() returns, context: %p, current: %p",
0203 *p_ctxt, G_atmi_tls);
0204 #endif
0205
0206
0207 return ret;
0208 }
0209
0210
0211
0212
0213
0214 expublic int Otpcall(TPCONTEXT_T *p_ctxt, char *svc, char *idata, long ilen, char **odata, long *olen, long flags)
0215 {
0216 int ret = EXSUCCEED;
0217 int did_set = EXFALSE;
0218
0219
0220 #ifdef NDRX_OAPI_DEBUG
0221 NDRX_LOG(log_debug, "ENTRY: tpcall() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0222 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0223 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0224
0225 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0226 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
0227
0228 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0229 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
0230
0231 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0232 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
0233
0234 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0235 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
0236
0237 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0238 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
0239
0240 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0241 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
0242 #endif
0243
0244
0245
0246
0247 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0248 {
0249 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0250 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0251 {
0252 userlog("ERROR! tpcall() failed to set context");
0253 EXFAIL_OUT(ret);
0254 }
0255 did_set = EXTRUE;
0256 }
0257 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0258 {
0259 userlog("WARNING! tpcall() context %p thinks that it is assocated "
0260 "with current thread, but thread is associated with %p context!",
0261 p_ctxt, G_atmi_tls);
0262 }
0263
0264 ret = tpcall(svc, idata, ilen, odata, olen, flags);
0265
0266 if (did_set)
0267 {
0268 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0269 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0270 {
0271 userlog("ERROR! tpcall() failed to get context");
0272 EXFAIL_OUT(ret);
0273 }
0274 }
0275 out:
0276
0277 #ifdef NDRX_OAPI_DEBUG
0278 NDRX_LOG(log_debug, "RETURN: tpcall() returns, context: %p, current: %p",
0279 *p_ctxt, G_atmi_tls);
0280 #endif
0281
0282
0283 return ret;
0284 }
0285
0286
0287
0288
0289
0290 expublic int Otpcancel(TPCONTEXT_T *p_ctxt, int cd)
0291 {
0292 int ret = EXSUCCEED;
0293 int did_set = EXFALSE;
0294
0295
0296 #ifdef NDRX_OAPI_DEBUG
0297 NDRX_LOG(log_debug, "ENTRY: tpcancel() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0298 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0299 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0300
0301 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0302 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
0303
0304 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0305 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
0306
0307 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0308 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
0309
0310 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0311 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
0312
0313 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0314 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
0315
0316 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0317 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
0318 #endif
0319
0320
0321
0322
0323 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0324 {
0325 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0326 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0327 {
0328 userlog("ERROR! tpcancel() failed to set context");
0329 EXFAIL_OUT(ret);
0330 }
0331 did_set = EXTRUE;
0332 }
0333 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0334 {
0335 userlog("WARNING! tpcancel() context %p thinks that it is assocated "
0336 "with current thread, but thread is associated with %p context!",
0337 p_ctxt, G_atmi_tls);
0338 }
0339
0340 ret = tpcancel(cd);
0341
0342 if (did_set)
0343 {
0344 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0345 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0346 {
0347 userlog("ERROR! tpcancel() failed to get context");
0348 EXFAIL_OUT(ret);
0349 }
0350 }
0351 out:
0352
0353 #ifdef NDRX_OAPI_DEBUG
0354 NDRX_LOG(log_debug, "RETURN: tpcancel() returns, context: %p, current: %p",
0355 *p_ctxt, G_atmi_tls);
0356 #endif
0357
0358
0359 return ret;
0360 }
0361
0362
0363
0364
0365
0366 expublic int Otpconnect(TPCONTEXT_T *p_ctxt, char *svc, char *data, long len, long flags)
0367 {
0368 int ret = EXSUCCEED;
0369 int did_set = EXFALSE;
0370
0371
0372 #ifdef NDRX_OAPI_DEBUG
0373 NDRX_LOG(log_debug, "ENTRY: tpconnect() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0374 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0375 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0376
0377 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0378 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
0379
0380 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0381 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
0382
0383 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0384 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
0385
0386 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0387 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
0388
0389 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0390 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
0391
0392 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0393 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
0394 #endif
0395
0396
0397
0398
0399 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0400 {
0401 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0402 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0403 {
0404 userlog("ERROR! tpconnect() failed to set context");
0405 EXFAIL_OUT(ret);
0406 }
0407 did_set = EXTRUE;
0408 }
0409 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0410 {
0411 userlog("WARNING! tpconnect() context %p thinks that it is assocated "
0412 "with current thread, but thread is associated with %p context!",
0413 p_ctxt, G_atmi_tls);
0414 }
0415
0416 ret = tpconnect(svc, data, len, flags);
0417
0418 if (did_set)
0419 {
0420 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0421 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0422 {
0423 userlog("ERROR! tpconnect() failed to get context");
0424 EXFAIL_OUT(ret);
0425 }
0426 }
0427 out:
0428
0429 #ifdef NDRX_OAPI_DEBUG
0430 NDRX_LOG(log_debug, "RETURN: tpconnect() returns, context: %p, current: %p",
0431 *p_ctxt, G_atmi_tls);
0432 #endif
0433
0434
0435 return ret;
0436 }
0437
0438
0439
0440
0441
0442 expublic int Otpdiscon(TPCONTEXT_T *p_ctxt, int cd)
0443 {
0444 int ret = EXSUCCEED;
0445 int did_set = EXFALSE;
0446
0447
0448 #ifdef NDRX_OAPI_DEBUG
0449 NDRX_LOG(log_debug, "ENTRY: tpdiscon() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0450 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0451 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0452
0453 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0454 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
0455
0456 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0457 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
0458
0459 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0460 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
0461
0462 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0463 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
0464
0465 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0466 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
0467
0468 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0469 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
0470 #endif
0471
0472
0473
0474
0475 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0476 {
0477 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0478 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0479 {
0480 userlog("ERROR! tpdiscon() failed to set context");
0481 EXFAIL_OUT(ret);
0482 }
0483 did_set = EXTRUE;
0484 }
0485 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0486 {
0487 userlog("WARNING! tpdiscon() context %p thinks that it is assocated "
0488 "with current thread, but thread is associated with %p context!",
0489 p_ctxt, G_atmi_tls);
0490 }
0491
0492 ret = tpdiscon(cd);
0493
0494 if (did_set)
0495 {
0496 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0497 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0498 {
0499 userlog("ERROR! tpdiscon() failed to get context");
0500 EXFAIL_OUT(ret);
0501 }
0502 }
0503 out:
0504
0505 #ifdef NDRX_OAPI_DEBUG
0506 NDRX_LOG(log_debug, "RETURN: tpdiscon() returns, context: %p, current: %p",
0507 *p_ctxt, G_atmi_tls);
0508 #endif
0509
0510
0511 return ret;
0512 }
0513
0514
0515
0516
0517 expublic void Otpfree(TPCONTEXT_T *p_ctxt, char *ptr)
0518 {
0519 int did_set = EXFALSE;
0520
0521
0522 #ifdef NDRX_OAPI_DEBUG
0523 NDRX_LOG(log_debug, "ENTRY: tpfree() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0524 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0525 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0526
0527 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0528 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0529
0530 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0531 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0532
0533 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0534 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0535
0536 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0537 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0538
0539 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0540 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0541
0542 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0543 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0544 #endif
0545
0546
0547
0548
0549 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0550 {
0551
0552 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0553 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0554 {
0555 userlog("ERROR! tpfree() failed to set context");
0556 }
0557 did_set = EXTRUE;
0558 }
0559 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0560 {
0561 userlog("WARNING! tpfree() context %p thinks that it is assocated "
0562 "with current thread, but thread is associated with %p context!",
0563 p_ctxt, G_atmi_tls);
0564 }
0565
0566 tpfree(ptr);
0567
0568 if (did_set)
0569 {
0570 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0571 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0572 {
0573 userlog("ERROR! tpfree() failed to get context");
0574 }
0575 }
0576 out:
0577
0578 #ifdef NDRX_OAPI_DEBUG
0579 NDRX_LOG(log_debug, "RETURN: tpfree() returns, context: %p, current: %p",
0580 *p_ctxt, G_atmi_tls);
0581 #endif
0582
0583
0584 return;
0585 }
0586
0587
0588
0589
0590
0591 expublic int Otpisautobuf(TPCONTEXT_T *p_ctxt, char *buf)
0592 {
0593 int ret = EXSUCCEED;
0594 int did_set = EXFALSE;
0595
0596
0597 #ifdef NDRX_OAPI_DEBUG
0598 NDRX_LOG(log_debug, "ENTRY: tpisautobuf() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0599 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0600 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0601
0602 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0603 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0604
0605 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0606 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0607
0608 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0609 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0610
0611 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0612 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0613
0614 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0615 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0616
0617 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0618 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0619 #endif
0620
0621
0622
0623
0624 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0625 {
0626 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0627 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0628 {
0629 userlog("ERROR! tpisautobuf() failed to set context");
0630 EXFAIL_OUT(ret);
0631 }
0632 did_set = EXTRUE;
0633 }
0634 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0635 {
0636 userlog("WARNING! tpisautobuf() context %p thinks that it is assocated "
0637 "with current thread, but thread is associated with %p context!",
0638 p_ctxt, G_atmi_tls);
0639 }
0640
0641 ret = tpisautobuf(buf);
0642
0643 if (did_set)
0644 {
0645 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0646 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0647 {
0648 userlog("ERROR! tpisautobuf() failed to get context");
0649 EXFAIL_OUT(ret);
0650 }
0651 }
0652 out:
0653
0654 #ifdef NDRX_OAPI_DEBUG
0655 NDRX_LOG(log_debug, "RETURN: tpisautobuf() returns, context: %p, current: %p",
0656 *p_ctxt, G_atmi_tls);
0657 #endif
0658
0659
0660 return ret;
0661 }
0662
0663
0664
0665
0666
0667 expublic int Otpgetrply(TPCONTEXT_T *p_ctxt, int *cd, char **data, long *len, long flags)
0668 {
0669 int ret = EXSUCCEED;
0670 int did_set = EXFALSE;
0671
0672
0673 #ifdef NDRX_OAPI_DEBUG
0674 NDRX_LOG(log_debug, "ENTRY: tpgetrply() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0675 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0676 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0677
0678 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0679 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
0680
0681 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0682 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
0683
0684 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0685 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
0686
0687 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0688 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
0689
0690 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0691 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
0692
0693 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0694 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
0695 #endif
0696
0697
0698
0699
0700 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0701 {
0702 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0703 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0704 {
0705 userlog("ERROR! tpgetrply() failed to set context");
0706 EXFAIL_OUT(ret);
0707 }
0708 did_set = EXTRUE;
0709 }
0710 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0711 {
0712 userlog("WARNING! tpgetrply() context %p thinks that it is assocated "
0713 "with current thread, but thread is associated with %p context!",
0714 p_ctxt, G_atmi_tls);
0715 }
0716
0717 ret = tpgetrply(cd, data, len, flags);
0718
0719 if (did_set)
0720 {
0721 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0722 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0723 {
0724 userlog("ERROR! tpgetrply() failed to get context");
0725 EXFAIL_OUT(ret);
0726 }
0727 }
0728 out:
0729
0730 #ifdef NDRX_OAPI_DEBUG
0731 NDRX_LOG(log_debug, "RETURN: tpgetrply() returns, context: %p, current: %p",
0732 *p_ctxt, G_atmi_tls);
0733 #endif
0734
0735
0736 return ret;
0737 }
0738
0739
0740
0741
0742
0743 expublic char * Otprealloc(TPCONTEXT_T *p_ctxt, char *ptr, long size)
0744 {
0745 int did_set = EXFALSE;
0746 char * ret = NULL;
0747
0748
0749 #ifdef NDRX_OAPI_DEBUG
0750 NDRX_LOG(log_debug, "ENTRY: tprealloc() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0751 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0752 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0753
0754 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0755 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0756
0757 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0758 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0759
0760 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0761 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0762
0763 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0764 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0765
0766 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0767 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0768
0769 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0770 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0771 #endif
0772
0773
0774
0775 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0776 {
0777
0778 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0779 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0780 {
0781 userlog("ERROR! tprealloc() failed to set context");
0782 ret = NULL;
0783 goto out;
0784 }
0785 did_set = EXTRUE;
0786 }
0787 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0788 {
0789 userlog("WARNING! tprealloc() context %p thinks that it is assocated "
0790 "with current thread, but thread is associated with %p context!",
0791 p_ctxt, G_atmi_tls);
0792 }
0793
0794 ret = tprealloc(ptr, size);
0795
0796 if (did_set)
0797 {
0798 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0799 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0800 {
0801 userlog("ERROR! tprealloc() failed to get context");
0802 ret = NULL;
0803 goto out;
0804 }
0805 }
0806 out:
0807
0808 #ifdef NDRX_OAPI_DEBUG
0809 NDRX_LOG(log_debug, "RETURN: tprealloc() returns, context: %p, current: %p",
0810 *p_ctxt, G_atmi_tls);
0811 #endif
0812
0813
0814 return ret;
0815 }
0816
0817
0818
0819
0820
0821 expublic int Otprecv(TPCONTEXT_T *p_ctxt, int cd, char **data, long *len, long flags, long *revent)
0822 {
0823 int ret = EXSUCCEED;
0824 int did_set = EXFALSE;
0825
0826
0827 #ifdef NDRX_OAPI_DEBUG
0828 NDRX_LOG(log_debug, "ENTRY: tprecv() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0829 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0830 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0831
0832 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0833 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
0834
0835 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0836 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
0837
0838 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0839 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
0840
0841 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0842 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
0843
0844 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0845 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
0846
0847 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0848 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
0849 #endif
0850
0851
0852
0853
0854 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0855 {
0856 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0857 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0858 {
0859 userlog("ERROR! tprecv() failed to set context");
0860 EXFAIL_OUT(ret);
0861 }
0862 did_set = EXTRUE;
0863 }
0864 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0865 {
0866 userlog("WARNING! tprecv() context %p thinks that it is assocated "
0867 "with current thread, but thread is associated with %p context!",
0868 p_ctxt, G_atmi_tls);
0869 }
0870
0871 ret = tprecv(cd, data, len, flags, revent);
0872
0873 if (did_set)
0874 {
0875 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0876 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0877 {
0878 userlog("ERROR! tprecv() failed to get context");
0879 EXFAIL_OUT(ret);
0880 }
0881 }
0882 out:
0883
0884 #ifdef NDRX_OAPI_DEBUG
0885 NDRX_LOG(log_debug, "RETURN: tprecv() returns, context: %p, current: %p",
0886 *p_ctxt, G_atmi_tls);
0887 #endif
0888
0889
0890 return ret;
0891 }
0892
0893
0894
0895
0896
0897 expublic int Otpsend(TPCONTEXT_T *p_ctxt, int cd, char *data, long len, long flags, long *revent)
0898 {
0899 int ret = EXSUCCEED;
0900 int did_set = EXFALSE;
0901
0902
0903 #ifdef NDRX_OAPI_DEBUG
0904 NDRX_LOG(log_debug, "ENTRY: tpsend() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0905 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0906 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0907
0908 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0909 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
0910
0911 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0912 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
0913
0914 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0915 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
0916
0917 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0918 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
0919
0920 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0921 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
0922
0923 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0924 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
0925 #endif
0926
0927
0928
0929
0930 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0931 {
0932 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0933 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0934 {
0935 userlog("ERROR! tpsend() failed to set context");
0936 EXFAIL_OUT(ret);
0937 }
0938 did_set = EXTRUE;
0939 }
0940 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0941 {
0942 userlog("WARNING! tpsend() context %p thinks that it is assocated "
0943 "with current thread, but thread is associated with %p context!",
0944 p_ctxt, G_atmi_tls);
0945 }
0946
0947 ret = tpsend(cd, data, len, flags, revent);
0948
0949 if (did_set)
0950 {
0951 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0952 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0953 {
0954 userlog("ERROR! tpsend() failed to get context");
0955 EXFAIL_OUT(ret);
0956 }
0957 }
0958 out:
0959
0960 #ifdef NDRX_OAPI_DEBUG
0961 NDRX_LOG(log_debug, "RETURN: tpsend() returns, context: %p, current: %p",
0962 *p_ctxt, G_atmi_tls);
0963 #endif
0964
0965
0966 return ret;
0967 }
0968
0969
0970
0971
0972
0973 expublic long Otptypes(TPCONTEXT_T *p_ctxt, char *ptr, char *type, char *subtype)
0974 {
0975 long ret = EXSUCCEED;
0976 int did_set = EXFALSE;
0977
0978
0979 #ifdef NDRX_OAPI_DEBUG
0980 NDRX_LOG(log_debug, "ENTRY: tptypes() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0981 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0982 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0983
0984 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0985 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0986
0987 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0988 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0989
0990 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0991 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0992
0993 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0994 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0995
0996 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0997 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0998
0999 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1000 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
1001 #endif
1002
1003
1004
1005
1006 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1007 {
1008 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1009 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1010 {
1011 userlog("ERROR! tptypes() failed to set context");
1012 EXFAIL_OUT(ret);
1013 }
1014 did_set = EXTRUE;
1015 }
1016 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1017 {
1018 userlog("WARNING! tptypes() context %p thinks that it is assocated "
1019 "with current thread, but thread is associated with %p context!",
1020 p_ctxt, G_atmi_tls);
1021 }
1022
1023 ret = tptypes(ptr, type, subtype);
1024
1025 if (did_set)
1026 {
1027 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1028 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1029 {
1030 userlog("ERROR! tptypes() failed to get context");
1031 EXFAIL_OUT(ret);
1032 }
1033 }
1034 out:
1035
1036 #ifdef NDRX_OAPI_DEBUG
1037 NDRX_LOG(log_debug, "RETURN: tptypes() returns, context: %p, current: %p",
1038 *p_ctxt, G_atmi_tls);
1039 #endif
1040
1041
1042 return ret;
1043 }
1044
1045
1046
1047
1048
1049 expublic int Otpabort(TPCONTEXT_T *p_ctxt, long flags)
1050 {
1051 int ret = EXSUCCEED;
1052 int did_set = EXFALSE;
1053
1054
1055 #ifdef NDRX_OAPI_DEBUG
1056 NDRX_LOG(log_debug, "ENTRY: tpabort() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1057 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1058 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1059
1060 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1061 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
1062
1063 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1064 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
1065
1066 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1067 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
1068
1069 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1070 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
1071
1072 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1073 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
1074
1075 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1076 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
1077 #endif
1078
1079
1080
1081
1082 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1083 {
1084 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1085 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
1086 {
1087 userlog("ERROR! tpabort() failed to set context");
1088 EXFAIL_OUT(ret);
1089 }
1090 did_set = EXTRUE;
1091 }
1092 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1093 {
1094 userlog("WARNING! tpabort() context %p thinks that it is assocated "
1095 "with current thread, but thread is associated with %p context!",
1096 p_ctxt, G_atmi_tls);
1097 }
1098
1099 ret = tpabort(flags);
1100
1101 if (did_set)
1102 {
1103 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1104 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
1105 {
1106 userlog("ERROR! tpabort() failed to get context");
1107 EXFAIL_OUT(ret);
1108 }
1109 }
1110 out:
1111
1112 #ifdef NDRX_OAPI_DEBUG
1113 NDRX_LOG(log_debug, "RETURN: tpabort() returns, context: %p, current: %p",
1114 *p_ctxt, G_atmi_tls);
1115 #endif
1116
1117
1118 return ret;
1119 }
1120
1121
1122
1123
1124
1125 expublic int Otpscmt(TPCONTEXT_T *p_ctxt, long flags)
1126 {
1127 int ret = EXSUCCEED;
1128 int did_set = EXFALSE;
1129
1130
1131 #ifdef NDRX_OAPI_DEBUG
1132 NDRX_LOG(log_debug, "ENTRY: tpscmt() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1133 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1134 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1135
1136 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1137 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
1138
1139 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1140 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
1141
1142 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1143 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
1144
1145 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1146 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
1147
1148 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1149 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
1150
1151 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1152 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
1153 #endif
1154
1155
1156
1157
1158 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1159 {
1160 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1161 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1162 {
1163 userlog("ERROR! tpscmt() failed to set context");
1164 EXFAIL_OUT(ret);
1165 }
1166 did_set = EXTRUE;
1167 }
1168 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1169 {
1170 userlog("WARNING! tpscmt() context %p thinks that it is assocated "
1171 "with current thread, but thread is associated with %p context!",
1172 p_ctxt, G_atmi_tls);
1173 }
1174
1175 ret = tpscmt(flags);
1176
1177 if (did_set)
1178 {
1179 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1180 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1181 {
1182 userlog("ERROR! tpscmt() failed to get context");
1183 EXFAIL_OUT(ret);
1184 }
1185 }
1186 out:
1187
1188 #ifdef NDRX_OAPI_DEBUG
1189 NDRX_LOG(log_debug, "RETURN: tpscmt() returns, context: %p, current: %p",
1190 *p_ctxt, G_atmi_tls);
1191 #endif
1192
1193
1194 return ret;
1195 }
1196
1197
1198
1199
1200
1201 expublic int Otpbegin(TPCONTEXT_T *p_ctxt, unsigned long timeout, long flags)
1202 {
1203 int ret = EXSUCCEED;
1204 int did_set = EXFALSE;
1205
1206
1207 #ifdef NDRX_OAPI_DEBUG
1208 NDRX_LOG(log_debug, "ENTRY: tpbegin() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1209 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1210 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1211
1212 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1213 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
1214
1215 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1216 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
1217
1218 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1219 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
1220
1221 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1222 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
1223
1224 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1225 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
1226
1227 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1228 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
1229 #endif
1230
1231
1232
1233
1234 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1235 {
1236 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1237 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
1238 {
1239 userlog("ERROR! tpbegin() failed to set context");
1240 EXFAIL_OUT(ret);
1241 }
1242 did_set = EXTRUE;
1243 }
1244 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1245 {
1246 userlog("WARNING! tpbegin() context %p thinks that it is assocated "
1247 "with current thread, but thread is associated with %p context!",
1248 p_ctxt, G_atmi_tls);
1249 }
1250
1251 ret = tpbegin(timeout, flags);
1252
1253 if (did_set)
1254 {
1255 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1256 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
1257 {
1258 userlog("ERROR! tpbegin() failed to get context");
1259 EXFAIL_OUT(ret);
1260 }
1261 }
1262 out:
1263
1264 #ifdef NDRX_OAPI_DEBUG
1265 NDRX_LOG(log_debug, "RETURN: tpbegin() returns, context: %p, current: %p",
1266 *p_ctxt, G_atmi_tls);
1267 #endif
1268
1269
1270 return ret;
1271 }
1272
1273
1274
1275
1276
1277 expublic int Otpcommit(TPCONTEXT_T *p_ctxt, long flags)
1278 {
1279 int ret = EXSUCCEED;
1280 int did_set = EXFALSE;
1281
1282
1283 #ifdef NDRX_OAPI_DEBUG
1284 NDRX_LOG(log_debug, "ENTRY: tpcommit() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1285 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1286 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1287
1288 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1289 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
1290
1291 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1292 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
1293
1294 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1295 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
1296
1297 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1298 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
1299
1300 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1301 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
1302
1303 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1304 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
1305 #endif
1306
1307
1308
1309
1310 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1311 {
1312 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1313 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
1314 {
1315 userlog("ERROR! tpcommit() failed to set context");
1316 EXFAIL_OUT(ret);
1317 }
1318 did_set = EXTRUE;
1319 }
1320 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1321 {
1322 userlog("WARNING! tpcommit() context %p thinks that it is assocated "
1323 "with current thread, but thread is associated with %p context!",
1324 p_ctxt, G_atmi_tls);
1325 }
1326
1327 ret = tpcommit(flags);
1328
1329 if (did_set)
1330 {
1331 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1332 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
1333 {
1334 userlog("ERROR! tpcommit() failed to get context");
1335 EXFAIL_OUT(ret);
1336 }
1337 }
1338 out:
1339
1340 #ifdef NDRX_OAPI_DEBUG
1341 NDRX_LOG(log_debug, "RETURN: tpcommit() returns, context: %p, current: %p",
1342 *p_ctxt, G_atmi_tls);
1343 #endif
1344
1345
1346 return ret;
1347 }
1348
1349
1350
1351
1352
1353 expublic int Otpconvert(TPCONTEXT_T *p_ctxt, char *str, char *bin, long flags)
1354 {
1355 int ret = EXSUCCEED;
1356 int did_set = EXFALSE;
1357
1358
1359 #ifdef NDRX_OAPI_DEBUG
1360 NDRX_LOG(log_debug, "ENTRY: tpconvert() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1361 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1362 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1363
1364 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1365 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
1366
1367 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1368 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
1369
1370 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1371 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
1372
1373 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1374 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
1375
1376 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1377 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
1378
1379 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1380 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
1381 #endif
1382
1383
1384
1385
1386 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1387 {
1388 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1389 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1390 {
1391 userlog("ERROR! tpconvert() failed to set context");
1392 EXFAIL_OUT(ret);
1393 }
1394 did_set = EXTRUE;
1395 }
1396 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1397 {
1398 userlog("WARNING! tpconvert() context %p thinks that it is assocated "
1399 "with current thread, but thread is associated with %p context!",
1400 p_ctxt, G_atmi_tls);
1401 }
1402
1403 ret = tpconvert(str, bin, flags);
1404
1405 if (did_set)
1406 {
1407 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1408 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1409 {
1410 userlog("ERROR! tpconvert() failed to get context");
1411 EXFAIL_OUT(ret);
1412 }
1413 }
1414 out:
1415
1416 #ifdef NDRX_OAPI_DEBUG
1417 NDRX_LOG(log_debug, "RETURN: tpconvert() returns, context: %p, current: %p",
1418 *p_ctxt, G_atmi_tls);
1419 #endif
1420
1421
1422 return ret;
1423 }
1424
1425
1426
1427
1428
1429 expublic int Otpsuspend(TPCONTEXT_T *p_ctxt, TPTRANID *tranid, long flags)
1430 {
1431 int ret = EXSUCCEED;
1432 int did_set = EXFALSE;
1433
1434
1435 #ifdef NDRX_OAPI_DEBUG
1436 NDRX_LOG(log_debug, "ENTRY: tpsuspend() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1437 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1438 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1439
1440 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1441 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
1442
1443 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1444 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
1445
1446 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1447 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
1448
1449 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1450 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
1451
1452 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1453 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
1454
1455 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1456 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
1457 #endif
1458
1459
1460
1461
1462 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1463 {
1464 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1465 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
1466 {
1467 userlog("ERROR! tpsuspend() failed to set context");
1468 EXFAIL_OUT(ret);
1469 }
1470 did_set = EXTRUE;
1471 }
1472 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1473 {
1474 userlog("WARNING! tpsuspend() context %p thinks that it is assocated "
1475 "with current thread, but thread is associated with %p context!",
1476 p_ctxt, G_atmi_tls);
1477 }
1478
1479 ret = tpsuspend(tranid, flags);
1480
1481 if (did_set)
1482 {
1483 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1484 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
1485 {
1486 userlog("ERROR! tpsuspend() failed to get context");
1487 EXFAIL_OUT(ret);
1488 }
1489 }
1490 out:
1491
1492 #ifdef NDRX_OAPI_DEBUG
1493 NDRX_LOG(log_debug, "RETURN: tpsuspend() returns, context: %p, current: %p",
1494 *p_ctxt, G_atmi_tls);
1495 #endif
1496
1497
1498 return ret;
1499 }
1500
1501
1502
1503
1504
1505 expublic int Otpresume(TPCONTEXT_T *p_ctxt, TPTRANID *tranid, long flags)
1506 {
1507 int ret = EXSUCCEED;
1508 int did_set = EXFALSE;
1509
1510
1511 #ifdef NDRX_OAPI_DEBUG
1512 NDRX_LOG(log_debug, "ENTRY: tpresume() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1513 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1514 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1515
1516 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1517 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
1518
1519 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1520 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
1521
1522 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1523 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
1524
1525 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1526 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
1527
1528 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1529 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
1530
1531 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1532 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
1533 #endif
1534
1535
1536
1537
1538 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1539 {
1540 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1541 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
1542 {
1543 userlog("ERROR! tpresume() failed to set context");
1544 EXFAIL_OUT(ret);
1545 }
1546 did_set = EXTRUE;
1547 }
1548 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1549 {
1550 userlog("WARNING! tpresume() context %p thinks that it is assocated "
1551 "with current thread, but thread is associated with %p context!",
1552 p_ctxt, G_atmi_tls);
1553 }
1554
1555 ret = tpresume(tranid, flags);
1556
1557 if (did_set)
1558 {
1559 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1560 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
1561 {
1562 userlog("ERROR! tpresume() failed to get context");
1563 EXFAIL_OUT(ret);
1564 }
1565 }
1566 out:
1567
1568 #ifdef NDRX_OAPI_DEBUG
1569 NDRX_LOG(log_debug, "RETURN: tpresume() returns, context: %p, current: %p",
1570 *p_ctxt, G_atmi_tls);
1571 #endif
1572
1573
1574 return ret;
1575 }
1576
1577
1578
1579
1580
1581 expublic int Otpopen(TPCONTEXT_T *p_ctxt)
1582 {
1583 int ret = EXSUCCEED;
1584 int did_set = EXFALSE;
1585
1586
1587 #ifdef NDRX_OAPI_DEBUG
1588 NDRX_LOG(log_debug, "ENTRY: tpopen() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1589 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1590 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1591
1592 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1593 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
1594
1595 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1596 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
1597
1598 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1599 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
1600
1601 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1602 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
1603
1604 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1605 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
1606
1607 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1608 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
1609 #endif
1610
1611
1612
1613
1614 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1615 {
1616 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1617 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
1618 {
1619 userlog("ERROR! tpopen() failed to set context");
1620 EXFAIL_OUT(ret);
1621 }
1622 did_set = EXTRUE;
1623 }
1624 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1625 {
1626 userlog("WARNING! tpopen() context %p thinks that it is assocated "
1627 "with current thread, but thread is associated with %p context!",
1628 p_ctxt, G_atmi_tls);
1629 }
1630
1631 ret = tpopen();
1632
1633 if (did_set)
1634 {
1635 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1636 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
1637 {
1638 userlog("ERROR! tpopen() failed to get context");
1639 EXFAIL_OUT(ret);
1640 }
1641 }
1642 out:
1643
1644 #ifdef NDRX_OAPI_DEBUG
1645 NDRX_LOG(log_debug, "RETURN: tpopen() returns, context: %p, current: %p",
1646 *p_ctxt, G_atmi_tls);
1647 #endif
1648
1649
1650 return ret;
1651 }
1652
1653
1654
1655
1656
1657 expublic int Otpclose(TPCONTEXT_T *p_ctxt)
1658 {
1659 int ret = EXSUCCEED;
1660 int did_set = EXFALSE;
1661
1662
1663 #ifdef NDRX_OAPI_DEBUG
1664 NDRX_LOG(log_debug, "ENTRY: tpclose() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1665 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1666 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1667
1668 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1669 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
1670
1671 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1672 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
1673
1674 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1675 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
1676
1677 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1678 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
1679
1680 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1681 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
1682
1683 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1684 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
1685 #endif
1686
1687
1688
1689
1690 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1691 {
1692 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1693 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
1694 {
1695 userlog("ERROR! tpclose() failed to set context");
1696 EXFAIL_OUT(ret);
1697 }
1698 did_set = EXTRUE;
1699 }
1700 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1701 {
1702 userlog("WARNING! tpclose() context %p thinks that it is assocated "
1703 "with current thread, but thread is associated with %p context!",
1704 p_ctxt, G_atmi_tls);
1705 }
1706
1707 ret = tpclose();
1708
1709 if (did_set)
1710 {
1711 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1712 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
1713 {
1714 userlog("ERROR! tpclose() failed to get context");
1715 EXFAIL_OUT(ret);
1716 }
1717 }
1718 out:
1719
1720 #ifdef NDRX_OAPI_DEBUG
1721 NDRX_LOG(log_debug, "RETURN: tpclose() returns, context: %p, current: %p",
1722 *p_ctxt, G_atmi_tls);
1723 #endif
1724
1725
1726 return ret;
1727 }
1728
1729
1730
1731
1732
1733 expublic int Otpgetlev(TPCONTEXT_T *p_ctxt)
1734 {
1735 int ret = EXSUCCEED;
1736 int did_set = EXFALSE;
1737
1738
1739 #ifdef NDRX_OAPI_DEBUG
1740 NDRX_LOG(log_debug, "ENTRY: tpgetlev() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1741 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1742 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1743
1744 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1745 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
1746
1747 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1748 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
1749
1750 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1751 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
1752
1753 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1754 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
1755
1756 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1757 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
1758
1759 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1760 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
1761 #endif
1762
1763
1764
1765
1766 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1767 {
1768 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1769 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
1770 {
1771 userlog("ERROR! tpgetlev() failed to set context");
1772 EXFAIL_OUT(ret);
1773 }
1774 did_set = EXTRUE;
1775 }
1776 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1777 {
1778 userlog("WARNING! tpgetlev() context %p thinks that it is assocated "
1779 "with current thread, but thread is associated with %p context!",
1780 p_ctxt, G_atmi_tls);
1781 }
1782
1783 ret = tpgetlev();
1784
1785 if (did_set)
1786 {
1787 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1788 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
1789 {
1790 userlog("ERROR! tpgetlev() failed to get context");
1791 EXFAIL_OUT(ret);
1792 }
1793 }
1794 out:
1795
1796 #ifdef NDRX_OAPI_DEBUG
1797 NDRX_LOG(log_debug, "RETURN: tpgetlev() returns, context: %p, current: %p",
1798 *p_ctxt, G_atmi_tls);
1799 #endif
1800
1801
1802 return ret;
1803 }
1804
1805
1806
1807
1808
1809 expublic char * Otpstrerror(TPCONTEXT_T *p_ctxt, int err)
1810 {
1811 int did_set = EXFALSE;
1812 char * ret = NULL;
1813
1814
1815 #ifdef NDRX_OAPI_DEBUG
1816 NDRX_LOG(log_debug, "ENTRY: tpstrerror() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1817 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1818 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1819
1820 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1821 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
1822
1823 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1824 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
1825
1826 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1827 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
1828
1829 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1830 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
1831
1832 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1833 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
1834
1835 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1836 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
1837 #endif
1838
1839
1840
1841 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1842 {
1843
1844 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1845 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1846 {
1847 userlog("ERROR! tpstrerror() failed to set context");
1848 ret = NULL;
1849 goto out;
1850 }
1851 did_set = EXTRUE;
1852 }
1853 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1854 {
1855 userlog("WARNING! tpstrerror() context %p thinks that it is assocated "
1856 "with current thread, but thread is associated with %p context!",
1857 p_ctxt, G_atmi_tls);
1858 }
1859
1860 ret = tpstrerror(err);
1861
1862 if (did_set)
1863 {
1864 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1865 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1866 {
1867 userlog("ERROR! tpstrerror() failed to get context");
1868 ret = NULL;
1869 goto out;
1870 }
1871 }
1872 out:
1873
1874 #ifdef NDRX_OAPI_DEBUG
1875 NDRX_LOG(log_debug, "RETURN: tpstrerror() returns, context: %p, current: %p",
1876 *p_ctxt, G_atmi_tls);
1877 #endif
1878
1879
1880 return ret;
1881 }
1882
1883
1884
1885
1886
1887 expublic int Otperrordetail(TPCONTEXT_T *p_ctxt, long flags)
1888 {
1889 int ret = EXSUCCEED;
1890 int did_set = EXFALSE;
1891
1892
1893 #ifdef NDRX_OAPI_DEBUG
1894 NDRX_LOG(log_debug, "ENTRY: tperrordetail() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1895 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1896 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1897
1898 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1899 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
1900
1901 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1902 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
1903
1904 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1905 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
1906
1907 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1908 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
1909
1910 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1911 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
1912
1913 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1914 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
1915 #endif
1916
1917
1918
1919
1920 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1921 {
1922 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1923 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1924 {
1925 userlog("ERROR! tperrordetail() failed to set context");
1926 EXFAIL_OUT(ret);
1927 }
1928 did_set = EXTRUE;
1929 }
1930 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1931 {
1932 userlog("WARNING! tperrordetail() context %p thinks that it is assocated "
1933 "with current thread, but thread is associated with %p context!",
1934 p_ctxt, G_atmi_tls);
1935 }
1936
1937 ret = tperrordetail(flags);
1938
1939 if (did_set)
1940 {
1941 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1942 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1943 {
1944 userlog("ERROR! tperrordetail() failed to get context");
1945 EXFAIL_OUT(ret);
1946 }
1947 }
1948 out:
1949
1950 #ifdef NDRX_OAPI_DEBUG
1951 NDRX_LOG(log_debug, "RETURN: tperrordetail() returns, context: %p, current: %p",
1952 *p_ctxt, G_atmi_tls);
1953 #endif
1954
1955
1956 return ret;
1957 }
1958
1959
1960
1961
1962
1963 expublic char * Otpstrerrordetail(TPCONTEXT_T *p_ctxt, int err, long flags)
1964 {
1965 int did_set = EXFALSE;
1966 char * ret = NULL;
1967
1968
1969 #ifdef NDRX_OAPI_DEBUG
1970 NDRX_LOG(log_debug, "ENTRY: tpstrerrordetail() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1971 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1972 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1973
1974 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1975 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
1976
1977 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1978 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
1979
1980 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1981 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
1982
1983 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1984 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
1985
1986 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1987 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
1988
1989 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1990 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
1991 #endif
1992
1993
1994
1995 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1996 {
1997
1998 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1999 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2000 {
2001 userlog("ERROR! tpstrerrordetail() failed to set context");
2002 ret = NULL;
2003 goto out;
2004 }
2005 did_set = EXTRUE;
2006 }
2007 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
2008 {
2009 userlog("WARNING! tpstrerrordetail() context %p thinks that it is assocated "
2010 "with current thread, but thread is associated with %p context!",
2011 p_ctxt, G_atmi_tls);
2012 }
2013
2014 ret = tpstrerrordetail(err, flags);
2015
2016 if (did_set)
2017 {
2018 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
2019 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2020 {
2021 userlog("ERROR! tpstrerrordetail() failed to get context");
2022 ret = NULL;
2023 goto out;
2024 }
2025 }
2026 out:
2027
2028 #ifdef NDRX_OAPI_DEBUG
2029 NDRX_LOG(log_debug, "RETURN: tpstrerrordetail() returns, context: %p, current: %p",
2030 *p_ctxt, G_atmi_tls);
2031 #endif
2032
2033
2034 return ret;
2035 }
2036
2037
2038
2039
2040
2041 expublic char * Otpecodestr(TPCONTEXT_T *p_ctxt, int err)
2042 {
2043 int did_set = EXFALSE;
2044 char * ret = NULL;
2045
2046
2047 #ifdef NDRX_OAPI_DEBUG
2048 NDRX_LOG(log_debug, "ENTRY: tpecodestr() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
2049 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
2050 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
2051
2052 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
2053 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
2054
2055 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
2056 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
2057
2058 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
2059 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
2060
2061 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
2062 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
2063
2064 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
2065 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
2066
2067 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
2068 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
2069 #endif
2070
2071
2072
2073 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
2074 {
2075
2076 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
2077 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2078 {
2079 userlog("ERROR! tpecodestr() failed to set context");
2080 ret = NULL;
2081 goto out;
2082 }
2083 did_set = EXTRUE;
2084 }
2085 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
2086 {
2087 userlog("WARNING! tpecodestr() context %p thinks that it is assocated "
2088 "with current thread, but thread is associated with %p context!",
2089 p_ctxt, G_atmi_tls);
2090 }
2091
2092 ret = tpecodestr(err);
2093
2094 if (did_set)
2095 {
2096 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
2097 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2098 {
2099 userlog("ERROR! tpecodestr() failed to get context");
2100 ret = NULL;
2101 goto out;
2102 }
2103 }
2104 out:
2105
2106 #ifdef NDRX_OAPI_DEBUG
2107 NDRX_LOG(log_debug, "RETURN: tpecodestr() returns, context: %p, current: %p",
2108 *p_ctxt, G_atmi_tls);
2109 #endif
2110
2111
2112 return ret;
2113 }
2114
2115
2116
2117
2118
2119 expublic long Otpgetnodeid(TPCONTEXT_T *p_ctxt)
2120 {
2121 long ret = EXSUCCEED;
2122 int did_set = EXFALSE;
2123
2124
2125 #ifdef NDRX_OAPI_DEBUG
2126 NDRX_LOG(log_debug, "ENTRY: tpgetnodeid() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
2127 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
2128 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
2129
2130 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
2131 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
2132
2133 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
2134 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
2135
2136 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
2137 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
2138
2139 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
2140 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
2141
2142 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
2143 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
2144
2145 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
2146 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
2147 #endif
2148
2149
2150
2151
2152 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
2153 {
2154 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
2155 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2156 {
2157 userlog("ERROR! tpgetnodeid() failed to set context");
2158 EXFAIL_OUT(ret);
2159 }
2160 did_set = EXTRUE;
2161 }
2162 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
2163 {
2164 userlog("WARNING! tpgetnodeid() context %p thinks that it is assocated "
2165 "with current thread, but thread is associated with %p context!",
2166 p_ctxt, G_atmi_tls);
2167 }
2168
2169 ret = tpgetnodeid();
2170
2171 if (did_set)
2172 {
2173 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
2174 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2175 {
2176 userlog("ERROR! tpgetnodeid() failed to get context");
2177 EXFAIL_OUT(ret);
2178 }
2179 }
2180 out:
2181
2182 #ifdef NDRX_OAPI_DEBUG
2183 NDRX_LOG(log_debug, "RETURN: tpgetnodeid() returns, context: %p, current: %p",
2184 *p_ctxt, G_atmi_tls);
2185 #endif
2186
2187
2188 return ret;
2189 }
2190
2191
2192
2193
2194
2195 expublic long Otpsubscribe(TPCONTEXT_T *p_ctxt, char *eventexpr, char *filter, TPEVCTL *ctl, long flags)
2196 {
2197 long ret = EXSUCCEED;
2198 int did_set = EXFALSE;
2199
2200
2201 #ifdef NDRX_OAPI_DEBUG
2202 NDRX_LOG(log_debug, "ENTRY: tpsubscribe() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
2203 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
2204 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
2205
2206 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
2207 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
2208
2209 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
2210 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
2211
2212 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
2213 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
2214
2215 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
2216 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
2217
2218 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
2219 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
2220
2221 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
2222 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
2223 #endif
2224
2225
2226
2227
2228 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
2229 {
2230 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
2231 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2232 {
2233 userlog("ERROR! tpsubscribe() failed to set context");
2234 EXFAIL_OUT(ret);
2235 }
2236 did_set = EXTRUE;
2237 }
2238 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
2239 {
2240 userlog("WARNING! tpsubscribe() context %p thinks that it is assocated "
2241 "with current thread, but thread is associated with %p context!",
2242 p_ctxt, G_atmi_tls);
2243 }
2244
2245 ret = tpsubscribe(eventexpr, filter, ctl, flags);
2246
2247 if (did_set)
2248 {
2249 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
2250 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2251 {
2252 userlog("ERROR! tpsubscribe() failed to get context");
2253 EXFAIL_OUT(ret);
2254 }
2255 }
2256 out:
2257
2258 #ifdef NDRX_OAPI_DEBUG
2259 NDRX_LOG(log_debug, "RETURN: tpsubscribe() returns, context: %p, current: %p",
2260 *p_ctxt, G_atmi_tls);
2261 #endif
2262
2263
2264 return ret;
2265 }
2266
2267
2268
2269
2270
2271 expublic int Otpunsubscribe(TPCONTEXT_T *p_ctxt, long subscription, long flags)
2272 {
2273 int ret = EXSUCCEED;
2274 int did_set = EXFALSE;
2275
2276
2277 #ifdef NDRX_OAPI_DEBUG
2278 NDRX_LOG(log_debug, "ENTRY: tpunsubscribe() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
2279 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
2280 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
2281
2282 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
2283 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
2284
2285 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
2286 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
2287
2288 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
2289 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
2290
2291 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
2292 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
2293
2294 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
2295 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
2296
2297 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
2298 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
2299 #endif
2300
2301
2302
2303
2304 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
2305 {
2306 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
2307 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2308 {
2309 userlog("ERROR! tpunsubscribe() failed to set context");
2310 EXFAIL_OUT(ret);
2311 }
2312 did_set = EXTRUE;
2313 }
2314 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
2315 {
2316 userlog("WARNING! tpunsubscribe() context %p thinks that it is assocated "
2317 "with current thread, but thread is associated with %p context!",
2318 p_ctxt, G_atmi_tls);
2319 }
2320
2321 ret = tpunsubscribe(subscription, flags);
2322
2323 if (did_set)
2324 {
2325 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
2326 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2327 {
2328 userlog("ERROR! tpunsubscribe() failed to get context");
2329 EXFAIL_OUT(ret);
2330 }
2331 }
2332 out:
2333
2334 #ifdef NDRX_OAPI_DEBUG
2335 NDRX_LOG(log_debug, "RETURN: tpunsubscribe() returns, context: %p, current: %p",
2336 *p_ctxt, G_atmi_tls);
2337 #endif
2338
2339
2340 return ret;
2341 }
2342
2343
2344
2345
2346
2347 expublic int Otppost(TPCONTEXT_T *p_ctxt, char *eventname, char *data, long len, long flags)
2348 {
2349 int ret = EXSUCCEED;
2350 int did_set = EXFALSE;
2351
2352
2353 #ifdef NDRX_OAPI_DEBUG
2354 NDRX_LOG(log_debug, "ENTRY: tppost() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
2355 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
2356 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
2357
2358 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
2359 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
2360
2361 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
2362 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
2363
2364 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
2365 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
2366
2367 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
2368 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
2369
2370 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
2371 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
2372
2373 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
2374 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
2375 #endif
2376
2377
2378
2379
2380 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
2381 {
2382 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
2383 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
2384 {
2385 userlog("ERROR! tppost() failed to set context");
2386 EXFAIL_OUT(ret);
2387 }
2388 did_set = EXTRUE;
2389 }
2390 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
2391 {
2392 userlog("WARNING! tppost() context %p thinks that it is assocated "
2393 "with current thread, but thread is associated with %p context!",
2394 p_ctxt, G_atmi_tls);
2395 }
2396
2397 ret = tppost(eventname, data, len, flags);
2398
2399 if (did_set)
2400 {
2401 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
2402 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
2403 {
2404 userlog("ERROR! tppost() failed to get context");
2405 EXFAIL_OUT(ret);
2406 }
2407 }
2408 out:
2409
2410 #ifdef NDRX_OAPI_DEBUG
2411 NDRX_LOG(log_debug, "RETURN: tppost() returns, context: %p, current: %p",
2412 *p_ctxt, G_atmi_tls);
2413 #endif
2414
2415
2416 return ret;
2417 }
2418
2419
2420
2421
2422
2423 expublic int * O_exget_tperrno_addr(TPCONTEXT_T *p_ctxt)
2424 {
2425 int did_set = EXFALSE;
2426 int * ret = NULL;
2427
2428
2429 #ifdef NDRX_OAPI_DEBUG
2430 NDRX_LOG(log_debug, "ENTRY: _exget_tperrno_addr() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
2431 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
2432 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
2433
2434 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
2435 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
2436
2437 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
2438 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
2439
2440 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
2441 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
2442
2443 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
2444 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
2445
2446 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
2447 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
2448
2449 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
2450 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
2451 #endif
2452
2453
2454
2455 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
2456 {
2457
2458 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
2459 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2460 {
2461 userlog("ERROR! _exget_tperrno_addr() failed to set context");
2462 ret = NULL;
2463 goto out;
2464 }
2465 did_set = EXTRUE;
2466 }
2467 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
2468 {
2469 userlog("WARNING! _exget_tperrno_addr() context %p thinks that it is assocated "
2470 "with current thread, but thread is associated with %p context!",
2471 p_ctxt, G_atmi_tls);
2472 }
2473
2474 ret = _exget_tperrno_addr();
2475
2476 if (did_set)
2477 {
2478 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
2479 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2480 {
2481 userlog("ERROR! _exget_tperrno_addr() failed to get context");
2482 ret = NULL;
2483 goto out;
2484 }
2485 }
2486 out:
2487
2488 #ifdef NDRX_OAPI_DEBUG
2489 NDRX_LOG(log_debug, "RETURN: _exget_tperrno_addr() returns, context: %p, current: %p",
2490 *p_ctxt, G_atmi_tls);
2491 #endif
2492
2493
2494 return ret;
2495 }
2496
2497
2498
2499
2500
2501 expublic long * O_exget_tpurcode_addr(TPCONTEXT_T *p_ctxt)
2502 {
2503 int did_set = EXFALSE;
2504 long * ret = NULL;
2505
2506
2507 #ifdef NDRX_OAPI_DEBUG
2508 NDRX_LOG(log_debug, "ENTRY: _exget_tpurcode_addr() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
2509 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
2510 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
2511
2512 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
2513 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
2514
2515 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
2516 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
2517
2518 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
2519 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
2520
2521 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
2522 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
2523
2524 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
2525 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
2526
2527 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
2528 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
2529 #endif
2530
2531
2532
2533 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
2534 {
2535
2536 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
2537 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2538 {
2539 userlog("ERROR! _exget_tpurcode_addr() failed to set context");
2540 ret = NULL;
2541 goto out;
2542 }
2543 did_set = EXTRUE;
2544 }
2545 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
2546 {
2547 userlog("WARNING! _exget_tpurcode_addr() context %p thinks that it is assocated "
2548 "with current thread, but thread is associated with %p context!",
2549 p_ctxt, G_atmi_tls);
2550 }
2551
2552 ret = _exget_tpurcode_addr();
2553
2554 if (did_set)
2555 {
2556 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
2557 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2558 {
2559 userlog("ERROR! _exget_tpurcode_addr() failed to get context");
2560 ret = NULL;
2561 goto out;
2562 }
2563 }
2564 out:
2565
2566 #ifdef NDRX_OAPI_DEBUG
2567 NDRX_LOG(log_debug, "RETURN: _exget_tpurcode_addr() returns, context: %p, current: %p",
2568 *p_ctxt, G_atmi_tls);
2569 #endif
2570
2571
2572 return ret;
2573 }
2574
2575
2576
2577
2578
2579 expublic int Otpinit(TPCONTEXT_T *p_ctxt, TPINIT *tpinfo)
2580 {
2581 int ret = EXSUCCEED;
2582 int did_set = EXFALSE;
2583
2584
2585 #ifdef NDRX_OAPI_DEBUG
2586 NDRX_LOG(log_debug, "ENTRY: tpinit() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
2587 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
2588 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
2589
2590 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
2591 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
2592
2593 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
2594 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
2595
2596 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
2597 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
2598
2599 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
2600 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
2601
2602 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
2603 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
2604
2605 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
2606 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
2607 #endif
2608
2609
2610
2611
2612 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
2613 {
2614 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
2615 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2616 {
2617 userlog("ERROR! tpinit() failed to set context");
2618 EXFAIL_OUT(ret);
2619 }
2620 did_set = EXTRUE;
2621 }
2622 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
2623 {
2624 userlog("WARNING! tpinit() context %p thinks that it is assocated "
2625 "with current thread, but thread is associated with %p context!",
2626 p_ctxt, G_atmi_tls);
2627 }
2628
2629 ret = tpinit(tpinfo);
2630
2631 if (did_set)
2632 {
2633 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
2634 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2635 {
2636 userlog("ERROR! tpinit() failed to get context");
2637 EXFAIL_OUT(ret);
2638 }
2639 }
2640 out:
2641
2642 #ifdef NDRX_OAPI_DEBUG
2643 NDRX_LOG(log_debug, "RETURN: tpinit() returns, context: %p, current: %p",
2644 *p_ctxt, G_atmi_tls);
2645 #endif
2646
2647
2648 return ret;
2649 }
2650
2651
2652
2653
2654
2655 expublic int Otpappthrinit(TPCONTEXT_T *p_ctxt, TPINIT *tpinfo)
2656 {
2657 int ret = EXSUCCEED;
2658 int did_set = EXFALSE;
2659
2660
2661 #ifdef NDRX_OAPI_DEBUG
2662 NDRX_LOG(log_debug, "ENTRY: tpappthrinit() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
2663 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
2664 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
2665
2666 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
2667 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
2668
2669 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
2670 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
2671
2672 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
2673 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
2674
2675 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
2676 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
2677
2678 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
2679 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
2680
2681 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
2682 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
2683 #endif
2684
2685
2686
2687
2688 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
2689 {
2690 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
2691 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2692 {
2693 userlog("ERROR! tpappthrinit() failed to set context");
2694 EXFAIL_OUT(ret);
2695 }
2696 did_set = EXTRUE;
2697 }
2698 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
2699 {
2700 userlog("WARNING! tpappthrinit() context %p thinks that it is assocated "
2701 "with current thread, but thread is associated with %p context!",
2702 p_ctxt, G_atmi_tls);
2703 }
2704
2705 ret = tpappthrinit(tpinfo);
2706
2707 if (did_set)
2708 {
2709 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
2710 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2711 {
2712 userlog("ERROR! tpappthrinit() failed to get context");
2713 EXFAIL_OUT(ret);
2714 }
2715 }
2716 out:
2717
2718 #ifdef NDRX_OAPI_DEBUG
2719 NDRX_LOG(log_debug, "RETURN: tpappthrinit() returns, context: %p, current: %p",
2720 *p_ctxt, G_atmi_tls);
2721 #endif
2722
2723
2724 return ret;
2725 }
2726
2727
2728
2729
2730
2731 expublic int Otpchkauth(TPCONTEXT_T *p_ctxt)
2732 {
2733 int ret = EXSUCCEED;
2734 int did_set = EXFALSE;
2735
2736
2737 #ifdef NDRX_OAPI_DEBUG
2738 NDRX_LOG(log_debug, "ENTRY: tpchkauth() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
2739 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
2740 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
2741
2742 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
2743 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
2744
2745 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
2746 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
2747
2748 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
2749 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
2750
2751 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
2752 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
2753
2754 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
2755 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
2756
2757 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
2758 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
2759 #endif
2760
2761
2762
2763
2764 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
2765 {
2766 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
2767 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2768 {
2769 userlog("ERROR! tpchkauth() failed to set context");
2770 EXFAIL_OUT(ret);
2771 }
2772 did_set = EXTRUE;
2773 }
2774 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
2775 {
2776 userlog("WARNING! tpchkauth() context %p thinks that it is assocated "
2777 "with current thread, but thread is associated with %p context!",
2778 p_ctxt, G_atmi_tls);
2779 }
2780
2781 ret = tpchkauth();
2782
2783 if (did_set)
2784 {
2785 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
2786 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2787 {
2788 userlog("ERROR! tpchkauth() failed to get context");
2789 EXFAIL_OUT(ret);
2790 }
2791 }
2792 out:
2793
2794 #ifdef NDRX_OAPI_DEBUG
2795 NDRX_LOG(log_debug, "RETURN: tpchkauth() returns, context: %p, current: %p",
2796 *p_ctxt, G_atmi_tls);
2797 #endif
2798
2799
2800 return ret;
2801 }
2802
2803
2804
2805
2806
2807 expublic void (*Otpsetunsol (TPCONTEXT_T *p_ctxt, void (*disp) (char *data, long len, long flags))) (char *data, long len, long flags)
2808 {
2809 int did_set = EXFALSE;
2810 void (*ret) (char *data, long len, long flags) = NULL;
2811
2812
2813 #ifdef NDRX_OAPI_DEBUG
2814 NDRX_LOG(log_debug, "ENTRY: tpsetunsol() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
2815 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
2816 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
2817
2818 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
2819 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
2820
2821 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
2822 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
2823
2824 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
2825 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
2826
2827 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
2828 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
2829
2830 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
2831 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
2832
2833 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
2834 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
2835 #endif
2836
2837
2838
2839 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
2840 {
2841
2842 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
2843 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2844 {
2845 userlog("ERROR! tpsetunsol() failed to set context");
2846 ret = NULL;
2847 goto out;
2848 }
2849 did_set = EXTRUE;
2850 }
2851 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
2852 {
2853 userlog("WARNING! tpsetunsol() context %p thinks that it is assocated "
2854 "with current thread, but thread is associated with %p context!",
2855 p_ctxt, G_atmi_tls);
2856 }
2857
2858 ret = tpsetunsol(disp);
2859
2860 if (did_set)
2861 {
2862 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
2863 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2864 {
2865 userlog("ERROR! tpsetunsol() failed to get context");
2866 ret = NULL;
2867 goto out;
2868 }
2869 }
2870 out:
2871
2872 #ifdef NDRX_OAPI_DEBUG
2873 NDRX_LOG(log_debug, "RETURN: tpsetunsol() returns, context: %p, current: %p",
2874 *p_ctxt, G_atmi_tls);
2875 #endif
2876
2877
2878 return ret;
2879 }
2880
2881
2882
2883
2884
2885 expublic int Otpnotify(TPCONTEXT_T *p_ctxt, CLIENTID *clientid, char *data, long len, long flags)
2886 {
2887 int ret = EXSUCCEED;
2888 int did_set = EXFALSE;
2889
2890
2891 #ifdef NDRX_OAPI_DEBUG
2892 NDRX_LOG(log_debug, "ENTRY: tpnotify() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
2893 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
2894 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
2895
2896 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
2897 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
2898
2899 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
2900 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
2901
2902 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
2903 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
2904
2905 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
2906 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
2907
2908 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
2909 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
2910
2911 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
2912 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
2913 #endif
2914
2915
2916
2917
2918 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
2919 {
2920 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
2921 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2922 {
2923 userlog("ERROR! tpnotify() failed to set context");
2924 EXFAIL_OUT(ret);
2925 }
2926 did_set = EXTRUE;
2927 }
2928 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
2929 {
2930 userlog("WARNING! tpnotify() context %p thinks that it is assocated "
2931 "with current thread, but thread is associated with %p context!",
2932 p_ctxt, G_atmi_tls);
2933 }
2934
2935 ret = tpnotify(clientid, data, len, flags);
2936
2937 if (did_set)
2938 {
2939 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
2940 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2941 {
2942 userlog("ERROR! tpnotify() failed to get context");
2943 EXFAIL_OUT(ret);
2944 }
2945 }
2946 out:
2947
2948 #ifdef NDRX_OAPI_DEBUG
2949 NDRX_LOG(log_debug, "RETURN: tpnotify() returns, context: %p, current: %p",
2950 *p_ctxt, G_atmi_tls);
2951 #endif
2952
2953
2954 return ret;
2955 }
2956
2957
2958
2959
2960
2961 expublic int Otpbroadcast(TPCONTEXT_T *p_ctxt, char *lmid, char *usrname, char *cltname, char *data, long len, long flags)
2962 {
2963 int ret = EXSUCCEED;
2964 int did_set = EXFALSE;
2965
2966
2967 #ifdef NDRX_OAPI_DEBUG
2968 NDRX_LOG(log_debug, "ENTRY: tpbroadcast() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
2969 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
2970 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
2971
2972 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
2973 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
2974
2975 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
2976 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
2977
2978 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
2979 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
2980
2981 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
2982 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
2983
2984 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
2985 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
2986
2987 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
2988 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
2989 #endif
2990
2991
2992
2993
2994 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
2995 {
2996 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
2997 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
2998 {
2999 userlog("ERROR! tpbroadcast() failed to set context");
3000 EXFAIL_OUT(ret);
3001 }
3002 did_set = EXTRUE;
3003 }
3004 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
3005 {
3006 userlog("WARNING! tpbroadcast() context %p thinks that it is assocated "
3007 "with current thread, but thread is associated with %p context!",
3008 p_ctxt, G_atmi_tls);
3009 }
3010
3011 ret = tpbroadcast(lmid, usrname, cltname, data, len, flags);
3012
3013 if (did_set)
3014 {
3015 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
3016 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3017 {
3018 userlog("ERROR! tpbroadcast() failed to get context");
3019 EXFAIL_OUT(ret);
3020 }
3021 }
3022 out:
3023
3024 #ifdef NDRX_OAPI_DEBUG
3025 NDRX_LOG(log_debug, "RETURN: tpbroadcast() returns, context: %p, current: %p",
3026 *p_ctxt, G_atmi_tls);
3027 #endif
3028
3029
3030 return ret;
3031 }
3032
3033
3034
3035
3036
3037 expublic int Otpchkunsol(TPCONTEXT_T *p_ctxt)
3038 {
3039 int ret = EXSUCCEED;
3040 int did_set = EXFALSE;
3041
3042
3043 #ifdef NDRX_OAPI_DEBUG
3044 NDRX_LOG(log_debug, "ENTRY: tpchkunsol() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
3045 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
3046 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
3047
3048 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
3049 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
3050
3051 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
3052 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
3053
3054 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
3055 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
3056
3057 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
3058 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
3059
3060 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
3061 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
3062
3063 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
3064 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
3065 #endif
3066
3067
3068
3069
3070 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
3071 {
3072 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
3073 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3074 {
3075 userlog("ERROR! tpchkunsol() failed to set context");
3076 EXFAIL_OUT(ret);
3077 }
3078 did_set = EXTRUE;
3079 }
3080 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
3081 {
3082 userlog("WARNING! tpchkunsol() context %p thinks that it is assocated "
3083 "with current thread, but thread is associated with %p context!",
3084 p_ctxt, G_atmi_tls);
3085 }
3086
3087 ret = tpchkunsol();
3088
3089 if (did_set)
3090 {
3091 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
3092 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3093 {
3094 userlog("ERROR! tpchkunsol() failed to get context");
3095 EXFAIL_OUT(ret);
3096 }
3097 }
3098 out:
3099
3100 #ifdef NDRX_OAPI_DEBUG
3101 NDRX_LOG(log_debug, "RETURN: tpchkunsol() returns, context: %p, current: %p",
3102 *p_ctxt, G_atmi_tls);
3103 #endif
3104
3105
3106 return ret;
3107 }
3108
3109
3110
3111
3112
3113 expublic int Otptoutset(TPCONTEXT_T *p_ctxt, int tout)
3114 {
3115 int ret = EXSUCCEED;
3116 int did_set = EXFALSE;
3117
3118
3119 #ifdef NDRX_OAPI_DEBUG
3120 NDRX_LOG(log_debug, "ENTRY: tptoutset() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
3121 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
3122 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
3123
3124 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
3125 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
3126
3127 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
3128 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
3129
3130 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
3131 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
3132
3133 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
3134 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
3135
3136 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
3137 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
3138
3139 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
3140 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
3141 #endif
3142
3143
3144
3145
3146 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
3147 {
3148 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
3149 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3150 {
3151 userlog("ERROR! tptoutset() failed to set context");
3152 EXFAIL_OUT(ret);
3153 }
3154 did_set = EXTRUE;
3155 }
3156 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
3157 {
3158 userlog("WARNING! tptoutset() context %p thinks that it is assocated "
3159 "with current thread, but thread is associated with %p context!",
3160 p_ctxt, G_atmi_tls);
3161 }
3162
3163 ret = tptoutset(tout);
3164
3165 if (did_set)
3166 {
3167 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
3168 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3169 {
3170 userlog("ERROR! tptoutset() failed to get context");
3171 EXFAIL_OUT(ret);
3172 }
3173 }
3174 out:
3175
3176 #ifdef NDRX_OAPI_DEBUG
3177 NDRX_LOG(log_debug, "RETURN: tptoutset() returns, context: %p, current: %p",
3178 *p_ctxt, G_atmi_tls);
3179 #endif
3180
3181
3182 return ret;
3183 }
3184
3185
3186
3187
3188
3189 expublic int Otptoutget(TPCONTEXT_T *p_ctxt)
3190 {
3191 int ret = EXSUCCEED;
3192 int did_set = EXFALSE;
3193
3194
3195 #ifdef NDRX_OAPI_DEBUG
3196 NDRX_LOG(log_debug, "ENTRY: tptoutget() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
3197 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
3198 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
3199
3200 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
3201 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
3202
3203 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
3204 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
3205
3206 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
3207 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
3208
3209 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
3210 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
3211
3212 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
3213 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
3214
3215 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
3216 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
3217 #endif
3218
3219
3220
3221
3222 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
3223 {
3224 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
3225 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3226 {
3227 userlog("ERROR! tptoutget() failed to set context");
3228 EXFAIL_OUT(ret);
3229 }
3230 did_set = EXTRUE;
3231 }
3232 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
3233 {
3234 userlog("WARNING! tptoutget() context %p thinks that it is assocated "
3235 "with current thread, but thread is associated with %p context!",
3236 p_ctxt, G_atmi_tls);
3237 }
3238
3239 ret = tptoutget();
3240
3241 if (did_set)
3242 {
3243 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
3244 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3245 {
3246 userlog("ERROR! tptoutget() failed to get context");
3247 EXFAIL_OUT(ret);
3248 }
3249 }
3250 out:
3251
3252 #ifdef NDRX_OAPI_DEBUG
3253 NDRX_LOG(log_debug, "RETURN: tptoutget() returns, context: %p, current: %p",
3254 *p_ctxt, G_atmi_tls);
3255 #endif
3256
3257
3258 return ret;
3259 }
3260
3261
3262
3263
3264
3265 expublic int Otpimport(TPCONTEXT_T *p_ctxt, char *istr, long ilen, char **obuf, long *olen, long flags)
3266 {
3267 int ret = EXSUCCEED;
3268 int did_set = EXFALSE;
3269
3270
3271 #ifdef NDRX_OAPI_DEBUG
3272 NDRX_LOG(log_debug, "ENTRY: tpimport() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
3273 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
3274 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
3275
3276 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
3277 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
3278
3279 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
3280 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
3281
3282 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
3283 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
3284
3285 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
3286 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
3287
3288 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
3289 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
3290
3291 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
3292 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
3293 #endif
3294
3295
3296
3297
3298 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
3299 {
3300 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
3301 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3302 {
3303 userlog("ERROR! tpimport() failed to set context");
3304 EXFAIL_OUT(ret);
3305 }
3306 did_set = EXTRUE;
3307 }
3308 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
3309 {
3310 userlog("WARNING! tpimport() context %p thinks that it is assocated "
3311 "with current thread, but thread is associated with %p context!",
3312 p_ctxt, G_atmi_tls);
3313 }
3314
3315 ret = tpimport(istr, ilen, obuf, olen, flags);
3316
3317 if (did_set)
3318 {
3319 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
3320 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3321 {
3322 userlog("ERROR! tpimport() failed to get context");
3323 EXFAIL_OUT(ret);
3324 }
3325 }
3326 out:
3327
3328 #ifdef NDRX_OAPI_DEBUG
3329 NDRX_LOG(log_debug, "RETURN: tpimport() returns, context: %p, current: %p",
3330 *p_ctxt, G_atmi_tls);
3331 #endif
3332
3333
3334 return ret;
3335 }
3336
3337
3338
3339
3340
3341 expublic int Otpexport(TPCONTEXT_T *p_ctxt, char *ibuf, long ilen, char *ostr, long *olen, long flags)
3342 {
3343 int ret = EXSUCCEED;
3344 int did_set = EXFALSE;
3345
3346
3347 #ifdef NDRX_OAPI_DEBUG
3348 NDRX_LOG(log_debug, "ENTRY: tpexport() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
3349 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
3350 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
3351
3352 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
3353 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
3354
3355 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
3356 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
3357
3358 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
3359 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
3360
3361 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
3362 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
3363
3364 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
3365 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
3366
3367 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
3368 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
3369 #endif
3370
3371
3372
3373
3374 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
3375 {
3376 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
3377 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3378 {
3379 userlog("ERROR! tpexport() failed to set context");
3380 EXFAIL_OUT(ret);
3381 }
3382 did_set = EXTRUE;
3383 }
3384 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
3385 {
3386 userlog("WARNING! tpexport() context %p thinks that it is assocated "
3387 "with current thread, but thread is associated with %p context!",
3388 p_ctxt, G_atmi_tls);
3389 }
3390
3391 ret = tpexport(ibuf, ilen, ostr, olen, flags);
3392
3393 if (did_set)
3394 {
3395 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
3396 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3397 {
3398 userlog("ERROR! tpexport() failed to get context");
3399 EXFAIL_OUT(ret);
3400 }
3401 }
3402 out:
3403
3404 #ifdef NDRX_OAPI_DEBUG
3405 NDRX_LOG(log_debug, "RETURN: tpexport() returns, context: %p, current: %p",
3406 *p_ctxt, G_atmi_tls);
3407 #endif
3408
3409
3410 return ret;
3411 }
3412
3413
3414
3415
3416
3417 expublic char * Otuxgetenv(TPCONTEXT_T *p_ctxt, char *envname)
3418 {
3419 int did_set = EXFALSE;
3420 char * ret = NULL;
3421
3422
3423 #ifdef NDRX_OAPI_DEBUG
3424 NDRX_LOG(log_debug, "ENTRY: tuxgetenv() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
3425 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
3426 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
3427
3428 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
3429 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
3430
3431 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
3432 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
3433
3434 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
3435 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
3436
3437 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
3438 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
3439
3440 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
3441 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
3442
3443 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
3444 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
3445 #endif
3446
3447
3448
3449 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
3450 {
3451
3452 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
3453 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3454 {
3455 userlog("ERROR! tuxgetenv() failed to set context");
3456 ret = NULL;
3457 goto out;
3458 }
3459 did_set = EXTRUE;
3460 }
3461 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
3462 {
3463 userlog("WARNING! tuxgetenv() context %p thinks that it is assocated "
3464 "with current thread, but thread is associated with %p context!",
3465 p_ctxt, G_atmi_tls);
3466 }
3467
3468 ret = tuxgetenv(envname);
3469
3470 if (did_set)
3471 {
3472 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
3473 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3474 {
3475 userlog("ERROR! tuxgetenv() failed to get context");
3476 ret = NULL;
3477 goto out;
3478 }
3479 }
3480 out:
3481
3482 #ifdef NDRX_OAPI_DEBUG
3483 NDRX_LOG(log_debug, "RETURN: tuxgetenv() returns, context: %p, current: %p",
3484 *p_ctxt, G_atmi_tls);
3485 #endif
3486
3487
3488 return ret;
3489 }
3490
3491
3492
3493
3494
3495 expublic int Otpgetcallinfo(TPCONTEXT_T *p_ctxt, const char *msg, UBFH **cibuf, long flags)
3496 {
3497 int ret = EXSUCCEED;
3498 int did_set = EXFALSE;
3499
3500
3501 #ifdef NDRX_OAPI_DEBUG
3502 NDRX_LOG(log_debug, "ENTRY: tpgetcallinfo() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
3503 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
3504 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
3505
3506 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
3507 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
3508
3509 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
3510 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
3511
3512 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
3513 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
3514
3515 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
3516 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
3517
3518 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
3519 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
3520
3521 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
3522 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
3523 #endif
3524
3525
3526
3527
3528 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
3529 {
3530 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
3531 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3532 {
3533 userlog("ERROR! tpgetcallinfo() failed to set context");
3534 EXFAIL_OUT(ret);
3535 }
3536 did_set = EXTRUE;
3537 }
3538 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
3539 {
3540 userlog("WARNING! tpgetcallinfo() context %p thinks that it is assocated "
3541 "with current thread, but thread is associated with %p context!",
3542 p_ctxt, G_atmi_tls);
3543 }
3544
3545 ret = tpgetcallinfo(msg, cibuf, flags);
3546
3547 if (did_set)
3548 {
3549 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
3550 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3551 {
3552 userlog("ERROR! tpgetcallinfo() failed to get context");
3553 EXFAIL_OUT(ret);
3554 }
3555 }
3556 out:
3557
3558 #ifdef NDRX_OAPI_DEBUG
3559 NDRX_LOG(log_debug, "RETURN: tpgetcallinfo() returns, context: %p, current: %p",
3560 *p_ctxt, G_atmi_tls);
3561 #endif
3562
3563
3564 return ret;
3565 }
3566
3567
3568
3569
3570
3571 expublic int Otpsetcallinfo(TPCONTEXT_T *p_ctxt, const char *msg, UBFH *cibuf, long flags)
3572 {
3573 int ret = EXSUCCEED;
3574 int did_set = EXFALSE;
3575
3576
3577 #ifdef NDRX_OAPI_DEBUG
3578 NDRX_LOG(log_debug, "ENTRY: tpsetcallinfo() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
3579 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
3580 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
3581
3582 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
3583 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
3584
3585 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
3586 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
3587
3588 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
3589 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
3590
3591 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
3592 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
3593
3594 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
3595 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
3596
3597 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
3598 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
3599 #endif
3600
3601
3602
3603
3604 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
3605 {
3606 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
3607 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3608 {
3609 userlog("ERROR! tpsetcallinfo() failed to set context");
3610 EXFAIL_OUT(ret);
3611 }
3612 did_set = EXTRUE;
3613 }
3614 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
3615 {
3616 userlog("WARNING! tpsetcallinfo() context %p thinks that it is assocated "
3617 "with current thread, but thread is associated with %p context!",
3618 p_ctxt, G_atmi_tls);
3619 }
3620
3621 ret = tpsetcallinfo(msg, cibuf, flags);
3622
3623 if (did_set)
3624 {
3625 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
3626 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3627 {
3628 userlog("ERROR! tpsetcallinfo() failed to get context");
3629 EXFAIL_OUT(ret);
3630 }
3631 }
3632 out:
3633
3634 #ifdef NDRX_OAPI_DEBUG
3635 NDRX_LOG(log_debug, "RETURN: tpsetcallinfo() returns, context: %p, current: %p",
3636 *p_ctxt, G_atmi_tls);
3637 #endif
3638
3639
3640 return ret;
3641 }
3642
3643
3644
3645
3646
3647 expublic int Otpterm(TPCONTEXT_T *p_ctxt)
3648 {
3649 int ret = EXSUCCEED;
3650 int did_set = EXFALSE;
3651
3652
3653 #ifdef NDRX_OAPI_DEBUG
3654 NDRX_LOG(log_debug, "ENTRY: tpterm() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
3655 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
3656 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
3657
3658 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
3659 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
3660
3661 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
3662 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
3663
3664 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
3665 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
3666
3667 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
3668 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
3669
3670 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
3671 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
3672
3673 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
3674 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
3675 #endif
3676
3677
3678
3679
3680 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
3681 {
3682 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
3683 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
3684 {
3685 userlog("ERROR! tpterm() failed to set context");
3686 EXFAIL_OUT(ret);
3687 }
3688 did_set = EXTRUE;
3689 }
3690 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
3691 {
3692 userlog("WARNING! tpterm() context %p thinks that it is assocated "
3693 "with current thread, but thread is associated with %p context!",
3694 p_ctxt, G_atmi_tls);
3695 }
3696
3697 ret = tpterm();
3698
3699 if (did_set)
3700 {
3701 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
3702 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
3703 {
3704 userlog("ERROR! tpterm() failed to get context");
3705 EXFAIL_OUT(ret);
3706 }
3707 }
3708 out:
3709
3710 #ifdef NDRX_OAPI_DEBUG
3711 NDRX_LOG(log_debug, "RETURN: tpterm() returns, context: %p, current: %p",
3712 *p_ctxt, G_atmi_tls);
3713 #endif
3714
3715
3716 return ret;
3717 }
3718
3719
3720
3721
3722
3723 expublic int Otpappthrterm(TPCONTEXT_T *p_ctxt)
3724 {
3725 int ret = EXSUCCEED;
3726 int did_set = EXFALSE;
3727
3728
3729 #ifdef NDRX_OAPI_DEBUG
3730 NDRX_LOG(log_debug, "ENTRY: tpappthrterm() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
3731 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
3732 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
3733
3734 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
3735 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
3736
3737 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
3738 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
3739
3740 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
3741 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
3742
3743 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
3744 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
3745
3746 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
3747 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
3748
3749 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
3750 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
3751 #endif
3752
3753
3754
3755
3756 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
3757 {
3758 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
3759 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3760 {
3761 userlog("ERROR! tpappthrterm() failed to set context");
3762 EXFAIL_OUT(ret);
3763 }
3764 did_set = EXTRUE;
3765 }
3766 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
3767 {
3768 userlog("WARNING! tpappthrterm() context %p thinks that it is assocated "
3769 "with current thread, but thread is associated with %p context!",
3770 p_ctxt, G_atmi_tls);
3771 }
3772
3773 ret = tpappthrterm();
3774
3775 if (did_set)
3776 {
3777 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
3778 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3779 {
3780 userlog("ERROR! tpappthrterm() failed to get context");
3781 EXFAIL_OUT(ret);
3782 }
3783 }
3784 out:
3785
3786 #ifdef NDRX_OAPI_DEBUG
3787 NDRX_LOG(log_debug, "RETURN: tpappthrterm() returns, context: %p, current: %p",
3788 *p_ctxt, G_atmi_tls);
3789 #endif
3790
3791
3792 return ret;
3793 }
3794
3795
3796
3797
3798
3799 expublic int Otpjsontoubf(TPCONTEXT_T *p_ctxt, UBFH *p_ub, char *buffer)
3800 {
3801 int ret = EXSUCCEED;
3802 int did_set = EXFALSE;
3803
3804
3805 #ifdef NDRX_OAPI_DEBUG
3806 NDRX_LOG(log_debug, "ENTRY: tpjsontoubf() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
3807 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
3808 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
3809
3810 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
3811 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
3812
3813 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
3814 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
3815
3816 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
3817 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
3818
3819 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
3820 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
3821
3822 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
3823 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
3824
3825 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
3826 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
3827 #endif
3828
3829
3830
3831
3832 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
3833 {
3834 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
3835 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3836 {
3837 userlog("ERROR! tpjsontoubf() failed to set context");
3838 EXFAIL_OUT(ret);
3839 }
3840 did_set = EXTRUE;
3841 }
3842 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
3843 {
3844 userlog("WARNING! tpjsontoubf() context %p thinks that it is assocated "
3845 "with current thread, but thread is associated with %p context!",
3846 p_ctxt, G_atmi_tls);
3847 }
3848
3849 ret = tpjsontoubf(p_ub, buffer);
3850
3851 if (did_set)
3852 {
3853 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
3854 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3855 {
3856 userlog("ERROR! tpjsontoubf() failed to get context");
3857 EXFAIL_OUT(ret);
3858 }
3859 }
3860 out:
3861
3862 #ifdef NDRX_OAPI_DEBUG
3863 NDRX_LOG(log_debug, "RETURN: tpjsontoubf() returns, context: %p, current: %p",
3864 *p_ctxt, G_atmi_tls);
3865 #endif
3866
3867
3868 return ret;
3869 }
3870
3871
3872
3873
3874
3875 expublic int Otpubftojson(TPCONTEXT_T *p_ctxt, UBFH *p_ub, char *buffer, int bufsize)
3876 {
3877 int ret = EXSUCCEED;
3878 int did_set = EXFALSE;
3879
3880
3881 #ifdef NDRX_OAPI_DEBUG
3882 NDRX_LOG(log_debug, "ENTRY: tpubftojson() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
3883 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
3884 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
3885
3886 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
3887 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
3888
3889 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
3890 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
3891
3892 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
3893 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
3894
3895 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
3896 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
3897
3898 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
3899 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
3900
3901 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
3902 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
3903 #endif
3904
3905
3906
3907
3908 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
3909 {
3910 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
3911 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3912 {
3913 userlog("ERROR! tpubftojson() failed to set context");
3914 EXFAIL_OUT(ret);
3915 }
3916 did_set = EXTRUE;
3917 }
3918 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
3919 {
3920 userlog("WARNING! tpubftojson() context %p thinks that it is assocated "
3921 "with current thread, but thread is associated with %p context!",
3922 p_ctxt, G_atmi_tls);
3923 }
3924
3925 ret = tpubftojson(p_ub, buffer, bufsize);
3926
3927 if (did_set)
3928 {
3929 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
3930 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3931 {
3932 userlog("ERROR! tpubftojson() failed to get context");
3933 EXFAIL_OUT(ret);
3934 }
3935 }
3936 out:
3937
3938 #ifdef NDRX_OAPI_DEBUG
3939 NDRX_LOG(log_debug, "RETURN: tpubftojson() returns, context: %p, current: %p",
3940 *p_ctxt, G_atmi_tls);
3941 #endif
3942
3943
3944 return ret;
3945 }
3946
3947
3948
3949
3950
3951 expublic int Otpviewtojson(TPCONTEXT_T *p_ctxt, char *cstruct, char *view, char *buffer,int bufsize, long flags)
3952 {
3953 int ret = EXSUCCEED;
3954 int did_set = EXFALSE;
3955
3956
3957 #ifdef NDRX_OAPI_DEBUG
3958 NDRX_LOG(log_debug, "ENTRY: tpviewtojson() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
3959 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
3960 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
3961
3962 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
3963 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
3964
3965 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
3966 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
3967
3968 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
3969 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
3970
3971 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
3972 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
3973
3974 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
3975 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
3976
3977 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
3978 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
3979 #endif
3980
3981
3982
3983
3984 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
3985 {
3986 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
3987 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
3988 {
3989 userlog("ERROR! tpviewtojson() failed to set context");
3990 EXFAIL_OUT(ret);
3991 }
3992 did_set = EXTRUE;
3993 }
3994 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
3995 {
3996 userlog("WARNING! tpviewtojson() context %p thinks that it is assocated "
3997 "with current thread, but thread is associated with %p context!",
3998 p_ctxt, G_atmi_tls);
3999 }
4000
4001 ret = tpviewtojson(cstruct, view, buffer, bufsize, flags);
4002
4003 if (did_set)
4004 {
4005 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
4006 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
4007 {
4008 userlog("ERROR! tpviewtojson() failed to get context");
4009 EXFAIL_OUT(ret);
4010 }
4011 }
4012 out:
4013
4014 #ifdef NDRX_OAPI_DEBUG
4015 NDRX_LOG(log_debug, "RETURN: tpviewtojson() returns, context: %p, current: %p",
4016 *p_ctxt, G_atmi_tls);
4017 #endif
4018
4019
4020 return ret;
4021 }
4022
4023
4024
4025
4026
4027 expublic char * Otpjsontoview(TPCONTEXT_T *p_ctxt, char *view, char *buffer)
4028 {
4029 int did_set = EXFALSE;
4030 char * ret = NULL;
4031
4032
4033 #ifdef NDRX_OAPI_DEBUG
4034 NDRX_LOG(log_debug, "ENTRY: tpjsontoview() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
4035 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
4036 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
4037
4038 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
4039 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
4040
4041 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
4042 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
4043
4044 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
4045 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
4046
4047 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
4048 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
4049
4050 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
4051 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
4052
4053 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
4054 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
4055 #endif
4056
4057
4058
4059 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
4060 {
4061
4062 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
4063 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
4064 {
4065 userlog("ERROR! tpjsontoview() failed to set context");
4066 ret = NULL;
4067 goto out;
4068 }
4069 did_set = EXTRUE;
4070 }
4071 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
4072 {
4073 userlog("WARNING! tpjsontoview() context %p thinks that it is assocated "
4074 "with current thread, but thread is associated with %p context!",
4075 p_ctxt, G_atmi_tls);
4076 }
4077
4078 ret = tpjsontoview(view, buffer);
4079
4080 if (did_set)
4081 {
4082 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
4083 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
4084 {
4085 userlog("ERROR! tpjsontoview() failed to get context");
4086 ret = NULL;
4087 goto out;
4088 }
4089 }
4090 out:
4091
4092 #ifdef NDRX_OAPI_DEBUG
4093 NDRX_LOG(log_debug, "RETURN: tpjsontoview() returns, context: %p, current: %p",
4094 *p_ctxt, G_atmi_tls);
4095 #endif
4096
4097
4098 return ret;
4099 }
4100
4101
4102
4103
4104
4105 expublic int Otpenqueue(TPCONTEXT_T *p_ctxt, char *qspace, char *qname, TPQCTL *ctl, char *data, long len, long flags)
4106 {
4107 int ret = EXSUCCEED;
4108 int did_set = EXFALSE;
4109
4110
4111 #ifdef NDRX_OAPI_DEBUG
4112 NDRX_LOG(log_debug, "ENTRY: tpenqueue() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
4113 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
4114 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
4115
4116 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
4117 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
4118
4119 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
4120 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
4121
4122 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
4123 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
4124
4125 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
4126 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
4127
4128 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
4129 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
4130
4131 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
4132 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
4133 #endif
4134
4135
4136
4137
4138 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
4139 {
4140 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
4141 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
4142 {
4143 userlog("ERROR! tpenqueue() failed to set context");
4144 EXFAIL_OUT(ret);
4145 }
4146 did_set = EXTRUE;
4147 }
4148 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
4149 {
4150 userlog("WARNING! tpenqueue() context %p thinks that it is assocated "
4151 "with current thread, but thread is associated with %p context!",
4152 p_ctxt, G_atmi_tls);
4153 }
4154
4155 ret = tpenqueue(qspace, qname, ctl, data, len, flags);
4156
4157 if (did_set)
4158 {
4159 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
4160 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
4161 {
4162 userlog("ERROR! tpenqueue() failed to get context");
4163 EXFAIL_OUT(ret);
4164 }
4165 }
4166 out:
4167
4168 #ifdef NDRX_OAPI_DEBUG
4169 NDRX_LOG(log_debug, "RETURN: tpenqueue() returns, context: %p, current: %p",
4170 *p_ctxt, G_atmi_tls);
4171 #endif
4172
4173
4174 return ret;
4175 }
4176
4177
4178
4179
4180
4181 expublic int Otpdequeue(TPCONTEXT_T *p_ctxt, char *qspace, char *qname, TPQCTL *ctl, char **data, long *len, long flags)
4182 {
4183 int ret = EXSUCCEED;
4184 int did_set = EXFALSE;
4185
4186
4187 #ifdef NDRX_OAPI_DEBUG
4188 NDRX_LOG(log_debug, "ENTRY: tpdequeue() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
4189 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
4190 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
4191
4192 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
4193 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
4194
4195 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
4196 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
4197
4198 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
4199 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
4200
4201 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
4202 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
4203
4204 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
4205 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
4206
4207 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
4208 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
4209 #endif
4210
4211
4212
4213
4214 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
4215 {
4216 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
4217 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
4218 {
4219 userlog("ERROR! tpdequeue() failed to set context");
4220 EXFAIL_OUT(ret);
4221 }
4222 did_set = EXTRUE;
4223 }
4224 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
4225 {
4226 userlog("WARNING! tpdequeue() context %p thinks that it is assocated "
4227 "with current thread, but thread is associated with %p context!",
4228 p_ctxt, G_atmi_tls);
4229 }
4230
4231 ret = tpdequeue(qspace, qname, ctl, data, len, flags);
4232
4233 if (did_set)
4234 {
4235 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
4236 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
4237 {
4238 userlog("ERROR! tpdequeue() failed to get context");
4239 EXFAIL_OUT(ret);
4240 }
4241 }
4242 out:
4243
4244 #ifdef NDRX_OAPI_DEBUG
4245 NDRX_LOG(log_debug, "RETURN: tpdequeue() returns, context: %p, current: %p",
4246 *p_ctxt, G_atmi_tls);
4247 #endif
4248
4249
4250 return ret;
4251 }
4252
4253
4254
4255
4256
4257 expublic int Otpenqueueex(TPCONTEXT_T *p_ctxt, short nodeid, short srvid, char *qname, TPQCTL *ctl, char *data, long len, long flags)
4258 {
4259 int ret = EXSUCCEED;
4260 int did_set = EXFALSE;
4261
4262
4263 #ifdef NDRX_OAPI_DEBUG
4264 NDRX_LOG(log_debug, "ENTRY: tpenqueueex() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
4265 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
4266 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
4267
4268 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
4269 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
4270
4271 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
4272 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
4273
4274 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
4275 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
4276
4277 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
4278 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
4279
4280 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
4281 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
4282
4283 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
4284 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
4285 #endif
4286
4287
4288
4289
4290 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
4291 {
4292 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
4293 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
4294 {
4295 userlog("ERROR! tpenqueueex() failed to set context");
4296 EXFAIL_OUT(ret);
4297 }
4298 did_set = EXTRUE;
4299 }
4300 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
4301 {
4302 userlog("WARNING! tpenqueueex() context %p thinks that it is assocated "
4303 "with current thread, but thread is associated with %p context!",
4304 p_ctxt, G_atmi_tls);
4305 }
4306
4307 ret = tpenqueueex(nodeid, srvid, qname, ctl, data, len, flags);
4308
4309 if (did_set)
4310 {
4311 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
4312 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
4313 {
4314 userlog("ERROR! tpenqueueex() failed to get context");
4315 EXFAIL_OUT(ret);
4316 }
4317 }
4318 out:
4319
4320 #ifdef NDRX_OAPI_DEBUG
4321 NDRX_LOG(log_debug, "RETURN: tpenqueueex() returns, context: %p, current: %p",
4322 *p_ctxt, G_atmi_tls);
4323 #endif
4324
4325
4326 return ret;
4327 }
4328
4329
4330
4331
4332
4333 expublic int Otpdequeueex(TPCONTEXT_T *p_ctxt, short nodeid, short srvid, char *qname, TPQCTL *ctl, char **data, long *len, long flags)
4334 {
4335 int ret = EXSUCCEED;
4336 int did_set = EXFALSE;
4337
4338
4339 #ifdef NDRX_OAPI_DEBUG
4340 NDRX_LOG(log_debug, "ENTRY: tpdequeueex() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
4341 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
4342 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
4343
4344 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
4345 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
4346
4347 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
4348 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
4349
4350 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
4351 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
4352
4353 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
4354 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
4355
4356 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
4357 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
4358
4359 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
4360 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
4361 #endif
4362
4363
4364
4365
4366 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
4367 {
4368 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
4369 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
4370 {
4371 userlog("ERROR! tpdequeueex() failed to set context");
4372 EXFAIL_OUT(ret);
4373 }
4374 did_set = EXTRUE;
4375 }
4376 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
4377 {
4378 userlog("WARNING! tpdequeueex() context %p thinks that it is assocated "
4379 "with current thread, but thread is associated with %p context!",
4380 p_ctxt, G_atmi_tls);
4381 }
4382
4383 ret = tpdequeueex(nodeid, srvid, qname, ctl, data, len, flags);
4384
4385 if (did_set)
4386 {
4387 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
4388 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
4389 {
4390 userlog("ERROR! tpdequeueex() failed to get context");
4391 EXFAIL_OUT(ret);
4392 }
4393 }
4394 out:
4395
4396 #ifdef NDRX_OAPI_DEBUG
4397 NDRX_LOG(log_debug, "RETURN: tpdequeueex() returns, context: %p, current: %p",
4398 *p_ctxt, G_atmi_tls);
4399 #endif
4400
4401
4402 return ret;
4403 }
4404
4405
4406
4407
4408
4409 expublic int Otpgetctxt(TPCONTEXT_T *p_ctxt, TPCONTEXT_T *context, long flags)
4410 {
4411 int ret = EXSUCCEED;
4412 int did_set = EXFALSE;
4413
4414
4415 #ifdef NDRX_OAPI_DEBUG
4416 NDRX_LOG(log_debug, "ENTRY: tpgetctxt() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
4417 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
4418 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
4419
4420 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
4421 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
4422
4423 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
4424 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
4425
4426 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
4427 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
4428
4429 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
4430 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
4431
4432 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
4433 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
4434
4435 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
4436 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
4437 #endif
4438
4439
4440
4441
4442 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
4443 {
4444 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
4445 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
4446 {
4447 userlog("ERROR! tpgetctxt() failed to set context");
4448 EXFAIL_OUT(ret);
4449 }
4450 did_set = EXTRUE;
4451 }
4452 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
4453 {
4454 userlog("WARNING! tpgetctxt() context %p thinks that it is assocated "
4455 "with current thread, but thread is associated with %p context!",
4456 p_ctxt, G_atmi_tls);
4457 }
4458
4459 ret = tpgetctxt(context, flags);
4460
4461 if (did_set)
4462 {
4463 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
4464 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
4465 {
4466 userlog("ERROR! tpgetctxt() failed to get context");
4467 EXFAIL_OUT(ret);
4468 }
4469 }
4470 out:
4471
4472 #ifdef NDRX_OAPI_DEBUG
4473 NDRX_LOG(log_debug, "RETURN: tpgetctxt() returns, context: %p, current: %p",
4474 *p_ctxt, G_atmi_tls);
4475 #endif
4476
4477
4478 return ret;
4479 }
4480
4481
4482
4483
4484
4485 expublic int Otpsetctxt(TPCONTEXT_T *p_ctxt, TPCONTEXT_T context, long flags)
4486 {
4487 int ret = EXSUCCEED;
4488 int did_set = EXFALSE;
4489
4490
4491 #ifdef NDRX_OAPI_DEBUG
4492 NDRX_LOG(log_debug, "ENTRY: tpsetctxt() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
4493 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
4494 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
4495
4496 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
4497 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
4498
4499 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
4500 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
4501
4502 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
4503 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
4504
4505 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
4506 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
4507
4508 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
4509 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
4510
4511 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
4512 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
4513 #endif
4514
4515
4516
4517
4518 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
4519 {
4520 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
4521 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
4522 {
4523 userlog("ERROR! tpsetctxt() failed to set context");
4524 EXFAIL_OUT(ret);
4525 }
4526 did_set = EXTRUE;
4527 }
4528 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
4529 {
4530 userlog("WARNING! tpsetctxt() context %p thinks that it is assocated "
4531 "with current thread, but thread is associated with %p context!",
4532 p_ctxt, G_atmi_tls);
4533 }
4534
4535 ret = tpsetctxt(context, flags);
4536
4537 if (did_set)
4538 {
4539 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
4540 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
4541 {
4542 userlog("ERROR! tpsetctxt() failed to get context");
4543 EXFAIL_OUT(ret);
4544 }
4545 }
4546 out:
4547
4548 #ifdef NDRX_OAPI_DEBUG
4549 NDRX_LOG(log_debug, "RETURN: tpsetctxt() returns, context: %p, current: %p",
4550 *p_ctxt, G_atmi_tls);
4551 #endif
4552
4553
4554 return ret;
4555 }
4556
4557
4558
4559
4560 expublic void Otpfreectxt(TPCONTEXT_T *p_ctxt, TPCONTEXT_T context)
4561 {
4562 int did_set = EXFALSE;
4563
4564
4565 #ifdef NDRX_OAPI_DEBUG
4566 NDRX_LOG(log_debug, "ENTRY: tpfreectxt() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
4567 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
4568 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
4569
4570 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
4571 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
4572
4573 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
4574 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
4575
4576 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
4577 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
4578
4579 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
4580 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
4581
4582 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
4583 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
4584
4585 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
4586 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
4587 #endif
4588
4589
4590
4591
4592 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
4593 {
4594
4595 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
4596 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
4597 {
4598 userlog("ERROR! tpfreectxt() failed to set context");
4599 }
4600 did_set = EXTRUE;
4601 }
4602 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
4603 {
4604 userlog("WARNING! tpfreectxt() context %p thinks that it is assocated "
4605 "with current thread, but thread is associated with %p context!",
4606 p_ctxt, G_atmi_tls);
4607 }
4608
4609 tpfreectxt(context);
4610
4611 *p_ctxt = NULL;
4612
4613 out:
4614
4615 #ifdef NDRX_OAPI_DEBUG
4616 NDRX_LOG(log_debug, "RETURN: tpfreectxt() returns, context: %p, current: %p",
4617 *p_ctxt, G_atmi_tls);
4618 #endif
4619
4620
4621 return;
4622 }
4623
4624
4625
4626
4627
4628 expublic int Otplogsetreqfile(TPCONTEXT_T *p_ctxt, char **data, char *filename, char *filesvc)
4629 {
4630 int ret = EXSUCCEED;
4631 int did_set = EXFALSE;
4632
4633
4634 #ifdef NDRX_OAPI_DEBUG
4635 NDRX_LOG(log_debug, "ENTRY: tplogsetreqfile() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
4636 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
4637 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
4638
4639 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
4640 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
4641
4642 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
4643 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
4644
4645 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
4646 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
4647
4648 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
4649 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
4650
4651 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
4652 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
4653
4654 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
4655 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
4656 #endif
4657
4658
4659
4660
4661 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
4662 {
4663 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
4664 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
4665 {
4666 userlog("ERROR! tplogsetreqfile() failed to set context");
4667 EXFAIL_OUT(ret);
4668 }
4669 did_set = EXTRUE;
4670 }
4671 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
4672 {
4673 userlog("WARNING! tplogsetreqfile() context %p thinks that it is assocated "
4674 "with current thread, but thread is associated with %p context!",
4675 p_ctxt, G_atmi_tls);
4676 }
4677
4678 ret = tplogsetreqfile(data, filename, filesvc);
4679
4680 if (did_set)
4681 {
4682 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
4683 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
4684 {
4685 userlog("ERROR! tplogsetreqfile() failed to get context");
4686 EXFAIL_OUT(ret);
4687 }
4688 }
4689 out:
4690
4691 #ifdef NDRX_OAPI_DEBUG
4692 NDRX_LOG(log_debug, "RETURN: tplogsetreqfile() returns, context: %p, current: %p",
4693 *p_ctxt, G_atmi_tls);
4694 #endif
4695
4696
4697 return ret;
4698 }
4699
4700
4701
4702
4703
4704 expublic int Otploggetbufreqfile(TPCONTEXT_T *p_ctxt, char *data, char *filename, int bufsize)
4705 {
4706 int ret = EXSUCCEED;
4707 int did_set = EXFALSE;
4708
4709
4710 #ifdef NDRX_OAPI_DEBUG
4711 NDRX_LOG(log_debug, "ENTRY: tploggetbufreqfile() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
4712 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
4713 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
4714
4715 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
4716 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
4717
4718 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
4719 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
4720
4721 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
4722 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
4723
4724 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
4725 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
4726
4727 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
4728 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
4729
4730 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
4731 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
4732 #endif
4733
4734
4735
4736
4737 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
4738 {
4739 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
4740 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
4741 {
4742 userlog("ERROR! tploggetbufreqfile() failed to set context");
4743 EXFAIL_OUT(ret);
4744 }
4745 did_set = EXTRUE;
4746 }
4747 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
4748 {
4749 userlog("WARNING! tploggetbufreqfile() context %p thinks that it is assocated "
4750 "with current thread, but thread is associated with %p context!",
4751 p_ctxt, G_atmi_tls);
4752 }
4753
4754 ret = tploggetbufreqfile(data, filename, bufsize);
4755
4756 if (did_set)
4757 {
4758 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
4759 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
4760 {
4761 userlog("ERROR! tploggetbufreqfile() failed to get context");
4762 EXFAIL_OUT(ret);
4763 }
4764 }
4765 out:
4766
4767 #ifdef NDRX_OAPI_DEBUG
4768 NDRX_LOG(log_debug, "RETURN: tploggetbufreqfile() returns, context: %p, current: %p",
4769 *p_ctxt, G_atmi_tls);
4770 #endif
4771
4772
4773 return ret;
4774 }
4775
4776
4777
4778
4779
4780 expublic int Otplogdelbufreqfile(TPCONTEXT_T *p_ctxt, char *data)
4781 {
4782 int ret = EXSUCCEED;
4783 int did_set = EXFALSE;
4784
4785
4786 #ifdef NDRX_OAPI_DEBUG
4787 NDRX_LOG(log_debug, "ENTRY: tplogdelbufreqfile() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
4788 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
4789 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
4790
4791 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
4792 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
4793
4794 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
4795 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
4796
4797 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
4798 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
4799
4800 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
4801 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
4802
4803 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
4804 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
4805
4806 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
4807 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
4808 #endif
4809
4810
4811
4812
4813 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
4814 {
4815 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
4816 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
4817 {
4818 userlog("ERROR! tplogdelbufreqfile() failed to set context");
4819 EXFAIL_OUT(ret);
4820 }
4821 did_set = EXTRUE;
4822 }
4823 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
4824 {
4825 userlog("WARNING! tplogdelbufreqfile() context %p thinks that it is assocated "
4826 "with current thread, but thread is associated with %p context!",
4827 p_ctxt, G_atmi_tls);
4828 }
4829
4830 ret = tplogdelbufreqfile(data);
4831
4832 if (did_set)
4833 {
4834 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
4835 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
4836 {
4837 userlog("ERROR! tplogdelbufreqfile() failed to get context");
4838 EXFAIL_OUT(ret);
4839 }
4840 }
4841 out:
4842
4843 #ifdef NDRX_OAPI_DEBUG
4844 NDRX_LOG(log_debug, "RETURN: tplogdelbufreqfile() returns, context: %p, current: %p",
4845 *p_ctxt, G_atmi_tls);
4846 #endif
4847
4848
4849 return ret;
4850 }
4851
4852
4853
4854
4855 expublic void Otplogprintubf(TPCONTEXT_T *p_ctxt, int lev, char *title, UBFH *p_ub)
4856 {
4857 int did_set = EXFALSE;
4858
4859
4860 #ifdef NDRX_OAPI_DEBUG
4861 NDRX_LOG(log_debug, "ENTRY: tplogprintubf() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
4862 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
4863 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
4864
4865 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
4866 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
4867
4868 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
4869 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
4870
4871 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
4872 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
4873
4874 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
4875 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
4876
4877 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
4878 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
4879
4880 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
4881 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
4882 #endif
4883
4884
4885
4886
4887 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
4888 {
4889
4890 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
4891 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
4892 {
4893 userlog("ERROR! tplogprintubf() failed to set context");
4894 }
4895 did_set = EXTRUE;
4896 }
4897 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
4898 {
4899 userlog("WARNING! tplogprintubf() context %p thinks that it is assocated "
4900 "with current thread, but thread is associated with %p context!",
4901 p_ctxt, G_atmi_tls);
4902 }
4903
4904 tplogprintubf(lev, title, p_ub);
4905
4906 if (did_set)
4907 {
4908 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
4909 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
4910 {
4911 userlog("ERROR! tplogprintubf() failed to get context");
4912 }
4913 }
4914 out:
4915
4916 #ifdef NDRX_OAPI_DEBUG
4917 NDRX_LOG(log_debug, "RETURN: tplogprintubf() returns, context: %p, current: %p",
4918 *p_ctxt, G_atmi_tls);
4919 #endif
4920
4921
4922 return;
4923 }
4924
4925
4926
4927
4928 expublic void Ondrx_ndrx_tmunsolerr_handler(TPCONTEXT_T *p_ctxt, char *data, long len, long flags)
4929 {
4930 int did_set = EXFALSE;
4931
4932
4933 #ifdef NDRX_OAPI_DEBUG
4934 NDRX_LOG(log_debug, "ENTRY: ndrx_ndrx_tmunsolerr_handler() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
4935 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
4936 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
4937
4938 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
4939 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
4940
4941 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
4942 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
4943
4944 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
4945 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
4946
4947 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
4948 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
4949
4950 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
4951 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
4952
4953 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
4954 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
4955 #endif
4956
4957
4958
4959
4960 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
4961 {
4962
4963 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
4964 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
4965 {
4966 userlog("ERROR! ndrx_ndrx_tmunsolerr_handler() failed to set context");
4967 }
4968 did_set = EXTRUE;
4969 }
4970 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
4971 {
4972 userlog("WARNING! ndrx_ndrx_tmunsolerr_handler() context %p thinks that it is assocated "
4973 "with current thread, but thread is associated with %p context!",
4974 p_ctxt, G_atmi_tls);
4975 }
4976
4977 ndrx_ndrx_tmunsolerr_handler(data, len, flags);
4978
4979 if (did_set)
4980 {
4981 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
4982 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
4983 {
4984 userlog("ERROR! ndrx_ndrx_tmunsolerr_handler() failed to get context");
4985 }
4986 }
4987 out:
4988
4989 #ifdef NDRX_OAPI_DEBUG
4990 NDRX_LOG(log_debug, "RETURN: ndrx_ndrx_tmunsolerr_handler() returns, context: %p, current: %p",
4991 *p_ctxt, G_atmi_tls);
4992 #endif
4993
4994
4995 return;
4996 }
4997
4998
4999
5000
5001 expublic void Ondrx_atfork_child(TPCONTEXT_T *p_ctxt)
5002 {
5003 int did_set = EXFALSE;
5004
5005
5006 #ifdef NDRX_OAPI_DEBUG
5007 NDRX_LOG(log_debug, "ENTRY: ndrx_atfork_child() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
5008 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
5009 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
5010
5011 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
5012 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
5013
5014 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
5015 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
5016
5017 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
5018 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
5019
5020 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
5021 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
5022
5023 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
5024 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
5025
5026 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
5027 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
5028 #endif
5029
5030
5031
5032
5033 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
5034 {
5035
5036 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
5037 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5038 {
5039 userlog("ERROR! ndrx_atfork_child() failed to set context");
5040 }
5041 did_set = EXTRUE;
5042 }
5043 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
5044 {
5045 userlog("WARNING! ndrx_atfork_child() context %p thinks that it is assocated "
5046 "with current thread, but thread is associated with %p context!",
5047 p_ctxt, G_atmi_tls);
5048 }
5049
5050 ndrx_atfork_child();
5051
5052 if (did_set)
5053 {
5054 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
5055 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5056 {
5057 userlog("ERROR! ndrx_atfork_child() failed to get context");
5058 }
5059 }
5060 out:
5061
5062 #ifdef NDRX_OAPI_DEBUG
5063 NDRX_LOG(log_debug, "RETURN: ndrx_atfork_child() returns, context: %p, current: %p",
5064 *p_ctxt, G_atmi_tls);
5065 #endif
5066
5067
5068 return;
5069 }
5070
5071
5072
5073
5074 expublic void Ondrx_atfork_parent(TPCONTEXT_T *p_ctxt)
5075 {
5076 int did_set = EXFALSE;
5077
5078
5079 #ifdef NDRX_OAPI_DEBUG
5080 NDRX_LOG(log_debug, "ENTRY: ndrx_atfork_parent() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
5081 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
5082 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
5083
5084 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
5085 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
5086
5087 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
5088 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
5089
5090 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
5091 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
5092
5093 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
5094 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
5095
5096 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
5097 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
5098
5099 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
5100 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
5101 #endif
5102
5103
5104
5105
5106 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
5107 {
5108
5109 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
5110 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5111 {
5112 userlog("ERROR! ndrx_atfork_parent() failed to set context");
5113 }
5114 did_set = EXTRUE;
5115 }
5116 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
5117 {
5118 userlog("WARNING! ndrx_atfork_parent() context %p thinks that it is assocated "
5119 "with current thread, but thread is associated with %p context!",
5120 p_ctxt, G_atmi_tls);
5121 }
5122
5123 ndrx_atfork_parent();
5124
5125 if (did_set)
5126 {
5127 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
5128 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5129 {
5130 userlog("ERROR! ndrx_atfork_parent() failed to get context");
5131 }
5132 }
5133 out:
5134
5135 #ifdef NDRX_OAPI_DEBUG
5136 NDRX_LOG(log_debug, "RETURN: ndrx_atfork_parent() returns, context: %p, current: %p",
5137 *p_ctxt, G_atmi_tls);
5138 #endif
5139
5140
5141 return;
5142 }
5143
5144
5145
5146
5147 expublic void Ondrx_atfork_prepare(TPCONTEXT_T *p_ctxt)
5148 {
5149 int did_set = EXFALSE;
5150
5151
5152 #ifdef NDRX_OAPI_DEBUG
5153 NDRX_LOG(log_debug, "ENTRY: ndrx_atfork_prepare() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
5154 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
5155 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
5156
5157 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
5158 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
5159
5160 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
5161 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
5162
5163 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
5164 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
5165
5166 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
5167 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
5168
5169 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
5170 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
5171
5172 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
5173 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
5174 #endif
5175
5176
5177
5178
5179 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
5180 {
5181
5182 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
5183 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5184 {
5185 userlog("ERROR! ndrx_atfork_prepare() failed to set context");
5186 }
5187 did_set = EXTRUE;
5188 }
5189 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
5190 {
5191 userlog("WARNING! ndrx_atfork_prepare() context %p thinks that it is assocated "
5192 "with current thread, but thread is associated with %p context!",
5193 p_ctxt, G_atmi_tls);
5194 }
5195
5196 ndrx_atfork_prepare();
5197
5198 if (did_set)
5199 {
5200 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
5201 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5202 {
5203 userlog("ERROR! ndrx_atfork_prepare() failed to get context");
5204 }
5205 }
5206 out:
5207
5208 #ifdef NDRX_OAPI_DEBUG
5209 NDRX_LOG(log_debug, "RETURN: ndrx_atfork_prepare() returns, context: %p, current: %p",
5210 *p_ctxt, G_atmi_tls);
5211 #endif
5212
5213
5214 return;
5215 }
5216
5217
5218
5219
5220
5221 expublic int Otpencrypt(TPCONTEXT_T *p_ctxt, char *input, long ilen, char *output, long *olen, long flags)
5222 {
5223 int ret = EXSUCCEED;
5224 int did_set = EXFALSE;
5225
5226
5227 #ifdef NDRX_OAPI_DEBUG
5228 NDRX_LOG(log_debug, "ENTRY: tpencrypt() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
5229 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
5230 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
5231
5232 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
5233 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
5234
5235 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
5236 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
5237
5238 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
5239 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
5240
5241 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
5242 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
5243
5244 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
5245 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
5246
5247 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
5248 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
5249 #endif
5250
5251
5252
5253
5254 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
5255 {
5256 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
5257 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5258 {
5259 userlog("ERROR! tpencrypt() failed to set context");
5260 EXFAIL_OUT(ret);
5261 }
5262 did_set = EXTRUE;
5263 }
5264 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
5265 {
5266 userlog("WARNING! tpencrypt() context %p thinks that it is assocated "
5267 "with current thread, but thread is associated with %p context!",
5268 p_ctxt, G_atmi_tls);
5269 }
5270
5271 ret = tpencrypt(input, ilen, output, olen, flags);
5272
5273 if (did_set)
5274 {
5275 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
5276 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5277 {
5278 userlog("ERROR! tpencrypt() failed to get context");
5279 EXFAIL_OUT(ret);
5280 }
5281 }
5282 out:
5283
5284 #ifdef NDRX_OAPI_DEBUG
5285 NDRX_LOG(log_debug, "RETURN: tpencrypt() returns, context: %p, current: %p",
5286 *p_ctxt, G_atmi_tls);
5287 #endif
5288
5289
5290 return ret;
5291 }
5292
5293
5294
5295
5296
5297 expublic int Otpdecrypt(TPCONTEXT_T *p_ctxt, char *input, long ilen, char *output, long *olen, long flags)
5298 {
5299 int ret = EXSUCCEED;
5300 int did_set = EXFALSE;
5301
5302
5303 #ifdef NDRX_OAPI_DEBUG
5304 NDRX_LOG(log_debug, "ENTRY: tpdecrypt() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
5305 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
5306 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
5307
5308 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
5309 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
5310
5311 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
5312 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
5313
5314 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
5315 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
5316
5317 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
5318 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
5319
5320 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
5321 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
5322
5323 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
5324 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
5325 #endif
5326
5327
5328
5329
5330 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
5331 {
5332 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
5333 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5334 {
5335 userlog("ERROR! tpdecrypt() failed to set context");
5336 EXFAIL_OUT(ret);
5337 }
5338 did_set = EXTRUE;
5339 }
5340 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
5341 {
5342 userlog("WARNING! tpdecrypt() context %p thinks that it is assocated "
5343 "with current thread, but thread is associated with %p context!",
5344 p_ctxt, G_atmi_tls);
5345 }
5346
5347 ret = tpdecrypt(input, ilen, output, olen, flags);
5348
5349 if (did_set)
5350 {
5351 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
5352 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5353 {
5354 userlog("ERROR! tpdecrypt() failed to get context");
5355 EXFAIL_OUT(ret);
5356 }
5357 }
5358 out:
5359
5360 #ifdef NDRX_OAPI_DEBUG
5361 NDRX_LOG(log_debug, "RETURN: tpdecrypt() returns, context: %p, current: %p",
5362 *p_ctxt, G_atmi_tls);
5363 #endif
5364
5365
5366 return ret;
5367 }
5368
5369
5370
5371
5372
5373 expublic int Otpsprio(TPCONTEXT_T *p_ctxt, int prio, long flags)
5374 {
5375 int ret = EXSUCCEED;
5376 int did_set = EXFALSE;
5377
5378
5379 #ifdef NDRX_OAPI_DEBUG
5380 NDRX_LOG(log_debug, "ENTRY: tpsprio() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
5381 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
5382 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
5383
5384 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
5385 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
5386
5387 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
5388 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
5389
5390 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
5391 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
5392
5393 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
5394 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
5395
5396 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
5397 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
5398
5399 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
5400 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
5401 #endif
5402
5403
5404
5405
5406 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
5407 {
5408 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
5409 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5410 {
5411 userlog("ERROR! tpsprio() failed to set context");
5412 EXFAIL_OUT(ret);
5413 }
5414 did_set = EXTRUE;
5415 }
5416 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
5417 {
5418 userlog("WARNING! tpsprio() context %p thinks that it is assocated "
5419 "with current thread, but thread is associated with %p context!",
5420 p_ctxt, G_atmi_tls);
5421 }
5422
5423 ret = tpsprio(prio, flags);
5424
5425 if (did_set)
5426 {
5427 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
5428 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5429 {
5430 userlog("ERROR! tpsprio() failed to get context");
5431 EXFAIL_OUT(ret);
5432 }
5433 }
5434 out:
5435
5436 #ifdef NDRX_OAPI_DEBUG
5437 NDRX_LOG(log_debug, "RETURN: tpsprio() returns, context: %p, current: %p",
5438 *p_ctxt, G_atmi_tls);
5439 #endif
5440
5441
5442 return ret;
5443 }
5444
5445
5446
5447
5448
5449 expublic int Otpgprio(TPCONTEXT_T *p_ctxt)
5450 {
5451 int ret = EXSUCCEED;
5452 int did_set = EXFALSE;
5453
5454
5455 #ifdef NDRX_OAPI_DEBUG
5456 NDRX_LOG(log_debug, "ENTRY: tpgprio() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
5457 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
5458 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
5459
5460 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
5461 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
5462
5463 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
5464 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
5465
5466 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
5467 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
5468
5469 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
5470 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
5471
5472 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
5473 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
5474
5475 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
5476 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
5477 #endif
5478
5479
5480
5481
5482 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
5483 {
5484 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
5485 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5486 {
5487 userlog("ERROR! tpgprio() failed to set context");
5488 EXFAIL_OUT(ret);
5489 }
5490 did_set = EXTRUE;
5491 }
5492 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
5493 {
5494 userlog("WARNING! tpgprio() context %p thinks that it is assocated "
5495 "with current thread, but thread is associated with %p context!",
5496 p_ctxt, G_atmi_tls);
5497 }
5498
5499 ret = tpgprio();
5500
5501 if (did_set)
5502 {
5503 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
5504 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5505 {
5506 userlog("ERROR! tpgprio() failed to get context");
5507 EXFAIL_OUT(ret);
5508 }
5509 }
5510 out:
5511
5512 #ifdef NDRX_OAPI_DEBUG
5513 NDRX_LOG(log_debug, "RETURN: tpgprio() returns, context: %p, current: %p",
5514 *p_ctxt, G_atmi_tls);
5515 #endif
5516
5517
5518 return ret;
5519 }
5520
5521
5522
5523
5524
5525 expublic int Otpsblktime(TPCONTEXT_T *p_ctxt, int tout,long flags)
5526 {
5527 int ret = EXSUCCEED;
5528 int did_set = EXFALSE;
5529
5530
5531 #ifdef NDRX_OAPI_DEBUG
5532 NDRX_LOG(log_debug, "ENTRY: tpsblktime() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
5533 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
5534 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
5535
5536 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
5537 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
5538
5539 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
5540 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
5541
5542 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
5543 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
5544
5545 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
5546 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
5547
5548 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
5549 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
5550
5551 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
5552 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
5553 #endif
5554
5555
5556
5557
5558 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
5559 {
5560 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
5561 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5562 {
5563 userlog("ERROR! tpsblktime() failed to set context");
5564 EXFAIL_OUT(ret);
5565 }
5566 did_set = EXTRUE;
5567 }
5568 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
5569 {
5570 userlog("WARNING! tpsblktime() context %p thinks that it is assocated "
5571 "with current thread, but thread is associated with %p context!",
5572 p_ctxt, G_atmi_tls);
5573 }
5574
5575 ret = tpsblktime(tout, flags);
5576
5577 if (did_set)
5578 {
5579 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
5580 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5581 {
5582 userlog("ERROR! tpsblktime() failed to get context");
5583 EXFAIL_OUT(ret);
5584 }
5585 }
5586 out:
5587
5588 #ifdef NDRX_OAPI_DEBUG
5589 NDRX_LOG(log_debug, "RETURN: tpsblktime() returns, context: %p, current: %p",
5590 *p_ctxt, G_atmi_tls);
5591 #endif
5592
5593
5594 return ret;
5595 }
5596
5597
5598
5599
5600
5601 expublic int Otpgblktime(TPCONTEXT_T *p_ctxt, long flags)
5602 {
5603 int ret = EXSUCCEED;
5604 int did_set = EXFALSE;
5605
5606
5607 #ifdef NDRX_OAPI_DEBUG
5608 NDRX_LOG(log_debug, "ENTRY: tpgblktime() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
5609 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
5610 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
5611
5612 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
5613 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
5614
5615 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
5616 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
5617
5618 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
5619 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
5620
5621 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
5622 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
5623
5624 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
5625 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
5626
5627 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
5628 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
5629 #endif
5630
5631
5632
5633
5634 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
5635 {
5636 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
5637 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5638 {
5639 userlog("ERROR! tpgblktime() failed to set context");
5640 EXFAIL_OUT(ret);
5641 }
5642 did_set = EXTRUE;
5643 }
5644 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
5645 {
5646 userlog("WARNING! tpgblktime() context %p thinks that it is assocated "
5647 "with current thread, but thread is associated with %p context!",
5648 p_ctxt, G_atmi_tls);
5649 }
5650
5651 ret = tpgblktime(flags);
5652
5653 if (did_set)
5654 {
5655 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
5656 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
5657 {
5658 userlog("ERROR! tpgblktime() failed to get context");
5659 EXFAIL_OUT(ret);
5660 }
5661 }
5662 out:
5663
5664 #ifdef NDRX_OAPI_DEBUG
5665 NDRX_LOG(log_debug, "RETURN: tpgblktime() returns, context: %p, current: %p",
5666 *p_ctxt, G_atmi_tls);
5667 #endif
5668
5669
5670 return ret;
5671 }
5672
5673