| 1 |
#ifndef PROTON_MESSENGER_H |
| 2 |
#define PROTON_MESSENGER_H 1 |
| 3 |
|
| 4 |
/* |
| 5 |
* |
| 6 |
* Licensed to the Apache Software Foundation (ASF) under one |
| 7 |
* or more contributor license agreements. See the NOTICE file |
| 8 |
* distributed with this work for additional information |
| 9 |
* regarding copyright ownership. The ASF licenses this file |
| 10 |
* to you under the Apache License, Version 2.0 (the |
| 11 |
* "License"); you may not use this file except in compliance |
| 12 |
* with the License. You may obtain a copy of the License at |
| 13 |
* |
| 14 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 15 |
* |
| 16 |
* Unless required by applicable law or agreed to in writing, |
| 17 |
* software distributed under the License is distributed on an |
| 18 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 19 |
* KIND, either express or implied. See the License for the |
| 20 |
* specific language governing permissions and limitations |
| 21 |
* under the License. |
| 22 |
* |
| 23 |
*/ |
| 24 |
|
| 25 |
#include <proton/import_export.h> |
| 26 |
#include <proton/message.h> |
| 27 |
#include <proton/selectable.h> |
| 28 |
#include <proton/link.h> |
| 29 |
#include <proton/transport.h> |
| 30 |
#include <proton/ssl.h> |
| 31 |
|
| 32 |
#ifdef __cplusplus |
| 33 |
extern "C" { |
| 34 |
#endif |
| 35 |
|
| 36 |
/** |
| 37 |
* @file |
| 38 |
* |
| 39 |
* @copybrief messenger |
| 40 |
* |
| 41 |
* @addtogroup messenger |
| 42 |
* @{ |
| 43 |
*/ |
| 44 |
|
| 45 |
/** |
| 46 |
* A ::pn_messenger_t provides a high level interface for sending and |
| 47 |
* receiving messages (See ::pn_message_t). |
| 48 |
* |
| 49 |
* Every messenger contains a single logical queue of incoming |
| 50 |
* messages and a single logical queue of outgoing messages. The |
| 51 |
* messages in these queues may be destined for, or originate from, a |
| 52 |
* variety of addresses. |
| 53 |
* |
| 54 |
* The messenger interface is single-threaded. All methods except one |
| 55 |
* (::pn_messenger_interrupt()) are intended to be used by one thread |
| 56 |
* at a time. |
| 57 |
* |
| 58 |
* |
| 59 |
* Address Syntax |
| 60 |
* ============== |
| 61 |
* |
| 62 |
* An address has the following form:: |
| 63 |
* |
| 64 |
* [ amqp[s]:// ] [user[:password]@] domain [/[name]] |
| 65 |
* |
| 66 |
* Where domain can be one of:: |
| 67 |
* |
| 68 |
* host | host:port | ip | ip:port | name |
| 69 |
* |
| 70 |
* The following are valid examples of addresses: |
| 71 |
* |
| 72 |
* - example.org |
| 73 |
* - example.org:1234 |
| 74 |
* - amqp://example.org |
| 75 |
* - amqps://example.org |
| 76 |
* - example.org/incoming |
| 77 |
* - amqps://example.org/outgoing |
| 78 |
* - amqps://fred:[email protected] |
| 79 |
* - 127.0.0.1:1234 |
| 80 |
* - amqps://127.0.0.1:1234 |
| 81 |
* |
| 82 |
* Sending & Receiving Messages |
| 83 |
* ============================ |
| 84 |
* |
| 85 |
* The messenger API works in conjunction with the ::pn_message_t API. |
| 86 |
* A ::pn_message_t is a mutable holder of message content. |
| 87 |
* |
| 88 |
* The ::pn_messenger_put() operation copies content from the supplied |
| 89 |
* ::pn_message_t to the outgoing queue, and may send queued messages |
| 90 |
* if it can do so without blocking. The ::pn_messenger_send() |
| 91 |
* operation blocks until it has sent the requested number of |
| 92 |
* messages, or until a timeout interrupts the attempt. |
| 93 |
* |
| 94 |
* |
| 95 |
* pn_messenger_t *messenger = pn_messenger(NULL); |
| 96 |
* pn_message_t *message = pn_message(); |
| 97 |
* char subject[1024]; |
| 98 |
* for (int i = 0; i < 3; i++) { |
| 99 |
* pn_message_set_address(message, "amqp://host/queue"); |
| 100 |
* sprintf(subject, "Hello World! %i", i); |
| 101 |
* pn_message_set_subject(message, subject); |
| 102 |
* pn_messenger_put(messenger, message) |
| 103 |
* pn_messenger_send(messenger); |
| 104 |
* |
| 105 |
* Similarly, the ::pn_messenger_recv() method receives messages into |
| 106 |
* the incoming queue, and may block as it attempts to receive up to |
| 107 |
* the requested number of messages, or until the timeout is reached. |
| 108 |
* It may receive fewer than the requested number. The |
| 109 |
* ::pn_messenger_get() method pops the eldest message off the |
| 110 |
* incoming queue and copies its content into the supplied |
| 111 |
* ::pn_message_t object. It will not block. |
| 112 |
* |
| 113 |
* |
| 114 |
* pn_messenger_t *messenger = pn_messenger(NULL); |
| 115 |
* pn_message_t *message = pn_message() |
| 116 |
* pn_messenger_recv(messenger): |
| 117 |
* while (pn_messenger_incoming(messenger) > 0) { |
| 118 |
* pn_messenger_get(messenger, message); |
| 119 |
* printf("%s", message.subject); |
| 120 |
* } |
| 121 |
* |
| 122 |
* Output: |
| 123 |
* Hello World 0 |
| 124 |
* Hello World 1 |
| 125 |
* Hello World 2 |
| 126 |
* |
| 127 |
* The blocking flag allows you to turn off blocking behavior |
| 128 |
* entirely, in which case ::pn_messenger_send() and |
| 129 |
* ::pn_messenger_recv() will do whatever they can without blocking, |
| 130 |
* and then return. You can then look at the number of incoming and |
| 131 |
* outgoing messages to see how much outstanding work still remains. |
| 132 |
* |
| 133 |
* Authentication Mechanisms |
| 134 |
* ======================== |
| 135 |
* |
| 136 |
* The messenger API authenticates using some specific mechanisms. In prior versions |
| 137 |
* of Proton the only authentication mechanism available was the PLAIN mechanism |
| 138 |
* which transports the user's password over the network unencrypted. The Proton versions |
| 139 |
* 0.10 and newer support other more secure mechanisms which avoid sending the users's |
| 140 |
* password over the network unencrypted. For backwards compatibility the 0.10 version |
| 141 |
* of the messenger API will also allow the use of the unencrypted PLAIN mechanism. From the |
| 142 |
* 0.11 version and onwards you will need to set the flag PN_FLAGS_ALLOW_INSECURE_MECHS to |
| 143 |
* carry on using the unencrypted PLAIN mechanism. |
| 144 |
* |
| 145 |
* The code for this looks like: |
| 146 |
* |
| 147 |
* ... |
| 148 |
* pn_messenger_set_flags(messenger, PN_FLAGS_ALLOW_INSECURE_MECHS); |
| 149 |
* ... |
| 150 |
* |
| 151 |
* Note that the use of the PLAIN mechanism over an SSL connection is allowed as the |
| 152 |
* password is not sent unencrypted. |
| 153 |
*/ |
| 154 |
typedef struct pn_messenger_t pn_messenger_t; |
| 155 |
|
| 156 |
/** |
| 157 |
* A subscription is a request for incoming messages. |
| 158 |
*/ |
| 159 |
typedef struct pn_subscription_t pn_subscription_t; |
| 160 |
|
| 161 |
/** |
| 162 |
* Trackers provide a lightweight handle used to track the status of |
| 163 |
* incoming and outgoing deliveries. |
| 164 |
*/ |
| 165 |
typedef int64_t pn_tracker_t; |
| 166 |
|
| 167 |
/** |
| 168 |
* Describes all the possible states for a message associated with a |
| 169 |
* given tracker. |
| 170 |
*/ |
| 171 |
typedef enum { |
| 172 |
PN_STATUS_UNKNOWN = 0, /**< The tracker is unknown. */ |
| 173 |
PN_STATUS_PENDING = 1, /**< The message is in flight. For outgoing |
| 174 |
messages, use ::pn_messenger_buffered to |
| 175 |
see if it has been sent or not. */ |
| 176 |
PN_STATUS_ACCEPTED = 2, /**< The message was accepted. */ |
| 177 |
PN_STATUS_REJECTED = 3, /**< The message was rejected. */ |
| 178 |
PN_STATUS_RELEASED = 4, /**< The message was released. */ |
| 179 |
PN_STATUS_MODIFIED = 5, /**< The message was modified. */ |
| 180 |
PN_STATUS_ABORTED = 6, /**< The message was aborted. */ |
| 181 |
PN_STATUS_SETTLED = 7 /**< The remote party has settled the message. */ |
| 182 |
} pn_status_t; |
| 183 |
|
| 184 |
/** |
| 185 |
* Construct a new ::pn_messenger_t with the given name. The name is |
| 186 |
* global. If a NULL name is supplied, a UUID based name will be |
| 187 |
* chosen. |
| 188 |
* |
| 189 |
* @param[in] name the name of the messenger or NULL |
| 190 |
* |
| 191 |
* @return pointer to a new ::pn_messenger_t |
| 192 |
*/ |
| 193 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 194 |
PNX_EXTERN pn_messenger_t *pn_messenger(const char *name); |
| 195 |
|
| 196 |
/** |
| 197 |
* Get the name of a messenger. |
| 198 |
* |
| 199 |
* @param[in] messenger a messenger object |
| 200 |
* @return the name of the messenger |
| 201 |
*/ |
| 202 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 203 |
PNX_EXTERN const char *pn_messenger_name(pn_messenger_t *messenger); |
| 204 |
|
| 205 |
/** |
| 206 |
* Sets the path that will be used to get the certificate that will be |
| 207 |
* used to identify this messenger to its peers. The validity of the |
| 208 |
* path is not checked by this function. |
| 209 |
* |
| 210 |
* @param[in] messenger the messenger |
| 211 |
* @param[in] certificate a path to a certificate file |
| 212 |
* @return an error code of zero if there is no error |
| 213 |
*/ |
| 214 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 215 |
PNX_EXTERN int pn_messenger_set_certificate(pn_messenger_t *messenger, const char *certificate); |
| 216 |
|
| 217 |
/** |
| 218 |
* Get the certificate path. This value may be set by |
| 219 |
* pn_messenger_set_certificate. The default certificate path is null. |
| 220 |
* |
| 221 |
* @param[in] messenger the messenger |
| 222 |
* @return the certificate file path |
| 223 |
*/ |
| 224 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 225 |
PNX_EXTERN const char *pn_messenger_get_certificate(pn_messenger_t *messenger); |
| 226 |
|
| 227 |
/** |
| 228 |
* Set path to the private key that was used to sign the certificate. |
| 229 |
* See ::pn_messenger_set_certificate |
| 230 |
* |
| 231 |
* @param[in] messenger a messenger object |
| 232 |
* @param[in] private_key a path to a private key file |
| 233 |
* @return an error code of zero if there is no error |
| 234 |
*/ |
| 235 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 236 |
PNX_EXTERN int pn_messenger_set_private_key(pn_messenger_t *messenger, const char *private_key); |
| 237 |
|
| 238 |
/** |
| 239 |
* Gets the private key file for a messenger. |
| 240 |
* |
| 241 |
* @param[in] messenger a messenger object |
| 242 |
* @return the messenger's private key file path |
| 243 |
*/ |
| 244 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 245 |
PNX_EXTERN const char *pn_messenger_get_private_key(pn_messenger_t *messenger); |
| 246 |
|
| 247 |
/** |
| 248 |
* Sets the private key password for a messenger. |
| 249 |
* |
| 250 |
* @param[in] messenger a messenger object |
| 251 |
* @param[in] password the password for the private key file |
| 252 |
* |
| 253 |
* @return an error code of zero if there is no error |
| 254 |
*/ |
| 255 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 256 |
PNX_EXTERN int pn_messenger_set_password(pn_messenger_t *messenger, const char *password); |
| 257 |
|
| 258 |
/** |
| 259 |
* Gets the private key file password for a messenger. |
| 260 |
* |
| 261 |
* @param[in] messenger a messenger object |
| 262 |
* @return password for the private key file |
| 263 |
*/ |
| 264 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 265 |
PNX_EXTERN const char *pn_messenger_get_password(pn_messenger_t *messenger); |
| 266 |
|
| 267 |
/** |
| 268 |
* Sets the trusted certificates database for a messenger. |
| 269 |
* |
| 270 |
* The messenger will use this database to validate the certificate |
| 271 |
* provided by the peer. |
| 272 |
* |
| 273 |
* @param[in] messenger a messenger object |
| 274 |
* @param[in] cert_db a path to the certificates database |
| 275 |
* |
| 276 |
* @return an error code of zero if there is no error |
| 277 |
*/ |
| 278 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 279 |
PNX_EXTERN int pn_messenger_set_trusted_certificates(pn_messenger_t *messenger, const char *cert_db); |
| 280 |
|
| 281 |
/** |
| 282 |
* Gets the trusted certificates database for a messenger. |
| 283 |
* |
| 284 |
* @param[in] messenger a messenger object |
| 285 |
* @return path to the trusted certificates database |
| 286 |
*/ |
| 287 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 288 |
PNX_EXTERN const char *pn_messenger_get_trusted_certificates(pn_messenger_t *messenger); |
| 289 |
|
| 290 |
/** |
| 291 |
* Set the default timeout for a messenger. |
| 292 |
* |
| 293 |
* Any messenger call that blocks during execution will stop blocking |
| 294 |
* and return control when this timeout is reached, if you have set it |
| 295 |
* to a value greater than zero. The timeout is expressed in |
| 296 |
* milliseconds. |
| 297 |
* |
| 298 |
* @param[in] messenger a messenger object |
| 299 |
* @param[in] timeout a new timeout for the messenger, in milliseconds |
| 300 |
* @return an error code or zero if there is no error |
| 301 |
*/ |
| 302 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 303 |
PNX_EXTERN int pn_messenger_set_timeout(pn_messenger_t *messenger, int timeout); |
| 304 |
|
| 305 |
/** |
| 306 |
* Gets the timeout for a messenger object. |
| 307 |
* |
| 308 |
* See ::pn_messenger_set_timeout() for details. |
| 309 |
* |
| 310 |
* @param[in] messenger a messenger object |
| 311 |
* @return the timeout for the messenger, in milliseconds |
| 312 |
*/ |
| 313 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 314 |
PNX_EXTERN int pn_messenger_get_timeout(pn_messenger_t *messenger); |
| 315 |
|
| 316 |
/** |
| 317 |
* Check if a messenger is in blocking mode. |
| 318 |
* |
| 319 |
* @param[in] messenger a messenger object |
| 320 |
* @return true if blocking has been enabled, false otherwise |
| 321 |
*/ |
| 322 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 323 |
PNX_EXTERN bool pn_messenger_is_blocking(pn_messenger_t *messenger); |
| 324 |
|
| 325 |
/** |
| 326 |
* Enable or disable blocking behavior for a messenger during calls to |
| 327 |
* ::pn_messenger_send and ::pn_messenger_recv. |
| 328 |
* |
| 329 |
* @param[in] messenger a messenger object |
| 330 |
* @param[in] blocking the value of the blocking flag |
| 331 |
* @return an error code or zero if there is no error |
| 332 |
*/ |
| 333 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 334 |
PNX_EXTERN int pn_messenger_set_blocking(pn_messenger_t *messenger, bool blocking); |
| 335 |
|
| 336 |
/** |
| 337 |
* Check if a messenger is in passive mode. |
| 338 |
* |
| 339 |
* A messenger that is in passive mode will never attempt to perform |
| 340 |
* I/O internally, but instead will make all internal file descriptors |
| 341 |
* accessible through ::pn_messenger_selectable() to be serviced |
| 342 |
* externally. This can be useful for integrating messenger into an |
| 343 |
* external event loop. |
| 344 |
* |
| 345 |
* @param[in] messenger a messenger object |
| 346 |
* @return true if the messenger is in passive mode, false otherwise |
| 347 |
*/ |
| 348 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 349 |
PNX_EXTERN bool pn_messenger_is_passive(pn_messenger_t *messenger); |
| 350 |
|
| 351 |
/** |
| 352 |
* Set the passive mode for a messenger. |
| 353 |
* |
| 354 |
* See ::pn_messenger_is_passive() for details on passive mode. |
| 355 |
* |
| 356 |
* @param[in] messenger a messenger object |
| 357 |
* @param[in] passive true to enable passive mode, false to disable |
| 358 |
* passive mode |
| 359 |
* @return an error code or zero on success |
| 360 |
*/ |
| 361 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 362 |
PNX_EXTERN int pn_messenger_set_passive(pn_messenger_t *messenger, bool passive); |
| 363 |
|
| 364 |
/** Frees a Messenger. |
| 365 |
* |
| 366 |
* @param[in] messenger the messenger to free (or NULL), no longer |
| 367 |
* valid on return |
| 368 |
*/ |
| 369 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 370 |
PNX_EXTERN void pn_messenger_free(pn_messenger_t *messenger); |
| 371 |
|
| 372 |
/** |
| 373 |
* Get the code for a messenger's most recent error. |
| 374 |
* |
| 375 |
* The error code is initialized to zero at messenger creation. The |
| 376 |
* error number is "sticky" i.e. error codes are not reset to 0 at the |
| 377 |
* end of successful API calls. You can use ::pn_messenger_error to |
| 378 |
* access the messenger's error object and clear explicitly if |
| 379 |
* desired. |
| 380 |
* |
| 381 |
* @param[in] messenger the messenger to check for errors |
| 382 |
* @return an error code or zero if there is no error |
| 383 |
* @see error.h |
| 384 |
*/ |
| 385 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 386 |
PNX_EXTERN int pn_messenger_errno(pn_messenger_t *messenger); |
| 387 |
|
| 388 |
/** |
| 389 |
* Get a messenger's error object. |
| 390 |
* |
| 391 |
* Returns a pointer to a pn_error_t that is valid until the messenger |
| 392 |
* is freed. The pn_error_* API allows you to access the text, error |
| 393 |
* number, and lets you set or clear the error code explicitly. |
| 394 |
* |
| 395 |
* @param[in] messenger the messenger to check for errors |
| 396 |
* @return a pointer to the messenger's error descriptor |
| 397 |
* @see error.h |
| 398 |
*/ |
| 399 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 400 |
PNX_EXTERN pn_error_t *pn_messenger_error(pn_messenger_t *messenger); |
| 401 |
|
| 402 |
/** |
| 403 |
* Get the size of a messenger's outgoing window. |
| 404 |
* |
| 405 |
* The size of the outgoing window limits the number of messages whose |
| 406 |
* status you can check with a tracker. A message enters this window |
| 407 |
* when you call pn_messenger_put on the message. For example, if your |
| 408 |
* outgoing window size is 10, and you call pn_messenger_put 12 times, |
| 409 |
* new status information will no longer be available for the first 2 |
| 410 |
* messages. |
| 411 |
* |
| 412 |
* The default outgoing window size is 0. |
| 413 |
* |
| 414 |
* @param[in] messenger a messenger object |
| 415 |
* @return the outgoing window for the messenger |
| 416 |
*/ |
| 417 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 418 |
PNX_EXTERN int pn_messenger_get_outgoing_window(pn_messenger_t *messenger); |
| 419 |
|
| 420 |
/** |
| 421 |
* Set the size of a messenger's outgoing window. |
| 422 |
* |
| 423 |
* See ::pn_messenger_get_outgoing_window() for details. |
| 424 |
* |
| 425 |
* @param[in] messenger a messenger object |
| 426 |
* @param[in] window the number of deliveries to track |
| 427 |
* @return an error or zero on success |
| 428 |
* @see error.h |
| 429 |
*/ |
| 430 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 431 |
PNX_EXTERN int pn_messenger_set_outgoing_window(pn_messenger_t *messenger, int window); |
| 432 |
|
| 433 |
/** |
| 434 |
* Get the size of a messenger's incoming window. |
| 435 |
* |
| 436 |
* The size of a messenger's incoming window limits the number of |
| 437 |
* messages that can be accepted or rejected using trackers. Messages |
| 438 |
* *do not* enter this window when they have been received |
| 439 |
* (::pn_messenger_recv) onto you incoming queue. Messages only enter |
| 440 |
* this window only when you access them using pn_messenger_get. If |
| 441 |
* your incoming window size is N, and you get N+1 messages without |
| 442 |
* explicitly accepting or rejecting the oldest message, then it will |
| 443 |
* be implicitly accepted when it falls off the edge of the incoming |
| 444 |
* window. |
| 445 |
* |
| 446 |
* The default incoming window size is 0. |
| 447 |
* |
| 448 |
* @param[in] messenger a messenger object |
| 449 |
* @return the incoming window for the messenger |
| 450 |
*/ |
| 451 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 452 |
PNX_EXTERN int pn_messenger_get_incoming_window(pn_messenger_t *messenger); |
| 453 |
|
| 454 |
/** |
| 455 |
* Set the size of a messenger's incoming window. |
| 456 |
* |
| 457 |
* See ::pn_messenger_get_incoming_window() for details. |
| 458 |
* |
| 459 |
* @param[in] messenger a messenger object |
| 460 |
* @param[in] window the number of deliveries to track |
| 461 |
* @return an error or zero on success |
| 462 |
* @see error.h |
| 463 |
*/ |
| 464 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 465 |
PNX_EXTERN int pn_messenger_set_incoming_window(pn_messenger_t *messenger, |
| 466 |
int window); |
| 467 |
|
| 468 |
/** |
| 469 |
* Currently a no-op placeholder. For future compatibility, do not |
| 470 |
* send or receive messages before starting the messenger. |
| 471 |
* |
| 472 |
* @param[in] messenger the messenger to start |
| 473 |
* @return an error code or zero on success |
| 474 |
* @see error.h |
| 475 |
*/ |
| 476 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 477 |
PNX_EXTERN int pn_messenger_start(pn_messenger_t *messenger); |
| 478 |
|
| 479 |
/** |
| 480 |
* Stops a messenger. |
| 481 |
* |
| 482 |
* Stopping a messenger will perform an orderly shutdown of all |
| 483 |
* underlying connections. This may require some time. If the |
| 484 |
* messenger is in non blocking mode (see ::pn_messenger_is_blocking), |
| 485 |
* this operation will return PN_INPROGRESS if it cannot finish |
| 486 |
* immediately. In that case, you can use ::pn_messenger_stopped() to |
| 487 |
* determine when the messenger has finished stopping. |
| 488 |
* |
| 489 |
* @param[in] messenger the messenger to stop |
| 490 |
* @return an error code or zero on success |
| 491 |
* @see error.h |
| 492 |
*/ |
| 493 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 494 |
PNX_EXTERN int pn_messenger_stop(pn_messenger_t *messenger); |
| 495 |
|
| 496 |
/** |
| 497 |
* Returns true if a messenger is in the stopped state. This function |
| 498 |
* does not block. |
| 499 |
* |
| 500 |
* @param[in] messenger the messenger to stop |
| 501 |
* |
| 502 |
*/ |
| 503 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 504 |
PNX_EXTERN bool pn_messenger_stopped(pn_messenger_t *messenger); |
| 505 |
|
| 506 |
/** |
| 507 |
* Subscribes a messenger to messages from the specified source. |
| 508 |
* |
| 509 |
* @param[in] messenger the messenger to subscribe |
| 510 |
* @param[in] source |
| 511 |
* @return a subscription |
| 512 |
*/ |
| 513 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 514 |
PNX_EXTERN pn_subscription_t *pn_messenger_subscribe(pn_messenger_t *messenger, const char *source); |
| 515 |
|
| 516 |
/** |
| 517 |
* Subscribes a messenger to messages from the specified source with the given |
| 518 |
* timeout for the subscription's lifetime. |
| 519 |
* |
| 520 |
* @param[in] messenger the messenger to subscribe |
| 521 |
* @param[in] source |
| 522 |
* @param[in] timeout the maximum time to keep the subscription alive once the |
| 523 |
* link is closed. |
| 524 |
* @return a subscription |
| 525 |
*/ |
| 526 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 527 |
PNX_EXTERN pn_subscription_t * |
| 528 |
pn_messenger_subscribe_ttl(pn_messenger_t *messenger, const char *source, |
| 529 |
pn_seconds_t timeout); |
| 530 |
|
| 531 |
/** |
| 532 |
* Get a link based on link name and whether the link is a sender or receiver |
| 533 |
* |
| 534 |
* @param[in] messenger the messenger to get the link from |
| 535 |
* @param[in] address the link address that identifies the link to receive |
| 536 |
* @param[in] sender true if the link is a sender, false if the link is a |
| 537 |
* receiver |
| 538 |
* @return a link, or NULL if no link matches the address / sender parameters |
| 539 |
*/ |
| 540 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 541 |
PNX_EXTERN pn_link_t *pn_messenger_get_link(pn_messenger_t *messenger, |
| 542 |
const char *address, bool sender); |
| 543 |
|
| 544 |
/** |
| 545 |
* Get a subscription's application context. |
| 546 |
* |
| 547 |
* See ::pn_subscription_set_context(). |
| 548 |
* |
| 549 |
* @param[in] sub a subscription object |
| 550 |
* @return the subscription's application context |
| 551 |
*/ |
| 552 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 553 |
PNX_EXTERN void *pn_subscription_get_context(pn_subscription_t *sub); |
| 554 |
|
| 555 |
/** |
| 556 |
* Set an application context for a subscription. |
| 557 |
* |
| 558 |
* @param[in] sub a subscription object |
| 559 |
* @param[in] context the application context for the subscription |
| 560 |
*/ |
| 561 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 562 |
PNX_EXTERN void pn_subscription_set_context(pn_subscription_t *sub, void *context); |
| 563 |
|
| 564 |
/** |
| 565 |
* Get the source address of a subscription. |
| 566 |
* |
| 567 |
* @param[in] sub a subscription object |
| 568 |
* @return the subscription's source address |
| 569 |
*/ |
| 570 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 571 |
PNX_EXTERN const char *pn_subscription_address(pn_subscription_t *sub); |
| 572 |
|
| 573 |
/** |
| 574 |
* Puts a message onto the messenger's outgoing queue. The message may |
| 575 |
* also be sent if transmission would not cause blocking. This call |
| 576 |
* will not block. |
| 577 |
* |
| 578 |
* @param[in] messenger a messenger object |
| 579 |
* @param[in] msg a message to put on the messenger's outgoing queue |
| 580 |
* @return an error code or zero on success |
| 581 |
* @see error.h |
| 582 |
*/ |
| 583 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 584 |
PNX_EXTERN int pn_messenger_put(pn_messenger_t *messenger, pn_message_t *msg); |
| 585 |
|
| 586 |
/** |
| 587 |
* Track the status of a delivery. |
| 588 |
* |
| 589 |
* Get the current status of the delivery associated with the supplied |
| 590 |
* tracker. This may return PN_STATUS_UNKOWN if the tracker has fallen |
| 591 |
* outside the incoming/outgoing tracking windows of the messenger. |
| 592 |
* |
| 593 |
* @param[in] messenger the messenger |
| 594 |
* @param[in] tracker the tracker identifying the delivery |
| 595 |
* @return a status code for the delivery |
| 596 |
*/ |
| 597 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 598 |
PNX_EXTERN pn_status_t pn_messenger_status(pn_messenger_t *messenger, pn_tracker_t tracker); |
| 599 |
|
| 600 |
/** |
| 601 |
* Get delivery information about a delivery. |
| 602 |
* |
| 603 |
* Returns the delivery information associated with the supplied tracker. |
| 604 |
* This may return NULL if the tracker has fallen outside the |
| 605 |
* incoming/outgoing tracking windows of the messenger. |
| 606 |
* |
| 607 |
* @param[in] messenger the messenger |
| 608 |
* @param[in] tracker the tracker identifying the delivery |
| 609 |
* @return a pn_delivery_t representing the delivery. |
| 610 |
*/ |
| 611 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 612 |
PNX_EXTERN pn_delivery_t *pn_messenger_delivery(pn_messenger_t *messenger, |
| 613 |
pn_tracker_t tracker); |
| 614 |
|
| 615 |
/** |
| 616 |
* Check if the delivery associated with a given tracker is still |
| 617 |
* waiting to be sent. |
| 618 |
* |
| 619 |
* Note that returning false does not imply that the delivery was |
| 620 |
* actually sent over the wire. |
| 621 |
* |
| 622 |
* @param[in] messenger the messenger |
| 623 |
* @param[in] tracker the tracker identifying the delivery |
| 624 |
* |
| 625 |
* @return true if the delivery is still buffered |
| 626 |
*/ |
| 627 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 628 |
PNX_EXTERN bool pn_messenger_buffered(pn_messenger_t *messenger, pn_tracker_t tracker); |
| 629 |
|
| 630 |
/** |
| 631 |
* Frees a Messenger from tracking the status associated with a given |
| 632 |
* tracker. Use the PN_CUMULATIVE flag to indicate everything up to |
| 633 |
* (and including) the given tracker. |
| 634 |
* |
| 635 |
* @param[in] messenger the Messenger |
| 636 |
* @param[in] tracker identifies a delivery |
| 637 |
* @param[in] flags 0 or PN_CUMULATIVE |
| 638 |
* |
| 639 |
* @return an error code or zero on success |
| 640 |
* @see error.h |
| 641 |
*/ |
| 642 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 643 |
PNX_EXTERN int pn_messenger_settle(pn_messenger_t *messenger, pn_tracker_t tracker, int flags); |
| 644 |
|
| 645 |
/** |
| 646 |
* Get a tracker for the outgoing message most recently given to |
| 647 |
* pn_messenger_put. |
| 648 |
* |
| 649 |
* This tracker may be used with pn_messenger_status to determine the |
| 650 |
* delivery status of the message, as long as the message is still |
| 651 |
* within your outgoing window. |
| 652 |
* |
| 653 |
* @param[in] messenger the messenger |
| 654 |
* |
| 655 |
* @return a pn_tracker_t or an undefined value if pn_messenger_get |
| 656 |
* has never been called for the given messenger |
| 657 |
*/ |
| 658 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 659 |
PNX_EXTERN pn_tracker_t pn_messenger_outgoing_tracker(pn_messenger_t *messenger); |
| 660 |
|
| 661 |
/** |
| 662 |
* Sends or receives any outstanding messages queued for a messenger. |
| 663 |
* This will block for the indicated timeout. |
| 664 |
* |
| 665 |
* @param[in] messenger the Messenger |
| 666 |
* @param[in] timeout the maximum time to block in milliseconds, -1 == |
| 667 |
* forever, 0 == do not block |
| 668 |
* |
| 669 |
* @return 0 if no work to do, < 0 if error, or 1 if work was done. |
| 670 |
*/ |
| 671 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 672 |
PNX_EXTERN int pn_messenger_work(pn_messenger_t *messenger, int timeout); |
| 673 |
|
| 674 |
/** |
| 675 |
* Interrupt a messenger object that may be blocking in another |
| 676 |
* thread. |
| 677 |
* |
| 678 |
* The messenger interface is single-threaded. This is the only |
| 679 |
* messenger function intended to be concurrently called from another |
| 680 |
* thread. It will interrupt any messenger function which is currently |
| 681 |
* blocking and cause it to return with a status of ::PN_INTR. |
| 682 |
* |
| 683 |
* @param[in] messenger the Messenger to interrupt |
| 684 |
*/ |
| 685 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 686 |
PNX_EXTERN int pn_messenger_interrupt(pn_messenger_t *messenger); |
| 687 |
|
| 688 |
/** |
| 689 |
* Send messages from a messenger's outgoing queue. |
| 690 |
* |
| 691 |
* If a messenger is in blocking mode (see |
| 692 |
* ::pn_messenger_is_blocking()), this operation will block until N |
| 693 |
* messages have been sent from the outgoing queue. A value of -1 for |
| 694 |
* N means "all messages in the outgoing queue". See below for a full |
| 695 |
* definition of what sent from the outgoing queue means. |
| 696 |
* |
| 697 |
* Any blocking will end once the messenger's configured timeout (if |
| 698 |
* any) has been reached. When this happens an error code of |
| 699 |
* ::PN_TIMEOUT is returned. |
| 700 |
* |
| 701 |
* If the messenger is in non blocking mode, this call will return an |
| 702 |
* error code of ::PN_INPROGRESS if it is unable to send the requested |
| 703 |
* number of messages without blocking. |
| 704 |
* |
| 705 |
* A message is considered to be sent from the outgoing queue when its |
| 706 |
* status has been fully determined. This does not necessarily mean |
| 707 |
* the message was successfully sent to the final recipient though, |
| 708 |
* for example of the receiver rejects the message, the final status |
| 709 |
* will be ::PN_STATUS_REJECTED. Similarly, if a message is sent to an |
| 710 |
* invalid address, it may be removed from the outgoing queue without |
| 711 |
* ever even being transmitted. In this case the final status will be |
| 712 |
* ::PN_STATUS_ABORTED. |
| 713 |
* |
| 714 |
* @param[in] messenger a messenger object |
| 715 |
* @param[in] n the number of messages to send |
| 716 |
* |
| 717 |
* @return an error code or zero on success |
| 718 |
* @see error.h |
| 719 |
*/ |
| 720 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 721 |
PNX_EXTERN int pn_messenger_send(pn_messenger_t *messenger, int n); |
| 722 |
|
| 723 |
/** |
| 724 |
* Retrieve messages into a messenger's incoming queue. |
| 725 |
* |
| 726 |
* Instructs a messenger to receive up to @c limit messages into the |
| 727 |
* incoming message queue of a messenger. If @c limit is -1, the |
| 728 |
* messenger will receive as many messages as it can buffer |
| 729 |
* internally. If the messenger is in blocking mode, this call will |
| 730 |
* block until at least one message is available in the incoming |
| 731 |
* queue. |
| 732 |
* |
| 733 |
* Each call to pn_messenger_recv replaces the previous receive |
| 734 |
* operation, so pn_messenger_recv(messenger, 0) will cancel any |
| 735 |
* outstanding receive. |
| 736 |
* |
| 737 |
* After receiving messages onto your incoming queue use |
| 738 |
* ::pn_messenger_get() to access message content. |
| 739 |
* |
| 740 |
* @param[in] messenger the messenger |
| 741 |
* @param[in] limit the maximum number of messages to receive or -1 to |
| 742 |
* to receive as many messages as it can buffer |
| 743 |
* internally. |
| 744 |
* @return an error code or zero on success |
| 745 |
* @see error.h |
| 746 |
*/ |
| 747 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 748 |
PNX_EXTERN int pn_messenger_recv(pn_messenger_t *messenger, int limit); |
| 749 |
|
| 750 |
/** |
| 751 |
* Get the capacity of the incoming message queue of a messenger. |
| 752 |
* |
| 753 |
* Note this count does not include those messages already available |
| 754 |
* on the incoming queue (@see pn_messenger_incoming()). Rather it |
| 755 |
* returns the number of incoming queue entries available for |
| 756 |
* receiving messages. |
| 757 |
* |
| 758 |
* @param[in] messenger the messenger |
| 759 |
*/ |
| 760 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 761 |
PNX_EXTERN int pn_messenger_receiving(pn_messenger_t *messenger); |
| 762 |
|
| 763 |
/** |
| 764 |
* Get the next message from the head of a messenger's incoming queue. |
| 765 |
* |
| 766 |
* The get operation copies the message data from the head of the |
| 767 |
* messenger's incoming queue into the provided ::pn_message_t object. |
| 768 |
* If provided ::pn_message_t pointer is NULL, the head message will be |
| 769 |
* discarded. This operation will return ::PN_EOS if there are no |
| 770 |
* messages left on the incoming queue. |
| 771 |
* |
| 772 |
* @param[in] messenger a messenger object |
| 773 |
* @param[out] message upon return contains the message from the head of the queue |
| 774 |
* @return an error code or zero on success |
| 775 |
* @see error.h |
| 776 |
*/ |
| 777 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 778 |
PNX_EXTERN int pn_messenger_get(pn_messenger_t *messenger, pn_message_t *message); |
| 779 |
|
| 780 |
/** |
| 781 |
* Get a tracker for the message most recently retrieved by |
| 782 |
* ::pn_messenger_get(). |
| 783 |
* |
| 784 |
* A tracker for an incoming message allows you to accept or reject |
| 785 |
* the associated message. It can also be used for cumulative |
| 786 |
* accept/reject operations for the associated message and all prior |
| 787 |
* messages as well. |
| 788 |
* |
| 789 |
* @param[in] messenger a messenger object |
| 790 |
* @return a pn_tracker_t or an undefined value if pn_messenger_get |
| 791 |
* has never been called for the given messenger |
| 792 |
*/ |
| 793 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 794 |
PNX_EXTERN pn_tracker_t pn_messenger_incoming_tracker(pn_messenger_t *messenger); |
| 795 |
|
| 796 |
/** |
| 797 |
* Get the subscription of the message most recently retrieved by ::pn_messenger_get(). |
| 798 |
* |
| 799 |
* This operation will return NULL if ::pn_messenger_get() has never |
| 800 |
* been successfully called. |
| 801 |
* |
| 802 |
* @param[in] messenger a messenger object |
| 803 |
* @return a pn_subscription_t or NULL |
| 804 |
*/ |
| 805 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 806 |
PNX_EXTERN pn_subscription_t *pn_messenger_incoming_subscription(pn_messenger_t *messenger); |
| 807 |
|
| 808 |
/** |
| 809 |
* Indicates that an accept or reject should operate cumulatively. |
| 810 |
*/ |
| 811 |
#define PN_CUMULATIVE (0x1) |
| 812 |
|
| 813 |
/** |
| 814 |
* Signal successful processing of message(s). |
| 815 |
* |
| 816 |
* With no flags this operation will signal the sender that the |
| 817 |
* message referenced by the tracker was accepted. If the |
| 818 |
* PN_CUMULATIVE flag is set, this operation will also reject all |
| 819 |
* pending messages prior to the message indicated by the tracker. |
| 820 |
* |
| 821 |
* Note that when a message is accepted or rejected multiple times, |
| 822 |
* either explicitly, or implicitly through use of the ::PN_CUMULATIVE |
| 823 |
* flag, only the first outcome applies. For example if a sequence of |
| 824 |
* three messages are received: M1, M2, M3, and M2 is rejected, and M3 |
| 825 |
* is cumulatively accepted, M2 will remain rejected and only M1 and |
| 826 |
* M3 will be considered accepted. |
| 827 |
* |
| 828 |
* @param[in] messenger a messenger object |
| 829 |
* @param[in] tracker an incoming tracker |
| 830 |
* @param[in] flags 0 or PN_CUMULATIVE |
| 831 |
* @return an error code or zero on success |
| 832 |
* @see error.h |
| 833 |
*/ |
| 834 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 835 |
PNX_EXTERN int pn_messenger_accept(pn_messenger_t *messenger, pn_tracker_t tracker, int flags); |
| 836 |
|
| 837 |
/** |
| 838 |
* Signal unsuccessful processing of message(s). |
| 839 |
* |
| 840 |
* With no flags this operation will signal the sender that the |
| 841 |
* message indicated by the tracker was rejected. If the PN_CUMULATIVE |
| 842 |
* flag is used this operation will also reject all pending messages |
| 843 |
* prior to the message indicated by the tracker. |
| 844 |
* |
| 845 |
* Note that when a message is accepted or rejected multiple times, |
| 846 |
* either explicitly, or implicitly through use of the ::PN_CUMULATIVE |
| 847 |
* flag, only the first outcome applies. For example if a sequence of |
| 848 |
* three messages are received: M1, M2, M3, and M2 is accepted, and M3 |
| 849 |
* is cumulatively rejected, M2 will remain accepted and only M1 and |
| 850 |
* M3 will be considered rejected. |
| 851 |
* |
| 852 |
* @param[in] messenger a messenger object |
| 853 |
* @param[in] tracker an incoming tracker |
| 854 |
* @param[in] flags 0 or PN_CUMULATIVE |
| 855 |
* @return an error code or zero on success |
| 856 |
* @see error.h |
| 857 |
*/ |
| 858 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 859 |
PNX_EXTERN int pn_messenger_reject(pn_messenger_t *messenger, pn_tracker_t tracker, int flags); |
| 860 |
|
| 861 |
/** |
| 862 |
* Get link for the message referenced by the given tracker. |
| 863 |
* |
| 864 |
* @param[in] messenger a messenger object |
| 865 |
* @param[in] tracker a tracker object |
| 866 |
* @return a pn_link_t or NULL if the link could not be determined. |
| 867 |
*/ |
| 868 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 869 |
PNX_EXTERN pn_link_t *pn_messenger_tracker_link(pn_messenger_t *messenger, |
| 870 |
pn_tracker_t tracker); |
| 871 |
|
| 872 |
/** |
| 873 |
* Get the number of messages in the outgoing message queue of a |
| 874 |
* messenger. |
| 875 |
* |
| 876 |
* @param[in] messenger a messenger object |
| 877 |
* @return the outgoing queue depth |
| 878 |
*/ |
| 879 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 880 |
PNX_EXTERN int pn_messenger_outgoing(pn_messenger_t *messenger); |
| 881 |
|
| 882 |
/** |
| 883 |
* Get the number of messages in the incoming message queue of a messenger. |
| 884 |
* |
| 885 |
* @param[in] messenger a messenger object |
| 886 |
* @return the incoming queue depth |
| 887 |
*/ |
| 888 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 889 |
PNX_EXTERN int pn_messenger_incoming(pn_messenger_t *messenger); |
| 890 |
|
| 891 |
//! Adds a routing rule to a Messenger's internal routing table. |
| 892 |
//! |
| 893 |
//! The route procedure may be used to influence how a messenger will |
| 894 |
//! internally treat a given address or class of addresses. Every call |
| 895 |
//! to the route procedure will result in messenger appending a routing |
| 896 |
//! rule to its internal routing table. |
| 897 |
//! |
| 898 |
//! Whenever a message is presented to a messenger for delivery, it |
| 899 |
//! will match the address of this message against the set of routing |
| 900 |
//! rules in order. The first rule to match will be triggered, and |
| 901 |
//! instead of routing based on the address presented in the message, |
| 902 |
//! the messenger will route based on the address supplied in the rule. |
| 903 |
//! |
| 904 |
//! The pattern matching syntax supports two types of matches, a '%' |
| 905 |
//! will match any character except a '/', and a '*' will match any |
| 906 |
//! character including a '/'. |
| 907 |
//! |
| 908 |
//! A routing address is specified as a normal AMQP address, however it |
| 909 |
//! may additionally use substitution variables from the pattern match |
| 910 |
//! that triggered the rule. |
| 911 |
//! |
| 912 |
//! Any message sent to "foo" will be routed to "amqp://foo.com": |
| 913 |
//! |
| 914 |
//! pn_messenger_route("foo", "amqp://foo.com"); |
| 915 |
//! |
| 916 |
//! Any message sent to "foobar" will be routed to |
| 917 |
//! "amqp://foo.com/bar": |
| 918 |
//! |
| 919 |
//! pn_messenger_route("foobar", "amqp://foo.com/bar"); |
| 920 |
//! |
| 921 |
//! Any message sent to bar/<path> will be routed to the corresponding |
| 922 |
//! path within the amqp://bar.com domain: |
| 923 |
//! |
| 924 |
//! pn_messenger_route("bar/*", "amqp://bar.com/$1"); |
| 925 |
//! |
| 926 |
//! Route all messages over TLS: |
| 927 |
//! |
| 928 |
//! pn_messenger_route("amqp:*", "amqps:$1") |
| 929 |
//! |
| 930 |
//! Supply credentials for foo.com: |
| 931 |
//! |
| 932 |
//! pn_messenger_route("amqp://foo.com/*", "amqp://user:[email protected]/$1"); |
| 933 |
//! |
| 934 |
//! Supply credentials for all domains: |
| 935 |
//! |
| 936 |
//! pn_messenger_route("amqp://*", "amqp://user:password@$1"); |
| 937 |
//! |
| 938 |
//! Route all addresses through a single proxy while preserving the |
| 939 |
//! original destination: |
| 940 |
//! |
| 941 |
//! pn_messenger_route("amqp://%/*", "amqp://user:password@proxy/$1/$2"); |
| 942 |
//! |
| 943 |
//! Route any address through a single broker: |
| 944 |
//! |
| 945 |
//! pn_messenger_route("*", "amqp://user:password@broker/$1"); |
| 946 |
//! |
| 947 |
//! @param[in] messenger the Messenger |
| 948 |
//! @param[in] pattern a glob pattern |
| 949 |
//! @param[in] address an address indicating alternative routing |
| 950 |
//! |
| 951 |
//! @return an error code or zero on success |
| 952 |
//! @see error.h |
| 953 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 954 |
PNX_EXTERN int pn_messenger_route(pn_messenger_t *messenger, const char *pattern, |
| 955 |
const char *address); |
| 956 |
|
| 957 |
/** |
| 958 |
* Rewrite message addresses prior to transmission. |
| 959 |
* |
| 960 |
* This operation is similar to pn_messenger_route, except that the |
| 961 |
* destination of the message is determined before the message address |
| 962 |
* is rewritten. |
| 963 |
* |
| 964 |
* The outgoing address is only rewritten after routing has been |
| 965 |
* finalized. If a message has an outgoing address of |
| 966 |
* "amqp://0.0.0.0:5678", and a rewriting rule that changes its |
| 967 |
* outgoing address to "foo", it will still arrive at the peer that |
| 968 |
* is listening on "amqp://0.0.0.0:5678", but when it arrives there, |
| 969 |
* the receiver will see its outgoing address as "foo". |
| 970 |
* |
| 971 |
* The default rewrite rule removes username and password from |
| 972 |
* addresses before they are transmitted. |
| 973 |
* |
| 974 |
* @param[in] messenger a messenger object |
| 975 |
* @param[in] pattern a glob pattern to select messages |
| 976 |
* @param[in] address an address indicating outgoing address rewrite |
| 977 |
* @return an error code or zero on success |
| 978 |
*/ |
| 979 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 980 |
PNX_EXTERN int pn_messenger_rewrite(pn_messenger_t *messenger, const char *pattern, |
| 981 |
const char *address); |
| 982 |
|
| 983 |
/** |
| 984 |
* Extract selectables from a passive messenger. |
| 985 |
* |
| 986 |
* A messenger that is in passive mode (see |
| 987 |
* ::pn_messenger_is_passive()) will never attempt to perform any I/O |
| 988 |
* internally, but instead make its internal file descriptors |
| 989 |
* available for external processing via the |
| 990 |
* ::pn_messenger_selectable() operation. |
| 991 |
* |
| 992 |
* An application wishing to perform I/O on behalf of a passive |
| 993 |
* messenger must extract all available selectables by calling this |
| 994 |
* operation until it returns NULL. The selectable interface may then |
| 995 |
* be used by the application to perform I/O outside the messenger. |
| 996 |
* |
| 997 |
* All selectables returned by this operation must be serviced until |
| 998 |
* they reach a terminal state and then freed. See |
| 999 |
* `pn_selectable_is_terminal()` for more details. |
| 1000 |
* |
| 1001 |
* By default any given selectable will only ever be returned once by |
| 1002 |
* this operation, however if the selectable's registered flag is set |
| 1003 |
* to true (see `pn_selectable_set_registered()`), then the selectable |
| 1004 |
* will be returned whenever its interest set may have changed. |
| 1005 |
* |
| 1006 |
* @param[in] messenger a messenger object |
| 1007 |
* @return the next selectable, or NULL if there are none left |
| 1008 |
*/ |
| 1009 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 1010 |
PNX_EXTERN pn_selectable_t *pn_messenger_selectable(pn_messenger_t *messenger); |
| 1011 |
|
| 1012 |
/** |
| 1013 |
* Get the nearest deadline for selectables associated with a messenger. |
| 1014 |
* |
| 1015 |
* @param[in] messenger a messenger object |
| 1016 |
* @return the nearest deadline |
| 1017 |
*/ |
| 1018 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 1019 |
PNX_EXTERN pn_timestamp_t pn_messenger_deadline(pn_messenger_t *messenger); |
| 1020 |
|
| 1021 |
#define PN_FLAGS_CHECK_ROUTES \ |
| 1022 |
(0x1) /**< Messenger flag to indicate that a call \ |
| 1023 |
to pn_messenger_start should check that \ |
| 1024 |
any defined routes are valid */ |
| 1025 |
|
| 1026 |
#define PN_FLAGS_ALLOW_INSECURE_MECHS \ |
| 1027 |
(0x2) /**< Messenger flag to indicate that the PLAIN \ |
| 1028 |
mechanism is allowed on an unencrypted \ |
| 1029 |
connection */ |
| 1030 |
|
| 1031 |
/** |
| 1032 |
* Sets control flags to enable additional function for the Messenger. |
| 1033 |
* |
| 1034 |
* @param[in] messenger the messenger |
| 1035 |
* @param[in] flags 0 or PN_FLAGS_CHECK_ROUTES |
| 1036 |
* |
| 1037 |
* @return an error code of zero if there is no error |
| 1038 |
*/ |
| 1039 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 1040 |
PNX_EXTERN int pn_messenger_set_flags(pn_messenger_t *messenger, |
| 1041 |
const int flags); |
| 1042 |
|
| 1043 |
/** |
| 1044 |
* Gets the flags for a Messenger. |
| 1045 |
* |
| 1046 |
* @param[in] messenger the messenger |
| 1047 |
* @return The flags set for the messenger |
| 1048 |
*/ |
| 1049 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 1050 |
PNX_EXTERN int pn_messenger_get_flags(pn_messenger_t *messenger); |
| 1051 |
|
| 1052 |
/** |
| 1053 |
* Set the local sender settle mode for the underlying link. |
| 1054 |
* |
| 1055 |
* @param[in] messenger the messenger |
| 1056 |
* @param[in] mode the sender settle mode |
| 1057 |
*/ |
| 1058 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 1059 |
PNX_EXTERN int pn_messenger_set_snd_settle_mode(pn_messenger_t *messenger, |
| 1060 |
const pn_snd_settle_mode_t mode); |
| 1061 |
|
| 1062 |
/** |
| 1063 |
* Set the local receiver settle mode for the underlying link. |
| 1064 |
* |
| 1065 |
* @param[in] messenger the messenger |
| 1066 |
* @param[in] mode the receiver settle mode |
| 1067 |
*/ |
| 1068 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 1069 |
PNX_EXTERN int pn_messenger_set_rcv_settle_mode(pn_messenger_t *messenger, |
| 1070 |
const pn_rcv_settle_mode_t mode); |
| 1071 |
|
| 1072 |
/** |
| 1073 |
* Set the tracer associated with a messenger. |
| 1074 |
* |
| 1075 |
* @param[in] messenger a messenger object |
| 1076 |
* @param[in] tracer the tracer callback |
| 1077 |
*/ |
| 1078 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 1079 |
PNX_EXTERN void pn_messenger_set_tracer(pn_messenger_t *messenger, |
| 1080 |
pn_tracer_t tracer); |
| 1081 |
|
| 1082 |
/** |
| 1083 |
* Gets the remote idle timeout for the specified remote service address |
| 1084 |
* |
| 1085 |
* @param[in] messenger a messenger object |
| 1086 |
* @param[in] address of remote service whose idle timeout is required |
| 1087 |
* @return the timeout in milliseconds or -1 if an error occurs |
| 1088 |
*/ |
| 1089 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 1090 |
PNX_EXTERN pn_millis_t |
| 1091 |
pn_messenger_get_remote_idle_timeout(pn_messenger_t *messenger, |
| 1092 |
const char *address); |
| 1093 |
|
| 1094 |
/** |
| 1095 |
* Sets the SSL peer authentication mode required when a trust |
| 1096 |
* certificate is used. |
| 1097 |
* |
| 1098 |
* @param[in] messenger a messenger object |
| 1099 |
* @param[in] mode the mode required (see pn_ssl_verify_mode_t |
| 1100 |
* enum for valid values) |
| 1101 |
* @return 0 if successful or -1 if an error occurs |
| 1102 |
*/ |
| 1103 |
PN_DEPRECATED("Use the Proactor API or Qpid Proton C++") |
| 1104 |
PNX_EXTERN int |
| 1105 |
pn_messenger_set_ssl_peer_authentication_mode(pn_messenger_t *messenger, |
| 1106 |
const pn_ssl_verify_mode_t mode); |
| 1107 |
|
| 1108 |
/** |
| 1109 |
* @} |
| 1110 |
*/ |
| 1111 |
|
| 1112 |
#ifdef __cplusplus |
| 1113 |
} |
| 1114 |
#endif |
| 1115 |
|
| 1116 |
#endif /* messenger.h */ |