IBM MQ API exit context structure (MQAXC)
The MQAXC structure, an external control block, is used as an input parameter to an API exit.
MQAXC has the following C declaration:typedef struct tagMQAXC { MQCHAR4 StrucId; /* Structure identifier */ MQLONG Version; /* Structure version number */ MQLONG Environment; /* Environment */ MQCHAR12 UserId; /* UserId associated with appl */ MQBYTE40 SecurityId /* Extension to UserId running appl */ MQCHAR264 ConnectionName; /* Connection name */ MQLONG LongMCAUserIdLength; /* long MCA user identifier length */ MQLONG LongRemoteUserIdLength; /* long remote user identifier length */ MQPTR LongMCAUserIdPtr; /* long MCA user identifier address */ MQPTR LongRemoteUserIdPtr; /* long remote user identifier address */ MQCHAR28 ApplName; /* Application name */ MQLONG ApplType; /* Application type */ MQPID ProcessId; /* Process identifier */ MQTID ThreadId; /* Thread identifier */ /* Ver:1 */ MQCHAR ChannelName[20] /* Channel Name */ MQBYTE4 Reserved1; /* Reserved */ PMQCD pChannelDefinition; /* Channel Definition pointer */ };The parameters to MQAXC are:
- StrucId (MQCHAR4) - input
- The exit context structure identifier, with a value of MQAXC_STRUC_ID. For C programs, the constant MQAXC_STRUC_ID_ARRAY is also defined, with the same value as MQAXC_STRUC_ID, but as an array of characters instead of a string.
The exit handler sets this field on entry to each exit function.
- Version (MQLONG) - input
- The structure version number, with a value of:
- MQAXC_VERSION_2
- Version number for the exit context structure.
- MQAXC_CURRENT_VERSION
- Current version number for the exit context structure.
The exit handler sets this field on entry to each exit function.
- Environment (MQLONG) - input
- The environment from which an IBM MQ API call was issued that resulted in an exit function being driven. Valid values for this field are:
- MQXE_OTHER
- This value is consistent with invocations an API exit sees if the exit is called from a server application. This means that an API exit runs unchanged on a client and does not see anything different.
If the exit really needs to determine whether it is running on the client, the exit can do so by looking at the ChannelName and ChannelDefinition fields.
- MQXE_MCA
- Message channel agent
- MQXE_MCA_SVRCONN
- A message channel agent acting on behalf of a client
- MQXE_COMMAND_SERVER
- The command server
- MQXE_MQSC
- The runmqsc command interpreter
The exit handler sets this field on entry to each exit function.
- UserId (MQCHAR12) - input
- The user ID associated with the application. In particular, in the case of client connections, this field contains the user ID of the adopted user as opposed to the user ID under which the channel code is running. If a blank user ID flows from the client, then no change is made to the user ID already being used. That is, no new user ID is adopted.
The exit handler sets this field on entry to each exit function. The length of this field is given by MQ_USER_ID_LENGTH.
In the case of a client, this is the user ID sent from the client to the server. Note, that this might not be the effective user ID the client is running against in the queue manager, as there could be an MCAUser or CHLAUTH configuration which changes the user ID.
- SecurityId (MQBYTE40) - input
- An extension to the user ID running the application. Its length is given by MQ_SECURITY_ID_LENGTH.
In the case of a client, this is the user ID sent from the client to the server. Note, that this might not be the effective user ID the client is running against in the queue manager, as there could be an MCAUser or CHLAUTH configuration which changes the user ID.
- ConnectionName (MQCHAR264) - input
- The connection name field, set to the address of the client. For example, for TCP/IP, it would be the client IP address.
The length of this field is given by MQ_CONN_NAME_LENGTH.
In the case of a client, this is the partner address of the queue manager.
- LongMCAUserIdLength (MQLONG) - input
- The length of the long MCA user identifier.
When MCA connects to the queue manager this field is set to the length of the long MCA user identifier (or zero if there is no such identifier).
In the case of a client, this is the client long user identifier.
- LongRemoteUserIdLength (MQLONG) - input
- The length of the long remote user identifier.
When MCA connects to the queue manager this field is set to the length of the long remote user identifier. Otherwise this field will be set to zero
In the case of a client, set this field to zero.
- LongMCAUserIdPtr (MQPTR) - input
- Address of long MCA user identifier.
When MCA connects to the queue manager this field is set to the address of the long MCA user identifier (or to a null pointer if there is no such identifier).
In the case of a client, this is the client long user identifier.
- LongRemoteUserIdPtr (MQPTR) - input
- The address of the long remote user identifier.
When MCA connects to the queue manager this field is set to the address of the long remote user identifier (or to a null pointer if there is no such identifier).
In the case of a client, set this field to zero.
- ApplName (MQCHAR28) - input
- The name of the application or component that issued the IBM MQ API call.
The rules for generating the ApplName are the same as for generating the default name for an MQPUT.
The value of this field is found by querying the operating system for the program name. Its length is given by MQ_APPL_NAME_LENGTH.
- ApplType (MQLONG) - input
- The type of application or component that issued the IBM MQ API call.
The value is MQAT_DEFAULT for the platform on which the application is compiled, or it equates to one of the defined MQAT_* values.
The exit handler sets this field on entry to each exit function.
- ProcessId (MQPID) - input
- The operating system process identifier.
Where applicable, the exit handler sets this field on entry to each exit function.
- ThreadId (MQTID) - input
- The MQ thread identifier. This is the same identifier used in MQ trace and FFST dumps, but might be different from the operating system thread identifier.
Where applicable, the exit handler sets this field on entry to each exit function.
- ChannelName (MQCHAR) - input
- The name of the channel, padded with blanks, if applicable and known.
If not applicable, this field is set to NULL characters.
- Reserved1 (MQBYTE4) - input
- This field is reserved.
- ChanneDefinition (PMQCD) - input
- A pointer to the channel definition being used, if applicable and known.
If not applicable, this field is set to NULL characters.
Note that the pointer is only completed if the connection is processing on behalf of an IBM MQ channel and that channel definition has been read.
In particular, the channel definition is not given on the server when the first MQCONN call is made for the channel. Furthermore, if the pointer is filled, the structure (and any sub structures) pointed to by the pointer must be treated as read only; any updating of the structure would lead to unpredictable results and is not supported.
In the case of a client, fields other than those with a value specified for a client, contain values that are appropriate for a client application.