C AMQP Protocol Engine API  0.5
proton/messenger.h
Go to the documentation of this file.
00001 #ifndef PROTON_MESSENGER_H
00002 #define PROTON_MESSENGER_H 1
00003 
00004 /*
00005  *
00006  * Licensed to the Apache Software Foundation (ASF) under one
00007  * or more contributor license agreements.  See the NOTICE file
00008  * distributed with this work for additional information
00009  * regarding copyright ownership.  The ASF licenses this file
00010  * to you under the Apache License, Version 2.0 (the
00011  * "License"); you may not use this file except in compliance
00012  * with the License.  You may obtain a copy of the License at
00013  *
00014  *   http://www.apache.org/licenses/LICENSE-2.0
00015  *
00016  * Unless required by applicable law or agreed to in writing,
00017  * software distributed under the License is distributed on an
00018  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00019  * KIND, either express or implied.  See the License for the
00020  * specific language governing permissions and limitations
00021  * under the License.
00022  *
00023  */
00024 
00025 #include <proton/import_export.h>
00026 #include <proton/message.h>
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00037 typedef struct pn_messenger_t pn_messenger_t; 
00038 typedef struct pn_subscription_t pn_subscription_t; 
00039 typedef int64_t pn_tracker_t;
00040 
00041 typedef enum {
00042   PN_STATUS_UNKNOWN = 0,
00043   PN_STATUS_PENDING = 1,
00044   PN_STATUS_ACCEPTED = 2,
00045   PN_STATUS_REJECTED = 3,
00046   PN_STATUS_MODIFIED = 4
00047 } pn_status_t;
00048 
00056 PN_EXTERN pn_messenger_t *pn_messenger(const char *name);
00057 
00064 PN_EXTERN const char *pn_messenger_name(pn_messenger_t *messenger);
00065 
00074 PN_EXTERN int pn_messenger_set_certificate(pn_messenger_t *messenger, const char *certificate);
00075 
00081 PN_EXTERN const char *pn_messenger_get_certificate(pn_messenger_t *messenger);
00082 
00091 PN_EXTERN int pn_messenger_set_private_key(pn_messenger_t *messenger, const char *private_key);
00092 
00098 PN_EXTERN const char *pn_messenger_get_private_key(pn_messenger_t *messenger);
00099 
00107 PN_EXTERN int pn_messenger_set_password(pn_messenger_t *messenger, const char *password);
00108 
00114 PN_EXTERN const char *pn_messenger_get_password(pn_messenger_t *messenger);
00115 
00125 PN_EXTERN int pn_messenger_set_trusted_certificates(pn_messenger_t *messenger, const char *cert_db);
00126 
00132 PN_EXTERN const char *pn_messenger_get_trusted_certificates(pn_messenger_t *messenger);
00133 
00142 PN_EXTERN int pn_messenger_set_timeout(pn_messenger_t *messenger, int timeout);
00143 
00150 PN_EXTERN int pn_messenger_get_timeout(pn_messenger_t *messenger);
00151 
00152 PN_EXTERN bool pn_messenger_is_blocking(pn_messenger_t *messenger);
00153 PN_EXTERN int pn_messenger_set_blocking(pn_messenger_t *messenger, bool blocking);
00154 
00160 PN_EXTERN void pn_messenger_free(pn_messenger_t *messenger);
00161 
00169 PN_EXTERN int pn_messenger_errno(pn_messenger_t *messenger);
00170 
00178 PN_EXTERN pn_error_t *pn_messenger_error(pn_messenger_t *messenger);
00179 
00187 PN_EXTERN int pn_messenger_get_outgoing_window(pn_messenger_t *messenger);
00188 
00200 PN_EXTERN int pn_messenger_set_outgoing_window(pn_messenger_t *messenger, int window);
00201 
00209 PN_EXTERN int pn_messenger_get_incoming_window(pn_messenger_t *messenger);
00210 
00223 PN_EXTERN int pn_messenger_set_incoming_window(pn_messenger_t *messenger, int window);
00224 
00233 PN_EXTERN int pn_messenger_start(pn_messenger_t *messenger);
00234 
00243 PN_EXTERN int pn_messenger_stop(pn_messenger_t *messenger);
00244 
00245 PN_EXTERN bool pn_messenger_stopped(pn_messenger_t *messenger);
00246 
00254 PN_EXTERN pn_subscription_t *pn_messenger_subscribe(pn_messenger_t *messenger, const char *source);
00255 
00256 PN_EXTERN void *pn_subscription_get_context(pn_subscription_t *sub);
00257 
00258 PN_EXTERN void pn_subscription_set_context(pn_subscription_t *sub, void *context);
00259 
00268 PN_EXTERN int pn_messenger_put(pn_messenger_t *messenger, pn_message_t *msg);
00269 
00278 PN_EXTERN pn_status_t pn_messenger_status(pn_messenger_t *messenger, pn_tracker_t tracker);
00279 
00291 PN_EXTERN int pn_messenger_settle(pn_messenger_t *messenger, pn_tracker_t tracker, int flags);
00292 
00301 PN_EXTERN pn_tracker_t pn_messenger_outgoing_tracker(pn_messenger_t *messenger);
00302 
00309 PN_EXTERN int pn_messenger_work(pn_messenger_t *messenger, int timeout);
00310 
00316 PN_EXTERN int pn_messenger_interrupt(pn_messenger_t *messenger);
00317 
00329 PN_EXTERN int pn_messenger_send(pn_messenger_t *messenger, int n);
00330 
00349 PN_EXTERN int pn_messenger_recv(pn_messenger_t *messenger, int limit);
00350 
00356 PN_EXTERN int pn_messenger_receiving(pn_messenger_t *messenger);
00357 
00367 PN_EXTERN int pn_messenger_get(pn_messenger_t *messenger, pn_message_t *msg);
00368 
00377 PN_EXTERN pn_tracker_t pn_messenger_incoming_tracker(pn_messenger_t *messenger);
00378 
00379 PN_EXTERN pn_subscription_t *pn_messenger_incoming_subscription(pn_messenger_t *messenger);
00380 
00381 #define PN_CUMULATIVE (0x1)
00382 
00394 PN_EXTERN int pn_messenger_accept(pn_messenger_t *messenger, pn_tracker_t tracker, int flags);
00395 
00407 PN_EXTERN int pn_messenger_reject(pn_messenger_t *messenger, pn_tracker_t tracker, int flags);
00408 
00415 PN_EXTERN int pn_messenger_outgoing(pn_messenger_t *messenger);
00416 
00423 PN_EXTERN int pn_messenger_incoming(pn_messenger_t *messenger);
00424 
00489 PN_EXTERN int pn_messenger_route(pn_messenger_t *messenger, const char *pattern,
00490                                  const char *address);
00491 
00492 PN_EXTERN int pn_messenger_rewrite(pn_messenger_t *messenger, const char *pattern,
00493                                    const char *address);
00494 
00495 #ifdef __cplusplus
00496 }
00497 #endif
00498 
00499 #endif /* messenger.h */