summaryrefslogtreecommitdiff
path: root/qpid/cpp/include
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/cpp/include')
-rw-r--r--qpid/cpp/include/qmf/Agent.h287
-rw-r--r--qpid/cpp/include/qmf/AgentObject.h95
-rw-r--r--qpid/cpp/include/qmf/Connection.h125
-rw-r--r--qpid/cpp/include/qmf/ConnectionSettings.h143
-rw-r--r--qpid/cpp/include/qmf/QmfImportExport.h33
-rw-r--r--qpid/cpp/include/qpid/client/Connection.h14
-rw-r--r--qpid/cpp/include/qpid/client/amqp0_10/Codecs.h61
-rw-r--r--qpid/cpp/include/qpid/framing/FieldTable.h9
-rw-r--r--qpid/cpp/include/qpid/framing/FieldValue.h120
-rw-r--r--qpid/cpp/include/qpid/framing/List.h77
-rw-r--r--qpid/cpp/include/qpid/framing/Uuid.h27
-rw-r--r--qpid/cpp/include/qpid/management/Manageable.h2
-rw-r--r--qpid/cpp/include/qpid/messaging/Address.h58
-rw-r--r--qpid/cpp/include/qpid/messaging/Codec.h44
-rw-r--r--qpid/cpp/include/qpid/messaging/Connection.h67
-rw-r--r--qpid/cpp/include/qpid/messaging/Filter.h (renamed from qpid/cpp/include/qpid/sys/windows/uuid.h)36
-rw-r--r--qpid/cpp/include/qpid/messaging/Message.h88
-rw-r--r--qpid/cpp/include/qpid/messaging/MessageContent.h90
-rw-r--r--qpid/cpp/include/qpid/messaging/MessageListener.h49
-rw-r--r--qpid/cpp/include/qpid/messaging/Receiver.h115
-rw-r--r--qpid/cpp/include/qpid/messaging/Sender.h57
-rw-r--r--qpid/cpp/include/qpid/messaging/Session.h99
-rw-r--r--qpid/cpp/include/qpid/messaging/Variant.h167
-rw-r--r--qpid/cpp/include/qpid/sys/uuid.h28
-rwxr-xr-xqpid/cpp/include/qpid/sys/windows/Condition.h1
-rwxr-xr-xqpid/cpp/include/qpid/sys/windows/Mutex.h1
26 files changed, 1830 insertions, 63 deletions
diff --git a/qpid/cpp/include/qmf/Agent.h b/qpid/cpp/include/qmf/Agent.h
new file mode 100644
index 0000000000..e61cd737d0
--- /dev/null
+++ b/qpid/cpp/include/qmf/Agent.h
@@ -0,0 +1,287 @@
+#ifndef _QmfAgent_
+#define _QmfAgent_
+
+/*
+ * 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 "qmf/QmfImportExport.h"
+
+namespace qmf {
+
+ class AgentImpl;
+ class Connection;
+ class ObjectId;
+ class AgentObject;
+ class Value;
+ class Event;
+ class SchemaObjectClass;
+
+ /**
+ * AgentListener is used by agents that select the internalStore=false option (see Agent
+ * constructor) or by agents that wish to provide access control for queries and methods.
+ *
+ * \ingroup qmfapi
+ */
+ class AgentListener {
+ QMF_EXTERN virtual ~AgentListener();
+
+ /**
+ * allowQuery is called before a query operation is executed. If true is returned
+ * by this function, the query will proceed. If false is returned, the query will
+ * be forbidden.
+ *
+ * @param q The query being requested.
+ * @param userId The authenticated identity of the user requesting the query.
+ */
+ virtual bool allowQuery(const Query& q, const char* userId);
+
+ /**
+ * allowMethod is called before a method call is executed. If true is returned
+ * by this function, the method call will proceed. If false is returned, the method
+ * call will be forbidden.
+ *
+ * @param name The name of the method being called.
+ * @param args A value object (of type "map") that contains both input and output arguments.
+ * @param oid The objectId that identifies the instance of the object being called.
+ * @param cls The Schema describing the object being called.
+ * @param userId The authenticated identity of the requesting user.
+ */
+ virtual bool allowMethod(const char* name, const Value& args, const ObjectId& oid,
+ const SchemaObjectClass& cls, const char* userId);
+
+ /**
+ * query is called when the agent receives a query request. The handler must invoke
+ * Agent::queryResponse zero or more times (using the supplied context) followed by
+ * a single invocation of Agent::queryComplete. These calls do not need to be made
+ * synchronously in the context of this function. They may occur before or after this
+ * function returns.
+ *
+ * This function will only be invoked if internalStore=false in the Agent's constructor.
+ *
+ * @param context A context value to use in resulting calls to queryResponse and quertComplete.
+ * @param q The query requested by the console.
+ * @param userId the authenticated identity of the user requesting the query.
+ */
+ virtual void query(uint32_t context, const Query& q, const char* userId);
+
+ /**
+ * syncStart is called when a console requests a standing query. This function must
+ * behave exactly like AgentListener::query (i.e. send zero or more responses followed
+ * by a queryComplete) except it then remembers the context and the query and makes
+ * subsequent queryResponse calls whenever appropriate according the the query.
+ *
+ * The standing query shall stay in effect until syncStop is called with the same context
+ * value or until a specified period of time elapses without receiving a syncTouch for the
+ * context.
+ *
+ * This function will only be invoked if internalStore=false in the Agent's constructor.
+ *
+ * @param context A context value to use in resulting calls to queryResponse and queryComplete.
+ * @param q The query requested by the console.
+ * @param userId the authenticated identity of the user requesting the query.
+ */
+ virtual void syncStart(uint32_t context, const Query& q, const char* userId);
+
+ /**
+ * syncTouch is called when the console that requested a standing query refreshes its
+ * interest in the query. The console must periodically "touch" a standing query to keep
+ * it alive. This prevents standing queries from accumulating when the console disconnects
+ * before it can stop the query.
+ *
+ * This function will only be invoked if internalStore=false in the Agent's constructor.
+ *
+ * @param context The context supplied in a previous call to syncStart.
+ * @param userId The authenticated identity of the requesting user.
+ */
+ virtual void syncTouch(uint32_t context, const char* userId);
+
+ /**
+ * syncStop is called when the console that requested a standing query no longer wishes to
+ * receive data associated with that query. The application shall stop processing this
+ * query and shall remove its record of the context value.
+ *
+ * This function will only be invoked if internalStore=false in the Agent's constructor.
+ *
+ * @param context The context supplied in a previous call to syncStart.
+ * @param userId The authenticated identity of the requesting user.
+ */
+ virtual void syncStop(uint32_t context, const char* userId);
+
+ /**
+ * methodCall is called when a console invokes a method on a QMF object. The application
+ * must call Agent::methodResponse once in response to this function. The response does
+ * not need to be called synchronously in the context of this function. It may be called
+ * before or after this function returns.
+ *
+ * This function will only be invoked if internalStore=false in the Agent's constructor.
+ *
+ * @param context A context value to use in resulting call to methodResponse.
+ * @param name The name of the method being called.
+ * @param args A value object (of type "map") that contains both input and output arguments.
+ * @param oid The objectId that identifies the instance of the object being called.
+ * @param cls The Schema describing the object being called.
+ * @param userId The authenticated identity of the requesting user.
+ */
+ virtual void methodCall(uint32_t context, const char* name, Value& args,
+ const ObjectId& oid, const SchemaObjectClass& cls, const char* userId);
+ };
+
+ /**
+ * The Agent class is the QMF Agent portal. It should be instantiated once and associated with a
+ * Connection (setConnection) to connect an agent to the QMF infrastructure.
+ *
+ * \ingroup qmfapi
+ */
+ class Agent {
+ public:
+ /**
+ * Create an instance of the Agent class.
+ *
+ * @param label An optional string label that can be used to identify the agent.
+ *
+ * @param internalStore If true, objects shall be tracked internally by the agent.
+ * If false, the user of the agent must track the objects.
+ * If the agent is tracking the objects, queries and syncs are handled by
+ * the agent. The only involvement the user has is to optionally authorize
+ * individual operations. If the user is tracking the objects, the user code
+ * must implement queries and syncs (standing queries).
+ *
+ * @param listener A pointer to a class that implements the AgentListener interface.
+ * This must be supplied if any of the following conditions are true:
+ * - The agent model contains methods
+ * - The user wishes to individually authorize query and sync operations.
+ * - internalStore = false
+ */
+ QMF_EXTERN Agent(char* label="qmfa", bool internalStore=true, AgentListener* listener=0);
+
+ /**
+ * Destroy an instance of the Agent class.
+ */
+ QMF_EXTERN ~Agent();
+
+ /**
+ * Set the persistent store file. This file, if specified, is used to store state information
+ * about the Agent. For example, if object-ids must be persistent across restarts of the Agent
+ * program, this file path must be supplied.
+ *
+ * @param path Full path to a file that is both writable and readable by the Agent program.
+ */
+ QMF_EXTERN void setStoreDir(const char* path);
+
+ /**
+ * Provide a connection (to a Qpid broker) over which the agent can communicate.
+ *
+ * @param conn Pointer to a Connection object.
+ */
+ QMF_EXTERN void setConnection(Connection* conn);
+
+ /**
+ * Register a class schema (object or event) with the agent. The agent must have a registered
+ * schema for an object class or an event class before it can handle objects or events of that
+ * class.
+ *
+ * @param cls Pointer to the schema structure describing the class.
+ */
+ QMF_EXTERN void registerClass(SchemaObjectClass* cls);
+ QMF_EXTERN void registerClass(SchemaEventClass* cls);
+
+ /**
+ * Add an object to the agent (for internal storage mode only).
+ *
+ * @param obj Reference to the object to be managed by the agent.
+ *
+ * @param persistent Iff true, the object ID assigned to the object shall indicate persistence
+ * (i.e. the object ID shall be the same across restarts of the agent program).
+ *
+ * @param oid 64-bit value for the oid (if zero, the agent will assign the value).
+ *
+ * @param oidLo 32-bit value for the lower 32-bits of the oid.
+ *
+ * @param oidHi 32-bit value for the upper 32-bits of the oid.
+ */
+ QMF_EXTERN const ObjectId* addObject(AgentObject& obj, bool persistent=false, uint64_t oid=0);
+ QMF_EXTERN const ObjectId* addObject(AgentObject& obj, bool persistent, uint32_t oidLo, uint32_t oidHi);
+
+ /**
+ * Allocate an object ID for an object (for external storage mode only).
+ *
+ * @param persistent Iff true, the object ID allocated shall indicate persistence
+ * (i.e. the object ID shall be the same across restarts of the agent program).
+ *
+ * @param oid 64-bit value for the oid (if zero, the agent will assign the value).
+ *
+ * @param oidLo 32-bit value for the lower 32-bits of the oid.
+ *
+ * @param oidHi 32-bit value for the upper 32-bits of the oid.
+ */
+ QMF_EXTERN const ObjectId* allocObjectId(bool persistent=false, uint64_t oid=0);
+ QMF_EXTERN const ObjectId* allocObjectId(bool persistent, uint32_t oidLo, uint32_t oidHi);
+
+ /**
+ * Raise a QMF event.
+ *
+ * @param event Reference to an event object to be raised to the QMF infrastructure.
+ */
+ QMF_EXTERN void raiseEvent(Event& event);
+
+ /**
+ * Provide a response to a query (for external storage mode only).
+ *
+ * @param context The context value supplied in the query (via the AgentListener interface).
+ *
+ * @param object A reference to the agent that matched the query criteria.
+ *
+ * @param prop If true, transmit the property attributes of this object.
+ *
+ * @param stat If true, transmit the statistic attributes of this object.
+ */
+ QMF_EXTERN void queryResponse(uint32_t context, AgentObject& object, bool prop = true, bool stat = true);
+
+ /**
+ * Indicate that a query (or the initial dump of a sync) is complete (for external storage mode only).
+ *
+ * @param context The context value supplied in the query/sync (via the AgentListener interface).
+ */
+ QMF_EXTERN void queryComplete(uint32_t context);
+
+ /**
+ * Provide the response to a method call.
+ *
+ * @param context The context value supplied in the method request (via the AgentListener interface).
+ *
+ * @param args The argument list from the method call. Must include the output arguments (may include
+ * the input arguments).
+ *
+ * @param status Numerical return status: zero indicates no error, non-zero indicates error.
+ *
+ * @param exception Pointer to an exception value. If status is non-zero, the exception value is
+ * sent to the caller. It is optional (i.e. leave the pointer as 0), or may be
+ * set to any legal value. A string may be supplied, but an unmanaged object of
+ * any schema may also be passed.
+ */
+ QMF_EXTERN void methodResponse(uint32_t context, const Value& args, uint32_t status=0,
+ const Value* exception=0);
+
+ private:
+ AgentImpl* impl;
+ };
+
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/AgentObject.h b/qpid/cpp/include/qmf/AgentObject.h
new file mode 100644
index 0000000000..a1878605eb
--- /dev/null
+++ b/qpid/cpp/include/qmf/AgentObject.h
@@ -0,0 +1,95 @@
+#ifndef _QmfAgentObject_
+#define _QmfAgentObject_
+
+/*
+ * 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 "qmf/QmfImportExport.h"
+
+namespace qmf {
+
+ class AgentObjectImpl;
+ class SchemaObjectClass;
+ class ObjectId;
+ class Value;
+ class Agent;
+
+ /**
+ * AgentObject is an extension of Object with agent-specific methods added.
+ *
+ * \ingroup qmfapi
+ */
+ class AgentObject : public Object {
+ public:
+ /**
+ * Create a new Object of a specific type.
+ *
+ * @param type Pointer to the schema class to use as a type for this object.
+ */
+ QMF_EXTERN AgentObject(const SchemaObjectClass* type);
+
+ /**
+ * Schedule this object for deletion. Agent objects should never be directly
+ * destroyed, rather this method should be called and all pointers to this
+ * object dropped. The agent will clean up and properly delete the object at
+ * the appropraite time.
+ */
+ QMF_EXTERN void destroy();
+
+ /**
+ * Set the object ID for this object if it is to be managed by the agent.
+ *
+ * @param oid The new object ID for the managed object.
+ */
+ QMF_EXTERN void setObjectId(ObjectId& oid);
+
+ /**
+ * Handler for invoked method calls. This will only be called for objects that
+ * are being managed and stored by an agent (see internalStore argument in Agent::Agent).
+ * If this function is not overridden in a child class, the default implementation will
+ * cause AgentListener::methodCall to be invoked in the application program.
+ *
+ * If this function is overridden in a sub-class, the implementation must perform
+ * the actions associated with the method call (i.e. implement the method). Once the
+ * method execution is complete, it must call Agent::methodResponse with the result
+ * of the method execution. Agent::methodResponse does not need to be called
+ * synchronously in the context of this function call. It may be called at a later
+ * time from a different thread.
+ *
+ * @param context Context supplied by the agent and required to be passed in the
+ * call to Agent::methodResponse
+ *
+ * @param name The name of the method.
+ *
+ * @param args A Value (of type map) that contains the input and output arguments.
+ *
+ * @param userId The authenticated identity of the user who invoked the method.
+ */
+ QMF_EXTERN virtual void methodInvoked(uint32_t context, const char* name, Value& args,
+ const char* userId);
+ private:
+ friend class Agent;
+ virtual ~AgentObject();
+ void setAgent(Agent* agent);
+ AgentObjectImpl* impl;
+ };
+
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/Connection.h b/qpid/cpp/include/qmf/Connection.h
new file mode 100644
index 0000000000..f648b1427f
--- /dev/null
+++ b/qpid/cpp/include/qmf/Connection.h
@@ -0,0 +1,125 @@
+#ifndef _QmfConnection_
+#define _QmfConnection_
+
+/*
+ * 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 "qmf/QmfImportExport.h"
+#include "qmf/ConnectionSettings.h"
+
+namespace qmf {
+
+ /**
+ * Operational states for Connections.
+ *
+ * \ingroup qmfapi
+ */
+ enum ConnectionState {
+ CONNECTION_UP = 1,
+ CONNECTION_DOWN = 2
+ };
+
+ /**
+ * Implement a subclass of ConnectionListener and provide it with the
+ * Connection constructor to receive notification of changes in the
+ * connection state.
+ *
+ * \ingroup qmfapi
+ */
+ class ConnectionListener {
+ QMF_EXTERN virtual ~ConnectionListener();
+
+ /**
+ * Called each time the state of the connection changes.
+ *
+ * @param state the new state
+ */
+ virtual void newState(ConnectionState state);
+
+ /**
+ * Called if the connection requires input from an interactive client.
+ *
+ * @param prompt Text of the prompt - describes what information is required.
+ * @param answer The interactive user input.
+ * @param answerLen on Input - the maximum number of bytes that can be copied to answer.
+ * on Output - the number of bytes copied to answer.
+ */
+ virtual void interactivePrompt(const char* prompt, char* answer, uint32_t answerLen);
+ };
+
+ class ConnectionImpl;
+
+ /**
+ * The Connection class represents a connection to a QPID broker that can
+ * be used by agents and consoles, possibly multiple at the same time.
+ *
+ * \ingroup qmfapi
+ */
+ class Connection {
+ public:
+
+ /**
+ * Creates a connection object and begins the process of attempting to
+ * connect to the QPID broker.
+ *
+ * @param settings The settings that control how the connection is set
+ * up.
+ *
+ * @param listener An optional pointer to a subclass of
+ * ConnectionListener to receive notifications of events related to
+ * this connection.
+ */
+ QMF_EXTERN Connection(const ConnectionSettings& settings,
+ const ConnectionListener* listener = 0);
+
+ /**
+ * Destroys a connection, causing the connection to be closed.
+ */
+ QMF_EXTERN ~Connection();
+
+ /**
+ * Set the administrative state of the connection (enabled or disabled).
+ *
+ * @param enabled True => enable connection, False => disable connection
+ */
+ QMF_EXTERN void setAdminState(bool enabled);
+
+ /**
+ * Return the current operational state of the connection (up or down).
+ *
+ * @return the current connection state.
+ */
+ QMF_EXTERN ConnectionState getOperState() const;
+
+ /**
+ * Get the error message from the last failure to connect.
+ *
+ * @return Null-terminated string containing the error message.
+ */
+ QMF_EXTERN const char* getLastError() const;
+
+ private:
+ friend class AgentImpl;
+ friend class ConsoleImpl;
+ ConnectionImpl* impl;
+ };
+
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/ConnectionSettings.h b/qpid/cpp/include/qmf/ConnectionSettings.h
new file mode 100644
index 0000000000..9bd6922a56
--- /dev/null
+++ b/qpid/cpp/include/qmf/ConnectionSettings.h
@@ -0,0 +1,143 @@
+#ifndef _QmfConnectionSettings_
+#define _QmfConnectionSettings_
+
+/*
+ * 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 "qmf/QmfImportExport.h"
+#include "qpid/sys/IntegerTypes.h"
+
+namespace qmf {
+
+ class ConnectionSettingsImpl;
+ class Value;
+
+ /**
+ * Settings for AMQP connections to the broker.
+ *
+ * \ingroup qmfapi
+ */
+ class ConnectionSettings {
+ public:
+
+ ConnectionSettings(const ConnectionSettings& copy);
+
+ /**
+ * Create a set of default connection settings.
+ *
+ * If no further attributes are set, the settings will cause a connection to be made to
+ * the default broker (on localhost or at a host/port supplied by service discovery) and
+ * authentication will be the best-available (GSSAPI/Kerberos, Anonymous, Plain with prompts
+ * for username and password).
+ */
+ QMF_EXTERN ConnectionSettings();
+
+ /**
+ * Create a set of connection settings by URL.
+ *
+ * @param url Universal resource locator describing the broker address and additional attributes.
+ *
+ * The URL is of the form:
+ * amqp[s]://host[:port][?key=value[&key=value]*]
+ *
+ * For example:
+ * amqp://localhost
+ * amqp://broker?transport=rdma&authmech=GSSAPI&authservice=qpidd
+ * amqps://broker?authmech=PLAIN&authuser=guest&authpass=guest
+ */
+ QMF_EXTERN ConnectionSettings(const char* url);
+
+ /**
+ * Destroy the connection settings object.
+ */
+ QMF_EXTERN ~ConnectionSettings();
+
+ /**
+ * Set an attribute to control connection setup.
+ *
+ * @param key A null-terminated string that is an attribute name.
+ *
+ * @param value Reference to a value to be stored as the attribute. The type of the value
+ * is specific to the key.
+ */
+ QMF_EXTERN void setAttr(const char* key, const Value& value);
+
+ /**
+ * Get the value of an attribute.
+ *
+ * @param key A null-terminated attribute name.
+ *
+ * @return The value associated with the attribute name.
+ */
+ QMF_EXTERN Value getAttr(const char* key) const;
+
+ /**
+ * Get the attribute string (the portion of the URL following the '?') for the settings.
+ *
+ * @return A pointer to the attribute string. If the content of this string needs to be
+ * available beyond the scope of the calling function, it should be copied. The
+ * returned pointer may become invalid if the set of attributes is changed.
+ */
+ QMF_EXTERN const char* getAttrString() const;
+
+ /**
+ * Shortcuts for setting the transport for the connection.
+ *
+ * @param port The port value for the connection address.
+ */
+ QMF_EXTERN void transportTcp(uint16_t port = 5672);
+ QMF_EXTERN void transportSsl(uint16_t port = 5671);
+ QMF_EXTERN void transportRdma(uint16_t port = 5672);
+
+ /**
+ * Shortcuts for setting authentication mechanisms.
+ *
+ * @param username Null-terminated authentication user name.
+ *
+ * @param password Null-terminated authentication password.
+ *
+ * @param serviceName Null-terminated GSSAPI service name (Kerberos service principal)
+ *
+ * @param minSsf Minimum security factor for connections. 0 = encryption not required.
+ *
+ * @param maxSsf Maximum security factor for connections. 0 = encryption not permitted.
+ */
+ QMF_EXTERN void authAnonymous(const char* username = 0);
+ QMF_EXTERN void authPlain(const char* username = 0, const char* password = 0);
+ QMF_EXTERN void authGssapi(const char* serviceName, uint32_t minSsf = 0, uint32_t maxSsf = 256);
+
+ /**
+ * Shortcut for setting connection retry attributes.
+ *
+ * @param delayMin Minimum delay (in seconds) between connection attempts.
+ *
+ * @param delaxMax Maximum delay (in seconds) between connection attempts.
+ *
+ * @param delayFactor Factor to multiply the delay by between failed connection attempts.
+ */
+ QMF_EXTERN void setRetry(int delayMin = 1, int delayMax = 128, int delayFactor = 2);
+
+ private:
+ friend class ResilientConnectionImpl;
+ ConnectionSettingsImpl* impl;
+ };
+
+}
+
+#endif
diff --git a/qpid/cpp/include/qmf/QmfImportExport.h b/qpid/cpp/include/qmf/QmfImportExport.h
new file mode 100644
index 0000000000..f5e1d9127c
--- /dev/null
+++ b/qpid/cpp/include/qmf/QmfImportExport.h
@@ -0,0 +1,33 @@
+#ifndef QMF_IMPORT_EXPORT_H
+#define QMF_IMPORT_EXPORT_H
+
+/*
+ * 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.
+ */
+
+#if defined(WIN32) && !defined(QPID_DECLARE_STATIC)
+# if defined(QMF_EXPORT) || defined (qmfcommon_EXPORTS)
+# define QMF_EXTERN __declspec(dllexport)
+# else
+# define QMF_EXTERN __declspec(dllimport)
+# endif
+#else
+# define QMF_EXTERN
+#endif
+
+#endif
diff --git a/qpid/cpp/include/qpid/client/Connection.h b/qpid/cpp/include/qpid/client/Connection.h
index b7b967d232..0f5999cdcc 100644
--- a/qpid/cpp/include/qpid/client/Connection.h
+++ b/qpid/cpp/include/qpid/client/Connection.h
@@ -43,7 +43,21 @@ class ConnectionImpl;
*
* \ingroup clientapi
*
+ * Some methods use an AMQP 0-10 URL to specify connection parameters.
+ * This is defined in the AMQP 0-10 specification (http://jira.amqp.org/confluence/display/AMQP/AMQP+Specification).
+ *
+ * amqp_url = "amqp:" prot_addr_list
+ * prot_addr_list = [prot_addr ","]* prot_addr
+ * prot_addr = tcp_prot_addr | tls_prot_addr
+ *
+ * tcp_prot_addr = tcp_id tcp_addr
+ * tcp_id = "tcp:" | ""
+ * tcp_addr = [host [":" port] ]
+ * host = <as per http://www.ietf.org/rfc/rfc3986.txt>
+ * port = number]]>
+ *
*/
+
class Connection
{
framing::ProtocolVersion version;
diff --git a/qpid/cpp/include/qpid/client/amqp0_10/Codecs.h b/qpid/cpp/include/qpid/client/amqp0_10/Codecs.h
new file mode 100644
index 0000000000..5ef0b9fffe
--- /dev/null
+++ b/qpid/cpp/include/qpid/client/amqp0_10/Codecs.h
@@ -0,0 +1,61 @@
+#ifndef QPID_CLIENT_AMQP0_10_CODECS_H
+#define QPID_CLIENT_AMQP0_10_CODECS_H
+
+/*
+ *
+ * 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 "qpid/messaging/Codec.h"
+
+namespace qpid {
+namespace client {
+namespace amqp0_10 {
+
+
+/**
+ * Codec for encoding/decoding a map of Variants using the AMQP 0-10
+ * map encoding.
+ */
+class MapCodec : public qpid::messaging::Codec
+{
+ public:
+ void encode(const qpid::messaging::Variant&, std::string&);
+ void decode(const std::string&, qpid::messaging::Variant&);
+
+ static const std::string contentType;
+ private:
+};
+
+/**
+ * Codec for encoding/decoding a list of Variants using the AMQP 0-10
+ * list encoding.
+ */
+class ListCodec : public qpid::messaging::Codec
+{
+ public:
+ void encode(const qpid::messaging::Variant&, std::string&);
+ void decode(const std::string&, qpid::messaging::Variant&);
+
+ static const std::string contentType;
+ private:
+};
+
+}}} // namespace qpid::client::amqp0_10
+
+#endif /*!QPID_CLIENT_AMQP0_10_CODECS_H*/
diff --git a/qpid/cpp/include/qpid/framing/FieldTable.h b/qpid/cpp/include/qpid/framing/FieldTable.h
index a3a5c8a4ee..fd09cfc6f6 100644
--- a/qpid/cpp/include/qpid/framing/FieldTable.h
+++ b/qpid/cpp/include/qpid/framing/FieldTable.h
@@ -51,6 +51,9 @@ class FieldTable
typedef boost::shared_ptr<FieldValue> ValuePtr;
typedef std::map<std::string, ValuePtr> ValueMap;
typedef ValueMap::iterator iterator;
+ typedef ValueMap::const_reference const_reference;
+ typedef ValueMap::reference reference;
+ typedef ValueMap::value_type value_type;
QPID_COMMON_EXTERN FieldTable() {};
QPID_COMMON_EXTERN FieldTable(const FieldTable& ft);
@@ -97,12 +100,16 @@ class FieldTable
QPID_COMMON_EXTERN bool operator==(const FieldTable& other) const;
// Map-like interface.
- // TODO: may need to duplicate into versions that return mutable iterator
ValueMap::const_iterator begin() const { return values.begin(); }
ValueMap::const_iterator end() const { return values.end(); }
ValueMap::const_iterator find(const std::string& s) const { return values.find(s); }
+ ValueMap::iterator begin() { return values.begin(); }
+ ValueMap::iterator end() { return values.end(); }
+ ValueMap::iterator find(const std::string& s) { return values.find(s); }
+
std::pair <ValueMap::iterator, bool> insert(const ValueMap::value_type&);
+ QPID_COMMON_EXTERN ValueMap::iterator insert(ValueMap::iterator, const ValueMap::value_type&);
void clear() { values.clear(); }
// ### Hack Alert
diff --git a/qpid/cpp/include/qpid/framing/FieldValue.h b/qpid/cpp/include/qpid/framing/FieldValue.h
index 97fc56d606..ce4d06d2c8 100644
--- a/qpid/cpp/include/qpid/framing/FieldValue.h
+++ b/qpid/cpp/include/qpid/framing/FieldValue.h
@@ -36,7 +36,6 @@
namespace qpid {
namespace framing {
-//class Array;
/**
* Exception that is the base exception for all field table errors.
*
@@ -53,6 +52,8 @@ struct InvalidConversionException : public FieldValueException {
InvalidConversionException() {}
};
+class List;
+
/**
* Value that can appear in an AMQP field table
*
@@ -82,7 +83,7 @@ class FieldValue {
FieldValue(): data(0) {};
// Default assignment operator is fine
void setType(uint8_t type);
- uint8_t getType();
+ QPID_COMMON_EXTERN uint8_t getType();
Data& getData() { return *data; }
uint32_t encodedSize() const { return 1 + data->encodedSize(); };
bool empty() const { return data.get() == 0; }
@@ -96,12 +97,19 @@ class FieldValue {
template <typename T> bool convertsTo() const { return false; }
template <typename T> T get() const { throw InvalidConversionException(); }
+ template <class T, int W> T getIntegerValue() const;
+ template <class T, int W> T getFloatingPointValue() const;
+ template <class T> bool get(T&) const;
+
protected:
FieldValue(uint8_t t, Data* d): typeOctet(t), data(d) {}
+ QPID_COMMON_EXTERN static uint8_t* convertIfRequired(uint8_t* const octets, int width);
+
private:
uint8_t typeOctet;
std::auto_ptr<Data> data;
+
};
template <>
@@ -165,10 +173,52 @@ class FixedWidthValue : public FieldValue::Data {
return v;
}
uint8_t* rawOctets() { return octets; }
+ uint8_t* rawOctets() const { return octets; }
void print(std::ostream& o) const { o << "F" << width << ":"; };
};
+template <class T, int W>
+inline T FieldValue::getIntegerValue() const
+{
+ FixedWidthValue<W>* const fwv = dynamic_cast< FixedWidthValue<W>* const>(data.get());
+ if (fwv) {
+ uint8_t* octets = fwv->rawOctets();
+ T v = 0;
+ for (int i = 0; i < W-1; ++i) {
+ v |= octets[i]; v <<= 8;
+ }
+ v |= octets[W-1];
+ return v;
+ } else {
+ throw InvalidConversionException();
+ }
+}
+
+template <class T, int W>
+inline T FieldValue::getFloatingPointValue() const {
+ FixedWidthValue<W>* const fwv = dynamic_cast< FixedWidthValue<W>* const>(data.get());
+ if (fwv) {
+ T value;
+ uint8_t* const octets = convertIfRequired(fwv->rawOctets(), W);
+ uint8_t* const target = reinterpret_cast<uint8_t*>(&value);
+ for (uint i = 0; i < W; ++i) target[i] = octets[i];
+ return value;
+ } else {
+ throw InvalidConversionException();
+ }
+}
+
+template <>
+inline float FieldValue::get<float>() const {
+ return getFloatingPointValue<float, 4>();
+}
+
+template <>
+inline double FieldValue::get<double>() const {
+ return getFloatingPointValue<double, 8>();
+}
+
template <>
class FixedWidthValue<0> : public FieldValue::Data {
public:
@@ -243,6 +293,27 @@ class EncodedValue : public FieldValue::Data {
void print(std::ostream& o) const { o << "[" << value << "]"; };
};
+/**
+ * Accessor that can be used to get values of type FieldTable, Array
+ * and List.
+ */
+template <class T>
+inline bool FieldValue::get(T& t) const
+{
+ const EncodedValue<T>* v = dynamic_cast< EncodedValue<T>* >(data.get());
+ if (v != 0) {
+ t = v->getValue();
+ return true;
+ } else {
+ try {
+ t = get<T>();
+ return true;
+ } catch (const InvalidConversionException&) {
+ return false;
+ }
+ }
+}
+
class Str8Value : public FieldValue {
public:
QPID_COMMON_EXTERN Str8Value(const std::string& v);
@@ -294,6 +365,7 @@ class Unsigned64Value : public FieldValue {
class FieldTableValue : public FieldValue {
public:
+ typedef FieldTable ValueType;
QPID_COMMON_EXTERN FieldTableValue(const FieldTable&);
};
@@ -302,6 +374,49 @@ class ArrayValue : public FieldValue {
QPID_COMMON_EXTERN ArrayValue(const Array&);
};
+class VoidValue : public FieldValue {
+ public:
+ QPID_COMMON_EXTERN VoidValue();
+};
+
+class BoolValue : public FieldValue {
+ public:
+ QPID_COMMON_EXTERN BoolValue(bool);
+};
+
+class Unsigned8Value : public FieldValue {
+ public:
+ QPID_COMMON_EXTERN Unsigned8Value(uint8_t);
+};
+
+class Unsigned16Value : public FieldValue {
+ public:
+ QPID_COMMON_EXTERN Unsigned16Value(uint16_t);
+};
+
+class Unsigned32Value : public FieldValue {
+ public:
+ QPID_COMMON_EXTERN Unsigned32Value(uint32_t);
+};
+
+class Integer8Value : public FieldValue {
+ public:
+ QPID_COMMON_EXTERN Integer8Value(int8_t);
+};
+
+class Integer16Value : public FieldValue {
+ public:
+ QPID_COMMON_EXTERN Integer16Value(int16_t);
+};
+
+typedef IntegerValue Integer32Value;
+
+class ListValue : public FieldValue {
+ public:
+ typedef List ValueType;
+ QPID_COMMON_EXTERN ListValue(const List&);
+};
+
template <class T>
bool getEncodedValue(FieldTable::ValuePtr vptr, T& value)
{
@@ -315,7 +430,6 @@ bool getEncodedValue(FieldTable::ValuePtr vptr, T& value)
return false;
}
-
}} // qpid::framing
#endif
diff --git a/qpid/cpp/include/qpid/framing/List.h b/qpid/cpp/include/qpid/framing/List.h
new file mode 100644
index 0000000000..0f17c7884c
--- /dev/null
+++ b/qpid/cpp/include/qpid/framing/List.h
@@ -0,0 +1,77 @@
+#ifndef QPID_FRAMING_LIST_H
+#define QPID_FRAMING_LIST_H
+
+/*
+ *
+ * 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 "qpid/CommonImportExport.h"
+#include "qpid/framing/amqp_types.h"
+#include <iostream>
+#include <list>
+#include <boost/shared_ptr.hpp>
+
+namespace qpid {
+namespace framing {
+
+class Buffer;
+class FieldValue;
+
+/**
+ * Representation of an AMQP 0-10 list
+ */
+class List
+{
+ public:
+ typedef boost::shared_ptr<FieldValue> ValuePtr;
+ typedef std::list<ValuePtr> Values;
+ typedef Values::const_iterator const_iterator;
+ typedef Values::iterator iterator;
+ typedef Values::const_reference const_reference;
+ typedef Values::reference reference;
+
+ QPID_COMMON_EXTERN uint32_t encodedSize() const;
+ QPID_COMMON_EXTERN void encode(Buffer& buffer) const;
+ QPID_COMMON_EXTERN void decode(Buffer& buffer);
+
+ QPID_COMMON_EXTERN bool operator==(const List& other) const;
+
+ // std collection interface.
+ QPID_COMMON_EXTERN const_iterator begin() const { return values.begin(); }
+ QPID_COMMON_EXTERN const_iterator end() const { return values.end(); }
+ QPID_COMMON_EXTERN iterator begin() { return values.begin(); }
+ QPID_COMMON_EXTERN iterator end(){ return values.end(); }
+
+ QPID_COMMON_EXTERN ValuePtr front() const { return values.front(); }
+ QPID_COMMON_EXTERN ValuePtr back() const { return values.back(); }
+ QPID_COMMON_EXTERN size_t size() const { return values.size(); }
+
+ QPID_COMMON_EXTERN iterator insert(iterator i, ValuePtr value) { return values.insert(i, value); }
+ QPID_COMMON_EXTERN void erase(iterator i) { values.erase(i); }
+ QPID_COMMON_EXTERN void push_back(ValuePtr value) { values.insert(end(), value); }
+ QPID_COMMON_EXTERN void pop_back() { values.pop_back(); }
+
+ private:
+ Values values;
+
+ friend QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& out, const List& list);
+};
+}} // namespace qpid::framing
+
+#endif /*!QPID_FRAMING_LIST_H*/
diff --git a/qpid/cpp/include/qpid/framing/Uuid.h b/qpid/cpp/include/qpid/framing/Uuid.h
index 0dfa7a58e7..618515622d 100644
--- a/qpid/cpp/include/qpid/framing/Uuid.h
+++ b/qpid/cpp/include/qpid/framing/Uuid.h
@@ -20,7 +20,6 @@
*/
#include "qpid/CommonImportExport.h"
-#include "qpid/sys/uuid.h"
#include "qpid/sys/IntegerTypes.h"
#include <boost/array.hpp>
@@ -38,33 +37,31 @@ class Buffer;
*
* Full value semantics, operators ==, < etc. are provided by
* boost::array so Uuid can be the key type in a map etc.
+ *
+ * TODO: change this implementation as it leaks boost into the
+ * client API
*/
struct Uuid : public boost::array<uint8_t, 16> {
/** If unique is true, generate a unique ID else a null ID. */
- Uuid(bool unique=false) { if (unique) generate(); else clear(); }
+ QPID_COMMON_EXTERN Uuid(bool unique=false);
/** Copy from 16 bytes of data. */
- Uuid(const uint8_t* data) { assign(data); }
+ QPID_COMMON_EXTERN Uuid(const uint8_t* data);
+
+ // Default op= and copy ctor are fine.
+ // boost::array gives us ==, < etc.
/** Copy from 16 bytes of data. */
- void assign(const uint8_t* data) {
- uuid_copy(c_array(), data);
- }
+ void assign(const uint8_t* data);
/** Set to a new unique identifier. */
- void generate() { uuid_generate(c_array()); }
+ QPID_COMMON_EXTERN void generate();
/** Set to all zeros. */
- void clear() { uuid_clear(c_array()); }
+ void clear();
/** Test for null (all zeros). */
- // Force int 0/!0 to false/true; avoids compile warnings.
- bool isNull() {
- return !!uuid_is_null(data());
- }
-
- // Default op= and copy ctor are fine.
- // boost::array gives us ==, < etc.
+ bool isNull();
QPID_COMMON_EXTERN void encode(framing::Buffer& buf) const;
QPID_COMMON_EXTERN void decode(framing::Buffer& buf);
diff --git a/qpid/cpp/include/qpid/management/Manageable.h b/qpid/cpp/include/qpid/management/Manageable.h
index 8062479ac6..7a72cc1592 100644
--- a/qpid/cpp/include/qpid/management/Manageable.h
+++ b/qpid/cpp/include/qpid/management/Manageable.h
@@ -43,7 +43,7 @@ class QPID_COMMON_EXTERN Manageable
static const status_t STATUS_UNKNOWN_OBJECT = 1;
static const status_t STATUS_UNKNOWN_METHOD = 2;
static const status_t STATUS_NOT_IMPLEMENTED = 3;
- static const status_t STATUS_INVALID_PARAMETER = 4;
+ static const status_t STATUS_PARAMETER_INVALID = 4;
static const status_t STATUS_FEATURE_NOT_IMPLEMENTED = 5;
static const status_t STATUS_FORBIDDEN = 6;
static const status_t STATUS_EXCEPTION = 7;
diff --git a/qpid/cpp/include/qpid/messaging/Address.h b/qpid/cpp/include/qpid/messaging/Address.h
new file mode 100644
index 0000000000..e66c52f4c2
--- /dev/null
+++ b/qpid/cpp/include/qpid/messaging/Address.h
@@ -0,0 +1,58 @@
+#ifndef QPID_MESSAGING_ADDRESS_H
+#define QPID_MESSAGING_ADDRESS_H
+
+/*
+ *
+ * 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 <string>
+#include "qpid/client/ClientImportExport.h"
+#include <ostream>
+
+namespace qpid {
+namespace client {
+}
+
+namespace messaging {
+
+/**
+ * Represents an address to which messages can be sent and from which
+ * messages can be received. Often a simple name is sufficient for
+ * this. However this struct allows the type of address to be
+ * specified allowing more sophisticated treatment if necessary.
+ */
+struct Address
+{
+ std::string value;
+ std::string type;
+
+ QPID_CLIENT_EXTERN Address();
+ QPID_CLIENT_EXTERN Address(const std::string& address);
+ QPID_CLIENT_EXTERN Address(const std::string& address, const std::string& type);
+ QPID_CLIENT_EXTERN operator const std::string&() const;
+ QPID_CLIENT_EXTERN const std::string& toStr() const;
+ QPID_CLIENT_EXTERN operator bool() const;
+ QPID_CLIENT_EXTERN bool operator !() const;
+};
+
+QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const Address& address);
+
+}} // namespace qpid::messaging
+
+#endif /*!QPID_MESSAGING_ADDRESS_H*/
diff --git a/qpid/cpp/include/qpid/messaging/Codec.h b/qpid/cpp/include/qpid/messaging/Codec.h
new file mode 100644
index 0000000000..bacec5c786
--- /dev/null
+++ b/qpid/cpp/include/qpid/messaging/Codec.h
@@ -0,0 +1,44 @@
+#ifndef QPID_MESSAGING_CODEC_H
+#define QPID_MESSAGING_CODEC_H
+
+/*
+ *
+ * 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 <string>
+#include "qpid/client/ClientImportExport.h"
+
+namespace qpid {
+namespace messaging {
+
+class Variant;
+/**
+ *
+ */
+class Codec
+{
+ public:
+ QPID_CLIENT_EXTERN virtual ~Codec() {}
+ virtual void encode(const Variant&, std::string&) = 0;
+ virtual void decode(const std::string&, Variant&) = 0;
+ private:
+};
+}} // namespace qpid::messaging
+
+#endif /*!QPID_MESSAGING_CODEC_H*/
diff --git a/qpid/cpp/include/qpid/messaging/Connection.h b/qpid/cpp/include/qpid/messaging/Connection.h
new file mode 100644
index 0000000000..19dae586a4
--- /dev/null
+++ b/qpid/cpp/include/qpid/messaging/Connection.h
@@ -0,0 +1,67 @@
+#ifndef QPID_MESSAGING_CONNECTION_H
+#define QPID_MESSAGING_CONNECTION_H
+
+/*
+ *
+ * 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 <string>
+#include "qpid/client/ClientImportExport.h"
+#include "qpid/client/Handle.h"
+#include "qpid/messaging/Variant.h"
+
+namespace qpid {
+namespace client {
+
+template <class> class PrivateImplRef;
+
+}
+
+namespace messaging {
+
+class ConnectionImpl;
+class Session;
+
+class Connection : public qpid::client::Handle<ConnectionImpl>
+{
+ public:
+ static QPID_CLIENT_EXTERN Connection open(const std::string& url, const Variant::Map& options = Variant::Map());
+
+ QPID_CLIENT_EXTERN Connection(ConnectionImpl* impl = 0);
+ QPID_CLIENT_EXTERN Connection(const Connection&);
+ QPID_CLIENT_EXTERN ~Connection();
+ QPID_CLIENT_EXTERN Connection& operator=(const Connection&);
+ QPID_CLIENT_EXTERN void close();
+ QPID_CLIENT_EXTERN Session newSession();
+ private:
+ friend class qpid::client::PrivateImplRef<Connection>;
+
+};
+
+struct InvalidOptionString : public qpid::Exception
+{
+ InvalidOptionString(const std::string& msg);
+};
+
+QPID_CLIENT_EXTERN void parseOptionString(const std::string&, Variant::Map&);
+QPID_CLIENT_EXTERN Variant::Map parseOptionString(const std::string&);
+
+}} // namespace qpid::messaging
+
+#endif /*!QPID_MESSAGING_CONNECTION_H*/
diff --git a/qpid/cpp/include/qpid/sys/windows/uuid.h b/qpid/cpp/include/qpid/messaging/Filter.h
index c79abe95c6..5cd844cf73 100644
--- a/qpid/cpp/include/qpid/sys/windows/uuid.h
+++ b/qpid/cpp/include/qpid/messaging/Filter.h
@@ -1,5 +1,5 @@
-#ifndef _sys_windows_uuid_h
-#define _sys_windows_uuid_h
+#ifndef QPID_MESSAGING_FILTER_H
+#define QPID_MESSAGING_FILTER_H
/*
*
@@ -21,18 +21,28 @@
* under the License.
*
*/
+#include <string>
+#include <vector>
+#include "qpid/client/ClientImportExport.h"
-#include "qpid/CommonImportExport.h"
-#include <qpid/sys/IntegerTypes.h>
+namespace qpid {
+namespace client {
+}
-namespace qpid { namespace sys { const size_t UuidSize = 16; }}
-typedef uint8_t uuid_t[qpid::sys::UuidSize];
+namespace messaging {
-QPID_COMMON_EXTERN void uuid_clear (uuid_t uu);
-QPID_COMMON_EXTERN void uuid_copy (uuid_t dst, const uuid_t src);
-QPID_COMMON_EXTERN void uuid_generate (uuid_t out);
-QPID_COMMON_EXTERN int uuid_is_null (const uuid_t uu); // Returns 1 if null, else 0
-QPID_COMMON_EXTERN int uuid_parse (const char *in, uuid_t uu); // Returns 0 on success, else -1
-QPID_COMMON_EXTERN void uuid_unparse (const uuid_t uu, char *out);
+struct Filter
+{
+ std::string type;
+ std::vector<std::string> patterns;
-#endif /*!_sys_windows_uuid_h*/
+ QPID_CLIENT_EXTERN Filter(std::string type, std::string pattern);
+ QPID_CLIENT_EXTERN Filter(std::string type, std::string pattern1, std::string pattern2);
+
+ static QPID_CLIENT_EXTERN const std::string WILDCARD;
+ static QPID_CLIENT_EXTERN const std::string EXACT_MATCH;
+};
+
+}} // namespace qpid::messaging
+
+#endif /*!QPID_MESSAGING_FILTER_H*/
diff --git a/qpid/cpp/include/qpid/messaging/Message.h b/qpid/cpp/include/qpid/messaging/Message.h
new file mode 100644
index 0000000000..e68d8a1141
--- /dev/null
+++ b/qpid/cpp/include/qpid/messaging/Message.h
@@ -0,0 +1,88 @@
+#ifndef QPID_MESSAGING_MESSAGE_H
+#define QPID_MESSAGING_MESSAGE_H
+
+/*
+ *
+ * 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 <string>
+#include "qpid/messaging/Variant.h"
+#include "qpid/messaging/MessageContent.h"
+#include "qpid/client/ClientImportExport.h"
+
+namespace qpid {
+namespace client {
+}
+
+namespace messaging {
+
+struct Address;
+class Codec;
+struct MessageImpl;
+
+/**
+ * Representation of a message.
+ */
+class Message
+{
+ public:
+ QPID_CLIENT_EXTERN Message(const std::string& bytes = std::string());
+ QPID_CLIENT_EXTERN Message(const char*, size_t);
+ QPID_CLIENT_EXTERN Message(const Message&);
+ QPID_CLIENT_EXTERN ~Message();
+
+ QPID_CLIENT_EXTERN Message& operator=(const Message&);
+
+ QPID_CLIENT_EXTERN void setReplyTo(const Address&);
+ QPID_CLIENT_EXTERN const Address& getReplyTo() const;
+
+ QPID_CLIENT_EXTERN void setSubject(const std::string&);
+ QPID_CLIENT_EXTERN const std::string& getSubject() const;
+
+ QPID_CLIENT_EXTERN void setContentType(const std::string&);
+ QPID_CLIENT_EXTERN const std::string& getContentType() const;
+
+ QPID_CLIENT_EXTERN const VariantMap& getHeaders() const;
+ QPID_CLIENT_EXTERN VariantMap& getHeaders();
+
+ QPID_CLIENT_EXTERN const std::string& getBytes() const;
+ QPID_CLIENT_EXTERN std::string& getBytes();
+ QPID_CLIENT_EXTERN void setBytes(const std::string&);
+ QPID_CLIENT_EXTERN void setBytes(const char* chars, size_t count);
+ QPID_CLIENT_EXTERN const char* getRawContent() const;
+ QPID_CLIENT_EXTERN size_t getContentSize() const;
+
+
+ QPID_CLIENT_EXTERN MessageContent& getContent();
+ QPID_CLIENT_EXTERN const MessageContent& getContent() const;
+ QPID_CLIENT_EXTERN void setContent(const std::string& s);
+ QPID_CLIENT_EXTERN void setContent(const Variant::Map&);
+ QPID_CLIENT_EXTERN void setContent(const Variant::List&);
+
+ QPID_CLIENT_EXTERN void encode(Codec&);
+ QPID_CLIENT_EXTERN void decode(Codec&);
+
+ private:
+ MessageImpl* impl;
+ friend struct MessageImplAccess;
+};
+}} // namespace qpid::messaging
+
+#endif /*!QPID_MESSAGING_MESSAGE_H*/
diff --git a/qpid/cpp/include/qpid/messaging/MessageContent.h b/qpid/cpp/include/qpid/messaging/MessageContent.h
new file mode 100644
index 0000000000..7c3a636c07
--- /dev/null
+++ b/qpid/cpp/include/qpid/messaging/MessageContent.h
@@ -0,0 +1,90 @@
+#ifndef QPID_MESSAGING_MESSAGECONTENT_H
+#define QPID_MESSAGING_MESSAGECONTENT_H
+
+/*
+ *
+ * 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 "qpid/messaging/Variant.h"
+#include <string>
+#include "qpid/client/ClientImportExport.h"
+
+namespace qpid {
+namespace messaging {
+
+/**
+ *
+ */
+class MessageContent
+{
+ public:
+ QPID_CLIENT_EXTERN virtual ~MessageContent() {}
+
+ virtual const std::string& asString() const = 0;
+ virtual std::string& asString() = 0;
+
+ virtual const char* asChars() const = 0;
+ virtual size_t size() const = 0;
+
+ virtual const Variant::Map& asMap() const = 0;
+ virtual Variant::Map& asMap() = 0;
+ virtual bool isMap() const = 0;
+
+ virtual const Variant::List& asList() const = 0;
+ virtual Variant::List& asList() = 0;
+ virtual bool isList() const = 0;
+
+ virtual void clear() = 0;
+
+ virtual Variant& operator[](const std::string&) = 0;
+
+
+ virtual std::ostream& print(std::ostream& out) const = 0;
+
+
+ //operator<< for variety of types... (is this a good idea?)
+ virtual MessageContent& operator<<(const std::string&) = 0;
+ virtual MessageContent& operator<<(const char*) = 0;
+ virtual MessageContent& operator<<(bool) = 0;
+ virtual MessageContent& operator<<(int8_t) = 0;
+ virtual MessageContent& operator<<(int16_t) = 0;
+ virtual MessageContent& operator<<(int32_t) = 0;
+ virtual MessageContent& operator<<(int64_t) = 0;
+ virtual MessageContent& operator<<(uint8_t) = 0;
+ virtual MessageContent& operator<<(uint16_t) = 0;
+ virtual MessageContent& operator<<(uint32_t) = 0;
+ virtual MessageContent& operator<<(uint64_t) = 0;
+ virtual MessageContent& operator<<(double) = 0;
+ virtual MessageContent& operator<<(float) = 0;
+
+ //assignment from string, map and list
+ virtual MessageContent& operator=(const std::string&) = 0;
+ virtual MessageContent& operator=(const char*) = 0;
+ virtual MessageContent& operator=(const Variant::Map&) = 0;
+ virtual MessageContent& operator=(const Variant::List&) = 0;
+
+ private:
+};
+
+QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const MessageContent& content);
+
+}} // namespace qpid::messaging
+
+#endif /*!QPID_MESSAGING_MESSAGECONTENT_H*/
diff --git a/qpid/cpp/include/qpid/messaging/MessageListener.h b/qpid/cpp/include/qpid/messaging/MessageListener.h
new file mode 100644
index 0000000000..72811e7b9c
--- /dev/null
+++ b/qpid/cpp/include/qpid/messaging/MessageListener.h
@@ -0,0 +1,49 @@
+#ifndef QPID_MESSAGING_MESSAGELISTENER_H
+#define QPID_MESSAGING_MESSAGELISTENER_H
+
+/*
+ *
+ * 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 "qpid/client/ClientImportExport.h"
+
+namespace qpid {
+namespace messaging {
+
+class Message;
+
+/**
+ * To use a push style interface for receiving messages, applications
+ * provide implementations of this interface and pass an implementing
+ * instance to MessageSource::subscribe().
+ *
+ * Messages arriving for that subscription will then be passed to the
+ * implementation via the received() method.
+ */
+class MessageListener
+{
+ public:
+ QPID_CLIENT_EXTERN virtual ~MessageListener() {}
+ virtual void received(Message&) = 0;
+ private:
+};
+
+}} // namespace qpid::messaging
+
+#endif /*!QPID_MESSAGING_MESSAGELISTENER_H*/
diff --git a/qpid/cpp/include/qpid/messaging/Receiver.h b/qpid/cpp/include/qpid/messaging/Receiver.h
new file mode 100644
index 0000000000..e51e1093d1
--- /dev/null
+++ b/qpid/cpp/include/qpid/messaging/Receiver.h
@@ -0,0 +1,115 @@
+#ifndef QPID_MESSAGING_RECEIVER_H
+#define QPID_MESSAGING_RECEIVER_H
+
+/*
+ *
+ * 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 "qpid/Exception.h"
+#include "qpid/client/ClientImportExport.h"
+#include "qpid/client/Handle.h"
+#include "qpid/sys/Time.h"
+
+namespace qpid {
+namespace client {
+
+template <class> class PrivateImplRef;
+
+}
+
+namespace messaging {
+
+class Message;
+class MessageListener;
+class ReceiverImpl;
+
+/**
+ * A pull style interface for message retrieval.
+ */
+class Receiver : public qpid::client::Handle<ReceiverImpl>
+{
+ public:
+ struct NoMessageAvailable : qpid::Exception {};
+
+ QPID_CLIENT_EXTERN Receiver(ReceiverImpl* impl = 0);
+ QPID_CLIENT_EXTERN Receiver(const Receiver&);
+ QPID_CLIENT_EXTERN ~Receiver();
+ QPID_CLIENT_EXTERN Receiver& operator=(const Receiver&);
+ /**
+ * Retrieves a message from this receivers local queue, or waits
+ * for upto the specified timeout for a message to become
+ * available. Returns false if there is no message to give after
+ * waiting for the specified timeout.
+ */
+ QPID_CLIENT_EXTERN bool get(Message& message, qpid::sys::Duration timeout=qpid::sys::TIME_INFINITE);
+ /**
+ * Retrieves a message from this receivers local queue, or waits
+ * for upto the specified timeout for a message to become
+ * available. Throws NoMessageAvailable if there is no
+ * message to give after waiting for the specified timeout.
+ */
+ QPID_CLIENT_EXTERN Message get(qpid::sys::Duration timeout=qpid::sys::TIME_INFINITE);
+ /**
+ * Retrieves a message for this receivers subscription or waits
+ * for upto the specified timeout for one to become
+ * available. Unlike get() this method will check with the server
+ * that there is no message for the subscription this receiver is
+ * serving before returning false.
+ */
+ QPID_CLIENT_EXTERN bool fetch(Message& message, qpid::sys::Duration timeout=qpid::sys::TIME_INFINITE);
+ /**
+ * Retrieves a message for this receivers subscription or waits
+ * for upto the specified timeout for one to become
+ * available. Unlike get() this method will check with the server
+ * that there is no message for the subscription this receiver is
+ * serving before throwing an exception.
+ */
+ QPID_CLIENT_EXTERN Message fetch(qpid::sys::Duration timeout=qpid::sys::TIME_INFINITE);
+
+ /**
+ * Enables the message flow for this receiver
+ */
+ QPID_CLIENT_EXTERN void start();
+ /**
+ * Stops the message flow for this receiver (without actually
+ * cancelling the subscription).
+ */
+ QPID_CLIENT_EXTERN void stop();
+ /**
+ * Sets the capacity for the receiver. The capacity determines how
+ * many incoming messages can be held in the receiver before being
+ * requested by a client via fetch() (or pushed to a listener).
+ */
+ QPID_CLIENT_EXTERN void setCapacity(uint32_t);
+
+ /**
+ * Cancels this receiver
+ */
+ QPID_CLIENT_EXTERN void cancel();
+
+ /**
+ * Set a message listener for receiving messages asynchronously.
+ */
+ QPID_CLIENT_EXTERN void setListener(MessageListener* listener);
+ private:
+ friend class qpid::client::PrivateImplRef<Receiver>;
+};
+}} // namespace qpid::messaging
+
+#endif /*!QPID_MESSAGING_RECEIVER_H*/
diff --git a/qpid/cpp/include/qpid/messaging/Sender.h b/qpid/cpp/include/qpid/messaging/Sender.h
new file mode 100644
index 0000000000..45ec659ecf
--- /dev/null
+++ b/qpid/cpp/include/qpid/messaging/Sender.h
@@ -0,0 +1,57 @@
+#ifndef QPID_MESSAGING_SENDER_H
+#define QPID_MESSAGING_SENDER_H
+
+/*
+ *
+ * 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 "qpid/client/ClientImportExport.h"
+#include "qpid/client/Handle.h"
+
+namespace qpid {
+namespace client {
+
+template <class> class PrivateImplRef;
+
+}
+
+namespace messaging {
+
+class Message;
+class SenderImpl;
+
+/**
+ * Interface through which messages are sent.
+ */
+class Sender : public qpid::client::Handle<SenderImpl>
+{
+ public:
+ QPID_CLIENT_EXTERN Sender(SenderImpl* impl = 0);
+ QPID_CLIENT_EXTERN Sender(const Sender&);
+ QPID_CLIENT_EXTERN ~Sender();
+ QPID_CLIENT_EXTERN Sender& operator=(const Sender&);
+
+ QPID_CLIENT_EXTERN void send(const Message& message);
+ QPID_CLIENT_EXTERN void cancel();
+ private:
+ friend class qpid::client::PrivateImplRef<Sender>;
+};
+}} // namespace qpid::messaging
+
+#endif /*!QPID_MESSAGING_SENDER_H*/
diff --git a/qpid/cpp/include/qpid/messaging/Session.h b/qpid/cpp/include/qpid/messaging/Session.h
new file mode 100644
index 0000000000..1d88882db6
--- /dev/null
+++ b/qpid/cpp/include/qpid/messaging/Session.h
@@ -0,0 +1,99 @@
+#ifndef QPID_MESSAGING_SESSION_H
+#define QPID_MESSAGING_SESSION_H
+
+/*
+ *
+ * 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 "qpid/client/ClientImportExport.h"
+#include "qpid/client/Handle.h"
+#include "qpid/sys/Time.h"
+#include "Variant.h"
+
+namespace qpid {
+namespace client {
+
+template <class> class PrivateImplRef;
+
+}
+
+namespace messaging {
+
+struct Address;
+struct Filter;
+class Message;
+class MessageListener;
+class Sender;
+class Receiver;
+class SessionImpl;
+class Subscription;
+
+/**
+ * A session represents a distinct 'conversation' which can involve
+ * sending and receiving messages from different sources and sinks.
+ */
+class Session : public qpid::client::Handle<SessionImpl>
+{
+ public:
+ QPID_CLIENT_EXTERN Session(SessionImpl* impl = 0);
+ QPID_CLIENT_EXTERN Session(const Session&);
+ QPID_CLIENT_EXTERN ~Session();
+ QPID_CLIENT_EXTERN Session& operator=(const Session&);
+
+ QPID_CLIENT_EXTERN void close();
+
+ QPID_CLIENT_EXTERN void commit();
+ QPID_CLIENT_EXTERN void rollback();
+
+ /**
+ * Acknowledges all outstanding messages that have been received
+ * by the application on this session.
+ */
+ QPID_CLIENT_EXTERN void acknowledge();
+ /**
+ * Rejects the specified message. This will prevent the message
+ * being redelivered.
+ */
+ QPID_CLIENT_EXTERN void reject(Message&);
+
+ QPID_CLIENT_EXTERN void sync();
+ QPID_CLIENT_EXTERN void flush();
+
+ QPID_CLIENT_EXTERN bool fetch(Message& message, qpid::sys::Duration timeout=qpid::sys::TIME_INFINITE);
+ QPID_CLIENT_EXTERN Message fetch(qpid::sys::Duration timeout=qpid::sys::TIME_INFINITE);
+ QPID_CLIENT_EXTERN bool dispatch(qpid::sys::Duration timeout=qpid::sys::TIME_INFINITE);
+
+ QPID_CLIENT_EXTERN Sender createSender(const Address& address, const VariantMap& options = VariantMap());
+ QPID_CLIENT_EXTERN Sender createSender(const std::string& address, const VariantMap& options = VariantMap());
+
+ QPID_CLIENT_EXTERN Receiver createReceiver(const Address& address, const VariantMap& options = VariantMap());
+ QPID_CLIENT_EXTERN Receiver createReceiver(const Address& address, const Filter& filter, const VariantMap& options = VariantMap());
+ QPID_CLIENT_EXTERN Receiver createReceiver(const std::string& address, const VariantMap& options = VariantMap());
+ QPID_CLIENT_EXTERN Receiver createReceiver(const std::string& address, const Filter& filter, const VariantMap& options = VariantMap());
+
+ QPID_CLIENT_EXTERN Address createTempQueue(const std::string& baseName = std::string());
+
+ QPID_CLIENT_EXTERN void* getLastConfirmedSent();
+ QPID_CLIENT_EXTERN void* getLastConfirmedAcknowledged();
+ private:
+ friend class qpid::client::PrivateImplRef<Session>;
+};
+}} // namespace qpid::messaging
+
+#endif /*!QPID_MESSAGING_SESSION_H*/
diff --git a/qpid/cpp/include/qpid/messaging/Variant.h b/qpid/cpp/include/qpid/messaging/Variant.h
new file mode 100644
index 0000000000..1e51914794
--- /dev/null
+++ b/qpid/cpp/include/qpid/messaging/Variant.h
@@ -0,0 +1,167 @@
+#ifndef QPID_MESSAGING_VARIANT_H
+#define QPID_MESSAGING_VARIANT_H
+
+/*
+ *
+ * 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 <list>
+#include <map>
+#include <ostream>
+#include <string>
+#include "qpid/Exception.h"
+#include "qpid/sys/IntegerTypes.h"
+#include "qpid/client/ClientImportExport.h"
+
+namespace qpid {
+namespace client {
+}
+
+namespace messaging {
+
+/**
+ * Thrown when an illegal conversion of a variant is attempted.
+ */
+struct InvalidConversion : public qpid::Exception
+{
+ InvalidConversion(const std::string& msg);
+};
+
+enum VariantType {
+ VAR_VOID = 0,
+ VAR_BOOL,
+ VAR_UINT8,
+ VAR_UINT16,
+ VAR_UINT32,
+ VAR_UINT64,
+ VAR_INT8,
+ VAR_INT16,
+ VAR_INT32,
+ VAR_INT64,
+ VAR_FLOAT,
+ VAR_DOUBLE,
+ VAR_STRING,
+ VAR_MAP,
+ VAR_LIST
+};
+
+class VariantImpl;
+
+/**
+ * Represents a value of variable type.
+ */
+class Variant
+{
+ public:
+ typedef std::map<std::string, Variant> Map;
+ typedef std::list<Variant> List;
+
+ QPID_CLIENT_EXTERN Variant();
+ QPID_CLIENT_EXTERN Variant(bool);
+ QPID_CLIENT_EXTERN Variant(uint8_t);
+ QPID_CLIENT_EXTERN Variant(uint16_t);
+ QPID_CLIENT_EXTERN Variant(uint32_t);
+ QPID_CLIENT_EXTERN Variant(uint64_t);
+ QPID_CLIENT_EXTERN Variant(int8_t);
+ QPID_CLIENT_EXTERN Variant(int16_t);
+ QPID_CLIENT_EXTERN Variant(int32_t);
+ QPID_CLIENT_EXTERN Variant(int64_t);
+ QPID_CLIENT_EXTERN Variant(float);
+ QPID_CLIENT_EXTERN Variant(double);
+ QPID_CLIENT_EXTERN Variant(const std::string&);
+ QPID_CLIENT_EXTERN Variant(const char*);
+ QPID_CLIENT_EXTERN Variant(const Map&);
+ QPID_CLIENT_EXTERN Variant(const List&);
+ QPID_CLIENT_EXTERN Variant(const Variant&);
+
+ QPID_CLIENT_EXTERN ~Variant();
+
+ QPID_CLIENT_EXTERN VariantType getType() const;
+
+ QPID_CLIENT_EXTERN Variant& operator=(bool);
+ QPID_CLIENT_EXTERN Variant& operator=(uint8_t);
+ QPID_CLIENT_EXTERN Variant& operator=(uint16_t);
+ QPID_CLIENT_EXTERN Variant& operator=(uint32_t);
+ QPID_CLIENT_EXTERN Variant& operator=(uint64_t);
+ QPID_CLIENT_EXTERN Variant& operator=(int8_t);
+ QPID_CLIENT_EXTERN Variant& operator=(int16_t);
+ QPID_CLIENT_EXTERN Variant& operator=(int32_t);
+ QPID_CLIENT_EXTERN Variant& operator=(int64_t);
+ QPID_CLIENT_EXTERN Variant& operator=(float);
+ QPID_CLIENT_EXTERN Variant& operator=(double);
+ QPID_CLIENT_EXTERN Variant& operator=(const std::string&);
+ QPID_CLIENT_EXTERN Variant& operator=(const char*);
+ QPID_CLIENT_EXTERN Variant& operator=(const Map&);
+ QPID_CLIENT_EXTERN Variant& operator=(const List&);
+ QPID_CLIENT_EXTERN Variant& operator=(const Variant&);
+
+ QPID_CLIENT_EXTERN bool asBool() const;
+ QPID_CLIENT_EXTERN uint8_t asUint8() const;
+ QPID_CLIENT_EXTERN uint16_t asUint16() const;
+ QPID_CLIENT_EXTERN uint32_t asUint32() const;
+ QPID_CLIENT_EXTERN uint64_t asUint64() const;
+ QPID_CLIENT_EXTERN int8_t asInt8() const;
+ QPID_CLIENT_EXTERN int16_t asInt16() const;
+ QPID_CLIENT_EXTERN int32_t asInt32() const;
+ QPID_CLIENT_EXTERN int64_t asInt64() const;
+ QPID_CLIENT_EXTERN float asFloat() const;
+ QPID_CLIENT_EXTERN double asDouble() const;
+ QPID_CLIENT_EXTERN std::string asString() const;
+
+ QPID_CLIENT_EXTERN operator bool() const;
+ QPID_CLIENT_EXTERN operator uint8_t() const;
+ QPID_CLIENT_EXTERN operator uint16_t() const;
+ QPID_CLIENT_EXTERN operator uint32_t() const;
+ QPID_CLIENT_EXTERN operator uint64_t() const;
+ QPID_CLIENT_EXTERN operator int8_t() const;
+ QPID_CLIENT_EXTERN operator int16_t() const;
+ QPID_CLIENT_EXTERN operator int32_t() const;
+ QPID_CLIENT_EXTERN operator int64_t() const;
+ QPID_CLIENT_EXTERN operator float() const;
+ QPID_CLIENT_EXTERN operator double() const;
+ QPID_CLIENT_EXTERN operator const char*() const;
+
+ QPID_CLIENT_EXTERN const Map& asMap() const;
+ QPID_CLIENT_EXTERN Map& asMap();
+ QPID_CLIENT_EXTERN const List& asList() const;
+ QPID_CLIENT_EXTERN List& asList();
+ /**
+ * Unlike asString(), getString() will not do any conversions and
+ * will throw InvalidConversion if the type is not STRING.
+ */
+ QPID_CLIENT_EXTERN const std::string& getString() const;
+ QPID_CLIENT_EXTERN std::string& getString();
+
+ QPID_CLIENT_EXTERN void setEncoding(const std::string&);
+ QPID_CLIENT_EXTERN const std::string& getEncoding() const;
+
+ QPID_CLIENT_EXTERN void reset();
+ private:
+ VariantImpl* impl;
+};
+
+QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const Variant& value);
+QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const Variant::Map& map);
+QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const Variant::List& list);
+
+typedef Variant::Map VariantMap;
+
+}} // namespace qpid::messaging
+
+#endif /*!QPID_MESSAGING_VARIANT_H*/
diff --git a/qpid/cpp/include/qpid/sys/uuid.h b/qpid/cpp/include/qpid/sys/uuid.h
deleted file mode 100644
index 804ab34463..0000000000
--- a/qpid/cpp/include/qpid/sys/uuid.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _sys_uuid_h
-#define _sys_uuid_h
-
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed 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.
- *
- */
-
-#ifdef _WIN32
-# include "qpid/sys/windows/uuid.h"
-#else
-# include <uuid/uuid.h>
-#endif /* _WIN32 */
-
-#endif /* _sys_uuid_h */
diff --git a/qpid/cpp/include/qpid/sys/windows/Condition.h b/qpid/cpp/include/qpid/sys/windows/Condition.h
index c31f7b4823..979fae9b0a 100755
--- a/qpid/cpp/include/qpid/sys/windows/Condition.h
+++ b/qpid/cpp/include/qpid/sys/windows/Condition.h
@@ -30,7 +30,6 @@
#include <boost/thread/condition.hpp>
#include <boost/thread/thread_time.hpp>
#include <windows.h>
-#undef STATUS_INVALID_PARAMETER // Hack for windows.h namespace pollution
namespace qpid {
namespace sys {
diff --git a/qpid/cpp/include/qpid/sys/windows/Mutex.h b/qpid/cpp/include/qpid/sys/windows/Mutex.h
index 12768640d5..5dcc69e836 100755
--- a/qpid/cpp/include/qpid/sys/windows/Mutex.h
+++ b/qpid/cpp/include/qpid/sys/windows/Mutex.h
@@ -31,7 +31,6 @@
#include <boost/thread/shared_mutex.hpp>
#include <boost/thread/thread_time.hpp>
#include <boost/thread/tss.hpp>
-#undef STATUS_INVALID_PARAMETER // Hack for windows.h namespace pollution
namespace qpid {
namespace sys {