libmqm_sys/
lib.rs

1/*!
2
3Bindings to the IBM® MQ Interface (MQI), Programmable Command Format (PCF) and MQ Administration Interface (MQAI) C libraries.
4
5Overview
6--------
7
8You can use `libmqm_sys` to:
9
10- Connect to an IBM MQ server to send and receive MQ messages through the MQI functions
11- Administer IBM MQ server through the PCF structures and MQAI functions
12- Create, send, and receive PCF messages
13- Develop MQ exit programs (untested)
14
15Compile time dynamic linking and run-time dynamic linking is supported.
16
17Developers must download the [MQI library](https://ibm.biz/mq94redistclients) directly from IBM.
18Refer to the [Usage](#usage) instructions.
19
20Safety
21------
22
23Functions provided in this crate are the raw `unsafe` functions exposed from the
24IBM provided library. Developers should build safe rust API wrappers over these functions.
25Developers who do not want to use the unsafe API should use the
26[mqi](https://github.com/advantic-au/mqi) crate for a *safe* API over the MQI.
27
28Usage
29-----
30
311. Download and install the redistributable client from IBM:
32   <https://ibm.biz/mq94redistclients>
33
342. Install the client in `/opt/mqm` or another location.
35
363. Set the `MQ_HOME` environment variable to the installed location.
37
38    ```bash
39    MQ_HOME=/opt/mqm
40    ```
41
424. Add the `libmqm_sys` crate to your project:
43
44    ```sh
45    cargo add libmqm_sys
46    ```
47
485. Use the crate in your source code:
49
50    ```rust
51    use libmqm_sys as mq;
52    ```
53
54Example
55-------
56
57```no_run
58use libmqm_sys as mq;
59
60let mut hconn = mq::MQHC_DEF_HCONN;
61let mut comp_code = mq::MQCC_UNKNOWN;
62let mut reason = mq::MQRC_NONE;
63let mut qmgr: mq::MQCHAR48 = [32; 48]; // All spaces = default qmgr
64
65unsafe {
66    mq::MQCONN(
67        &qmgr,
68        &mut hconn,
69        &mut comp_code,
70        &mut reason,
71    );
72    assert_eq!(reason, mq::MQRC_NONE, "MQRC");
73    assert_eq!(comp_code, mq::MQCC_OK, "MQCC");
74    mq::MQDISC(&mut hconn, &mut comp_code, &mut reason);
75};
76```
77
78## Features
79
80*/
81
82#![cfg_attr(feature = "docsrs", doc = document_features::document_features!())]
83
84/*!
85
86Minimum MQ client can be set using the `mqc_*` features
87*/
88
89/*!
90
91Support
92-------
93
94This crate is not approved, endorsed, acknowledged, or supported by IBM. You cannot use
95IBM formal support channels (Cases/PMRs) for assistance on the use of this crate.
96
97Documentation
98-------------
99
100Documentation of all API functions, arguments, structures, type aliases, and constants are derived
101from the MQ library header files. Accuracy of the documentation is dependent on IBM supplied header
102files.
103
104 */
105#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg, doc_cfg_hide))]
106#![cfg_attr(docsrs, doc(cfg_hide(feature = "bindgen")))]
107
108#[cfg(feature = "bindgen")]
109#[rustfmt::skip]
110#[path ="bindgen.rs"]
111mod generated;
112
113#[cfg(not(feature = "bindgen"))]
114#[rustfmt::skip]
115#[path = "pregen/mod.rs"]
116mod generated;
117
118pub use generated::function::*;
119
120pub use generated::bindings::mqi::*;
121
122pub mod version {
123    /*!
124       MQ library version information used in generation of the bindings
125    */
126    pub use super::generated::bindings::version::*;
127}
128
129#[cfg(feature = "pcf")]
130pub mod pcf {
131    /*!
132       Bindings to the IBM MQ [`Programmable Command Formats`](https://www.ibm.com/docs/en/SSFKSJ_latest/refadmin/q086860_.html)
133    */
134    pub use super::generated::bindings::pcf::*;
135}
136
137#[cfg(feature = "mqai")]
138pub mod mqai {
139    /*!
140       Bindings to the IBM MQ [`Administrative Interface`](https://www.ibm.com/docs/en/SSFKSJ_latest/refadmin/q089130_.html)
141    */
142    pub use super::generated::bindings::mqai::*;
143}
144
145#[cfg(feature = "exits")]
146pub mod exits {
147    /*!
148       Bindings to the IBM MQ [`exits`](https://www.ibm.com/docs/en/SSFKSJ_latest/develop/q027670_.html)
149    */
150    pub use super::generated::bindings::exits::*;
151}
152
153#[cfg(feature = "mock")]
154pub use generated::mock;
155
156#[cfg(feature = "constant_lookup")]
157#[rustfmt::skip]
158pub mod str {
159    include!(concat!(env!("OUT_DIR"), "/str.rs"));
160}
161
162#[cfg(feature = "struct_defaults")]
163mod default;
164
165#[cfg(feature = "dlopen2")]
166pub mod dlopen2;
167
168#[cfg(feature = "link_api")]
169pub mod link;