http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/include/proton/selectable.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/selectable.h b/proton-c/include/proton/selectable.h deleted file mode 100644 index 8c0a4db..0000000 --- a/proton-c/include/proton/selectable.h +++ /dev/null @@ -1,271 +0,0 @@ -#ifndef PROTON_SELECTABLE_H -#define PROTON_SELECTABLE_H 1 - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include <proton/import_export.h> -#include <proton/object.h> -#include <proton/event.h> -#include <proton/type_compat.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @cond INTERNAL - */ - -/** - * An iterator for selectables. - */ -typedef pn_iterator_t pn_selectables_t; - -/** - * A ::pn_socket_t provides an abstract handle to an IO stream. The - * pipe version is uni-directional. The network socket version is - * bi-directional. Both are non-blocking. - * - * pn_socket_t handles from pn_pipe() may only be used with - * pn_read(), pn_write(), pn_close() and pn_selector_select(). - * - * pn_socket_t handles from pn_listen(), pn_accept() and - * pn_connect() must perform further IO using Proton functions. - * Mixing Proton io.h functions with native IO functions on the same - * handles will result in undefined behavior. - * - * pn_socket_t handles may only be used with a single pn_io_t during - * their lifetime. - */ -#if defined(_WIN32) && ! defined(__CYGWIN__) -#ifdef _WIN64 -typedef unsigned __int64 pn_socket_t; -#else -typedef unsigned int pn_socket_t; -#endif -#define PN_INVALID_SOCKET (pn_socket_t)(~0) -#else -typedef int pn_socket_t; -#define PN_INVALID_SOCKET (-1) -#endif - -/** - * A selectable object provides an interface that can be used to - * incorporate proton's I/O into third party event loops. - * - * Every selectable is associated with exactly one file descriptor. - * Selectables may be interested in three kinds of events, read - * events, write events, and timer events. - * - * When a read, write, or timer event occurs, the selectable must be - * notified by calling ::pn_selectable_readable(), - * ::pn_selectable_writable(), and ::pn_selectable_expired() as - * appropriate. - * - * Once a selectable reaches a terminal state (see - * ::pn_selectable_is_terminal()), it will never be interested in - * events of any kind. When this occurs it should be removed from the - * external event loop and discarded using ::pn_selectable_free(). - */ -typedef struct pn_selectable_t pn_selectable_t; - -/** - * Construct a new selectables iterator. - * - * @return a pointer to a new selectables iterator - */ -PNX_EXTERN pn_selectables_t *pn_selectables(void); - -/** - * Get the next selectable from an iterator. - * - * @param[in] selectables a selectable iterator - * @return the next selectable from the iterator - */ -PNX_EXTERN pn_selectable_t *pn_selectables_next(pn_selectables_t *selectables); - -/** - * Free a selectables iterator. - * - * @param[in] selectables a selectables iterator (or NULL) - */ -PNX_EXTERN void pn_selectables_free(pn_selectables_t *selectables); - -PNX_EXTERN pn_selectable_t *pn_selectable(void); - -PNX_EXTERN void pn_selectable_on_readable(pn_selectable_t *sel, void (*readable)(pn_selectable_t *)); -PNX_EXTERN void pn_selectable_on_writable(pn_selectable_t *sel, void (*writable)(pn_selectable_t *)); -PNX_EXTERN void pn_selectable_on_expired(pn_selectable_t *sel, void (*expired)(pn_selectable_t *)); -PNX_EXTERN void pn_selectable_on_error(pn_selectable_t *sel, void (*error)(pn_selectable_t *)); -PNX_EXTERN void pn_selectable_on_release(pn_selectable_t *sel, void (*release)(pn_selectable_t *)); -PNX_EXTERN void pn_selectable_on_finalize(pn_selectable_t *sel, void (*finalize)(pn_selectable_t *)); - -PNX_EXTERN pn_record_t *pn_selectable_attachments(pn_selectable_t *sel); - -/** - * Get the file descriptor associated with a selectable. - * - * @param[in] selectable a selectable object - * @return the file descriptor associated with the selectable - */ -PNX_EXTERN pn_socket_t pn_selectable_get_fd(pn_selectable_t *selectable); - -/** - * Set the file descriptor associated with a selectable. - * - * @param[in] selectable a selectable object - * @param[in] fd the file descriptor - */ -PNX_EXTERN void pn_selectable_set_fd(pn_selectable_t *selectable, pn_socket_t fd); - -/** - * Check if a selectable is interested in readable events. - * - * @param[in] selectable a selectable object - * @return true iff the selectable is interested in read events - */ -PNX_EXTERN bool pn_selectable_is_reading(pn_selectable_t *selectable); - -PNX_EXTERN void pn_selectable_set_reading(pn_selectable_t *sel, bool reading); - -/** - * Check if a selectable is interested in writable events. - * - * @param[in] selectable a selectable object - * @return true iff the selectable is interested in writable events - */ -PNX_EXTERN bool pn_selectable_is_writing(pn_selectable_t *selectable); - - PNX_EXTERN void pn_selectable_set_writing(pn_selectable_t *sel, bool writing); - -/** - * Get the next deadline for a selectable. - * - * A selectable with a deadline is interested in being notified when - * that deadline expires. Zero indicates there is currently no - * deadline. - * - * @param[in] selectable a selectable object - * @return the next deadline or zero - */ -PNX_EXTERN pn_timestamp_t pn_selectable_get_deadline(pn_selectable_t *selectable); - -PNX_EXTERN void pn_selectable_set_deadline(pn_selectable_t *sel, pn_timestamp_t deadline); - -/** - * Notify a selectable that the file descriptor is readable. - * - * @param[in] selectable a selectable object - */ -PNX_EXTERN void pn_selectable_readable(pn_selectable_t *selectable); - -/** - * Notify a selectable that the file descriptor is writable. - * - * @param[in] selectable a selectable object - */ -PNX_EXTERN void pn_selectable_writable(pn_selectable_t *selectable); - -/** - * Notify a selectable that there is an error on the file descriptor. - * - * @param[in] selectable a selectable object - */ -PNX_EXTERN void pn_selectable_error(pn_selectable_t *selectable); - -/** - * Notify a selectable that its deadline has expired. - * - * @param[in] selectable a selectable object - */ -PNX_EXTERN void pn_selectable_expired(pn_selectable_t *selectable); - -/** - * Check if a selectable is registered. - * - * This flag is set via ::pn_selectable_set_registered() and can be - * used for tracking whether a given selectable has been registerd - * with an external event loop. - * - * @param[in] selectable - * @return true if the selectable is registered - */ -PNX_EXTERN bool pn_selectable_is_registered(pn_selectable_t *selectable); - -/** - * Set the registered flag for a selectable. - * - * See ::pn_selectable_is_registered() for details. - * - * @param[in] selectable a selectable object - * @param[in] registered the registered flag - */ -PNX_EXTERN void pn_selectable_set_registered(pn_selectable_t *selectable, bool registered); - -/** - * Check if a selectable is in the terminal state. - * - * A selectable that is in the terminal state will never be interested - * in being notified of events of any kind ever again. Once a - * selectable reaches this state it should be removed from any - * external I/O loops and freed in order to reclaim any resources - * associated with it. - * - * @param[in] selectable a selectable object - * @return true if the selectable is in the terminal state, false otherwise - */ -PNX_EXTERN bool pn_selectable_is_terminal(pn_selectable_t *selectable); - -/** - * Terminate a selectable. - * - * @param[in] selectable a selectable object - */ -PNX_EXTERN void pn_selectable_terminate(pn_selectable_t *selectable); - -PNX_EXTERN void pn_selectable_release(pn_selectable_t *selectable); - -/** - * Free a selectable object. - * - * @param[in] selectable a selectable object (or NULL) - */ -PNX_EXTERN void pn_selectable_free(pn_selectable_t *selectable); - -/** - * Configure a selectable with a set of callbacks that emit readable, - * writable, and expired events into the supplied collector. - * - * @param[in] selectable a selectable objet - * @param[in] collector a collector object - */ -PNX_EXTERN void pn_selectable_collect(pn_selectable_t *selectable, pn_collector_t *collector); - -/** - * @endcond - */ - -#ifdef __cplusplus -} -#endif - -#endif /* selectable.h */
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/include/proton/session.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/session.h b/proton-c/include/proton/session.h deleted file mode 100644 index 8c78db4..0000000 --- a/proton-c/include/proton/session.h +++ /dev/null @@ -1,297 +0,0 @@ -#ifndef PROTON_SESSION_H -#define PROTON_SESSION_H 1 - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include <proton/import_export.h> -#include <proton/type_compat.h> -#include <proton/types.h> -#include <proton/object.h> -#include <proton/error.h> -#include <proton/condition.h> -#include <stddef.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @file - * - * @copybrief session - * - * @addtogroup session - * @{ - */ - -/** - * Factory for creating a new session on a given connection object. - * - * Creates a new session object and adds it to the set of sessions - * maintained by the connection object. - * - * @param[in] connection the connection object - * @return a pointer to the new session - */ -PN_EXTERN pn_session_t *pn_session(pn_connection_t *connection); - -/** - * Free a session object. - * - * When a session is freed it will no longer be retained by the - * connection once any internal references to the session are no - * longer needed. Freeing a session will free all links on that - * session and settle any deliveries on those links. - * - * @param[in] session the session object to free (or NULL) - */ -PN_EXTERN void pn_session_free(pn_session_t *session); - -/** - * @deprecated - * - * Get the application context that is associated with a session - * object. - * - * The application context for a session may be set using - * ::pn_session_set_context. - * - * @param[in] session the session whose context is to be returned. - * @return the application context for the session object - */ -PN_EXTERN void *pn_session_get_context(pn_session_t *session); - -/** - * @deprecated - * - * Set a new application context for a session object. - * - * The application context for a session object may be retrieved - * using ::pn_session_get_context. - * - * @param[in] session the session object - * @param[in] context the application context - */ -PN_EXTERN void pn_session_set_context(pn_session_t *session, void *context); - -/** - * Get the attachments that are associated with a session object. - * - * @param[in] session the session whose attachments are to be returned. - * @return the attachments for the session object - */ -PN_EXTERN pn_record_t *pn_session_attachments(pn_session_t *session); - -/** - * Get the endpoint state flags for a session. - * - * @param[in] session the session object - * @return the session's state flags - */ -PN_EXTERN pn_state_t pn_session_state(pn_session_t *session); - -/** - * @deprecated - * - * Get additional error information associated with the session. - * - * Whenever a session operation fails (i.e. returns an error code), - * additional error details can be obtained using this function. The - * error object that is returned may also be used to clear the error - * condition. - * - * The pointer returned by this operation is valid until the - * session object is freed. - * - * @param[in] session the session object - * @return the session's error object - */ -PN_EXTERN pn_error_t *pn_session_error(pn_session_t *session); - -/** - * Get the local condition associated with the session endpoint. - * - * The ::pn_condition_t object retrieved may be modified prior to - * closing the session in order to indicate a particular condition - * exists when the session closes. This is normally used to - * communicate error conditions to the remote peer, however it may - * also be used in non error cases. See ::pn_condition_t for more - * details. - * - * The pointer returned by this operation is valid until the session - * object is freed. - * - * @param[in] session the session object - * @return the session's local condition object - */ -PN_EXTERN pn_condition_t *pn_session_condition(pn_session_t *session); - -/** - * Get the remote condition associated with the session endpoint. - * - * The ::pn_condition_t object retrieved may be examined in order to - * determine whether the remote peer was indicating some sort of - * exceptional condition when the remote session endpoint was - * closed. The ::pn_condition_t object returned may not be modified. - * - * The pointer returned by this operation is valid until the - * session object is freed. - * - * @param[in] session the session object - * @return the session's remote condition object - */ -PN_EXTERN pn_condition_t *pn_session_remote_condition(pn_session_t *session); - -/** - * Get the parent connection for a session object. - * - * This operation retrieves the parent pn_connection_t object that - * contains the given pn_session_t object. - * - * @param[in] session the session object - * @return the parent connection object - */ -PN_EXTERN pn_connection_t *pn_session_connection(pn_session_t *session); - -/** - * Open a session. - * - * Once this operation has completed, the PN_LOCAL_ACTIVE state flag - * will be set. - * - * @param[in] session the session object - */ -PN_EXTERN void pn_session_open(pn_session_t *session); - -/** - * Close a session. - * - * Once this operation has completed, the PN_LOCAL_CLOSED state flag - * will be set. This may be called without calling - * ::pn_session_open, in this case it is equivalent to calling - * ::pn_session_open followed by ::pn_session_close. - * - * @param[in] session the session object - */ -PN_EXTERN void pn_session_close(pn_session_t *session); - -/** - * Get the incoming capacity of the session measured in bytes. - * - * The incoming capacity of a session determines how much incoming - * message data the session will buffer. Note that if this value is - * less than the negotiated frame size of the transport, it will be - * rounded up to one full frame. - * - * @param[in] session the session object - * @return the incoming capacity of the session in bytes - */ -PN_EXTERN size_t pn_session_get_incoming_capacity(pn_session_t *session); - -/** - * Set the incoming capacity for a session object. - * - * The incoming capacity of a session determines how much incoming - * message data the session will buffer. Note that if this value is - * less than the negotiated frame size of the transport, it will be - * rounded up to one full frame. - * - * @param[in] session the session object - * @param[in] capacity the incoming capacity for the session - */ -PN_EXTERN void pn_session_set_incoming_capacity(pn_session_t *session, size_t capacity); - -/** - * Get the outgoing window for a session object. - * - * @param[in] session the session object - * @return the outgoing window for the session - */ -PN_EXTERN size_t pn_session_get_outgoing_window(pn_session_t *session); - -/** - * Set the outgoing window for a session object. - * - * @param[in] session the session object - * @param[in] window the outgoing window for the session - */ -PN_EXTERN void pn_session_set_outgoing_window(pn_session_t *session, size_t window); - -/** - * Get the number of outgoing bytes currently buffered by a session. - * - * @param[in] session the session object - * @return the number of outgoing bytes currently buffered - */ -PN_EXTERN size_t pn_session_outgoing_bytes(pn_session_t *session); - -/** - * Get the number of incoming bytes currently buffered by a session. - * - * @param[in] session the session object - * @return the number of incoming bytes currently buffered - */ -PN_EXTERN size_t pn_session_incoming_bytes(pn_session_t *session); - -/** - * Retrieve the first session from a given connection that matches the - * specified state mask. - * - * Examines the state of each session owned by the connection, and - * returns the first session that matches the given state mask. If - * state contains both local and remote flags, then an exact match - * against those flags is performed. If state contains only local or - * only remote flags, then a match occurs if any of the local or - * remote flags are set respectively. - * - * @param[in] connection to be searched for matching sessions - * @param[in] state mask to match - * @return the first session owned by the connection that matches the - * mask, else NULL if no sessions match - */ -PN_EXTERN pn_session_t *pn_session_head(pn_connection_t *connection, pn_state_t state); - -/** - * Retrieve the next session from a given connection that matches the - * specified state mask. - * - * When used with ::pn_session_head, application can access all - * sessions on the connection that match the given state. See - * ::pn_session_head for description of match behavior. - * - * @param[in] session the previous session obtained from - * ::pn_session_head or ::pn_session_next - * @param[in] state mask to match. - * @return the next session owned by the connection that matches the - * mask, else NULL if no sessions match - */ -PN_EXTERN pn_session_t *pn_session_next(pn_session_t *session, pn_state_t state); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* session.h */ http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/include/proton/ssl.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/ssl.h b/proton-c/include/proton/ssl.h deleted file mode 100644 index 4e5a0ca..0000000 --- a/proton-c/include/proton/ssl.h +++ /dev/null @@ -1,433 +0,0 @@ -#ifndef PROTON_SSL_H -#define PROTON_SSL_H 1 - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include <proton/import_export.h> -#include <proton/type_compat.h> -#include <proton/types.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @file - * - * @copybrief ssl - * - * @addtogroup ssl - * @{ - */ - -/** - * API for using SSL with the Transport Layer. - * - * A Transport may be configured to use SSL for encryption and/or authentication. A - * Transport can be configured as either an "SSL client" or an "SSL server". An SSL - * client is the party that proactively establishes a connection to an SSL server. An SSL - * server is the party that accepts a connection request from a remote SSL client. - * - * This SSL implementation defines the following objects: - - * @li A top-level object that stores the configuration used by one or more SSL - * sessions (pn_ssl_domain_t). - * @li A per-connection SSL session object that performs the encryption/authentication - * associated with the transport (pn_ssl_t). - * @li The encryption parameters negotiated for the SSL session (pn_ssl_state_t). - * - * A pn_ssl_domain_t object must be created and configured before an SSL session can be - * established. The pn_ssl_domain_t is used to construct an SSL session (pn_ssl_t). The - * session "adopts" its configuration from the pn_ssl_domain_t that was used to create it. - * For example, pn_ssl_domain_t can be configured as either a "client" or a "server". SSL - * sessions constructed from this domain will perform the corresponding role (either - * client or server). - * - * If either an SSL server or client needs to identify itself with the remote node, it - * must have its SSL certificate configured (see ::pn_ssl_domain_set_credentials()). - * - * If either an SSL server or client needs to verify the identity of the remote node, it - * must have its database of trusted CAs configured (see ::pn_ssl_domain_set_trusted_ca_db()). - * - * An SSL server connection may allow the remote client to connect without SSL (eg. "in - * the clear"), see ::pn_ssl_domain_allow_unsecured_client(). - * - * The level of verification required of the remote may be configured (see - * ::pn_ssl_domain_set_peer_authentication) - * - * Support for SSL Client Session resume is provided (see ::pn_ssl_init, - * ::pn_ssl_resume_status). - */ -typedef struct pn_ssl_domain_t pn_ssl_domain_t; - -/** - * @see pn_ssl - */ -typedef struct pn_ssl_t pn_ssl_t; - -/** - * Determines the type of SSL endpoint. - */ -typedef enum { - PN_SSL_MODE_CLIENT = 1, /**< Local connection endpoint is an SSL client */ - PN_SSL_MODE_SERVER /**< Local connection endpoint is an SSL server */ -} pn_ssl_mode_t; - -/** - * Indicates whether an SSL session has been resumed. - */ -typedef enum { - PN_SSL_RESUME_UNKNOWN, /**< Session resume state unknown/not supported */ - PN_SSL_RESUME_NEW, /**< Session renegotiated - not resumed */ - PN_SSL_RESUME_REUSED /**< Session resumed from previous session. */ -} pn_ssl_resume_status_t; - -/** - * Tests for SSL implementation present - * - * @return true if we support SSL, false if not - */ -PN_EXTERN bool pn_ssl_present( void ); - -/** - * Create an SSL configuration domain - * - * This method allocates an SSL domain object. This object is used to hold the SSL - * configuration for one or more SSL sessions. The SSL session object (pn_ssl_t) is - * allocated from this object. - * - * @param[in] mode the role, client or server, assumed by all SSL sessions created - * with this domain. - * @return a pointer to the SSL domain, if SSL support is present. - */ -PN_EXTERN pn_ssl_domain_t *pn_ssl_domain(pn_ssl_mode_t mode); - -/** - * Release an SSL configuration domain - * - * This method frees an SSL domain object allocated by ::pn_ssl_domain. - * @param[in] domain the domain to destroy. - */ -PN_EXTERN void pn_ssl_domain_free(pn_ssl_domain_t *domain); - -/** - * Set the certificate that identifies the local node to the remote. - * - * This certificate establishes the identity for the local node for all SSL sessions - * created from this domain. It will be sent to the remote if the remote needs to verify - * the identity of this node. This may be used for both SSL servers and SSL clients (if - * client authentication is required by the server). - * - * @note This setting effects only those pn_ssl_t objects created after this call - * returns. pn_ssl_t objects created before invoking this method will use the domain's - * previous setting. - * - * @param[in] domain the ssl domain that will use this certificate. - * @param[in] credential_1 specifier for the file/database containing the identifying - * certificate. For Openssl users, this is a PEM file. For Windows SChannel users, this is - * the PKCS#12 file or system store. - * @param[in] credential_2 an optional key to access the identifying certificate. For - * Openssl users, this is an optional PEM file containing the private key used to sign the - * certificate. For Windows SChannel users, this is the friendly name of the - * self-identifying certificate if there are multiple certificates in the store. - * @param[in] password the password used to sign the key, else NULL if key is not - * protected. - * @return 0 on success - */ -PN_EXTERN int pn_ssl_domain_set_credentials(pn_ssl_domain_t *domain, - const char *credential_1, - const char *credential_2, - const char *password); - -/** - * Configure the set of trusted CA certificates used by this domain to verify peers. - * - * If the local SSL client/server needs to verify the identity of the remote, it must - * validate the signature of the remote's certificate. This function sets the database of - * trusted CAs that will be used to verify the signature of the remote's certificate. - * - * @note This setting effects only those pn_ssl_t objects created after this call - * returns. pn_ssl_t objects created before invoking this method will use the domain's - * previous setting. - * - * @param[in] domain the ssl domain that will use the database. - * @param[in] certificate_db database of trusted CAs, used to authenticate the peer. - * @return 0 on success - */ -PN_EXTERN int pn_ssl_domain_set_trusted_ca_db(pn_ssl_domain_t *domain, - const char *certificate_db); - -/** - * Determines the level of peer validation. - * - * ANONYMOUS_PEER does not require a valid certificate, and permits - * use of ciphers that do not provide authentication. - * - * VERIFY_PEER will only connect to those peers that provide a valid - * identifying certificate signed by a trusted CA and are using an - * authenticated cipher. - * - * VERIFY_PEER_NAME is like VERIFY_PEER, but also requires the peer's - * identity as contained in the certificate to be valid (see - * ::pn_ssl_set_peer_hostname). - * - * ANONYMOUS_PEER is configured by default. - */ -typedef enum { - PN_SSL_VERIFY_NULL = 0, /**< internal use only */ - PN_SSL_VERIFY_PEER, /**< require peer to provide a valid identifying certificate */ - PN_SSL_ANONYMOUS_PEER, /**< do not require a certificate nor cipher authorization */ - PN_SSL_VERIFY_PEER_NAME /**< require valid certificate and matching name */ -} pn_ssl_verify_mode_t; - -/** - * Configure the level of verification used on the peer certificate. - * - * This method controls how the peer's certificate is validated, if at all. By default, - * neither servers nor clients attempt to verify their peers (PN_SSL_ANONYMOUS_PEER). - * Once certificates and trusted CAs are configured, peer verification can be enabled. - * - * @note In order to verify a peer, a trusted CA must be configured. See - * ::pn_ssl_domain_set_trusted_ca_db(). - * - * @note Servers must provide their own certificate when verifying a peer. See - * ::pn_ssl_domain_set_credentials(). - * - * @note This setting effects only those pn_ssl_t objects created after this call - * returns. pn_ssl_t objects created before invoking this method will use the domain's - * previous setting. - * - * @param[in] domain the ssl domain to configure. - * @param[in] mode the level of validation to apply to the peer - * @param[in] trusted_CAs path to a database of trusted CAs that the server will advertise - * to the peer client if the server has been configured to verify its peer. - * @return 0 on success - */ -PN_EXTERN int pn_ssl_domain_set_peer_authentication(pn_ssl_domain_t *domain, - const pn_ssl_verify_mode_t mode, - const char *trusted_CAs); - -/** - * Permit a server to accept connection requests from non-SSL clients. - * - * This configures the server to "sniff" the incoming client data stream, and dynamically - * determine whether SSL/TLS is being used. This option is disabled by default: only - * clients using SSL/TLS are accepted. - * - * @param[in] domain the domain (server) that will accept the client connections. - * @return 0 on success - */ -PN_EXTERN int pn_ssl_domain_allow_unsecured_client(pn_ssl_domain_t *domain); - -/** - * Create a new SSL session object associated with a transport. - * - * A transport must have an SSL object in order to "speak" SSL over its connection. This - * method allocates an SSL object associates it with the transport. - * - * @param[in] transport the transport that will own the new SSL session. - * @return a pointer to the SSL object configured for this transport. Returns NULL if - * no SSL session is associated with the transport. - */ -PN_EXTERN pn_ssl_t *pn_ssl(pn_transport_t *transport); - -/** - * Initialize an SSL session. - * - * This method configures an SSL object using the configuration provided by the given - * domain. - * - * @param[in] ssl the ssl session to configured. - * @param[in] domain the ssl domain used to configure the SSL session. - * @param[in] session_id if supplied, attempt to resume a previous SSL - * session that used the same session_id. If no previous SSL session - * is available, a new session will be created using the session_id - * and stored for future session restore (see ::::pn_ssl_resume_status). - * @return 0 on success, else an error code. - */ -PN_EXTERN int pn_ssl_init(pn_ssl_t *ssl, - pn_ssl_domain_t *domain, - const char *session_id); - -/** - * Get the name of the Cipher that is currently in use. - * - * Gets a text description of the cipher that is currently active, or - * returns FALSE if SSL is not active (no cipher). Note that the - * cipher in use may change over time due to renegotiation or other - * changes to the SSL state. - * - * @param[in] ssl the ssl client/server to query. - * @param[in,out] buffer buffer of size bytes to hold cipher name - * @param[in] size maximum number of bytes in buffer. - * @return True if cipher name written to buffer, False if no cipher in use. - */ -PN_EXTERN bool pn_ssl_get_cipher_name(pn_ssl_t *ssl, char *buffer, size_t size); - -/** - * Get the SSF (security strength factor) of the Cipher that is currently in use. - * - * @param[in] ssl the ssl client/server to query. - * @return the ssf, note that 0 means no security. - */ -PN_EXTERN int pn_ssl_get_ssf(pn_ssl_t *ssl); - -/** - * Get the name of the SSL protocol that is currently in use. - * - * Gets a text description of the SSL protocol that is currently active, or returns FALSE if SSL - * is not active. Note that the protocol may change over time due to renegotiation. - * - * @param[in] ssl the ssl client/server to query. - * @param[in,out] buffer buffer of size bytes to hold the version identifier - * @param[in] size maximum number of bytes in buffer. - * @return True if the version information was written to buffer, False if SSL connection - * not ready. - */ -PN_EXTERN bool pn_ssl_get_protocol_name(pn_ssl_t *ssl, char *buffer, size_t size); - -/** - * Check whether the state has been resumed. - * - * Used for client session resume. When called on an active session, indicates whether - * the state has been resumed from a previous session. - * - * @note This is a best-effort service - there is no guarantee that the remote server will - * accept the resumed parameters. The remote server may choose to ignore these - * parameters, and request a re-negotiation instead. - * - * @param[in] ssl the ssl session to check - * @return status code indicating whether or not the session has been resumed. - */ -PN_EXTERN pn_ssl_resume_status_t pn_ssl_resume_status(pn_ssl_t *ssl); - -/** - * Set the expected identity of the remote peer. - * - * By default, SSL will use the hostname associated with the connection that - * the transport is bound to (see ::pn_connection_set_hostname). This method - * allows the caller to override that default. - * - * The hostname is used for two purposes: 1) when set on an SSL client, it is sent to the - * server during the handshake (if Server Name Indication is supported), and 2) it is used - * to check against the identifying name provided in the peer's certificate. If the - * supplied name does not exactly match a SubjectAltName (type DNS name), or the - * CommonName entry in the peer's certificate, the peer is considered unauthenticated - * (potential imposter), and the SSL connection is aborted. - * - * @note Verification of the hostname is only done if PN_SSL_VERIFY_PEER_NAME is enabled. - * See ::pn_ssl_domain_set_peer_authentication. - * - * @param[in] ssl the ssl session. - * @param[in] hostname the expected identity of the remote. Must conform to the syntax as - * given in RFC1034, Section 3.5. - * @return 0 on success. - */ -PN_EXTERN int pn_ssl_set_peer_hostname(pn_ssl_t *ssl, const char *hostname); - -/** - * Access the configured peer identity. - * - * Return the expected identity of the remote peer, as set by ::pn_ssl_set_peer_hostname. - * - * @param[in] ssl the ssl session. - * @param[out] hostname buffer to hold the null-terminated name string. If null, no string - * is written. - * @param[in,out] bufsize on input set to the number of octets in hostname. On output, set - * to the number of octets needed to hold the value of hostname plus a null byte. Zero if - * no hostname set. - * @return 0 on success. - */ -PN_EXTERN int pn_ssl_get_peer_hostname(pn_ssl_t *ssl, char *hostname, size_t *bufsize); - -/** - * Get the subject from the peers certificate. - * - * @param[in] ssl the ssl client/server to query. - * @return A null terminated string representing the full subject, - * which is valid until the ssl object is destroyed. - */ -PN_EXTERN const char* pn_ssl_get_remote_subject(pn_ssl_t *ssl); - -/** - * Enumeration identifying the sub fields of the subject field in the ssl certificate. - */ -typedef enum { - PN_SSL_CERT_SUBJECT_COUNTRY_NAME, - PN_SSL_CERT_SUBJECT_STATE_OR_PROVINCE, - PN_SSL_CERT_SUBJECT_CITY_OR_LOCALITY, - PN_SSL_CERT_SUBJECT_ORGANIZATION_NAME, - PN_SSL_CERT_SUBJECT_ORGANIZATION_UNIT, - PN_SSL_CERT_SUBJECT_COMMON_NAME -} pn_ssl_cert_subject_subfield; - -/** - * Enumeration identifying hashing algorithm. - */ -typedef enum { - PN_SSL_SHA1, /* Produces hash that is 20 bytes long */ - PN_SSL_SHA256, /* Produces hash that is 32 bytes long */ - PN_SSL_SHA512, /* Produces hash that is 64 bytes long */ - PN_SSL_MD5 /* Produces hash that is 16 bytes long */ -} pn_ssl_hash_alg; - -/** - * Get the fingerprint of the certificate. The certificate fingerprint (as displayed in the Fingerprints section when - * looking at a certificate with say the Firefox browser) is the hexadecimal hash of the entire certificate. - * The fingerprint is not part of the certificate, rather it is computed from the certificate and can be used to uniquely identify a certificate. - * @param[in] ssl0 the ssl client/server to query - * @param[in] fingerprint char pointer. The certificate fingerprint (in hex format) will be populated in this array. - * If sha1 is the digest name, the fingerprint is 41 characters long (40 + 1 '\0' character), 65 characters long for - * sha256 and 129 characters long for sha512 and 33 characters for md5. - * @param[in] fingerprint_length - Must be at >= 33 for md5, >= 41 for sha1, >= 65 for sha256 and >=129 for sha512. - * @param[in] hash_alg the hash algorithm to use. Must be of type pn_ssl_hash_alg (currently supports sha1, sha256, sha512 and md5) - * @return error code - Returns 0 on success. Return a value less than zero if there were any errors. Upon execution of this function, - * char *fingerprint will contain the appropriate null terminated hex fingerprint - */ -PN_EXTERN int pn_ssl_get_cert_fingerprint(pn_ssl_t *ssl0, - char *fingerprint, - size_t fingerprint_length, - pn_ssl_hash_alg hash_alg); - -/** - * Returns a char pointer that contains the value of the sub field of the subject field in the ssl certificate. The subject field usually contains the following sub fields - - * C = ISO3166 two character country code - * ST = state or province - * L = Locality; generally means city - * O = Organization - Company Name - * OU = Organization Unit - division or unit - * CN = CommonName - * @param[in] ssl0 the ssl client/server to query - * @param[in] field The enumeration pn_ssl_cert_subject_subfield representing the required sub field. - * @return A null terminated string which contains the requested sub field value which is valid until the ssl object is destroyed. - */ -PN_EXTERN const char* pn_ssl_get_remote_subject_subfield(pn_ssl_t *ssl0, pn_ssl_cert_subject_subfield field); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* ssl.h */ http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/include/proton/terminus.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/terminus.h b/proton-c/include/proton/terminus.h deleted file mode 100644 index c18fb3e..0000000 --- a/proton-c/include/proton/terminus.h +++ /dev/null @@ -1,309 +0,0 @@ -#ifndef PROTON_TERMINUS_H -#define PROTON_TERMINUS_H 1 - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include <proton/import_export.h> -#include <proton/type_compat.h> -#include <proton/codec.h> -#include <stddef.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @file - * - * @copybrief terminus - * - * @addtogroup terminus - * @{ - */ - -/** - * Encapsulates the endpoint state associated with an AMQP Terminus. - * - * An AMQP Terminus acts as either a source or target for messages, - * but never both. Every AMQP link is associated with both a source - * terminus and a target terminus that is negotiated during link - * establishment. A terminus consists of an AMQP address, along with a - * number of other properties defining the quality of service and - * behaviour of the link. - */ -typedef struct pn_terminus_t pn_terminus_t; - -/** - * Type of an AMQP terminus. - */ -typedef enum { - PN_UNSPECIFIED = 0, /**< indicates a nonexistent terminus, may used - as a source or target */ - PN_SOURCE = 1, /**< indicates a source of messages */ - PN_TARGET = 2, /**< indicates a target for messages */ - PN_COORDINATOR = 3 /**< a special target identifying a transaction - coordinator */ -} pn_terminus_type_t; - -/** - * Durability mode of an AMQP terminus. - * - * An AMQP terminus may provide durable storage for its state, thereby - * permitting link recovery in the event of endpoint failures. This - * durability may be applied to the configuration of the terminus - * only, or to all delivery state as well. - */ -typedef enum { - PN_NONDURABLE = 0, /**< indicates a non durable terminus */ - PN_CONFIGURATION = 1, /**< indicates a terminus with durably held - configuration, but not delivery state */ - PN_DELIVERIES = 2 /**< indicates a terminus with both durably held - configuration and durably held delivery - state. */ -} pn_durability_t; - -/** - * Expiry policy of an AMQP terminus. - * - * An orphaned terminus can only exist for the timeout configured by - * ::pn_terminus_set_timeout. The expiry policy determins when a - * terminus is considered orphaned, i.e. when the expiry timer starts - * counting down. - */ -typedef enum { - PN_EXPIRE_WITH_LINK, /**< the terminus is orphaned when the parent link is closed */ - PN_EXPIRE_WITH_SESSION, /**< the terminus is orphaned when the parent session is closed */ - PN_EXPIRE_WITH_CONNECTION, /**< the terminus is orphaned when the parent connection is closed */ - PN_EXPIRE_NEVER /**< the terminus is never considered orphaned */ -} pn_expiry_policy_t; - -/** - * Distribution mode of an AMQP terminus. - * - * The distribution mode of a source terminus defines the behaviour - * when multiple receiving links provide addresses that resolve to the - * same node. - */ -typedef enum { - PN_DIST_MODE_UNSPECIFIED = 0, /**< the behaviour is defined by the node */ - PN_DIST_MODE_COPY = 1, /**< the receiver gets all messages */ - PN_DIST_MODE_MOVE = 2 /**< the receiver competes for messages */ -} pn_distribution_mode_t; - -/** - * Get the type of a terminus object. - * - * @param[in] terminus a terminus object - * @return the terminus type - */ -PN_EXTERN pn_terminus_type_t pn_terminus_get_type(pn_terminus_t *terminus); - -/** - * Set the type of a terminus object. - * - * @param[in] terminus a terminus object - * @param[in] type the terminus type - * @return 0 on success or an error code on failure - */ -PN_EXTERN int pn_terminus_set_type(pn_terminus_t *terminus, pn_terminus_type_t type); - -/** - * Get the address of a terminus object. - * - * The pointer returned by this operation is valid until - * ::pn_terminus_set_address is called or until the terminus is freed - * due to its parent link being freed. - * - * @param[in] terminus a terminus object - * @return a pointer to the address - */ -PN_EXTERN const char *pn_terminus_get_address(pn_terminus_t *terminus); - -/** - * Set the address of a terminus object. - * - * @param[in] terminus a terminus object - * @param[in] address an AMQP address string - * @return 0 on success or an error code on failure - */ -PN_EXTERN int pn_terminus_set_address(pn_terminus_t *terminus, const char *address); - -/** - * Get the distribution mode of a terminus object. - * - * @param[in] terminus a terminus object - * @return the distribution mode of the terminus - */ -PN_EXTERN pn_distribution_mode_t pn_terminus_get_distribution_mode(const pn_terminus_t *terminus); - -/** - * Set the distribution mode of a terminus object. - * - * @param[in] terminus a terminus object - * @param[in] mode the distribution mode for the terminus - * @return 0 on success or an error code on failure - */ -PN_EXTERN int pn_terminus_set_distribution_mode(pn_terminus_t *terminus, pn_distribution_mode_t mode); - -/** - * Get the durability mode of a terminus object. - * - * @param[in] terminus a terminus object - * @return the terminus durability mode - */ -PN_EXTERN pn_durability_t pn_terminus_get_durability(pn_terminus_t *terminus); - -/** - * Set the durability mode of a terminus object. - * - * @param[in] terminus a terminus object - * @param[in] durability the terminus durability mode - * @return 0 on success or an error code on failure - */ -PN_EXTERN int pn_terminus_set_durability(pn_terminus_t *terminus, - pn_durability_t durability); - -/** - * Get the expiry policy of a terminus object. - * - * @param[in] terminus a terminus object - * @return the expiry policy of the terminus - */ -PN_EXTERN pn_expiry_policy_t pn_terminus_get_expiry_policy(pn_terminus_t *terminus); - -/** - * Set the expiry policy of a terminus object. - * - * @param[in] terminus a terminus object - * @param[in] policy the expiry policy for the terminus - * @return 0 on success or an error code on failure - */ -PN_EXTERN int pn_terminus_set_expiry_policy(pn_terminus_t *terminus, pn_expiry_policy_t policy); - -/** - * Get the timeout of a terminus object. - * - * @param[in] terminus a terminus object - * @return the timeout of the terminus - */ -PN_EXTERN pn_seconds_t pn_terminus_get_timeout(pn_terminus_t *terminus); - -/** - * Set the timeout of a terminus object. - * - * @param[in] terminus a terminus object - * @param[in] timeout the timeout for the terminus - * @return 0 on success or an error code on failure - */ -PN_EXTERN int pn_terminus_set_timeout(pn_terminus_t *terminus, pn_seconds_t timeout); - -/** - * Get the dynamic flag for a terminus object. - * - * @param[in] terminus a terminus object - * @return true if the dynamic flag is set for the terminus, false otherwise - */ -PN_EXTERN bool pn_terminus_is_dynamic(pn_terminus_t *terminus); - -/** - * Set the dynamic flag for a terminus object. - * - * @param[in] terminus a terminus object - * @param[in] dynamic the dynamic flag for the terminus - * @return 0 on success or an error code on failure - */ -PN_EXTERN int pn_terminus_set_dynamic(pn_terminus_t *terminus, bool dynamic); - -/** - * Access/modify the AMQP properties data for a terminus object. - * - * This operation will return a pointer to a ::pn_data_t object that - * is valid until the terminus object is freed due to its parent link - * being freed. Any data contained by the ::pn_data_t object will be - * sent as the AMQP properties for the parent terminus object. Note - * that this MUST take the form of a symbol keyed map to be valid. - * - * @param[in] terminus a terminus object - * @return a pointer to a pn_data_t representing the terminus properties - */ -PN_EXTERN pn_data_t *pn_terminus_properties(pn_terminus_t *terminus); - -/** - * Access/modify the AMQP capabilities data for a terminus object. - * - * This operation will return a pointer to a ::pn_data_t object that - * is valid until the terminus object is freed due to its parent link - * being freed. Any data contained by the ::pn_data_t object will be - * sent as the AMQP capabilities for the parent terminus object. Note - * that this MUST take the form of an array of symbols to be valid. - * - * @param[in] terminus a terminus object - * @return a pointer to a pn_data_t representing the terminus capabilities - */ -PN_EXTERN pn_data_t *pn_terminus_capabilities(pn_terminus_t *terminus); - -/** - * Access/modify the AMQP outcomes for a terminus object. - * - * This operation will return a pointer to a ::pn_data_t object that - * is valid until the terminus object is freed due to its parent link - * being freed. Any data contained by the ::pn_data_t object will be - * sent as the AMQP outcomes for the parent terminus object. Note - * that this MUST take the form of an array of symbols to be valid. - * - * @param[in] terminus a terminus object - * @return a pointer to a pn_data_t representing the terminus outcomes - */ -PN_EXTERN pn_data_t *pn_terminus_outcomes(pn_terminus_t *terminus); - -/** - * Access/modify the AMQP filter set for a terminus object. - * - * This operation will return a pointer to a ::pn_data_t object that - * is valid until the terminus object is freed due to its parent link - * being freed. Any data contained by the ::pn_data_t object will be - * sent as the AMQP filter set for the parent terminus object. Note - * that this MUST take the form of a symbol keyed map to be valid. - * - * @param[in] terminus a source terminus object - * @return a pointer to a pn_data_t representing the terminus filter set - */ -PN_EXTERN pn_data_t *pn_terminus_filter(pn_terminus_t *terminus); - -/** - * Copy a terminus object. - * - * @param[in] terminus the terminus object to be copied into - * @param[in] src the terminus to be copied from - * @return 0 on success or an error code on failure - */ -PN_EXTERN int pn_terminus_copy(pn_terminus_t *terminus, pn_terminus_t *src); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* terminus.h */ http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/include/proton/transport.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/transport.h b/proton-c/include/proton/transport.h deleted file mode 100644 index 09fbb03..0000000 --- a/proton-c/include/proton/transport.h +++ /dev/null @@ -1,674 +0,0 @@ -#ifndef PROTON_TRANSPORT_H -#define PROTON_TRANSPORT_H 1 - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include <proton/import_export.h> -#include <proton/type_compat.h> -#include <proton/condition.h> -#include <stddef.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @file - * - * @copybrief transport - * - * @addtogroup transport - * @{ - */ - -/** - * Holds the trace flags for an AMQP transport. - * - * The trace flags for an AMQP transport control what sort of - * information is logged by an AMQP transport. The following bits can - * be set: - * - * - ::PN_TRACE_OFF - * - ::PN_TRACE_RAW - * - ::PN_TRACE_FRM - * - ::PN_TRACE_DRV - * - ::PN_TRACE_EVT - * - */ -typedef int pn_trace_t; - -/** - * Callback for customizing logging behaviour. - */ -typedef void (*pn_tracer_t)(pn_transport_t *transport, const char *message); - -/** - * Turn logging off entirely. - */ -#define PN_TRACE_OFF (0) - -/** - * Log raw binary data into/out of the transport. - */ -#define PN_TRACE_RAW (1) - -/** - * Log frames into/out of the transport. - */ -#define PN_TRACE_FRM (2) - -/** - * Log driver related events, e.g. initialization, end of stream, etc. - */ -#define PN_TRACE_DRV (4) - -/** - * Log events - */ -#define PN_TRACE_EVT (8) - -/** - * Factory for creating a transport. - * A transport is used by a connection to interface with the network. - * There can only be one connection associated with a transport. See - * pn_transport_bind(). - * - * Initially a transport is configured to be a client transport. Use pn_transport_set_server() - * to configure the transport as a server transport. - * - * A client transport initiates outgoing connections. - * - * A client transport must be configured with the protocol layers to use and cannot - * configure itself automatically. - * - * A server transport accepts incoming connections. It can automatically - * configure itself to include the various protocol layers depending on - * the incoming protocol headers. - * - * @return pointer to new transport - */ -PN_EXTERN pn_transport_t *pn_transport(void); - -/** - * Configure a transport as a server - * - * @param[in] transport a transport object - */ -PN_EXTERN void pn_transport_set_server(pn_transport_t *transport); - -/** - * Free a transport object. - * - * When a transport is freed, it is automatically unbound from its - * associated connection. - * - * @param[in] transport a transport object or NULL - */ -PN_EXTERN void pn_transport_free(pn_transport_t *transport); - -/** - * Retrieve the authenticated user. - * - * This is usually used at the the server end to find the name of the - * authenticated user. On the client it will merely return whatever - * user was passed in to the pn_connection_set_user() API of the bound - * connection. - * - * The returned value is only reliable after the - * PN_TRANSPORT_AUTHENTICATED event has been received. - * - * @param[in] transport the transport - * - * @return If a the user is anonymous (either no SASL layer is - * negotiated or the SASL ANONYMOUS mechanism is used) then the user - * will be "anonymous" Otherwise a string containing the user is - * returned. - */ -PN_EXTERN const char *pn_transport_get_user(pn_transport_t *transport); - -/** - * Set whether a non-authenticated transport connection is allowed. - * - * There are several ways within the AMQP protocol suite to get - * unauthenticated connections: - * - * - Use no SASL layer (with either no TLS or TLS without client certificates) - * - Use a SASL layer but the ANONYMOUS mechanism - * - * The default if this option is not set is to allow unauthenticated connections. - * - * @param[in] transport the transport - * @param[in] required boolean is true when authenticated connections are required - */ -PN_EXTERN void pn_transport_require_auth(pn_transport_t *transport, bool required); - -/** - * Tell whether the transport connection is authenticated - * - * Note that this property may not be stable until the PN_CONNECTION_REMOTE_OPEN - * event is received. - * - * @param[in] transport the transport - * @return bool representing authentication - */ -PN_EXTERN bool pn_transport_is_authenticated(pn_transport_t *transport); - -/** - * Set whether a non encrypted transport connection is allowed - * - * There are several ways within the AMQP protocol suite to get encrypted connections: - * - Use TLS - * - Use a SASL with a mechanism that supports saecurity layers - * - * The default if this option is not set is to allow unencrypted connections. - * - * @param[in] transport the transport - * @param[in] required boolean is true when encrypted connections are required - */ -PN_EXTERN void pn_transport_require_encryption(pn_transport_t *transport, bool required); - -/** - * Tell whether the transport connection is encrypted - * - * Note that this property may not be stable until the PN_CONNECTION_REMOTE_OPEN - * event is received. - * - * @param[in] transport the transport - * @return bool representing encryption - */ -PN_EXTERN bool pn_transport_is_encrypted(pn_transport_t *transport); - -/** - * Get additional information about the condition of the transport. - * - * When a PN_TRANSPORT_ERROR event occurs, this operation can be used - * to access the details of the error condtion. - * - * The pointer returned by this operation is valid until the - * transport object is freed. - * - * @param[in] transport the transport object - * @return the transport's condition object - */ -PN_EXTERN pn_condition_t *pn_transport_condition(pn_transport_t *transport); - -/** - * @deprecated - */ -PN_EXTERN pn_error_t *pn_transport_error(pn_transport_t *transport); - -/** - * Binds the transport to an AMQP connection. - * - * @return an error code, or 0 on success - */ -PN_EXTERN int pn_transport_bind(pn_transport_t *transport, pn_connection_t *connection); - -/** - * Unbinds a transport from its AMQP connection. - * - * @return an error code, or 0 on success - */ -PN_EXTERN int pn_transport_unbind(pn_transport_t *transport); - -/** - * Update a transports trace flags. - * - * The trace flags for a transport control what sort of information is - * logged. See ::pn_trace_t for more details. - * - * @param[in] transport a transport object - * @param[in] trace the trace flags - * - * @internal XXX Deprecate! - */ -PN_EXTERN void pn_transport_trace(pn_transport_t *transport, pn_trace_t trace); - -/** - * Set the tracing function used by a transport. - * - * The tracing function is called to perform logging. Overriding this - * function allows embedding applications to divert the engine's - * logging to a place of their choice. - * - * @param[in] transport a transport object - * @param[in] tracer the tracing function - * - * @internal XXX Deprecate! - */ -PN_EXTERN void pn_transport_set_tracer(pn_transport_t *transport, pn_tracer_t tracer); - -/** - * Get the tracing function used by a transport. - * - * @param[in] transport a transport object - * @return the tracing function used by a transport - * - * @internal XXX Deprecate! - */ -PN_EXTERN pn_tracer_t pn_transport_get_tracer(pn_transport_t *transport); - -/** - * @deprecated - * - * Get the application context that is associated with a transport object. - * - * The application context for a transport may be set using - * ::pn_transport_set_context. - * - * @param[in] transport the transport whose context is to be returned. - * @return the application context for the transport object - */ -PN_EXTERN void *pn_transport_get_context(pn_transport_t *transport); - -/** - * @deprecated - * - * Set a new application context for a transport object. - * - * The application context for a transport object may be retrieved using - * ::pn_transport_get_context. - * - * @param[in] transport the transport object - * @param[in] context the application context - */ -PN_EXTERN void pn_transport_set_context(pn_transport_t *transport, void *context); - -/** - * Get the attachments that are associated with a transport object. - * - * @param[in] transport the transport whose attachments are to be returned. - * @return the attachments for the transport object - */ -PN_EXTERN pn_record_t *pn_transport_attachments(pn_transport_t *transport); - -/** - * Log a message using a transport's logging mechanism. - * - * This can be useful in a debugging context as the log message will - * be prefixed with the transport's identifier. - * - * @param[in] transport a transport object - * @param[in] message the message to be logged - * - * @internal XXX Deprecate! - */ -PN_EXTERN void pn_transport_log(pn_transport_t *transport, const char *message); - -/** - * Log a printf formatted message using a transport's logging - * mechanism. - * - * This can be useful in a debugging context as the log message will - * be prefixed with the transport's identifier. - * - * @param[in] transport a transport object - * @param[in] fmt the printf formatted message to be logged - * @param[in] ap a vector containing the format arguments - * - * @internal XXX Deprecate! - */ -PN_EXTERN void pn_transport_vlogf(pn_transport_t *transport, const char *fmt, va_list ap); - -/** - * Log a printf formatted message using a transport's logging - * mechanism. - * - * This can be useful in a debugging context as the log message will - * be prefixed with the transport's identifier. - * - * @param[in] transport a transport object - * @param[in] fmt the printf formatted message to be logged - * - * @internal XXX Deprecate! - */ -PN_EXTERN void pn_transport_logf(pn_transport_t *transport, const char *fmt, ...); - -/** - * Get the maximum allowed channel for a transport. - * This will be the minimum of - * 1. limit imposed by this proton implementation - * 2. limit imposed by remote peer - * 3. limit imposed by this application, using pn_transport_set_channel_max() - * - * @param[in] transport a transport object - * @return the maximum allowed channel - * - * @internal XXX Deprecate! - */ -PN_EXTERN uint16_t pn_transport_get_channel_max(pn_transport_t *transport); - -/** - * Set the maximum allowed channel number for a transport. - * Note that this is the maximum channel number allowed, giving a - * valid channel number range of [0..channel_max]. Therefore the - * maximum number of simultaineously active channels will be - * channel_max plus 1. - * You can call this function more than once to raise and lower - * the limit your application imposes on max channels for this - * transport. However, smaller limits may be imposed by this - * library, or by the remote peer. - * After the OPEN frame has been sent to the remote peer, - * further calls to this function will have no effect. - * - * @param[in] transport a transport object - * @param[in] channel_max the maximum allowed channel - * @return PN_OK, or PN_STATE_ERR if it is too late to change channel_max - * - * @internal XXX Deprecate! - */ -PN_EXTERN int pn_transport_set_channel_max(pn_transport_t *transport, uint16_t channel_max); - -/** - * Get the maximum allowed channel of a transport's remote peer. - * - * @param[in] transport a transport object - * @return the maximum allowed channel of the transport's remote peer - * - * @internal XXX Deprecate! - */ -PN_EXTERN uint16_t pn_transport_remote_channel_max(pn_transport_t *transport); - -/** - * Get the maximum frame size of a transport. - * - * @param[in] transport a transport object - * @return the maximum frame size of the transport object - * - * @internal XXX Deprecate! - */ -PN_EXTERN uint32_t pn_transport_get_max_frame(pn_transport_t *transport); - -/** - * Set the maximum frame size of a transport. - * - * @param[in] transport a transport object - * @param[in] size the maximum frame size for the transport object - * - * @internal XXX Deprecate! - */ -PN_EXTERN void pn_transport_set_max_frame(pn_transport_t *transport, uint32_t size); - -/** - * Get the maximum frame size of a transport's remote peer. - * - * @param[in] transport a transport object - * @return the maximum frame size of the transport's remote peer - * - * @internal XXX Deprecate! - */ -PN_EXTERN uint32_t pn_transport_get_remote_max_frame(pn_transport_t *transport); - -/** - * Get the idle timeout for a transport. - * - * A zero idle timeout means heartbeats are disabled. - * - * @param[in] transport a transport object - * @return the transport's idle timeout - * - * @internal XXX Deprecate! - */ -PN_EXTERN pn_millis_t pn_transport_get_idle_timeout(pn_transport_t *transport); - -/** - * Set the idle timeout for a transport. - * - * A zero idle timeout means heartbeats are disabled. - * - * @param[in] transport a transport object - * @param[in] timeout the idle timeout for the transport object - * - * @internal XXX Deprecate! - */ -PN_EXTERN void pn_transport_set_idle_timeout(pn_transport_t *transport, pn_millis_t timeout); - -/** - * Get the idle timeout for a transport's remote peer. - * - * A zero idle timeout means heartbeats are disabled. - * - * @param[in] transport a transport object - * @return the idle timeout for the transport's remote peer - * - * @internal XXX Deprecate! - */ -PN_EXTERN pn_millis_t pn_transport_get_remote_idle_timeout(pn_transport_t *transport); - -/** - * @deprecated - */ -PN_EXTERN ssize_t pn_transport_input(pn_transport_t *transport, const char *bytes, size_t available); - -/** - * @deprecated - */ -PN_EXTERN ssize_t pn_transport_output(pn_transport_t *transport, char *bytes, size_t size); - -/** - * Get the amount of free space for input following the transport's - * tail pointer. - * - * If the engine is in an exceptional state such as encountering an - * error condition or reaching the end of stream state, a negative - * value will be returned indicating the condition. If an error is - * indicated, futher details can be obtained from - * ::pn_transport_error. Calls to ::pn_transport_process may alter the - * value of this pointer. See ::pn_transport_process for details. - * - * @param[in] transport the transport - * @return the free space in the transport, PN_EOS or error code if < 0 - */ -PN_EXTERN ssize_t pn_transport_capacity(pn_transport_t *transport); - -/** - * Get the transport's tail pointer. - * - * The amount of free space following this pointer is reported by - * ::pn_transport_capacity. Calls to ::pn_transport_process may alther - * the value of this pointer. See ::pn_transport_process for details. - * - * @param[in] transport the transport - * @return a pointer to the transport's input buffer, NULL if no capacity available. - */ -PN_EXTERN char *pn_transport_tail(pn_transport_t *transport); - -/** - * Pushes the supplied bytes into the tail of the transport. - * - * This is equivalent to copying @c size bytes afther the tail pointer - * and then calling ::pn_transport_process with an argument of @c - * size. Only some of the bytes will be copied if there is - * insufficienty capacity available. Use ::pn_transport_capacity to - * determine how much capacity the transport has. - * - * @param[in] transport the transport - * @param[in] src the start of the data to push into the transport - * @param[in] size the amount of data to push into the transport - * - * @return the number of bytes pushed on success, or error code if < 0 - */ -PN_EXTERN ssize_t pn_transport_push(pn_transport_t *transport, const char *src, size_t size); - -/** - * Process input data following the tail pointer. - * - * Calling this function will cause the transport to consume @c size - * bytes of input occupying the free space following the tail pointer. - * Calls to this function may change the value of ::pn_transport_tail, - * as well as the amount of free space reported by - * ::pn_transport_capacity. - * - * @param[in] transport the transport - * @param[in] size the amount of data written to the transport's input buffer - * @return 0 on success, or error code if < 0 - */ -PN_EXTERN int pn_transport_process(pn_transport_t *transport, size_t size); - -/** - * Indicate that the input has reached End Of Stream (EOS). - * - * This tells the transport that no more input will be forthcoming. - * - * @param[in] transport the transport - * @return 0 on success, or error code if < 0 - */ -PN_EXTERN int pn_transport_close_tail(pn_transport_t *transport); - -/** - * Get the number of pending output bytes following the transport's - * head pointer. - * - * If the engine is in an exceptional state such as encountering an - * error condition or reaching the end of stream state, a negative - * value will be returned indicating the condition. If an error is - * indicated, further details can be obtained from - * ::pn_transport_error. Calls to ::pn_transport_pop may alter the - * value of this pointer. See ::pn_transport_pop for details. - * - * @param[in] transport the transport - * @return the number of pending output bytes, or an error code - */ -PN_EXTERN ssize_t pn_transport_pending(pn_transport_t *transport); - -/** - * Get the transport's head pointer. - * - * This pointer references queued output data. The - * ::pn_transport_pending function reports how many bytes of output - * data follow this pointer. Calls to ::pn_transport_pop may alter - * this pointer and any data it references. See ::pn_transport_pop for - * details. - * - * @param[in] transport the transport - * @return a pointer to the transport's output buffer, or NULL if no pending output. - */ -PN_EXTERN const char *pn_transport_head(pn_transport_t *transport); - -/** - * Copies @c size bytes from the head of the transport to the @c dst - * pointer. - * - * It is an error to call this with a value of @c size that is greater - * than the value reported by ::pn_transport_pending. - * - * @param[in] transport the transport - * @param[out] dst the destination buffer - * @param[in] size the capacity of the destination buffer - * @return number of bytes copied on success, or error code if < 0 - */ -PN_EXTERN ssize_t pn_transport_peek(pn_transport_t *transport, char *dst, size_t size); - -/** - * Removes @c size bytes of output from the pending output queue - * following the transport's head pointer. - * - * Calls to this function may alter the transport's head pointer as - * well as the number of pending bytes reported by - * ::pn_transport_pending. - * - * @param[in] transport the transport - * @param[in] size the number of bytes to remove - */ -PN_EXTERN void pn_transport_pop(pn_transport_t *transport, size_t size); - -/** - * Indicate that the output has closed. - * - * This tells the transport that no more output will be popped. - * - * @param[in] transport the transport - * @return 0 on success, or error code if < 0 - */ -PN_EXTERN int pn_transport_close_head(pn_transport_t *transport); - -/** - * Check if a transport has buffered data. - * - * @param[in] transport a transport object - * @return true if the transport has buffered data, false otherwise - */ -PN_EXTERN bool pn_transport_quiesced(pn_transport_t *transport); - -/** - * Check if a transport is closed. - * - * A transport is defined to be closed when both the tail and the head - * are closed. In other words, when both ::pn_transport_capacity() < 0 - * and ::pn_transport_pending() < 0. - * - * @param[in] transport a transport object - * @return true if the transport is closed, false otherwise - */ -PN_EXTERN bool pn_transport_closed(pn_transport_t *transport); - -/** - * Process any pending transport timer events. - * - * This method should be called after all pending input has been - * processed by the transport (see ::pn_transport_input), and before - * generating output (see ::pn_transport_output). It returns the - * deadline for the next pending timer event, if any are present. - * - * @param[in] transport the transport to process. - * @param[in] now the current time - * - * @return if non-zero, then the expiration time of the next pending timer event for the - * transport. The caller must invoke pn_transport_tick again at least once at or before - * this deadline occurs. - */ -PN_EXTERN pn_timestamp_t pn_transport_tick(pn_transport_t *transport, pn_timestamp_t now); - -/** - * Get the number of frames output by a transport. - * - * @param[in] transport a transport object - * @return the number of frames output by the transport - */ -PN_EXTERN uint64_t pn_transport_get_frames_output(const pn_transport_t *transport); - -/** - * Get the number of frames input by a transport. - * - * @param[in] transport a transport object - * @return the number of frames input by the transport - */ -PN_EXTERN uint64_t pn_transport_get_frames_input(const pn_transport_t *transport); - -/** - * Access the AMQP Connection associated with the transport. - * - * @param[in] transport a transport object - * @return the connection context for the transport, or NULL if - * none - */ -PN_EXTERN pn_connection_t *pn_transport_connection(pn_transport_t *transport); - -#ifdef __cplusplus -} -#endif - -/** - * @} - */ - -#endif /* transport.h */ http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/include/proton/type_compat.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/type_compat.h b/proton-c/include/proton/type_compat.h deleted file mode 100644 index fe96994..0000000 --- a/proton-c/include/proton/type_compat.h +++ /dev/null @@ -1,150 +0,0 @@ -#ifndef PROTON_TYPE_COMPAT_H -#define PROTON_TYPE_COMPAT_H 1 - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -/** - * @cond INTERNAL - */ - -// Get Boolean -#if !defined(__cplusplus) && !defined(__bool_true_false_are_defined) -# if __STDC_VERSION__ >= 199901L || __GNUC__ >= 3 || _MSC_VER >=1800 -# include <stdbool.h> -# else -// Need to get bool/true/false manually -# if _MSC_VER -# define bool char -# define false 0 -# define true 1 -# define __bool_true_false_are_defined -# else -# error "No definitions for bool/true/false" -# endif -# endif -#endif -/* - * Handle special cases for stdint.h and the definition for ssize_t. - * Third party libraries (e.g. Boost) may provide competing solutions. - * - * The effects of this include file may be controlled by overrides: - * PN_DEFINE_STDINT/PN_NODEFINE_STDINT : turn on/off definition of int64_t etc. - * PN_DEFINE_SSIZE_T/PN_NODEFINE_SSIZE_T : turn on/off definition of ssize_t - * PN_INCLUDE_STDINT/PN_NOINCLUDE_STDINT : include (or not) stdint.h - */ - -// Honor positive overrides -#if defined(PN_DEFINE_STDINT) -# define PNI_DEFINE_STDINT -#endif -#if defined(PN_INCLUDE_STDINT) -# define PNI_INCLUDE_STDINT) -#endif -#if defined(PN_DEFINE_SSIZE_T) -# define PNI_DEFINE_SSIZE_T -#endif - -// Determinine default action -#ifndef _MSC_VER -// Not Windows and not using Visual Studio - -/* MBED_BUILD_TIMESTAMP is used to detect whether Proton is being built on www.mbed.org with -the ARM compiler. In that case ssize_t needs to be defined in this file. */ -#if defined(MBED_BUILD_TIMESTAMP) -# define PNI_DEFINE_SSIZE_T -#else -#include <sys/types.h> -#endif /* defined(MBED_LIBRARY_VERSION) */ - -# ifndef PNI_INCLUDE_STDINT -# define PNI_INCLUDE_STDINT -# endif -#else -// all versions of Visual Studio -# ifndef PNI_DEFINE_SSIZE_T -// ssize_t def is needed, unless third party definition interferes, e.g. python/swig -# ifndef Py_CONFIG_H -# define PNI_DEFINE_SSIZE_T -# endif -# endif - -# if (_MSC_VER < 1600) -// VS 2008 and earlier -# ifndef PNI_DEFINE_STDINT -# define PNI_DEFINE_STDINT -# endif -# else -// VS 2010 and newer -# ifndef PNI_INCLUDE_STDINT -# define PNI_INCLUDE_STDINT -# endif - -# endif // (_MSC_VER < 1600) -#endif //_MSC_VER - -// Honor negative overrides -#ifdef PN_NODEFINE_SSIZE_T -# undef PNI_DEFINE_SSIZE_T -#endif -#ifdef PN_NODEFINE_STDINT -# undef PNI_DEFINE_STDINT -#endif -#ifdef PN_NOINCLUDE_STDINT -# undef PNI_INCLUDE_STDINT -#endif - -#ifdef PNI_INCLUDE_STDINT -# include <stdint.h> -#endif - -#ifdef PNI_DEFINE_SSIZE_T -# ifdef _MSC_VER -# include <BaseTsd.h> -typedef SSIZE_T ssize_t; -# else -typedef intptr_t ssize_t; -# endif -#endif // PNI_DEFINE_SSIZE_T - -#ifdef PNI_DEFINE_STDINT -# ifdef _MSC_VER - -typedef signed __int8 int8_t; -typedef signed __int16 int16_t; -typedef signed __int32 int32_t; -typedef signed __int64 int64_t; - -typedef unsigned __int8 uint8_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; - -# else // _MSC_VER -# error stdint.h definitions not kown -# endif -#endif // PNI_DEFINE_SSIZE_T - -/** - * @endcond - */ - -#endif /* type_compat.h */ http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/include/proton/types.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/types.h b/proton-c/include/proton/types.h deleted file mode 100644 index c28beac..0000000 --- a/proton-c/include/proton/types.h +++ /dev/null @@ -1,437 +0,0 @@ -#ifndef PROTON_TYPES_H -#define PROTON_TYPES_H 1 - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include <proton/import_export.h> -#include <stddef.h> -#include <proton/type_compat.h> - -/** - * @file - * - * @copybrief types - * - * @defgroup core Core - * @brief Core protocol entities and event handling - * - * @defgroup connection Connection - * @brief A channel for communication between two peers on a network - * @ingroup core - * - * @defgroup session Session - * @brief A container of links - * @ingroup core - * - * @defgroup link Link - * @brief A channel for transferring messages - * @ingroup core - * - * @defgroup terminus Terminus - * @brief A source or target for messages - * @ingroup core - * - * @defgroup message Message - * @brief A mutable holder of application content - * @ingroup core - * - * @defgroup delivery Delivery - * @brief A message transfer - * @ingroup core - * - * @defgroup condition Condition - * @brief An endpoint error state - * @ingroup core - * - * @defgroup event Event - * @brief Protocol and transport events - * @ingroup core - * - * @defgroup transport Transport - * @brief A network channel supporting an AMQP connection - * @ingroup core - * - * @defgroup sasl SASL - * @brief SASL secure transport layer - * @ingroup core - * - * @defgroup ssl SSL - * @brief SSL secure transport layer - * @ingroup core - * - * @defgroup error Error - * @brief A Proton API error - * @ingroup core - * - * @defgroup types Types - * @brief AMQP and API data types - * - * @defgroup amqp_types AMQP data types - * @brief AMQP data types - * @ingroup types - * - * @defgroup api_types API data types - * @brief Additional data types used in the API - * @ingroup types - * - * @defgroup codec Codec - * @brief AMQP data encoding and decoding - * - * @defgroup data Data - * @brief A data structure for AMQP data - * @ingroup codec - * - * @defgroup io IO - * @brief IO integration interfaces - * - * @defgroup proactor Proactor - * @brief **Experimental** - Multithreaded IO - * @ingroup io - * - * @defgroup connection_driver Connection driver - * @brief **Experimental** - Low-level IO integration - * @ingroup io - * - * @defgroup messenger Messenger - * @deprecated - * @brief **Deprecated** - The Messenger API - * - * @defgroup url URL - * @deprecated - * @brief **Deprecated** - A URL parser - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * A sequence number. - * - * @ingroup api_types - */ -typedef int32_t pn_sequence_t; - -/** - * A span of time in milliseconds. - * - * @ingroup api_types - */ -typedef uint32_t pn_millis_t; - -/** - * The maximum value for @ref pn_millis_t. - * - * @ingroup api_types - */ -#define PN_MILLIS_MAX (~0U) - -/** - * A span of time in seconds. - * - * @ingroup api_types - */ -typedef uint32_t pn_seconds_t; - -/** - * A 64-bit timestamp in milliseconds since the Unix epoch. - * - * @ingroup amqp_types - */ -typedef int64_t pn_timestamp_t; - -/** - * A 32-bit Unicode code point. - * - * @ingroup amqp_types - */ -typedef uint32_t pn_char_t; - -/** - * A 32-bit decimal floating-point number. - * - * @ingroup amqp_types - */ -typedef uint32_t pn_decimal32_t; - -/** - * A 64-bit decimal floating-point number. - * - * @ingroup amqp_types - */ -typedef uint64_t pn_decimal64_t; - -/** - * A 128-bit decimal floating-point number. - * - * @ingroup amqp_types - */ -typedef struct { - char bytes[16]; -} pn_decimal128_t; - -/** - * A 16-byte universally unique identifier. - * - * @ingroup amqp_types - */ -typedef struct { - char bytes[16]; -} pn_uuid_t; - -/** - * A const byte buffer. - * - * @ingroup api_types - */ -typedef struct pn_bytes_t { - size_t size; - const char *start; -} pn_bytes_t; - -/** - * Create a @ref pn_bytes_t - * - * @ingroup api_types - */ -PN_EXTERN pn_bytes_t pn_bytes(size_t size, const char *start); - -static const pn_bytes_t pn_bytes_null = { 0, NULL }; - -/** - * A non-const byte buffer. - * - * @ingroup api_types - */ -typedef struct pn_rwbytes_t { - size_t size; - char *start; -} pn_rwbytes_t; - -/** - * Create a @ref pn_rwbytes_t - * - * @ingroup api_types - */ -PN_EXTERN pn_rwbytes_t pn_rwbytes(size_t size, char *start); - -static const pn_bytes_t pn_rwbytes_null = { 0, NULL }; - -/** - * Holds the state flags for an AMQP endpoint. - * - * A pn_state_t is an integral value with flags that encode both the - * local and remote state of an AMQP Endpoint (@link pn_connection_t - * Connection @endlink, @link pn_session_t Session @endlink, or @link - * pn_link_t Link @endlink). The local portion of the state may be - * accessed using ::PN_LOCAL_MASK, and the remote portion may be - * accessed using ::PN_REMOTE_MASK. Individual bits may be accessed - * using ::PN_LOCAL_UNINIT, ::PN_LOCAL_ACTIVE, ::PN_LOCAL_CLOSED, and - * ::PN_REMOTE_UNINIT, ::PN_REMOTE_ACTIVE, ::PN_REMOTE_CLOSED. - * - * Every AMQP endpoint (@link pn_connection_t Connection @endlink, - * @link pn_session_t Session @endlink, or @link pn_link_t Link - * @endlink) starts out in an uninitialized state and then proceeds - * linearly to an active and then closed state. This lifecycle occurs - * at both endpoints involved, and so the state model for an endpoint - * includes not only the known local state, but also the last known - * state of the remote endpoint. - * - * @ingroup connection - */ -typedef int pn_state_t; - -/** - * An AMQP Connection object. - * - * A pn_connection_t object encapsulates all of the endpoint state - * associated with an AMQP Connection. A pn_connection_t object - * contains zero or more ::pn_session_t objects, which in turn contain - * zero or more ::pn_link_t objects. Each ::pn_link_t object contains - * an ordered sequence of ::pn_delivery_t objects. A link is either a - * sender or a receiver but never both. - * - * @ingroup connection - */ -typedef struct pn_connection_t pn_connection_t; - -/** - * An AMQP Session object. - * - * A pn_session_t object encapsulates all of the endpoint state - * associated with an AMQP Session. A pn_session_t object contains - * zero or more ::pn_link_t objects. - * - * @ingroup session - */ -typedef struct pn_session_t pn_session_t; - -/** - * An AMQP Link object. - * - * A pn_link_t object encapsulates all of the endpoint state - * associated with an AMQP Link. A pn_link_t object contains an - * ordered sequence of ::pn_delivery_t objects representing in-flight - * deliveries. A pn_link_t may be either sender or a receiver but - * never both. - * - * A pn_link_t object maintains a pointer to the *current* delivery - * within the ordered sequence of deliveries contained by the link - * (See ::pn_link_current). The *current* delivery is the target of a - * number of operations associated with the link, such as sending - * (::pn_link_send) and receiving (::pn_link_recv) message data. - * - * @ingroup link - */ -typedef struct pn_link_t pn_link_t; - -/** - * An AMQP Delivery object. - * - * A pn_delivery_t object encapsulates all of the endpoint state - * associated with an AMQP Delivery. Every delivery exists within the - * context of a ::pn_link_t object. - * - * The AMQP model for settlement is based on the lifecycle of a - * delivery at an endpoint. At each end of a link, a delivery is - * created, it exists for some period of time, and finally it is - * forgotten, aka settled. Note that because this lifecycle happens - * independently at both the sender and the receiver, there are - * actually four events of interest in the combined lifecycle of a - * given delivery: - * - * - created at sender - * - created at receiver - * - settled at sender - * - settled at receiver - * - * Because the sender and receiver are operating concurrently, these - * events can occur in a variety of different orders, and the order of - * these events impacts the types of failures that may occur when - * transferring a delivery. Eliminating scenarios where the receiver - * creates the delivery first, we have the following possible - * sequences of interest: - * - * Sender presettles (aka at-most-once): - * ------------------------------------- - * - * 1. created at sender - * 2. settled at sender - * 3. created at receiver - * 4. settled at receiver - * - * In this configuration the sender settles (i.e. forgets about) the - * delivery before it even reaches the receiver, and if anything - * should happen to the delivery in-flight, there is no way to - * recover, hence the "at most once" semantics. - * - * Receiver settles first (aka at-least-once): - * ------------------------------------------- - * - * 1. created at sender - * 2. created at receiver - * 3. settled at receiver - * 4. settled at sender - * - * In this configuration the receiver settles the delivery first, and - * the sender settles once it sees the receiver has settled. Should - * anything happen to the delivery in-flight, the sender can resend, - * however the receiver may have already forgotten the delivery and so - * it could interpret the resend as a new delivery, hence the "at - * least once" semantics. - * - * Receiver settles second (aka exactly-once): - * ------------------------------------------- - * - * 1. created at sender - * 2. created at receiver - * 3. settled at sender - * 4. settled at receiver - * - * In this configuration the receiver settles only once it has seen - * that the sender has settled. This provides the sender the option to - * retransmit, and the receiver has the option to recognize (and - * discard) duplicates, allowing for exactly once semantics. - * - * Note that in the last scenario the sender needs some way to know - * when it is safe to settle. This is where delivery state comes in. - * In addition to these lifecycle related events surrounding - * deliveries there is also the notion of a delivery state that can - * change over the lifetime of a delivery, e.g. it might start out as - * nothing, transition to ::PN_RECEIVED and then transition to - * ::PN_ACCEPTED. In the first two scenarios the delivery state isn't - * required, however in final scenario the sender would typically - * trigger settlement based on seeing the delivery state transition to - * a terminal state like ::PN_ACCEPTED or ::PN_REJECTED. - * - * In practice settlement is controlled by application policy, so - * there may well be more options here, e.g. a sender might not settle - * strictly based on what has happened at the receiver, it might also - * choose to impose some time limit and settle after that period has - * expired, or it could simply have a sliding window of the last N - * deliveries and settle the oldest whenever a new one comes along. - * - * @ingroup delivery - */ -typedef struct pn_delivery_t pn_delivery_t; - -/** - * An event collector. - * - * A pn_collector_t may be used to register interest in being notified - * of high level events that can occur to the various objects - * representing AMQP endpoint state. See ::pn_event_t for more - * details. - * - * @ingroup event - */ -typedef struct pn_collector_t pn_collector_t; - -/** - * An AMQP Transport object. - * - * A pn_transport_t encapsulates the transport related state of all - * AMQP endpoint objects associated with a physical network connection - * at a given point in time. - * - * @ingroup transport - */ - -typedef struct pn_transport_t pn_transport_t; - -/** - * @cond INTERNAL - * - * An event handler - * - * A pn_handler_t is target of ::pn_event_t dispatched by the pn_reactor_t - */ -typedef struct pn_handler_t pn_handler_t; -/** - * @endcond - */ - -#ifdef __cplusplus -} -#endif - -#endif /* types.h */ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
