Intercept C++ method calls (Tuxedo, tpcall)

847 views Asked by At

General question on intercepting C++ method calls...

Are there any open-source frameworks? Using Tuxedo (11+) as my container so basically I want to do an "around" on successful tpcall calls. TSAM from Tuxedo does this as an extension but I would rather skip the TSAM elephant and trap tpcall calls myself.

Ideas?

2

There are 2 answers

0
aivarsk On BEST ANSWER

I think there are 2 possible solutions:

1) The simplest one is to implement tputrace(3c) function and libutrace.so and catch tpcall or tpservice there. The downside of this approach is that you will have to turn on tmtrace for you application which I wouldn't rely on for business functionality. It's fine for monitoring, debugging, etc.

2) Implement custom TSAM+ Tuxedo plug-in. You can enable just your own plug-in and skip mondebug, monshm elephants. Or you can skip TSAM+ completely and implement plug-in for undocumented engine/tsam/agent interface.

I wrote about similar problem for my DIY Tuxedo monitoring

1
Erhard Siegl On

If you want to intercept service MYSERVICE, you can write write an general service named INTERCEPTOR and do the following:

  1. Unadvertise MYSERVICE and advertise it with name INTER_MYSERVICE
  2. Advertise the INTERCEPTOR with the name MYSERVICE
  3. The INTERCEPTOR-service must look with which name it was called (MYSERVICE) and has to forward the call to the service with name INTER_name, in this case INTER_MYSERVICE.

This configuration can be done dynamically without restarts.

I use this for debugging/logging-purpose in development, where it works quite well. I'm not sure whether I would use it in production. Also we only use XOCTET buffer-types, which makes it easier, but I think it should work with different buffer-types as well.

Also doing it for hundreds of services at the same time might become a problem.