You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by sh...@apache.org on 2008/10/08 18:13:18 UTC
svn commit: r702917 - in /incubator/qpid/trunk/qpid/cpp/src: Makefile.am
qpid/framing/Uuid.h qpid/sys/uuid.h qpid/sys/windows/uuid.cpp
qpid/sys/windows/uuid.h
Author: shuston
Date: Wed Oct 8 09:13:18 2008
New Revision: 702917
URL: http://svn.apache.org/viewvc?rev=702917&view=rev
Log:
Add uuid wrapper for Windows; resolves QPID-1328
Added:
incubator/qpid/trunk/qpid/cpp/src/qpid/sys/uuid.h
incubator/qpid/trunk/qpid/cpp/src/qpid/sys/windows/uuid.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/sys/windows/uuid.h
Modified:
incubator/qpid/trunk/qpid/cpp/src/Makefile.am
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Uuid.h
Modified: incubator/qpid/trunk/qpid/cpp/src/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/Makefile.am?rev=702917&r1=702916&r2=702917&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/Makefile.am (original)
+++ incubator/qpid/trunk/qpid/cpp/src/Makefile.am Wed Oct 8 09:13:18 2008
@@ -622,7 +622,8 @@
qpid/sys/Waitable.h \
qpid/sys/Thread.h \
qpid/sys/Time.h \
- qpid/sys/TimeoutHandler.h
+ qpid/sys/TimeoutHandler.h \
+ qpid/sys/uuid.h
if HAVE_XML
nobase_include_HEADERS += qpid/broker/XmlExchange.h
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Uuid.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Uuid.h?rev=702917&r1=702916&r2=702917&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Uuid.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Uuid.h Wed Oct 8 09:13:18 2008
@@ -19,13 +19,13 @@
*
*/
+#include "qpid/sys/uuid.h"
+
#include <boost/array.hpp>
#include <ostream>
#include <istream>
-#include <uuid/uuid.h>
-
namespace qpid {
namespace framing {
Added: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/uuid.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/sys/uuid.h?rev=702917&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/sys/uuid.h (added)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/sys/uuid.h Wed Oct 8 09:13:18 2008
@@ -0,0 +1,28 @@
+#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 */
Added: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/windows/uuid.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/sys/windows/uuid.cpp?rev=702917&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/sys/windows/uuid.cpp (added)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/sys/windows/uuid.cpp Wed Oct 8 09:13:18 2008
@@ -0,0 +1,54 @@
+/*
+ *
+ * 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 "uuid.h"
+
+#include <string.h>
+
+void uuid_clear (uuid_t uu) {
+ UuidCreateNil (reinterpret_cast<UUID*>(uu));
+}
+
+void uuid_copy (uuid_t dst, const uuid_t src) {
+ memcpy (dst, src, qpid::sys::UuidSize);
+}
+
+void uuid_generate (uuid_t out) {
+ UuidCreate (reinterpret_cast<UUID*>(out));
+}
+
+int uuid_is_null (const uuid_t uu) {
+ RPC_STATUS unused;
+ return UuidIsNil ((UUID*)uu, &unused);
+}
+
+int uuid_parse (const char *in, uuid_t uu) {
+ return UuidFromString ((unsigned char*)in, (UUID*)uu) == RPC_S_OK;
+}
+
+void uuid_unparse (const uuid_t uu, char *out) {
+ unsigned char *formatted;
+ if (UuidToString((UUID*)uu, &formatted) == RPC_S_OK) {
+ strncpy_s (out, 36+1, (char*)formatted, _TRUNCATE);
+ RpcStringFree(&formatted);
+ }
+}
+
Added: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/windows/uuid.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/sys/windows/uuid.h?rev=702917&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/sys/windows/uuid.h (added)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/sys/windows/uuid.h Wed Oct 8 09:13:18 2008
@@ -0,0 +1,41 @@
+#ifndef _sys_windows_uuid_h
+#define _sys_windows_uuid_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 <Rpc.h>
+
+#ifdef uuid_t /* Done in rpcdce.h */
+# undef uuid_t
+#endif
+#include <qpid/sys/IntegerTypes.h>
+namespace qpid { namespace sys { const size_t UuidSize = 16; }}
+typedef uint8_t uuid_t[qpid::sys::UuidSize];
+
+void uuid_clear (uuid_t uu);
+void uuid_copy (uuid_t dst, const uuid_t src);
+void uuid_generate (uuid_t out);
+int uuid_is_null (const uuid_t uu); // Returns 1 if null, else 0
+int uuid_parse (const char *in, uuid_t uu); // Returns 0 on success, else -1
+void uuid_unparse (const uuid_t uu, char *out);
+
+#endif /*!_sys_windows_uuid_h*/