You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by fa...@apache.org on 2014/03/14 12:20:49 UTC
svn commit: r1577483 [2/5] - in
/qpid/proton/branches/fadams-javascript-binding/proton-c: ./ bindings/
bindings/perl/ bindings/perl/lib/ bindings/perl/lib/qpid/proton/
bindings/php/ bindings/python/ bindings/ruby/ docs/api/ include/proton/
src/ src/cod...
Added: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/container.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/container.h?rev=1577483&view=auto
==============================================================================
--- qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/container.h (added)
+++ qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/container.h Fri Mar 14 11:20:47 2014
@@ -0,0 +1,52 @@
+#ifndef PROTON_CONTAINER_H
+#define PROTON_CONTAINER_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>
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+#include <stddef.h>
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @file
+ * Container API for the proton Engine.
+ *
+ * @defgroup container Container
+ * @ingroup engine
+ * @{
+ */
+
+/**
+ * Encapsulates the endpoint state associated with an AMQP Container.
+ */
+typedef struct pn_container_t pn_container_t;
+
+/** @}
+ */
+
+#endif /* container.h */
Propchange: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/container.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/container.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/cproton.i
URL: http://svn.apache.org/viewvc/qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/cproton.i?rev=1577483&r1=1577482&r2=1577483&view=diff
==============================================================================
--- qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/cproton.i (original)
+++ qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/cproton.i Fri Mar 14 11:20:47 2014
@@ -587,7 +587,15 @@ typedef long long int int64_t;
delivery != NULL;
}
-%include "proton/engine.h"
+%include "proton/condition.h"
+%include "proton/connection.h"
+%include "proton/session.h"
+%include "proton/link.h"
+%include "proton/terminus.h"
+%include "proton/delivery.h"
+%include "proton/disposition.h"
+%include "proton/transport.h"
+%include "proton/event.h"
%contract pn_message_free(pn_message_t *msg)
{
@@ -1105,6 +1113,12 @@ typedef long long int int64_t;
listener != NULL;
}
+%contract pn_listener_set_context(pn_listener_t *listener, void *context)
+{
+ require:
+ listener != NULL;
+}
+
%contract pn_listener_close(pn_listener_t *listener)
{
require:
@@ -1173,7 +1187,6 @@ typedef long long int int64_t;
{
require:
ctor != NULL;
- connection != NULL;
}
%contract pn_connector_context(pn_connector_t *connector)
@@ -1317,6 +1330,10 @@ typedef long long int int64_t;
%include "proton/messenger.h"
+%include "proton/io.h"
+
+%include "proton/selectable.h"
+
%include "proton/ssl.h"
%ignore pn_decode_atoms;
Added: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/delivery.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/delivery.h?rev=1577483&view=auto
==============================================================================
--- qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/delivery.h (added)
+++ qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/delivery.h Fri Mar 14 11:20:47 2014
@@ -0,0 +1,304 @@
+#ifndef PROTON_DELIVERY_H
+#define PROTON_DELIVERY_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/disposition.h>
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+#include <stddef.h>
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file
+ *
+ * Delivery API for the proton Engine.
+ *
+ * @defgroup delivery Delivery
+ * @ingroup engine
+ * @{
+ */
+
+/**
+ * An AMQP delivery tag.
+ */
+typedef struct pn_delivery_tag_t {
+ size_t size;
+ const char *bytes;
+} pn_delivery_tag_t;
+
+#ifndef SWIG // older versions of SWIG choke on this:
+/**
+ * Construct a delivery tag.
+ *
+ * @param[in] bytes a pointer to the beginning of the tag
+ * @param[in] size the size of the tag
+ * @return the delivery tag
+ */
+static inline pn_delivery_tag_t pn_dtag(const char *bytes, size_t size) {
+ pn_delivery_tag_t dtag = {size, bytes};
+ return dtag;
+}
+#endif
+
+/**
+ * Create a delivery on a link.
+ *
+ * Every delivery object within a link must be supplied with a unique
+ * tag. Links maintain a sequence of delivery object in the order that
+ * they are created.
+ *
+ * @param[in] link a link object
+ * @param[in] tag the delivery tag
+ * @return a newly created delivery, or NULL if there was an error
+ */
+PN_EXTERN pn_delivery_t *pn_delivery(pn_link_t *link, pn_delivery_tag_t tag);
+
+/**
+ * Get the application context that is associated with a delivery object.
+ *
+ * The application context for a delivery may be set using
+ * ::pn_delivery_set_context.
+ *
+ * @param[in] delivery the delivery whose context is to be returned.
+ * @return the application context for the delivery object
+ */
+PN_EXTERN void *pn_delivery_get_context(pn_delivery_t *delivery);
+
+/**
+ * Set a new application context for a delivery object.
+ *
+ * The application context for a delivery object may be retrieved using
+ * ::pn_delivery_get_context.
+ *
+ * @param[in] delivery the delivery object
+ * @param[in] context the application context
+ */
+PN_EXTERN void pn_delivery_set_context(pn_delivery_t *delivery, void *context);
+
+/**
+ * Get the tag for a delivery object.
+ *
+ * @param[in] delivery a delivery object
+ * @return the delivery tag
+ */
+PN_EXTERN pn_delivery_tag_t pn_delivery_tag(pn_delivery_t *delivery);
+
+/**
+ * Get the parent link for a delivery object.
+ *
+ * @param[in] delivery a delivery object
+ * @return the parent link
+ */
+PN_EXTERN pn_link_t *pn_delivery_link(pn_delivery_t *delivery);
+
+/**
+ * Get the local disposition for a delivery.
+ *
+ * The pointer returned by this object is valid until the delivery is
+ * settled.
+ *
+ * @param[in] delivery a delivery object
+ * @return a pointer to the local disposition
+ */
+PN_EXTERN pn_disposition_t *pn_delivery_local(pn_delivery_t *delivery);
+
+/**
+ * Get the local disposition state for a delivery.
+ *
+ * @param[in] delivery a delivery object
+ * @return the local disposition state
+ */
+PN_EXTERN uint64_t pn_delivery_local_state(pn_delivery_t *delivery);
+
+/**
+ * Get the remote disposition for a delivery.
+ *
+ * The pointer returned by this object is valid until the delivery is
+ * settled.
+ *
+ * @param[in] delivery a delivery object
+ * @return a pointer to the remote disposition
+ */
+PN_EXTERN pn_disposition_t *pn_delivery_remote(pn_delivery_t *delivery);
+
+/**
+ * Get the remote disposition state for a delivery.
+ *
+ * @param[in] delivery a delivery object
+ * @return the remote disposition state
+ */
+PN_EXTERN uint64_t pn_delivery_remote_state(pn_delivery_t *delivery);
+
+/**
+ * Check if a delivery is remotely settled.
+ *
+ * @param[in] delivery a delivery object
+ * @return true if the delivery is settled at the remote endpoint, false otherwise
+ */
+PN_EXTERN bool pn_delivery_settled(pn_delivery_t *delivery);
+
+/**
+ * Get the amount of pending message data for a delivery.
+ *
+ * @param[in] delivery a delivery object
+ * @return the amount of pending message data in bytes
+ */
+PN_EXTERN size_t pn_delivery_pending(pn_delivery_t *delivery);
+
+/**
+ * Check if a delivery only has partial message data.
+ *
+ * @param[in] delivery a delivery object
+ * @return true if the delivery only contains part of a message, false otherwise
+ */
+PN_EXTERN bool pn_delivery_partial(pn_delivery_t *delivery);
+
+/**
+ * Check if a delivery is writable.
+ *
+ * A delivery is considered writable if it is the current delivery on
+ * an outgoing link, and the link has positive credit.
+ *
+ * @param[in] delivery a delivery object
+ * @return true if the delivery is writable, false otherwise
+ */
+PN_EXTERN bool pn_delivery_writable(pn_delivery_t *delivery);
+
+/**
+ * Check if a delivery is readable.
+ *
+ * A delivery is considered readable if it is the current delivery on
+ * an incoming link.
+ *
+ * @param[in] delivery a delivery object
+ * @return true if the delivery is readable, false otherwise
+ */
+PN_EXTERN bool pn_delivery_readable(pn_delivery_t *delivery);
+
+/**
+ * Check if a delivery is updated.
+ *
+ * A delivery is considered updated whenever the peer communicates a
+ * new disposition for the delivery. Once a delivery becomes updated,
+ * it will remain so until ::pn_delivery_clear is called.
+ *
+ * @param[in] delivery a delivery object
+ * @return true if the delivery is updated, false otherwise
+ */
+PN_EXTERN bool pn_delivery_updated(pn_delivery_t *delivery);
+
+/**
+ * Update the disposition of a delivery.
+ *
+ * When update is invoked the updated disposition of the delivery will
+ * be communicated to the peer.
+ *
+ * @param[in] delivery a delivery object
+ * @param[in] state the updated delivery state
+ */
+PN_EXTERN void pn_delivery_update(pn_delivery_t *delivery, uint64_t state);
+
+/**
+ * Clear the updated flag for a delivery.
+ *
+ * See ::pn_delivery_updated.
+ *
+ * @param[in] delivery a delivery object
+ */
+PN_EXTERN void pn_delivery_clear(pn_delivery_t *delivery);
+
+//int pn_delivery_format(pn_delivery_t *delivery);
+
+/**
+ * Settle a delivery.
+ *
+ * A settled delivery can never be used again.
+ *
+ * @param[in] delivery a delivery object
+ */
+PN_EXTERN void pn_delivery_settle(pn_delivery_t *delivery);
+
+/**
+ * Utility function for printing details of a delivery.
+ *
+ * @param[in] delivery a delivery object
+ */
+PN_EXTERN void pn_delivery_dump(pn_delivery_t *delivery);
+
+/**
+ * Check if a delivery is buffered.
+ *
+ * A delivery that is buffered has not yet been written to the wire.
+ *
+ * Note that returning false does not imply that a delivery was
+ * definitely written to the wire. If false is returned, it is not
+ * known whether the delivery was actually written to the wire or not.
+ *
+ * @param[in] delivery a delivery object
+ * @return true if the delivery is buffered
+ */
+PN_EXTERN bool pn_delivery_buffered(pn_delivery_t *delivery);
+
+/**
+ * Extracts the first delivery on the connection that has pending
+ * operations.
+ *
+ * Retrieves the first delivery on the Connection that has pending
+ * operations. A readable delivery indicates message data is waiting
+ * to be read. A writable delivery indicates that message data may be
+ * sent. An updated delivery indicates that the delivery's disposition
+ * has changed. A delivery will never be both readable and writible,
+ * but it may be both readable and updated or both writiable and
+ * updated.
+ *
+ * @param[in] connection the connection
+ * @return the first delivery object that needs to be serviced, else
+ * NULL if none
+ */
+PN_EXTERN pn_delivery_t *pn_work_head(pn_connection_t *connection);
+
+/**
+ * Get the next delivery on the connection that needs has pending
+ * operations.
+ *
+ * @param[in] delivery the previous delivery retrieved from
+ * either pn_work_head or pn_work_next
+ * @return the next delivery that has pending operations, else
+ * NULL if none
+ */
+PN_EXTERN pn_delivery_t *pn_work_next(pn_delivery_t *delivery);
+
+/** @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* delivery.h */
Propchange: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/delivery.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/delivery.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/disposition.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/disposition.h?rev=1577483&view=auto
==============================================================================
--- qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/disposition.h (added)
+++ qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/disposition.h Fri Mar 14 11:20:47 2014
@@ -0,0 +1,233 @@
+#ifndef PROTON_DISPOSITION_H
+#define PROTON_DISPOSITION_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>
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+#include <stddef.h>
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file
+ *
+ * Disposition API for the proton Engine.
+ *
+ * @defgroup disposition Disposition
+ * @ingroup delivery
+ * @{
+ */
+
+/**
+ * Dispositions record the current state and/or final outcome of a
+ * transfer. Every delivery contains both a local and remote
+ * disposition. The local disposition holds the local state of the
+ * delivery, and the remote disposition holds the last known remote
+ * state of the delivery.
+ */
+typedef struct pn_disposition_t pn_disposition_t;
+
+/**
+ * The PN_RECEIVED delivery state is a non terminal state indicating
+ * how much (if any) message data has been received for a delivery.
+ */
+#define PN_RECEIVED (0x0000000000000023)
+
+/**
+ * The PN_ACCEPTED delivery state is a terminal state indicating that
+ * the delivery was successfully processed. Once in this state there
+ * will be no further state changes prior to the delivery being
+ * settled.
+ */
+#define PN_ACCEPTED (0x0000000000000024)
+
+/**
+ * The PN_REJECTED delivery state is a terminal state indicating that
+ * the delivery could not be processed due to some error condition.
+ * Once in this state there will be no further state changes prior to
+ * the delivery being settled.
+ */
+#define PN_REJECTED (0x0000000000000025)
+
+/**
+ * The PN_RELEASED delivery state is a terminal state indicating that
+ * the delivery is being returned to the sender. Once in this state
+ * there will be no further state changes prior to the delivery being
+ * settled.
+ */
+#define PN_RELEASED (0x0000000000000026)
+
+/**
+ * The PN_MODIFIED delivery state is a terminal state indicating that
+ * the delivery is being returned to the sender and should be
+ * annotated by the sender prior to further delivery attempts. Once in
+ * this state there will be no further state changes prior to the
+ * delivery being settled.
+ */
+#define PN_MODIFIED (0x0000000000000027)
+
+/**
+ * Get the type of a disposition.
+ *
+ * Defined values are:
+ *
+ * - ::PN_RECEIVED
+ * - ::PN_ACCEPTED
+ * - ::PN_REJECTED
+ * - ::PN_RELEASED
+ * - ::PN_MODIFIED
+ *
+ * @param[in] disposition a disposition object
+ * @return the type of the disposition
+ */
+PN_EXTERN uint64_t pn_disposition_type(pn_disposition_t *disposition);
+
+/**
+ * Access the condition object associated with a disposition.
+ *
+ * The ::pn_condition_t object retrieved by this operation may be
+ * modified prior to updating a delivery. When a delivery is updated,
+ * the condition described by the disposition is reported to the peer
+ * if applicable to the current delivery state, e.g. states such as
+ * ::PN_REJECTED.
+ *
+ * The pointer returned by this operation is valid until the parent
+ * delivery is settled.
+ *
+ * @param[in] disposition a disposition object
+ * @return a pointer to the disposition condition
+ */
+PN_EXTERN pn_condition_t *pn_disposition_condition(pn_disposition_t *disposition);
+
+/**
+ * Access the disposition as a raw pn_data_t.
+ *
+ * Dispositions are an extension point in the AMQP protocol. The
+ * disposition interface provides setters/getters for those
+ * dispositions that are predefined by the specification, however
+ * access to the raw disposition data is provided so that other
+ * dispositions can be used.
+ *
+ * The ::pn_data_t pointer returned by this operation is valid until
+ * the parent delivery is settled.
+ *
+ * @param[in] disposition a disposition object
+ * @return a pointer to the raw disposition data
+ */
+PN_EXTERN pn_data_t *pn_disposition_data(pn_disposition_t *disposition);
+
+/**
+ * Get the section number associated with a disposition.
+ *
+ * @param[in] disposition a disposition object
+ * @return a section number
+ */
+PN_EXTERN uint32_t pn_disposition_get_section_number(pn_disposition_t *disposition);
+
+/**
+ * Set the section number associated with a disposition.
+ *
+ * @param[in] disposition a disposition object
+ * @param[in] section_number a section number
+ */
+PN_EXTERN void pn_disposition_set_section_number(pn_disposition_t *disposition, uint32_t section_number);
+
+/**
+ * Get the section offset associated with a disposition.
+ *
+ * @param[in] disposition a disposition object
+ * @return a section offset
+ */
+PN_EXTERN uint64_t pn_disposition_get_section_offset(pn_disposition_t *disposition);
+
+/**
+ * Set the section offset associated with a disposition.
+ *
+ * @param[in] disposition a disposition object
+ * @param[in] section_offset a section offset
+ */
+PN_EXTERN void pn_disposition_set_section_offset(pn_disposition_t *disposition, uint64_t section_offset);
+
+/**
+ * Check if a disposition has the failed flag set.
+ *
+ * @param[in] disposition a disposition object
+ * @return true if the disposition has the failed flag set, false otherwise
+ */
+PN_EXTERN bool pn_disposition_is_failed(pn_disposition_t *disposition);
+
+/**
+ * Set the failed flag on a disposition.
+ *
+ * @param[in] disposition a disposition object
+ * @param[in] failed the value of the failed flag
+ */
+PN_EXTERN void pn_disposition_set_failed(pn_disposition_t *disposition, bool failed);
+
+/**
+ * Check if a disposition has the undeliverable flag set.
+ *
+ * @param[in] disposition a disposition object
+ * @return true if the disposition has the undeliverable flag set, false otherwise
+ */
+PN_EXTERN bool pn_disposition_is_undeliverable(pn_disposition_t *disposition);
+
+/**
+ * Set the undeliverable flag on a disposition.
+ *
+ * @param[in] disposition a disposition object
+ * @param[in] undeliverable the value of the undeliverable flag
+ */
+PN_EXTERN void pn_disposition_set_undeliverable(pn_disposition_t *disposition, bool undeliverable);
+
+/**
+ * Access the annotations associated with a disposition.
+ *
+ * The ::pn_data_t object retrieved by this operation may be modified
+ * prior to updating a delivery. When a delivery is updated, the
+ * annotations described by the ::pn_data_t are reported to the peer
+ * if applicable to the current delivery state, e.g. states such as
+ * ::PN_MODIFIED. The ::pn_data_t must be empty or contain a symbol
+ * keyed map.
+ *
+ * The pointer returned by this operation is valid until the parent
+ * delivery is settled.
+ *
+ * @param[in] disposition a disposition object
+ * @return the annotations associated with the disposition
+ */
+PN_EXTERN pn_data_t *pn_disposition_annotations(pn_disposition_t *disposition);
+
+/** @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* disposition.h */
Propchange: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/disposition.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/disposition.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/driver.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/driver.h?rev=1577483&r1=1577482&r2=1577483&view=diff
==============================================================================
--- qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/driver.h (original)
+++ qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/driver.h Fri Mar 14 11:20:47 2014
@@ -26,6 +26,7 @@
#include <proton/error.h>
#include <proton/engine.h>
#include <proton/sasl.h>
+#include <proton/selectable.h>
#include <proton/ssl.h>
#ifdef __cplusplus
Modified: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/driver_extras.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/driver_extras.h?rev=1577483&r1=1577482&r2=1577483&view=diff
==============================================================================
--- qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/driver_extras.h (original)
+++ qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/driver_extras.h Fri Mar 14 11:20:47 2014
@@ -27,6 +27,7 @@ extern "C" {
#endif
#include <proton/import_export.h>
+#include <proton/io.h>
/** @file
* Additional API for the Driver Layer.
@@ -36,12 +37,6 @@ extern "C" {
*
*/
-#if defined(_WIN32) && ! defined(__CYGWIN__)
-typedef SOCKET pn_socket_t;
-#else
-typedef int pn_socket_t;
-#endif
-
/** Create a listener using the existing file descriptor.
*
* @param[in] driver driver that will 'own' this listener
@@ -52,6 +47,8 @@ typedef int pn_socket_t;
*/
PN_EXTERN pn_listener_t *pn_listener_fd(pn_driver_t *driver, pn_socket_t fd, void *context);
+PN_EXTERN pn_socket_t pn_listener_get_fd(pn_listener_t *listener);
+
/** Create a connector using the existing file descriptor.
*
* @param[in] driver driver that will 'own' this connector.
@@ -62,6 +59,7 @@ PN_EXTERN pn_listener_t *pn_listener_fd(
*/
PN_EXTERN pn_connector_t *pn_connector_fd(pn_driver_t *driver, pn_socket_t fd, void *context);
+PN_EXTERN pn_socket_t pn_connector_get_fd(pn_connector_t *connector);
#ifdef __cplusplus
}
Modified: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/engine.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/engine.h?rev=1577483&r1=1577482&r2=1577483&view=diff
==============================================================================
--- qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/engine.h (original)
+++ qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/engine.h Fri Mar 14 11:20:47 2014
@@ -22,588 +22,21 @@
*
*/
-#include <proton/import_export.h>
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
-#include <stddef.h>
-#include <sys/types.h>
-#include <proton/codec.h>
-#include <proton/error.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/** @file
- * API for the proton Engine.
- *
- * @todo
- */
-
-typedef struct pn_transport_t pn_transport_t;
-typedef struct pn_connection_t pn_connection_t; /**< Connection */
-typedef struct pn_session_t pn_session_t; /**< Session */
-typedef struct pn_link_t pn_link_t; /**< Link */
-typedef struct pn_terminus_t pn_terminus_t;
-typedef struct pn_condition_t pn_condition_t;
-
-typedef enum {
- PN_UNSPECIFIED = 0,
- PN_SOURCE = 1,
- PN_TARGET = 2,
- PN_COORDINATOR = 3
-} pn_terminus_type_t;
-typedef enum {
- PN_NONDURABLE = 0,
- PN_CONFIGURATION = 1,
- PN_DELIVERIES = 2
-} pn_durability_t;
-typedef enum {
- PN_LINK_CLOSE,
- PN_SESSION_CLOSE,
- PN_CONNECTION_CLOSE,
- PN_NEVER
-} pn_expiry_policy_t;
-typedef enum {
- PN_DIST_MODE_UNSPECIFIED,
- PN_DIST_MODE_COPY,
- PN_DIST_MODE_MOVE
-} pn_distribution_mode_t;
-typedef enum {
- PN_SND_UNSETTLED = 0,
- PN_SND_SETTLED = 1,
- PN_SND_MIXED = 2
-} pn_snd_settle_mode_t;
-typedef enum {
- PN_RCV_FIRST = 0, /**< implicitly settle rcvd xfers */
- PN_RCV_SECOND = 1 /**< explicit disposition required */
-} pn_rcv_settle_mode_t;
-
-typedef struct pn_disposition_t pn_disposition_t;
-typedef struct pn_delivery_t pn_delivery_t;
-
-typedef struct pn_delivery_tag_t {
- size_t size;
- const char *bytes;
-} pn_delivery_tag_t;
-
-#ifndef SWIG // older versions of SWIG choke on this:
-static inline pn_delivery_tag_t pn_dtag(const char *bytes, size_t size) {
- pn_delivery_tag_t dtag = {size, bytes};
- return dtag;
-}
-#endif
-
-typedef int pn_state_t; /**< encodes the state of an endpoint */
-
-#define PN_LOCAL_UNINIT (1) /**< local endpoint requires initialization */
-#define PN_LOCAL_ACTIVE (2) /**< local endpoint is active */
-#define PN_LOCAL_CLOSED (4) /**< local endpoint is closed */
-#define PN_REMOTE_UNINIT (8) /**< remote endpoint pending initialization by peer */
-#define PN_REMOTE_ACTIVE (16) /**< remote endpoint is active */
-#define PN_REMOTE_CLOSED (32) /**< remote endpoint has closed */
-
-#define PN_LOCAL_MASK (PN_LOCAL_UNINIT | PN_LOCAL_ACTIVE | PN_LOCAL_CLOSED)
-#define PN_REMOTE_MASK (PN_REMOTE_UNINIT | PN_REMOTE_ACTIVE | PN_REMOTE_CLOSED)
-
-/**
- * The state/outcome of a message transfer.
- *
- * @todo document each value
- */
-
-#define PN_RECEIVED (0x0000000000000023)
-#define PN_ACCEPTED (0x0000000000000024)
-#define PN_REJECTED (0x0000000000000025)
-#define PN_RELEASED (0x0000000000000026)
-#define PN_MODIFIED (0x0000000000000027)
-
-typedef int pn_trace_t;
-typedef void (pn_tracer_t)(pn_transport_t *transport, const char *message);
-
-#define PN_TRACE_OFF (0)
-#define PN_TRACE_RAW (1)
-#define PN_TRACE_FRM (2)
-#define PN_TRACE_DRV (4)
-
-// connection
-
-/** Factory to construct a new Connection.
- *
- * @return pointer to a new connection object.
- */
-PN_EXTERN pn_connection_t *pn_connection(void);
-
-/** Retrieve the state of the connection.
- *
- * @param[in] connection the connection
- * @return the connection's state flags
- */
-PN_EXTERN pn_state_t pn_connection_state(pn_connection_t *connection);
-/** @todo: needs documentation */
-PN_EXTERN pn_error_t *pn_connection_error(pn_connection_t *connection);
-/** @todo: needs documentation */
-PN_EXTERN const char *pn_connection_get_container(pn_connection_t *connection);
-/** @todo: needs documentation */
-PN_EXTERN void pn_connection_set_container(pn_connection_t *connection, const char *container);
-/** @todo: needs documentation */
-PN_EXTERN const char *pn_connection_get_hostname(pn_connection_t *connection);
-/** @todo: needs documentation */
-PN_EXTERN void pn_connection_set_hostname(pn_connection_t *connection, const char *hostname);
-PN_EXTERN const char *pn_connection_remote_container(pn_connection_t *connection);
-PN_EXTERN const char *pn_connection_remote_hostname(pn_connection_t *connection);
-PN_EXTERN pn_data_t *pn_connection_offered_capabilities(pn_connection_t *connection);
-PN_EXTERN pn_data_t *pn_connection_desired_capabilities(pn_connection_t *connection);
-PN_EXTERN pn_data_t *pn_connection_properties(pn_connection_t *connection);
-PN_EXTERN pn_data_t *pn_connection_remote_offered_capabilities(pn_connection_t *connection);
-PN_EXTERN pn_data_t *pn_connection_remote_desired_capabilities(pn_connection_t *connection);
-PN_EXTERN pn_data_t *pn_connection_remote_properties(pn_connection_t *connection);
-
-
-/** Extracts the first delivery on the connection that has pending
- * operations.
- *
- * Retrieves the first delivery on the Connection that has pending
- * operations. A readable delivery indicates message data is waiting
- * to be read. A writable delivery indicates that message data may be
- * sent. An updated delivery indicates that the delivery's disposition
- * has changed. A delivery will never be both readable and writible,
- * but it may be both readable and updated or both writiable and
- * updated.
- *
- * @param[in] connection the connection
- * @return the first delivery object that needs to be serviced, else
- * NULL if none
- */
-PN_EXTERN pn_delivery_t *pn_work_head(pn_connection_t *connection);
-
-/** Get the next delivery on the connection that needs has pending
- * operations.
- *
- * @param[in] delivery the previous delivery retrieved from
- * either pn_work_head() or pn_work_next()
- * @return the next delivery that has pending operations, else
- * NULL if none
- */
-PN_EXTERN pn_delivery_t *pn_work_next(pn_delivery_t *delivery);
-
-/** Factory for creating a new session on the connection.
- *
- * A new session is created for the connection, and is added to the
- * set of sessions maintained by the connection.
- *
- * @param[in] connection the session will exist over this connection
- * @return pointer to new session
- */
-PN_EXTERN pn_session_t *pn_session(pn_connection_t *connection);
-
-PN_EXTERN size_t pn_session_get_incoming_capacity(pn_session_t *ssn);
-PN_EXTERN void pn_session_set_incoming_capacity(pn_session_t *ssn, size_t capacity);
-
-PN_EXTERN size_t pn_session_outgoing_bytes(pn_session_t *ssn);
-PN_EXTERN size_t pn_session_incoming_bytes(pn_session_t *ssn);
-
-/** Factory for creating a transport.
- *
- * A transport to be used by a connection to interface with the
- * network. There can only be one connection associated with a
- * transport. See pn_transport_bind().
- *
- * @return pointer to new transport
- */
-PN_EXTERN pn_transport_t *pn_transport(void);
-
-/** Binds the transport to an AMQP connection endpoint.
- *
- * @return an error code, or 0 on success
- */
-
-PN_EXTERN int pn_transport_bind(pn_transport_t *transport, pn_connection_t *connection);
-
-PN_EXTERN int pn_transport_unbind(pn_transport_t *transport);
-
-/** Retrieve the first Session that matches the given 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 that matches the given 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);
-
-/** Retrieve the first Link that matches the given state mask.
- *
- * Examines the state of each Link owned by the connection and returns
- * the first Link 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 Links
- * @param[in] state mask to match
- * @return the first Link owned by the connection that matches the
- * mask, else NULL if no Links match
- */
-PN_EXTERN pn_link_t *pn_link_head(pn_connection_t *connection, pn_state_t state);
-
-/** Retrieve the next Link that matches the given state mask.
- *
- * When used with pn_link_head(), the application can access all Links
- * on the connection that match the given state. See pn_link_head()
- * for description of match behavior.
- *
- * @param[in] link the previous Link obtained from pn_link_head() or
- * pn_link_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_link_t *pn_link_next(pn_link_t *link, pn_state_t state);
-
-PN_EXTERN void pn_connection_reset(pn_connection_t *connection);
-PN_EXTERN void pn_connection_open(pn_connection_t *connection);
-PN_EXTERN void pn_connection_close(pn_connection_t *connection);
-PN_EXTERN void pn_connection_free(pn_connection_t *connection);
-
-/** Access the application context that is associated with the
- * connection.
- *
- * @param[in] connection the connection whose context is to be returned.
- *
- * @return the application context that was passed to pn_connection_set_context()
- */
-PN_EXTERN void *pn_connection_get_context(pn_connection_t *connection);
-
-/** Assign a new application context to the connection.
- *
- * @param[in] connection the connection which will hold the context.
- * @param[in] context new application context to associate with the
- * connection
- */
-PN_EXTERN void pn_connection_set_context(pn_connection_t *connection, void *context);
-
-
-// transport
-PN_EXTERN pn_error_t *pn_transport_error(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);
-
-/** Report 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);
-
-/** Return 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 ::size bytes afther the tail pointer and then
- * calling ::pn_transport_process with an argument of ::size. It is an
- * error to call this with a size larger than the capacity reported by
- * ::pn_transport_capacity.
- *
- * @param[in] transport the transport
- * @return 0 on success, or error code if < 0
- */
-PN_EXTERN int 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 ::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[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);
-
-/** Report 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] the transport
- * @return the number of pending output bytes, or an error code
- */
-PN_EXTERN ssize_t pn_transport_pending(pn_transport_t *transport);
-
-/** Return 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 ::size bytes from the head of the transport to the ::dst
- * pointer. It is an error to call this with a value of ::size that is
- * greater than the value reported by ::pn_transport_pending.
+ * The proton Engine API. The Engine API provides a complete
+ * implementation of AMQP as a Protocol Engine.
*
- * @param[in] transport the transport
- * @return 0 on success, or error code if < 0
+ * @defgroup engine Engine
*/
-PN_EXTERN int pn_transport_peek(pn_transport_t *transport, char *dst, size_t size);
-
-/** Removes ::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] the transport
- * @param[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);
-
-
-/** 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.
- *
- * @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);
-PN_EXTERN void pn_transport_trace(pn_transport_t *transport, pn_trace_t trace);
-PN_EXTERN void pn_transport_set_tracer(pn_transport_t *transport, pn_tracer_t *tracer);
-PN_EXTERN pn_tracer_t *pn_transport_get_tracer(pn_transport_t *transport);
-PN_EXTERN void pn_transport_set_context(pn_transport_t *transport, void *context);
-PN_EXTERN void *pn_transport_get_context(pn_transport_t *transport);
-PN_EXTERN void pn_transport_log(pn_transport_t *transport, const char *message);
-PN_EXTERN void pn_transport_logf(pn_transport_t *transport, const char *fmt, ...);
-// max frame of zero means "unlimited"
-PN_EXTERN uint32_t pn_transport_get_max_frame(pn_transport_t *transport);
-PN_EXTERN void pn_transport_set_max_frame(pn_transport_t *transport, uint32_t size);
-PN_EXTERN uint32_t pn_transport_get_remote_max_frame(pn_transport_t *transport);
-/* timeout of zero means "no timeout" */
-PN_EXTERN pn_millis_t pn_transport_get_idle_timeout(pn_transport_t *transport);
-PN_EXTERN void pn_transport_set_idle_timeout(pn_transport_t *transport, pn_millis_t timeout);
-PN_EXTERN pn_millis_t pn_transport_get_remote_idle_timeout(pn_transport_t *transport);
-PN_EXTERN uint64_t pn_transport_get_frames_output(const pn_transport_t *transport);
-PN_EXTERN uint64_t pn_transport_get_frames_input(const pn_transport_t *transport);
-PN_EXTERN bool pn_transport_quiesced(pn_transport_t *transport);
-PN_EXTERN void pn_transport_free(pn_transport_t *transport);
-
-// session
-PN_EXTERN pn_state_t pn_session_state(pn_session_t *session);
-PN_EXTERN pn_error_t *pn_session_error(pn_session_t *session);
-PN_EXTERN pn_connection_t *pn_session_connection(pn_session_t *session);
-PN_EXTERN void pn_session_open(pn_session_t *session);
-PN_EXTERN void pn_session_close(pn_session_t *session);
-PN_EXTERN void pn_session_free(pn_session_t *session);
-PN_EXTERN void *pn_session_get_context(pn_session_t *session);
-PN_EXTERN void pn_session_set_context(pn_session_t *session, void *context);
-
-// link
-PN_EXTERN pn_link_t *pn_sender(pn_session_t *session, const char *name);
-PN_EXTERN pn_link_t *pn_receiver(pn_session_t *session, const char *name);
-PN_EXTERN const char *pn_link_name(pn_link_t *link);
-PN_EXTERN bool pn_link_is_sender(pn_link_t *link);
-PN_EXTERN bool pn_link_is_receiver(pn_link_t *link);
-PN_EXTERN pn_state_t pn_link_state(pn_link_t *link);
-PN_EXTERN pn_error_t *pn_link_error(pn_link_t *link);
-PN_EXTERN pn_session_t *pn_link_session(pn_link_t *link);
-PN_EXTERN pn_terminus_t *pn_link_source(pn_link_t *link);
-PN_EXTERN pn_terminus_t *pn_link_target(pn_link_t *link);
-PN_EXTERN pn_terminus_t *pn_link_remote_source(pn_link_t *link);
-PN_EXTERN pn_terminus_t *pn_link_remote_target(pn_link_t *link);
-PN_EXTERN pn_delivery_t *pn_link_current(pn_link_t *link);
-PN_EXTERN bool pn_link_advance(pn_link_t *link);
-PN_EXTERN int pn_link_credit(pn_link_t *link);
-PN_EXTERN int pn_link_queued(pn_link_t *link);
-PN_EXTERN int pn_link_remote_credit(pn_link_t *link);
-PN_EXTERN int pn_link_available(pn_link_t *link);
-PN_EXTERN pn_snd_settle_mode_t pn_link_snd_settle_mode(pn_link_t *link);
-PN_EXTERN pn_rcv_settle_mode_t pn_link_rcv_settle_mode(pn_link_t *link);
-PN_EXTERN pn_snd_settle_mode_t pn_link_remote_snd_settle_mode(pn_link_t *link);
-PN_EXTERN pn_rcv_settle_mode_t pn_link_remote_rcv_settle_mode(pn_link_t *link);
-PN_EXTERN void pn_link_set_snd_settle_mode(pn_link_t *link, pn_snd_settle_mode_t);
-PN_EXTERN void pn_link_set_rcv_settle_mode(pn_link_t *link, pn_rcv_settle_mode_t);
-
-PN_EXTERN int pn_link_unsettled(pn_link_t *link);
-PN_EXTERN pn_delivery_t *pn_unsettled_head(pn_link_t *link);
-PN_EXTERN pn_delivery_t *pn_unsettled_next(pn_delivery_t *delivery);
-
-PN_EXTERN void pn_link_open(pn_link_t *sender);
-PN_EXTERN void pn_link_close(pn_link_t *sender);
-PN_EXTERN void pn_link_free(pn_link_t *sender);
-PN_EXTERN void *pn_link_get_context(pn_link_t *link);
-PN_EXTERN void pn_link_set_context(pn_link_t *link, void *context);
-PN_EXTERN bool pn_link_get_drain(pn_link_t *link);
-
-// sender
-PN_EXTERN void pn_link_offered(pn_link_t *sender, int credit);
-PN_EXTERN ssize_t pn_link_send(pn_link_t *sender, const char *bytes, size_t n);
-PN_EXTERN int pn_link_drained(pn_link_t *sender);
-//void pn_link_abort(pn_sender_t *sender);
-
-// receiver
-PN_EXTERN void pn_link_flow(pn_link_t *receiver, int credit);
-PN_EXTERN void pn_link_drain(pn_link_t *receiver, int credit);
-PN_EXTERN void pn_link_set_drain(pn_link_t *receiver, bool drain);
-PN_EXTERN ssize_t pn_link_recv(pn_link_t *receiver, char *bytes, size_t n);
-PN_EXTERN bool pn_link_draining(pn_link_t *receiver);
-
-// terminus
-PN_EXTERN pn_terminus_type_t pn_terminus_get_type(pn_terminus_t *terminus);
-PN_EXTERN int pn_terminus_set_type(pn_terminus_t *terminus, pn_terminus_type_t type);
-
-PN_EXTERN const char *pn_terminus_get_address(pn_terminus_t *terminus);
-PN_EXTERN int pn_terminus_set_address(pn_terminus_t *terminus, const char *address);
-PN_EXTERN pn_durability_t pn_terminus_get_durability(pn_terminus_t *terminus);
-PN_EXTERN int pn_terminus_set_durability(pn_terminus_t *terminus,
- pn_durability_t durability);
-PN_EXTERN pn_expiry_policy_t pn_terminus_get_expiry_policy(pn_terminus_t *terminus);
-PN_EXTERN int pn_terminus_set_expiry_policy(pn_terminus_t *terminus, pn_expiry_policy_t policy);
-PN_EXTERN pn_seconds_t pn_terminus_get_timeout(pn_terminus_t *terminus);
-PN_EXTERN int pn_terminus_set_timeout(pn_terminus_t *terminus, pn_seconds_t);
-PN_EXTERN bool pn_terminus_is_dynamic(pn_terminus_t *terminus);
-PN_EXTERN int pn_terminus_set_dynamic(pn_terminus_t *terminus, bool dynamic);
-PN_EXTERN pn_data_t *pn_terminus_properties(pn_terminus_t *terminus);
-PN_EXTERN pn_data_t *pn_terminus_capabilities(pn_terminus_t *terminus);
-PN_EXTERN pn_data_t *pn_terminus_outcomes(pn_terminus_t *terminus);
-PN_EXTERN pn_data_t *pn_terminus_filter(pn_terminus_t *terminus);
-PN_EXTERN pn_distribution_mode_t pn_terminus_get_distribution_mode(const pn_terminus_t *terminus);
-PN_EXTERN int pn_terminus_set_distribution_mode(pn_terminus_t *terminus, pn_distribution_mode_t m);
-PN_EXTERN int pn_terminus_copy(pn_terminus_t *terminus, pn_terminus_t *src);
-
-// delivery
-PN_EXTERN pn_delivery_t *pn_delivery(pn_link_t *link, pn_delivery_tag_t tag);
-PN_EXTERN pn_delivery_tag_t pn_delivery_tag(pn_delivery_t *delivery);
-PN_EXTERN pn_link_t *pn_delivery_link(pn_delivery_t *delivery);
-// how do we do delivery state?
-PN_EXTERN pn_disposition_t *pn_delivery_local(pn_delivery_t *delivery);
-PN_EXTERN uint64_t pn_delivery_local_state(pn_delivery_t *delivery);
-PN_EXTERN pn_disposition_t *pn_delivery_remote(pn_delivery_t *delivery);
-PN_EXTERN uint64_t pn_delivery_remote_state(pn_delivery_t *delivery);
-PN_EXTERN bool pn_delivery_settled(pn_delivery_t *delivery);
-PN_EXTERN size_t pn_delivery_pending(pn_delivery_t *delivery);
-PN_EXTERN bool pn_delivery_partial(pn_delivery_t *delivery);
-PN_EXTERN bool pn_delivery_writable(pn_delivery_t *delivery);
-PN_EXTERN bool pn_delivery_readable(pn_delivery_t *delivery);
-PN_EXTERN bool pn_delivery_updated(pn_delivery_t *delivery);
-PN_EXTERN void pn_delivery_update(pn_delivery_t *delivery, uint64_t state);
-PN_EXTERN void pn_delivery_clear(pn_delivery_t *delivery);
-//int pn_delivery_format(pn_delivery_t *delivery);
-PN_EXTERN void pn_delivery_settle(pn_delivery_t *delivery);
-PN_EXTERN void pn_delivery_dump(pn_delivery_t *delivery);
-PN_EXTERN void *pn_delivery_get_context(pn_delivery_t *delivery);
-PN_EXTERN void pn_delivery_set_context(pn_delivery_t *delivery, void *context);
-PN_EXTERN bool pn_delivery_buffered(pn_delivery_t *delivery);
-
-// disposition
-PN_EXTERN uint64_t pn_disposition_type(pn_disposition_t *disposition);
-PN_EXTERN pn_data_t *pn_disposition_data(pn_disposition_t *disposition);
-PN_EXTERN uint32_t pn_disposition_get_section_number(pn_disposition_t *disposition);
-PN_EXTERN void pn_disposition_set_section_number(pn_disposition_t *disposition, uint32_t section_number);
-PN_EXTERN uint64_t pn_disposition_get_section_offset(pn_disposition_t *disposition);
-PN_EXTERN void pn_disposition_set_section_offset(pn_disposition_t *disposition, uint64_t section_offset);
-PN_EXTERN bool pn_disposition_is_failed(pn_disposition_t *disposition);
-PN_EXTERN void pn_disposition_set_failed(pn_disposition_t *disposition, bool failed);
-PN_EXTERN bool pn_disposition_is_undeliverable(pn_disposition_t *disposition);
-PN_EXTERN void pn_disposition_set_undeliverable(pn_disposition_t *disposition, bool undeliverable);
-PN_EXTERN pn_data_t *pn_disposition_annotations(pn_disposition_t *disposition);
-
-// conditions
-PN_EXTERN pn_condition_t *pn_connection_condition(pn_connection_t *connection);
-PN_EXTERN pn_condition_t *pn_connection_remote_condition(pn_connection_t *connection);
-
-PN_EXTERN pn_condition_t *pn_session_condition(pn_session_t *session);
-PN_EXTERN pn_condition_t *pn_session_remote_condition(pn_session_t *session);
-
-PN_EXTERN pn_condition_t *pn_link_condition(pn_link_t *link);
-PN_EXTERN pn_condition_t *pn_link_remote_condition(pn_link_t *link);
-
-PN_EXTERN pn_condition_t *pn_disposition_condition(pn_disposition_t *disposition);
-
-PN_EXTERN bool pn_condition_is_set(pn_condition_t *condition);
-PN_EXTERN void pn_condition_clear(pn_condition_t *condition);
-
-PN_EXTERN const char *pn_condition_get_name(pn_condition_t *condition);
-PN_EXTERN int pn_condition_set_name(pn_condition_t *condition, const char *name);
-
-PN_EXTERN const char *pn_condition_get_description(pn_condition_t *condition);
-PN_EXTERN int pn_condition_set_description(pn_condition_t *condition, const char *description);
-
-PN_EXTERN pn_data_t *pn_condition_info(pn_condition_t *condition);
-
-PN_EXTERN bool pn_condition_is_redirect(pn_condition_t *condition);
-PN_EXTERN const char *pn_condition_redirect_host(pn_condition_t *condition);
-PN_EXTERN int pn_condition_redirect_port(pn_condition_t *condition);
-#ifdef __cplusplus
-}
-#endif
+#include <proton/condition.h>
+#include <proton/connection.h>
+#include <proton/session.h>
+#include <proton/terminus.h>
+#include <proton/link.h>
+#include <proton/delivery.h>
+#include <proton/event.h>
+#include <proton/transport.h>
#endif /* engine.h */
Modified: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/error.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/error.h?rev=1577483&r1=1577482&r2=1577483&view=diff
==============================================================================
--- qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/error.h (original)
+++ qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/error.h Fri Mar 14 11:20:47 2014
@@ -51,6 +51,7 @@ PN_EXTERN int pn_error_vformat(pn_error_
PN_EXTERN int pn_error_format(pn_error_t *error, int code, const char *fmt, ...);
PN_EXTERN int pn_error_code(pn_error_t *error);
PN_EXTERN const char *pn_error_text(pn_error_t *error);
+PN_EXTERN int pn_error_copy(pn_error_t *error, pn_error_t *src);
#ifdef __cplusplus
}
Added: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/event.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/event.h?rev=1577483&view=auto
==============================================================================
--- qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/event.h (added)
+++ qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/event.h Fri Mar 14 11:20:47 2014
@@ -0,0 +1,229 @@
+#ifndef PROTON_EVENT_H
+#define PROTON_EVENT_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>
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+#include <stddef.h>
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file
+ *
+ * Event API for the proton Engine.
+ *
+ * @defgroup event Event
+ * @ingroup engine
+ * @{
+ */
+
+/**
+ * An event provides notification of a state change within the
+ * protocol engine's object model.
+ *
+ * The AMQP endpoint state modeled by the protocol engine is captured
+ * by the following object types: @link pn_delivery_t Deliveries
+ * @endlink, @link pn_link_t Links @endlink, @link pn_session_t
+ * Sessions @endlink, @link pn_connection_t Connections @endlink, and
+ * @link pn_transport_t Transports @endlink. These objects are related
+ * as follows:
+ *
+ * - @link pn_delivery_t Deliveries @endlink always have a single
+ * parent Link
+ * - @link pn_link_t Links @endlink always have a single parent
+ * Session
+ * - @link pn_session_t Sessions @endlink always have a single parent
+ * Connection
+ * - @link pn_connection_t Connections @endlink optionally have at
+ * most one associated Transport
+ * - @link pn_transport_t Transports @endlink optionally have at most
+ * one associated Connection
+ *
+ * Every event has a type (see ::pn_event_type_t) that identifies what
+ * sort of state change has occurred along with a pointer to the
+ * object whose state has changed (as well as its associated objects).
+ *
+ * Events are accessed by creating a @link pn_collector_t Collector
+ * @endlink with ::pn_collector() and registering it with the @link
+ * pn_connection_t Connection @endlink of interest through use of
+ * ::pn_connection_collect(). Once a collector has been registered,
+ * ::pn_collector_peek() and ::pn_collector_pop() are used to access
+ * and process events.
+ */
+typedef struct pn_event_t pn_event_t;
+
+/**
+ * An event type.
+ */
+typedef enum {
+ /**
+ * Defined as a programming convenience. No event of this type will
+ * ever be generated.
+ */
+ PN_EVENT_NONE = 0,
+ /**
+ * The endpoint state flags for a connection have changed. Events of
+ * this type point to the relevant connection as well as its
+ * associated transport.
+ */
+ PN_CONNECTION_STATE = 1,
+ /**
+ * The endpoint state flags for a session have changed. Events of
+ * this type point to the relevant session as well as its associated
+ * connection and transport.
+ */
+ PN_SESSION_STATE = 2,
+ /**
+ * The endpoint state flags for a link have changed. Events of this
+ * type point to the relevant link as well as its associated
+ * session, connection, and transport.
+ */
+ PN_LINK_STATE = 4,
+ /**
+ * The flow control state for a link has changed. Events of this
+ * type point to the relevant link along with its associated
+ * session, connection, and transport.
+ */
+ PN_LINK_FLOW = 8,
+ /**
+ * A delivery has been created or updated. Events of this type point
+ * to the relevant delivery as well as its associated link, session,
+ * connection, and transport.
+ */
+ PN_DELIVERY = 16,
+ /**
+ * The transport has new data to read and/or write. Events of this
+ * type point to the relevant transport as well as its associated
+ * connection.
+ */
+ PN_TRANSPORT = 32
+} pn_event_type_t;
+
+/**
+ * Get a human readable name for an event type.
+ *
+ * @param[in] type an event type
+ * @return a human readable name
+ */
+PN_EXTERN const char *pn_event_type_name(pn_event_type_t type);
+
+/**
+ * Construct a collector.
+ *
+ * A collector is used to register interest in events produced by one
+ * or more ::pn_connection_t objects. Collectors are not currently
+ * thread safe, so synchronization must be used if they are to be
+ * shared between multiple connection objects.
+ */
+PN_EXTERN pn_collector_t *pn_collector(void);
+
+/**
+ * Free a collector.
+ *
+ * @param[in] collector a collector to free, or NULL
+ */
+PN_EXTERN void pn_collector_free(pn_collector_t *collector);
+
+/**
+ * Access the head event contained by a collector.
+ *
+ * This operation will continue to return the same event until it is
+ * cleared by using ::pn_collector_pop. The pointer return by this
+ * operation will be valid until ::pn_collector_pop is invoked or
+ * ::pn_collector_free is called, whichever happens sooner.
+ *
+ * @param[in] collector a collector object
+ * @return a pointer to the head event contained in the collector
+ */
+PN_EXTERN pn_event_t *pn_collector_peek(pn_collector_t *collector);
+
+/**
+ * Clear the head event on a collector.
+ *
+ * @param[in] collector a collector object
+ * @return true if the event was popped, false if the collector is empty
+ */
+PN_EXTERN bool pn_collector_pop(pn_collector_t *collector);
+
+/**
+ * Get the type of an event.
+ *
+ * @param[in] event an event object
+ * @return the type of the event
+ */
+PN_EXTERN pn_event_type_t pn_event_type(pn_event_t *event);
+
+/**
+ * Get the connection associated with an event.
+ *
+ * @param[in] event an event object
+ * @return the connection associated with the event (or NULL)
+ */
+PN_EXTERN pn_connection_t *pn_event_connection(pn_event_t *event);
+
+/**
+ * Get the session associated with an event.
+ *
+ * @param[in] event an event object
+ * @return the session associated with the event (or NULL)
+ */
+PN_EXTERN pn_session_t *pn_event_session(pn_event_t *event);
+
+/**
+ * Get the link associated with an event.
+ *
+ * @param[in] event an event object
+ * @return the link associated with the event (or NULL)
+ */
+PN_EXTERN pn_link_t *pn_event_link(pn_event_t *event);
+
+/**
+ * Get the delivery associated with an event.
+ *
+ * @param[in] event an event object
+ * @return the delivery associated with the event (or NULL)
+ */
+PN_EXTERN pn_delivery_t *pn_event_delivery(pn_event_t *event);
+
+/**
+ * Get the transport associated with an event.
+ *
+ * @param[in] event an event object
+ * @return the transport associated with the event (or NULL)
+ */
+PN_EXTERN pn_transport_t *pn_event_transport(pn_event_t *event);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}
+ */
+
+#endif /* event.h */
Propchange: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/event.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/event.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/io.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/io.h?rev=1577483&view=auto
==============================================================================
--- qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/io.h (added)
+++ qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/io.h Fri Mar 14 11:20:47 2014
@@ -0,0 +1,69 @@
+#ifndef PROTON_IO_H
+#define PROTON_IO_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/error.h>
+#include <sys/types.h>
+#include <proton/type_compat.h>
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#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
+
+typedef struct pn_io_t pn_io_t;
+
+PN_EXTERN pn_io_t *pn_io(void);
+PN_EXTERN void pn_io_free(pn_io_t *io);
+PN_EXTERN pn_error_t *pn_io_error(pn_io_t *io);
+PN_EXTERN pn_socket_t pn_connect(pn_io_t *io, const char *host, const char *port);
+PN_EXTERN pn_socket_t pn_listen(pn_io_t *io, const char *host, const char *port);
+PN_EXTERN pn_socket_t pn_accept(pn_io_t *io, pn_socket_t socket, char *name, size_t size);
+PN_EXTERN void pn_close(pn_io_t *io, pn_socket_t socket);
+PN_EXTERN ssize_t pn_send(pn_io_t *io, pn_socket_t socket, const void *buf, size_t size);
+PN_EXTERN ssize_t pn_recv(pn_io_t *io, pn_socket_t socket, void *buf, size_t size);
+PN_EXTERN int pn_pipe(pn_io_t *io, pn_socket_t *dest);
+PN_EXTERN ssize_t pn_read(pn_io_t *io, pn_socket_t socket, void *buf, size_t size);
+PN_EXTERN ssize_t pn_write(pn_io_t *io, pn_socket_t socket, const void *buf, size_t size);
+PN_EXTERN bool pn_wouldblock(pn_io_t *io);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* io.h */
Propchange: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/io.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/io.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/link.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/link.h?rev=1577483&view=auto
==============================================================================
--- qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/link.h (added)
+++ qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/link.h Fri Mar 14 11:20:47 2014
@@ -0,0 +1,650 @@
+#ifndef PROTON_LINK_H
+#define PROTON_LINK_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>
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+#include <stddef.h>
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file
+ *
+ * Link API for the proton Engine.
+ *
+ * @defgroup link Link
+ * @ingroup engine
+ * @{
+ */
+
+/**
+ * Construct a new sender on a session.
+ *
+ * Each sending link between two AMQP containers must be uniquely
+ * named. Note that this uniqueness cannot be enforced at the API
+ * level, so some consideration should be taken in choosing link
+ * names.
+ *
+ * @param[in] session the session object
+ * @param[in] name the name of the link
+ * @return a newly constructed sender link or NULL on error
+ */
+PN_EXTERN pn_link_t *pn_sender(pn_session_t *session, const char *name);
+
+/**
+ * Construct a new receiver on a session.
+ *
+ * Each receiving link between two AMQP containers must be uniquely
+ * named. Note that this uniqueness cannot be enforced at the API
+ * level, so some consideration should be taken in choosing link
+ * names.
+ *
+ * @param[in] session the session object
+ * @param[in] name the name of the link
+ * @return a newly constructed receiver link or NULL on error
+ */
+PN_EXTERN pn_link_t *pn_receiver(pn_session_t *session, const char *name);
+
+/**
+ * Free a link object.
+ *
+ * When a link object is freed, all ::pn_delivery_t objects associated
+ * with the session are also freed.
+ *
+ * @param[in] link a link object to free (or NULL)
+ */
+PN_EXTERN void pn_link_free(pn_link_t *link);
+
+/**
+ * Get the application context that is associated with a link object.
+ *
+ * The application context for a link may be set using
+ * ::pn_link_set_context.
+ *
+ * @param[in] link the link whose context is to be returned.
+ * @return the application context for the link object
+ */
+PN_EXTERN void *pn_link_get_context(pn_link_t *link);
+
+/**
+ * Set a new application context for a link object.
+ *
+ * The application context for a link object may be retrieved using
+ * ::pn_link_get_context.
+ *
+ * @param[in] link the link object
+ * @param[in] context the application context
+ */
+PN_EXTERN void pn_link_set_context(pn_link_t *link, void *context);
+
+/**
+ * Get the name of a link.
+ *
+ * @param[in] link a link object
+ * @return the name of the link
+ */
+PN_EXTERN const char *pn_link_name(pn_link_t *link);
+
+/**
+ * Test if a link is a sender.
+ *
+ * @param[in] link a link object
+ * @return true if and only if the link is a sender
+ */
+PN_EXTERN bool pn_link_is_sender(pn_link_t *link);
+
+/**
+ * Test if a link is a receiver.
+ *
+ * @param[in] link a link object
+ * @return true if and only if the link is a receiver
+ */
+PN_EXTERN bool pn_link_is_receiver(pn_link_t *link);
+
+/**
+ * Get the endpoint state flags for a link.
+ *
+ * @param[in] link the link
+ * @return the link's state flags
+ */
+PN_EXTERN pn_state_t pn_link_state(pn_link_t *link);
+
+/**
+ * Get additional error information associated with the link.
+ *
+ * Whenever a link 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
+ * link object is freed.
+ *
+ * @param[in] link the link object
+ * @return the link's error object
+ */
+PN_EXTERN pn_error_t *pn_link_error(pn_link_t *link);
+
+/**
+ * Get the local condition associated with a link endpoint.
+ *
+ * The ::pn_condition_t object retrieved may be modified prior to
+ * closing a link in order to indicate a particular condition
+ * exists when the link 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 link
+ * object is freed.
+ *
+ * @param[in] link the link object
+ * @return the link's local condition object
+ */
+PN_EXTERN pn_condition_t *pn_link_condition(pn_link_t *link);
+
+/**
+ * Get the remote condition associated with a link 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 link endpoint was
+ * closed. The ::pn_condition_t object returned may not be modified.
+ *
+ * The pointer returned by this operation is valid until the
+ * link object is freed.
+ *
+ * @param[in] link the link object
+ * @return the link's remote condition object
+ */
+PN_EXTERN pn_condition_t *pn_link_remote_condition(pn_link_t *link);
+
+/**
+ * Get the parent session for a link object.
+ *
+ * This operation retrieves the parent ::pn_session_t object that
+ * contains the given ::pn_link_t object.
+ *
+ * @param[in] link the link object
+ * @return the parent session object
+ */
+PN_EXTERN pn_session_t *pn_link_session(pn_link_t *link);
+
+/**
+ * Retrieve the first link that matches the given state mask.
+ *
+ * Examines the state of each link owned by the connection and returns
+ * the first link 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 Links
+ * @param[in] state mask to match
+ * @return the first link owned by the connection that matches the
+ * mask, else NULL if no links match
+ */
+PN_EXTERN pn_link_t *pn_link_head(pn_connection_t *connection, pn_state_t state);
+
+/**
+ * Retrieve the next link that matches the given state mask.
+ *
+ * When used with pn_link_head, the application can access all links
+ * on the connection that match the given state. See pn_link_head for
+ * description of match behavior.
+ *
+ * @param[in] link the previous link obtained from pn_link_head or
+ * pn_link_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_link_t *pn_link_next(pn_link_t *link, pn_state_t state);
+
+/**
+ * Open a link.
+ *
+ * Once this operation has completed, the PN_LOCAL_ACTIVE state flag
+ * will be set.
+ *
+ * @param[in] link a link object
+ */
+PN_EXTERN void pn_link_open(pn_link_t *link);
+
+/**
+ * Close a link.
+ *
+ * Once this operation has completed, the PN_LOCAL_CLOSED state flag
+ * will be set. This may be called without calling
+ * ::pn_link_open, in this case it is equivalent to calling
+ * ::pn_link_open followed by ::pn_link_close.
+ *
+ * @param[in] link a link object
+ */
+PN_EXTERN void pn_link_close(pn_link_t *link);
+
+/**
+ * Access the locally defined source definition for a link.
+ *
+ * The pointer returned by this operation is valid until the link
+ * object is freed.
+ *
+ * @param[in] link a link object
+ * @return a pointer to a source terminus
+ */
+PN_EXTERN pn_terminus_t *pn_link_source(pn_link_t *link);
+
+/**
+ * Access the locally defined target definition for a link.
+ *
+ * The pointer returned by this operation is valid until the link
+ * object is freed.
+ *
+ * @param[in] link a link object
+ * @return a pointer to a target terminus
+ */
+PN_EXTERN pn_terminus_t *pn_link_target(pn_link_t *link);
+
+/**
+ * Access the remotely defined source definition for a link.
+ *
+ * The pointer returned by this operation is valid until the link
+ * object is freed. The remotely defined terminus will be empty until
+ * the link is remotely opened as indicated by the PN_REMOTE_ACTIVE
+ * flag.
+ *
+ * @param[in] link a link object
+ * @return a pointer to the remotely defined source terminus
+ */
+PN_EXTERN pn_terminus_t *pn_link_remote_source(pn_link_t *link);
+
+/**
+ * Access the remotely defined target definition for a link.
+ *
+ * The pointer returned by this operation is valid until the link
+ * object is freed. The remotely defined terminus will be empty until
+ * the link is remotely opened as indicated by the PN_REMOTE_ACTIVE
+ * flag.
+ *
+ * @param[in] link a link object
+ * @return a pointer to the remotely defined target terminus
+ */
+PN_EXTERN pn_terminus_t *pn_link_remote_target(pn_link_t *link);
+
+/**
+ * Get the current delivery for a link.
+ *
+ * Each link maintains a sequence of deliveries in the order they were
+ * created, along with a pointer to the *current* delivery. All
+ * send/recv operations on a link take place on the *current*
+ * delivery. If a link has no current delivery, the current delivery
+ * is automatically initialized to the next delivery created on the
+ * link. Once initialized, the current delivery remains the same until
+ * it is changed through use of ::pn_link_advance or until it is
+ * settled via ::pn_delivery_settle.
+ *
+ * @param[in] link a link object
+ * @return the current delivery for the link, or NULL if there is none
+ */
+PN_EXTERN pn_delivery_t *pn_link_current(pn_link_t *link);
+
+/**
+ * Advance the current delivery of a link to the next delivery on the
+ * link.
+ *
+ * For sending links this operation is used to finish sending message
+ * data for the current outgoing delivery and move on to the next
+ * outgoing delivery (if any).
+ *
+ * For receiving links, this operation is used to finish accessing
+ * message data from the current incoming delivery and move on to the
+ * next incoming delivery (if any).
+ *
+ * Each link maintains a sequence of deliveries in the order they were
+ * created, along with a pointer to the *current* delivery. The
+ * pn_link_advance operation will modify the *current* delivery on the
+ * link to point to the next delivery in the sequence. If there is no
+ * next delivery in the sequence, the current delivery will be set to
+ * NULL. This operation will return true if invoking it caused the
+ * value of the current delivery to change, even if it was set to
+ * NULL.
+ *
+ * @param[in] link a link object
+ * @return true if the current delivery was changed
+ */
+PN_EXTERN bool pn_link_advance(pn_link_t *link);
+
+/**
+ * Get the credit balance for a link.
+ *
+ * Links use a credit based flow control scheme. Every receiver
+ * maintains a credit balance that corresponds to the number of
+ * deliveries that the receiver can accept at any given moment. As
+ * more capacity becomes available at the receiver (see
+ * ::pn_link_flow), it adds credit to this balance and communicates
+ * the new balance to the sender. Whenever a delivery is
+ * sent/received, the credit balance maintained by the link is
+ * decremented by one. Once the credit balance at the sender reaches
+ * zero, the sender must pause sending until more credit is obtained
+ * from the receiver.
+ *
+ * Note that a sending link may still be used to send deliveries even
+ * if pn_link_credit reaches zero, however those deliveries will end
+ * up being buffered by the link until enough credit is obtained from
+ * the receiver to send them over the wire. In this case the balance
+ * reported by ::pn_link_credit will go negative.
+ *
+ * @param[in] link a link object
+ * @return the credit balance for the link
+ */
+PN_EXTERN int pn_link_credit(pn_link_t *link);
+
+/**
+ * Get the number of queued deliveries for a link.
+ *
+ * Links may queue deliveries for a number of reasons, for example
+ * there may be insufficient credit to send them to the receiver (see
+ * ::pn_link_credit), or they simply may not have yet had a chance to
+ * be written to the wire. This operation will return the number of
+ * queued deliveries on a link.
+ *
+ * @param[in] link a link object
+ * @return the number of queued deliveries for the link
+ */
+PN_EXTERN int pn_link_queued(pn_link_t *link);
+
+/**
+ * Get the remote view of the credit for a link.
+ *
+ * The remote view of the credit for a link differs from local view of
+ * credit for a link by the number of queued deliveries. In other
+ * words ::pn_link_remote_credit is defined to be ::pn_link_credit -
+ * ::pn_link_queued.
+ *
+ * @param[in] link a link object
+ * @return the remote view of the credit for a link
+ */
+PN_EXTERN int pn_link_remote_credit(pn_link_t *link);
+
+/**
+ * Get the drain flag for a link.
+ *
+ * If a link is in drain mode, then the sending endpoint of a link
+ * must immediately use up all available credit on the link. If this
+ * is not possible, the excess credit must be returned by invoking
+ * ::pn_link_drained. Only the receiving endpoint can set the drain
+ * mode. See ::pn_link_set_drain for details.
+ *
+ * @param[in] link a link object
+ * @return true if and only if the link is in drain mode
+ */
+PN_EXTERN bool pn_link_get_drain(pn_link_t *link);
+
+/**
+ * Drain excess credit for a link.
+ *
+ * When a link is in drain mode, the sender must use all excess credit
+ * immediately, and release any excess credit back to the receiver if
+ * there are no deliveries available to send.
+ *
+ * When invoked on a sending link that is in drain mode, this
+ * operation will release all excess credit back to the receiver and
+ * return the number of credits released back to the sender. If the
+ * link is not in drain mode, this operation is a noop.
+ *
+ * When invoked on a receiving link, this operation will return and
+ * reset the number of credits the sender has released back to the
+ * receiver.
+ *
+ * @param[in] link a link object
+ * @return the number of credits drained
+ */
+PN_EXTERN int pn_link_drained(pn_link_t *link);
+
+/**
+ * Get the available deliveries hint for a link.
+ *
+ * The available count for a link provides a hint as to the number of
+ * deliveries that might be able to be sent if sufficient credit were
+ * issued by the receiving link endpoint. See ::pn_link_offered for
+ * more details.
+ *
+ * @param[in] link a link object
+ * @return the available deliveries hint
+ */
+PN_EXTERN int pn_link_available(pn_link_t *link);
+
+/**
+ * Describes the permitted/expected settlement behaviours of a sending
+ * link.
+ *
+ * The sender settle mode describes the permitted and expected
+ * behaviour of a sending link with respect to settling of deliveries.
+ * See ::pn_delivery_settle for more details.
+ */
+typedef enum {
+ PN_SND_UNSETTLED = 0, /**< The sender will send all deliveries
+ initially unsettled. */
+ PN_SND_SETTLED = 1, /**< The sender will send all deliveries settled
+ to the receiver. */
+ PN_SND_MIXED = 2 /**< The sender may send a mixure of settled and
+ unsettled deliveries. */
+} pn_snd_settle_mode_t;
+
+/**
+ * Describes the permitted/expected settlement behaviours of a
+ * receiving link.
+ *
+ * The receiver settle mode describes the permitted and expected
+ * behaviour of a receiving link with respect to settling of
+ * deliveries. See ::pn_delivery_settle for more details.
+ */
+typedef enum {
+ PN_RCV_FIRST = 0, /**< The receiver will settle deliveries
+ regardless of what the sender does. */
+ PN_RCV_SECOND = 1 /**< The receiver will only settle deliveries
+ after the sender settles. */
+} pn_rcv_settle_mode_t;
+
+/**
+ * Get the local sender settle mode for a link.
+ *
+ * @param[in] link a link object
+ * @return the local sender settle mode
+ */
+PN_EXTERN pn_snd_settle_mode_t pn_link_snd_settle_mode(pn_link_t *link);
+
+/**
+ * Get the local receiver settle mode for a link.
+ *
+ * @param[in] link a link object
+ * @return the local receiver settle mode
+ */
+PN_EXTERN pn_rcv_settle_mode_t pn_link_rcv_settle_mode(pn_link_t *link);
+
+/**
+ * Set the local sender settle mode for a link.
+ *
+ * @param[in] link a link object
+ * @param[in] mode the sender settle mode
+ */
+PN_EXTERN void pn_link_set_snd_settle_mode(pn_link_t *link, pn_snd_settle_mode_t mode);
+
+/**
+ * Set the local receiver settle mode for a link.
+ *
+ * @param[in] link a link object
+ * @param[in] mode the receiver settle mode
+ */
+PN_EXTERN void pn_link_set_rcv_settle_mode(pn_link_t *link, pn_rcv_settle_mode_t mode);
+
+/**
+ * Get the remote sender settle mode for a link.
+ *
+ * @param[in] link a link object
+ * @return the remote sender settle mode
+ */
+PN_EXTERN pn_snd_settle_mode_t pn_link_remote_snd_settle_mode(pn_link_t *link);
+
+/**
+ * Get the remote receiver settle mode for a link.
+ *
+ * @param[in] link a link object
+ * @return the remote receiver settle mode
+ */
+PN_EXTERN pn_rcv_settle_mode_t pn_link_remote_rcv_settle_mode(pn_link_t *link);
+
+/**
+ * Get the number of unsettled deliveries for a link.
+ *
+ * @param[in] link a link object
+ * @return the number of unsettled deliveries
+ */
+PN_EXTERN int pn_link_unsettled(pn_link_t *link);
+
+/**
+ * Get the first unsettled delivery for a link.
+ *
+ " @param[in] link a link object
+ * @return a pointer to the first unsettled delivery on the link
+ */
+PN_EXTERN pn_delivery_t *pn_unsettled_head(pn_link_t *link);
+
+/**
+ * Get the next unsettled delivery on a link.
+ *
+ * @param[in] delivery a delivery object
+ * @return the next unsettled delivery on the link
+ */
+PN_EXTERN pn_delivery_t *pn_unsettled_next(pn_delivery_t *delivery);
+
+/**
+ * @defgroup sender Sender
+ * @{
+ */
+
+/**
+ * Signal the availability of deliveries for a link.
+ *
+ * @param[in] sender a sender link object
+ * @param[in] credit the number of deliveries potentially available
+ * for transfer
+ */
+PN_EXTERN void pn_link_offered(pn_link_t *sender, int credit);
+
+/**
+ * Send message data for the current delivery on a link.
+ *
+ * @param[in] sender a sender link object
+ * @param[in] bytes the start of the message data
+ * @param[in] n the number of bytes of message data
+ * @return the number of bytes sent, or an error code
+ */
+PN_EXTERN ssize_t pn_link_send(pn_link_t *sender, const char *bytes, size_t n);
+
+//PN_EXTERN void pn_link_abort(pn_sender_t *sender);
+
+/** @} */
+
+// receiver
+/**
+ * @defgroup receiver Receiver
+ * @{
+ */
+
+/**
+ * Grant credit for incoming deliveries on a receiver.
+ *
+ * @param[in] receiver a receiving link object
+ * @param[in] credit the amount to increment the link credit
+ */
+PN_EXTERN void pn_link_flow(pn_link_t *receiver, int credit);
+
+/**
+ * Grant credit for incoming deliveries on a receiver, and set drain
+ * mode to true.
+ *
+ * Use ::pn_link_set_drain to set the drain mode explicitly.
+ *
+ * @param[in] receiver a receiving link object
+ * @param[in] credit the amount to increment the link credit
+ */
+PN_EXTERN void pn_link_drain(pn_link_t *receiver, int credit);
+
+/**
+ * Set the drain mode on a link.
+ *
+ * @param[in] receiver a receiving link object
+ * @param[in] drain the drain mode
+ */
+PN_EXTERN void pn_link_set_drain(pn_link_t *receiver, bool drain);
+
+/**
+ * Receive message data for the current delivery on a link.
+ *
+ * Use ::pn_delivery_pending on the current delivery to figure out how
+ * much buffer space is needed.
+ *
+ * Note that the link API can be used to stream large messages across
+ * the network, so just because there is no data to read does not
+ * imply the message is complete. To ensure the entirety of the
+ * message data has been read, either invoke ::pn_link_recv until
+ * PN_EOS is returned, or verify that ::pn_delivery_partial is false,
+ * and ::pn_delivery_pending is 0.
+ *
+ * @param[in] receiver a receiving link object
+ * @param[in] bytes a pointer to an empty buffer
+ * @param[in] n the buffer capacity
+ * @return the number of bytes received, PN_EOS, or an error code
+ */
+PN_EXTERN ssize_t pn_link_recv(pn_link_t *receiver, char *bytes, size_t n);
+
+/**
+ * Check if a link is currently draining.
+ *
+ * A link is defined to be draining when drain mode is set to true,
+ * and the sender still has excess credit.
+ *
+ * @param[in] receiver a receiving link object
+ * @return true if the link is currently draining, false otherwise
+ */
+PN_EXTERN bool pn_link_draining(pn_link_t *receiver);
+
+/** @} */
+
+/** @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* link.h */
+
Propchange: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/link.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/link.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/message.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/message.h?rev=1577483&r1=1577482&r2=1577483&view=diff
==============================================================================
--- qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/message.h (original)
+++ qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/message.h Fri Mar 14 11:20:47 2014
@@ -35,6 +35,13 @@
extern "C" {
#endif
+/** @file
+ * Message API for encoding/decoding AMQP Messages.
+ *
+ * @defgroup message Message
+ * @{
+ */
+
typedef struct pn_message_t pn_message_t;
typedef enum {
@@ -138,6 +145,9 @@ PN_EXTERN int pn_message_encode(pn_messa
PN_EXTERN ssize_t pn_message_data(char *dst, size_t available, const char *src, size_t size);
+/** @}
+ */
+
#ifdef __cplusplus
}
#endif
Modified: qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/messenger.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/messenger.h?rev=1577483&r1=1577482&r2=1577483&view=diff
==============================================================================
--- qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/messenger.h (original)
+++ qpid/proton/branches/fadams-javascript-binding/proton-c/include/proton/messenger.h Fri Mar 14 11:20:47 2014
@@ -24,6 +24,7 @@
#include <proton/import_export.h>
#include <proton/message.h>
+#include <proton/selectable.h>
#ifdef __cplusplus
extern "C" {
@@ -32,6 +33,9 @@ extern "C" {
/** @file
* The messenger API provides a high level interface for sending and
* receiving AMQP messages.
+ *
+ * @defgroup messenger Messenger
+ * @{
*/
typedef struct pn_messenger_t pn_messenger_t; /**< Messenger*/
@@ -167,14 +171,19 @@ PN_EXTERN int pn_messenger_get_timeout(p
PN_EXTERN bool pn_messenger_is_blocking(pn_messenger_t *messenger);
/** Enable or disable blocking behavior during calls to
- * pn_messenger_send and pn_messenger_recv.
+ * ::pn_messenger_send and ::pn_messenger_recv.
*
* @param[in] messenger the messenger
+ * @param[in] blocking the value of the blocking flag
*
- * @return true if blocking has been enabled.
+ * @return an error code or zero if there is no error
*/
PN_EXTERN int pn_messenger_set_blocking(pn_messenger_t *messenger, bool blocking);
+PN_EXTERN bool pn_messenger_is_passive(pn_messenger_t *messenger);
+
+PN_EXTERN int pn_messenger_set_passive(pn_messenger_t *messenger, bool passive);
+
/** Frees a Messenger.
*
* @param[in] messenger the messenger to free, no longer valid on
@@ -555,7 +564,7 @@ PN_EXTERN int pn_messenger_incoming(pn_m
//!
//! pn_messenger_route("foobar", "amqp://foo.com/bar");
//!
-//! Any message sent to bar/<path> will be routed to the corresponding
+//! Any message sent to bar/<path> will be routed to the corresponding
//! path within the amqp://bar.com domain:
//!
//! pn_messenger_route("bar/*", "amqp://bar.com/$1");
@@ -611,8 +620,16 @@ PN_EXTERN int pn_messenger_route(pn_mess
PN_EXTERN int pn_messenger_rewrite(pn_messenger_t *messenger, const char *pattern,
const char *address);
+PN_EXTERN pn_selectable_t *pn_messenger_selectable(pn_messenger_t *messenger);
+
+PN_EXTERN pn_timestamp_t pn_messenger_deadline(pn_messenger_t *messenger);
+
#ifdef __cplusplus
}
#endif
+/**
+ * @}
+ */
+
#endif /* messenger.h */
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org