[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r32491 - in gnunet-dbus/src: lib/common lib/include lib/uti
From: |
gnunet |
Subject: |
[GNUnet-SVN] r32491 - in gnunet-dbus/src: lib/common lib/include lib/util services |
Date: |
Fri, 28 Feb 2014 06:26:46 +0100 |
Author: canndrew
Date: 2014-02-28 06:26:46 +0100 (Fri, 28 Feb 2014)
New Revision: 32491
Added:
gnunet-dbus/src/lib/include/gnunet_crypto_dbus_lib_push.h
Modified:
gnunet-dbus/src/lib/common/gnunet_dbus_lib_arg.c
gnunet-dbus/src/lib/common/gnunet_dbus_lib_client.c
gnunet-dbus/src/lib/common/gnunet_dbus_lib_interface.c
gnunet-dbus/src/lib/common/gnunet_dbus_lib_method.c
gnunet-dbus/src/lib/common/gnunet_dbus_lib_method_context.c
gnunet-dbus/src/lib/common/gnunet_dbus_lib_object.c
gnunet-dbus/src/lib/common/gnunet_dbus_lib_pop.c
gnunet-dbus/src/lib/common/gnunet_dbus_lib_push.c
gnunet-dbus/src/lib/common/gnunet_dbus_lib_service.c
gnunet-dbus/src/lib/include/gnunet_crypto_dbus_lib.h
gnunet-dbus/src/lib/include/gnunet_crypto_dbus_lib_pop.h
gnunet-dbus/src/lib/include/gnunet_crypto_dbus_lib_signature.h
gnunet-dbus/src/lib/include/gnunet_dbus_lib_client.h
gnunet-dbus/src/lib/include/gnunet_dbus_lib_pop.h
gnunet-dbus/src/lib/include/gnunet_dbus_lib_push.h
gnunet-dbus/src/lib/include/gnunet_dbus_lib_service.h
gnunet-dbus/src/lib/include/gnunet_dbus_lib_signature.h
gnunet-dbus/src/lib/util/gnunet_crypto_dbus_lib_pop.c
gnunet-dbus/src/lib/util/gnunet_crypto_dbus_lib_push.c
gnunet-dbus/src/services/Makefile.am
gnunet-dbus/src/services/gnunet-service-dht-dbus.c
gnunet-dbus/src/services/gnunet-service-gns-dbus.c
Log:
DHT service can put and get
Modified: gnunet-dbus/src/lib/common/gnunet_dbus_lib_arg.c
===================================================================
--- gnunet-dbus/src/lib/common/gnunet_dbus_lib_arg.c 2014-02-27 21:34:13 UTC
(rev 32490)
+++ gnunet-dbus/src/lib/common/gnunet_dbus_lib_arg.c 2014-02-28 05:26:46 UTC
(rev 32491)
@@ -56,7 +56,7 @@
LOG (GNUNET_ERROR_TYPE_ERROR, "Tried to unreference arg with ref count
0\n");
GNUNET_abort ();
};
- if (--arg->ref_count == 0)
+ if (0 == --(arg->ref_count))
GNUNET_DBUS_arg_destroy (arg);
};
Modified: gnunet-dbus/src/lib/common/gnunet_dbus_lib_client.c
===================================================================
--- gnunet-dbus/src/lib/common/gnunet_dbus_lib_client.c 2014-02-27 21:34:13 UTC
(rev 32490)
+++ gnunet-dbus/src/lib/common/gnunet_dbus_lib_client.c 2014-02-28 05:26:46 UTC
(rev 32491)
@@ -75,3 +75,43 @@
return client->prefers_pretty_encodings;
};
+DBusMessage *
+GNUNET_DBUS_client_create_method_call (
+ struct GNUNET_DBUS_Client *client,
+ const char *object_path,
+ const char *interface,
+ const char *method,
+ bool pretty,
+ void (*return_callback)(DBusMessage *message))
+{
+ DBusMessage *ret = dbus_message_new_method_call (
+ client->unique_name,
+ object_path,
+ interface,
+ method);
+ GNUNET_DBUS_message_set_pretty (ret, pretty);
+ if (return_callback)
+ {
+ LOG (GNUNET_ERROR_TYPE_ERROR, "Method calls on external objects not
implemented yet.\n");
+ GNUNET_abort ();
+ };
+ return ret;
+}
+
+DBusMessage *
+GNUNET_DBUS_client_create_unicast_signal (
+ struct GNUNET_DBUS_Client *client,
+ const char *object_path,
+ const char *interface,
+ const char *signal,
+ bool pretty)
+{
+ DBusMessage *ret = dbus_message_new_signal (
+ object_path,
+ interface,
+ signal);
+ dbus_message_set_destination (ret, client->unique_name);
+ GNUNET_DBUS_message_set_pretty (ret, pretty);
+ return ret;
+}
+
Modified: gnunet-dbus/src/lib/common/gnunet_dbus_lib_interface.c
===================================================================
--- gnunet-dbus/src/lib/common/gnunet_dbus_lib_interface.c 2014-02-27
21:34:13 UTC (rev 32490)
+++ gnunet-dbus/src/lib/common/gnunet_dbus_lib_interface.c 2014-02-28
05:26:46 UTC (rev 32491)
@@ -76,7 +76,7 @@
LOG (GNUNET_ERROR_TYPE_ERROR, "Tried to unreference interface with ref
count 0\n");
GNUNET_abort ();
};
- if (--interface->ref_count == 0)
+ if (0 == --(interface->ref_count))
GNUNET_DBUS_interface_destroy (interface);
};
@@ -183,7 +183,6 @@
dbus_message_iter_init_append (reply, &reply_iter);
GNUNET_DBUS_push_string (reply, &reply_iter, (const char *const *)&data);
GNUNET_DBUS_method_context_send_reply (mc, reply);
- GNUNET_DBUS_method_context_unref (mc);
GNUNET_free (data);
};
Modified: gnunet-dbus/src/lib/common/gnunet_dbus_lib_method.c
===================================================================
--- gnunet-dbus/src/lib/common/gnunet_dbus_lib_method.c 2014-02-27 21:34:13 UTC
(rev 32490)
+++ gnunet-dbus/src/lib/common/gnunet_dbus_lib_method.c 2014-02-28 05:26:46 UTC
(rev 32491)
@@ -66,7 +66,7 @@
LOG (GNUNET_ERROR_TYPE_ERROR, "Tried to unreference method with ref count
0\n");
GNUNET_abort ();
};
- if (--method->ref_count == 0)
+ if (0 == --(method->ref_count))
GNUNET_DBUS_method_destroy (method);
};
Modified: gnunet-dbus/src/lib/common/gnunet_dbus_lib_method_context.c
===================================================================
--- gnunet-dbus/src/lib/common/gnunet_dbus_lib_method_context.c 2014-02-27
21:34:13 UTC (rev 32490)
+++ gnunet-dbus/src/lib/common/gnunet_dbus_lib_method_context.c 2014-02-28
05:26:46 UTC (rev 32491)
@@ -65,7 +65,7 @@
LOG (GNUNET_ERROR_TYPE_ERROR, "Tried to unreference method context with
ref count 0\n");
GNUNET_abort ();
};
- if (0 == --mc->ref_count)
+ if (0 == --(mc->ref_count))
GNUNET_DBUS_method_context_destroy (mc);
};
Modified: gnunet-dbus/src/lib/common/gnunet_dbus_lib_object.c
===================================================================
--- gnunet-dbus/src/lib/common/gnunet_dbus_lib_object.c 2014-02-27 21:34:13 UTC
(rev 32490)
+++ gnunet-dbus/src/lib/common/gnunet_dbus_lib_object.c 2014-02-28 05:26:46 UTC
(rev 32491)
@@ -72,7 +72,7 @@
LOG (GNUNET_ERROR_TYPE_ERROR, "Tried to unreference object with ref count
0\n");
GNUNET_abort ();
};
- if (--object->ref_count == 0)
+ if (0 == --(object->ref_count))
GNUNET_DBUS_object_destroy (object);
};
Modified: gnunet-dbus/src/lib/common/gnunet_dbus_lib_pop.c
===================================================================
--- gnunet-dbus/src/lib/common/gnunet_dbus_lib_pop.c 2014-02-27 21:34:13 UTC
(rev 32490)
+++ gnunet-dbus/src/lib/common/gnunet_dbus_lib_pop.c 2014-02-28 05:26:46 UTC
(rev 32491)
@@ -5,6 +5,7 @@
#include <gnunet/gnunet_strings_lib.h>
#include "gnunet_dbus_lib.h"
+#include "gnunet_crypto_dbus_lib.h"
#define LOG(kind, ...) GNUNET_log_from (kind, "dbus-pop", __VA_ARGS__)
@@ -703,4 +704,18 @@
};
}
+DBusMessage *
+GNUNET_DBUS_pop_peer_identity (
+ DBusMessage *message,
+ DBusMessageIter *iter,
+ const char *arg_name,
+ struct GNUNET_PeerIdentity *value)
+{
+ DBusMessageIter iter_sub;
+ DBusMessage *ret = GNUNET_DBUS_pop_enter_struct (message, iter, &iter_sub,
arg_name);
+ if (ret)
+ return ret;
+ return GNUNET_CRYPTO_DBUS_pop_eddsa_public_key (message, &iter_sub,
"public_key", &value->public_key);
+}
+
Modified: gnunet-dbus/src/lib/common/gnunet_dbus_lib_push.c
===================================================================
--- gnunet-dbus/src/lib/common/gnunet_dbus_lib_push.c 2014-02-27 21:34:13 UTC
(rev 32490)
+++ gnunet-dbus/src/lib/common/gnunet_dbus_lib_push.c 2014-02-28 05:26:46 UTC
(rev 32491)
@@ -7,6 +7,7 @@
#include <gnunet/gnunet_strings_lib.h>
#include "gnunet_dbus_lib.h"
+#include "gnunet_crypto_dbus_lib.h"
#define LOG(kind, ...) GNUNET_log_from (kind, "dbus-push", __VA_ARGS__)
@@ -492,3 +493,16 @@
GNUNET_DBUS_push_data (message, iter, value->bits, sizeof (value->bits));
}
+void
+GNUNET_DBUS_push_peer_identity (
+ DBusMessage *message,
+ DBusMessageIter *iter,
+ const struct GNUNET_PeerIdentity *value)
+{
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Pushing GNUNET_PeerIdentity\n");
+ DBusMessageIter iter_sub;
+ GNUNET_DBUS_push_open_struct (message, iter, &iter_sub);
+ GNUNET_CRYPTO_DBUS_push_eddsa_public_key (message, &iter_sub,
&value->public_key);
+ GNUNET_DBUS_push_close_struct (message, iter, &iter_sub);
+}
+
Modified: gnunet-dbus/src/lib/common/gnunet_dbus_lib_service.c
===================================================================
--- gnunet-dbus/src/lib/common/gnunet_dbus_lib_service.c 2014-02-27
21:34:13 UTC (rev 32490)
+++ gnunet-dbus/src/lib/common/gnunet_dbus_lib_service.c 2014-02-28
05:26:46 UTC (rev 32491)
@@ -531,6 +531,33 @@
};
void
+GNUNET_DBUS_service_remove_object (
+ struct GNUNET_DBUS_Service *service,
+ struct GNUNET_DBUS_Object *object)
+{
+ struct GNUNET_DBUS_ObjectIterator *obj_it;
+ for (obj_it = service->objects_front; obj_it; obj_it = obj_it->next)
+ {
+ if (obj_it->object == object)
+ break;
+ };
+
+ if (! obj_it)
+ {
+ LOG (GNUNET_ERROR_TYPE_ERROR, "Tried to remove object that has not been
added.\n");
+ GNUNET_abort ();
+ };
+
+ GNUNET_CONTAINER_DLL_remove (
+ service->objects_front,
+ service->objects_back,
+ obj_it);
+
+ GNUNET_free (obj_it);
+ GNUNET_DBUS_object_unref (object);
+}
+
+void
GNUNET_DBUS_service_send (
struct GNUNET_DBUS_Service *service,
DBusMessage *dbus_message)
Modified: gnunet-dbus/src/lib/include/gnunet_crypto_dbus_lib.h
===================================================================
--- gnunet-dbus/src/lib/include/gnunet_crypto_dbus_lib.h 2014-02-27
21:34:13 UTC (rev 32490)
+++ gnunet-dbus/src/lib/include/gnunet_crypto_dbus_lib.h 2014-02-28
05:26:46 UTC (rev 32491)
@@ -3,6 +3,7 @@
#include <gnunet_dbus_lib.h>
+#include "gnunet_crypto_dbus_lib_push.h"
#include "gnunet_crypto_dbus_lib_pop.h"
#include "gnunet_crypto_dbus_lib_signature.h"
Modified: gnunet-dbus/src/lib/include/gnunet_crypto_dbus_lib_pop.h
===================================================================
--- gnunet-dbus/src/lib/include/gnunet_crypto_dbus_lib_pop.h 2014-02-27
21:34:13 UTC (rev 32490)
+++ gnunet-dbus/src/lib/include/gnunet_crypto_dbus_lib_pop.h 2014-02-28
05:26:46 UTC (rev 32491)
@@ -1,6 +1,10 @@
#ifndef GNUNET_CRYPTO_DBUS_LIB_POP_H
#define GNUNET_CRYPTO_DBUS_LIB_POP_H
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_common.h>
+#include <gnunet/gnunet_crypto_lib.h>
+
DBusMessage *
GNUNET_CRYPTO_DBUS_pop_ecdsa_public_key (
DBusMessage *message,
@@ -8,5 +12,12 @@
const char *arg_name,
struct GNUNET_CRYPTO_EcdsaPublicKey *value);
+DBusMessage *
+GNUNET_CRYPTO_DBUS_pop_eddsa_public_key (
+ DBusMessage *message,
+ DBusMessageIter *iter,
+ const char *arg_name,
+ struct GNUNET_CRYPTO_EddsaPublicKey *value);
+
#endif
Added: gnunet-dbus/src/lib/include/gnunet_crypto_dbus_lib_push.h
===================================================================
--- gnunet-dbus/src/lib/include/gnunet_crypto_dbus_lib_push.h
(rev 0)
+++ gnunet-dbus/src/lib/include/gnunet_crypto_dbus_lib_push.h 2014-02-28
05:26:46 UTC (rev 32491)
@@ -0,0 +1,21 @@
+#ifndef GNUNET_CRYPTO_DBUS_LIB_PUSH_H
+#define GNUNET_CRYPTO_DBUS_LIB_PUSH_H
+
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_common.h>
+#include <gnunet/gnunet_crypto_lib.h>
+
+void
+GNUNET_CRYPTO_DBUS_push_ecdsa_public_key (
+ DBusMessage *message,
+ DBusMessageIter *iter,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *value);
+
+void
+GNUNET_CRYPTO_DBUS_push_eddsa_public_key (
+ DBusMessage *message,
+ DBusMessageIter *iter,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *value);
+
+#endif
+
Modified: gnunet-dbus/src/lib/include/gnunet_crypto_dbus_lib_signature.h
===================================================================
--- gnunet-dbus/src/lib/include/gnunet_crypto_dbus_lib_signature.h
2014-02-27 21:34:13 UTC (rev 32490)
+++ gnunet-dbus/src/lib/include/gnunet_crypto_dbus_lib_signature.h
2014-02-28 05:26:46 UTC (rev 32491)
@@ -16,6 +16,7 @@
)
#define GNUNET_CRYPTO_DBUS_SIGNATURE_ECDSA_PUBLIC_KEY
GNUNET_DBUS_SIGNATURE_VARIANT
+#define GNUNET_CRYPTO_DBUS_SIGNATURE_EDDSA_PUBLIC_KEY
GNUNET_DBUS_SIGNATURE_VARIANT
#endif
Modified: gnunet-dbus/src/lib/include/gnunet_dbus_lib_client.h
===================================================================
--- gnunet-dbus/src/lib/include/gnunet_dbus_lib_client.h 2014-02-27
21:34:13 UTC (rev 32490)
+++ gnunet-dbus/src/lib/include/gnunet_dbus_lib_client.h 2014-02-28
05:26:46 UTC (rev 32491)
@@ -43,5 +43,22 @@
GNUNET_DBUS_client_get_prefers_pretty_encodings (
const struct GNUNET_DBUS_Client *client);
+DBusMessage *
+GNUNET_DBUS_client_create_method_call (
+ struct GNUNET_DBUS_Client *client,
+ const char *object_path,
+ const char *interface,
+ const char *method,
+ bool pretty,
+ void (*return_callback)(DBusMessage *message));
+
+DBusMessage *
+GNUNET_DBUS_client_create_unicast_signal (
+ struct GNUNET_DBUS_Client *client,
+ const char *object_path,
+ const char *interface,
+ const char *signal,
+ bool pretty);
+
#endif
Modified: gnunet-dbus/src/lib/include/gnunet_dbus_lib_pop.h
===================================================================
--- gnunet-dbus/src/lib/include/gnunet_dbus_lib_pop.h 2014-02-27 21:34:13 UTC
(rev 32490)
+++ gnunet-dbus/src/lib/include/gnunet_dbus_lib_pop.h 2014-02-28 05:26:46 UTC
(rev 32491)
@@ -213,6 +213,13 @@
DBusMessageIter *iter,
const char *arg_name,
struct GNUNET_HashCode *value);
+
+DBusMessage *
+GNUNET_DBUS_pop_peer_identity (
+ DBusMessage *message,
+ DBusMessageIter *iter,
+ const char *arg_name,
+ struct GNUNET_PeerIdentity *value);
#endif
Modified: gnunet-dbus/src/lib/include/gnunet_dbus_lib_push.h
===================================================================
--- gnunet-dbus/src/lib/include/gnunet_dbus_lib_push.h 2014-02-27 21:34:13 UTC
(rev 32490)
+++ gnunet-dbus/src/lib/include/gnunet_dbus_lib_push.h 2014-02-28 05:26:46 UTC
(rev 32491)
@@ -224,6 +224,12 @@
DBusMessageIter *iter,
const struct GNUNET_HashCode *value);
+void
+GNUNET_DBUS_push_peer_identity (
+ DBusMessage *message,
+ DBusMessageIter *iter,
+ const struct GNUNET_PeerIdentity *value);
+
#endif
Modified: gnunet-dbus/src/lib/include/gnunet_dbus_lib_service.h
===================================================================
--- gnunet-dbus/src/lib/include/gnunet_dbus_lib_service.h 2014-02-27
21:34:13 UTC (rev 32490)
+++ gnunet-dbus/src/lib/include/gnunet_dbus_lib_service.h 2014-02-28
05:26:46 UTC (rev 32491)
@@ -37,6 +37,11 @@
__attribute__((warn_unused_result));
void
+GNUNET_DBUS_service_remove_object (
+ struct GNUNET_DBUS_Service *service,
+ struct GNUNET_DBUS_Object *object);
+
+void
GNUNET_DBUS_service_send (
struct GNUNET_DBUS_Service *service,
DBusMessage *dbus_message);
Modified: gnunet-dbus/src/lib/include/gnunet_dbus_lib_signature.h
===================================================================
--- gnunet-dbus/src/lib/include/gnunet_dbus_lib_signature.h 2014-02-27
21:34:13 UTC (rev 32490)
+++ gnunet-dbus/src/lib/include/gnunet_dbus_lib_signature.h 2014-02-28
05:26:46 UTC (rev 32491)
@@ -2,30 +2,32 @@
#define GNUNET_DBUS_LIB_SIGNATURE_H
#include <dbus/dbus.h>
+#include "gnunet_crypto_dbus_lib.h"
-#define GNUNET_DBUS_SIGNATURE_BYTE DBUS_TYPE_BYTE_AS_STRING
-#define GNUNET_DBUS_SIGNATURE_BOOLEAN DBUS_TYPE_BOOLEAN_AS_STRING
-#define GNUNET_DBUS_SIGNATURE_INT16 DBUS_TYPE_INT16_AS_STRING
-#define GNUNET_DBUS_SIGNATURE_UINT16 DBUS_TYPE_UINT16_AS_STRING
-#define GNUNET_DBUS_SIGNATURE_INT32 DBUS_TYPE_INT32_AS_STRING
-#define GNUNET_DBUS_SIGNATURE_UINT32 DBUS_TYPE_UINT32_AS_STRING
-#define GNUNET_DBUS_SIGNATURE_INT64 DBUS_TYPE_INT64_AS_STRING
-#define GNUNET_DBUS_SIGNATURE_UINT64 DBUS_TYPE_UINT64_AS_STRING
-#define GNUNET_DBUS_SIGNATURE_DOUBLE DBUS_TYPE_DOUBLE_AS_STRING
-#define GNUNET_DBUS_SIGNATURE_STRING DBUS_TYPE_STRING_AS_STRING
-#define GNUNET_DBUS_SIGNATURE_OBJECT_PATH DBUS_TYPE_OBJECT_PATH_AS_STRING
-#define GNUNET_DBUS_SIGNATURE_SIGNATURE DBUS_TYPE_SIGNATURE_AS_STRING
-#define GNUNET_DBUS_SIGNATURE_UNIX_FD DBUS_TYPE_UNIX_FD_AS_STRING
-#define GNUNET_DBUS_SIGNATURE_VARIANT DBUS_TYPE_VARIANT_AS_STRING
+#define GNUNET_DBUS_SIGNATURE_BYTE DBUS_TYPE_BYTE_AS_STRING
+#define GNUNET_DBUS_SIGNATURE_BOOLEAN DBUS_TYPE_BOOLEAN_AS_STRING
+#define GNUNET_DBUS_SIGNATURE_INT16 DBUS_TYPE_INT16_AS_STRING
+#define GNUNET_DBUS_SIGNATURE_UINT16 DBUS_TYPE_UINT16_AS_STRING
+#define GNUNET_DBUS_SIGNATURE_INT32 DBUS_TYPE_INT32_AS_STRING
+#define GNUNET_DBUS_SIGNATURE_UINT32 DBUS_TYPE_UINT32_AS_STRING
+#define GNUNET_DBUS_SIGNATURE_INT64 DBUS_TYPE_INT64_AS_STRING
+#define GNUNET_DBUS_SIGNATURE_UINT64 DBUS_TYPE_UINT64_AS_STRING
+#define GNUNET_DBUS_SIGNATURE_DOUBLE DBUS_TYPE_DOUBLE_AS_STRING
+#define GNUNET_DBUS_SIGNATURE_STRING DBUS_TYPE_STRING_AS_STRING
+#define GNUNET_DBUS_SIGNATURE_OBJECT_PATH DBUS_TYPE_OBJECT_PATH_AS_STRING
+#define GNUNET_DBUS_SIGNATURE_SIGNATURE DBUS_TYPE_SIGNATURE_AS_STRING
+#define GNUNET_DBUS_SIGNATURE_UNIX_FD DBUS_TYPE_UNIX_FD_AS_STRING
+#define GNUNET_DBUS_SIGNATURE_VARIANT DBUS_TYPE_VARIANT_AS_STRING
-#define GNUNET_DBUS_SIGNATURE_ARRAY(s) DBUS_TYPE_ARRAY_AS_STRING s
-#define GNUNET_DBUS_SIGNATURE_DICT(s) DBUS_TYPE_ARRAY_AS_STRING
DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING s DBUS_DICT_ENTRY_END_CHAR_AS_STRING
-#define GNUNET_DBUS_SIGNATURE_STRUCT(s) DBUS_STRUCT_BEGIN_CHAR_AS_STRING s
DBUS_STRUCT_END_CHAR_AS_STRING
+#define GNUNET_DBUS_SIGNATURE_ARRAY(s) DBUS_TYPE_ARRAY_AS_STRING s
+#define GNUNET_DBUS_SIGNATURE_DICT(s) DBUS_TYPE_ARRAY_AS_STRING
DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING s DBUS_DICT_ENTRY_END_CHAR_AS_STRING
+#define GNUNET_DBUS_SIGNATURE_STRUCT(s) DBUS_STRUCT_BEGIN_CHAR_AS_STRING s
DBUS_STRUCT_END_CHAR_AS_STRING
-#define GNUNET_DBUS_SIGNATURE_BITFIELD GNUNET_DBUS_SIGNATURE_VARIANT
-#define GNUNET_DBUS_SIGNATURE_ENUM GNUNET_DBUS_SIGNATURE_VARIANT
+#define GNUNET_DBUS_SIGNATURE_BITFIELD GNUNET_DBUS_SIGNATURE_VARIANT
+#define GNUNET_DBUS_SIGNATURE_ENUM GNUNET_DBUS_SIGNATURE_VARIANT
-#define GNUNET_DBUS_SIGNATURE_HASHCODE GNUNET_DBUS_SIGNATURE_VARIANT
+#define GNUNET_DBUS_SIGNATURE_HASHCODE GNUNET_DBUS_SIGNATURE_VARIANT
+#define GNUNET_DBUS_SIGNATURE_PEER_IDENTITY
GNUNET_DBUS_SIGNATURE_STRUCT(GNUNET_CRYPTO_DBUS_SIGNATURE_EDDSA_PUBLIC_KEY)
const char *
GNUNET_DBUS_signature_typecode_to_string (
Modified: gnunet-dbus/src/lib/util/gnunet_crypto_dbus_lib_pop.c
===================================================================
--- gnunet-dbus/src/lib/util/gnunet_crypto_dbus_lib_pop.c 2014-02-27
21:34:13 UTC (rev 32490)
+++ gnunet-dbus/src/lib/util/gnunet_crypto_dbus_lib_pop.c 2014-02-28
05:26:46 UTC (rev 32491)
@@ -72,4 +72,74 @@
}
}
+DBusMessage *
+GNUNET_CRYPTO_DBUS_pop_eddsa_public_key (
+ DBusMessage *message,
+ DBusMessageIter *iter,
+ const char *arg_name,
+ struct GNUNET_CRYPTO_EddsaPublicKey *value)
+{
+ DBusMessage *ret = NULL;
+ DBusMessageIter iter_sub;
+ DBusMessageIter iter_sub_sub;
+ ret = GNUNET_DBUS_pop_enter_variant (message, iter, &iter_sub, arg_name);
+ if (ret)
+ return ret;
+
+ const char *encoded;
+ int success;
+ int arg_type = dbus_message_iter_get_arg_type (&iter_sub);
+ int element_type;
+ int n_elements;
+ unsigned char *marshalled_array;
+ switch (arg_type)
+ {
+ case DBUS_TYPE_STRING:
+ dbus_message_iter_get_basic (&iter_sub, &encoded);
+ success = GNUNET_CRYPTO_eddsa_public_key_from_string (encoded, strlen
(encoded), value);
+ if (GNUNET_OK != success)
+ {
+ return dbus_message_new_error_printf (
+ message,
+ DBUS_ERROR_INVALID_ARGS,
+ "String is not a valid base32 encoded EDDSA public key for argument
'%s'",
+ arg_name);
+ }
+ GNUNET_DBUS_message_set_pretty (message, true);
+ return NULL;
+ case DBUS_TYPE_ARRAY:
+ element_type = dbus_message_iter_get_element_type (&iter_sub);
+ if (DBUS_TYPE_BYTE == element_type)
+ {
+ dbus_message_iter_recurse (&iter_sub, &iter_sub_sub);
+ dbus_message_iter_get_fixed_array (&iter_sub_sub, &marshalled_array,
&n_elements);
+ if (sizeof (value->q_y) == n_elements)
+ {
+ memcpy (value->q_y, marshalled_array, n_elements);
+ return NULL;
+ };
+ return dbus_message_new_error_printf (
+ message,
+ DBUS_ERROR_INVALID_ARGS,
+ "EDDSA public key consists of 32 bytes (256 bits). Array given for
argument '%s' contains %d bytes.",
+ arg_name,
+ n_elements);
+ };
+ return dbus_message_new_error_printf (
+ message,
+ DBUS_ERROR_INVALID_ARGS,
+ "Invalid type for argument '%s'. Variant contains an array of '%s'.
Should contain an EDDSA public key in the form of a base32 encoded string or an
array of 32 bytes (256 bits).",
+ arg_name,
+ GNUNET_DBUS_signature_typecode_to_string (element_type));
+ default:
+ return dbus_message_new_error_printf (
+ message,
+ DBUS_ERROR_INVALID_ARGS,
+ "Invalid type in variant for argument '%s'. Should contain an ECDSA
public key in the form of a base32 encoded string or an array of 32 bytes (256
bits). Contains '%s'",
+ arg_name,
+ GNUNET_DBUS_signature_typecode_to_string (arg_type));
+ }
+}
+
+
Modified: gnunet-dbus/src/lib/util/gnunet_crypto_dbus_lib_push.c
===================================================================
--- gnunet-dbus/src/lib/util/gnunet_crypto_dbus_lib_push.c 2014-02-27
21:34:13 UTC (rev 32490)
+++ gnunet-dbus/src/lib/util/gnunet_crypto_dbus_lib_push.c 2014-02-28
05:26:46 UTC (rev 32491)
@@ -0,0 +1,54 @@
+#include "config.h"
+
+#include "gnunet_dbus_lib.h"
+
+void
+GNUNET_CRYPTO_DBUS_push_ecdsa_public_key (
+ DBusMessage *message,
+ DBusMessageIter *iter,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *value)
+{
+ DBusMessageIter iter_sub;
+
+ if (GNUNET_DBUS_message_get_pretty (message))
+ {
+ GNUNET_DBUS_push_open_variant (message, iter, &iter_sub,
GNUNET_DBUS_SIGNATURE_STRING);
+ char *encoded = GNUNET_CRYPTO_ecdsa_public_key_to_string (value);
+ const char *encoded_const = encoded;
+ GNUNET_DBUS_push_string (message, &iter_sub, &encoded_const);
+ GNUNET_DBUS_push_close_variant (message, iter, &iter_sub);
+ GNUNET_free (encoded);
+ }
+ else
+ {
+ GNUNET_DBUS_push_open_variant (message, iter, &iter_sub,
GNUNET_DBUS_SIGNATURE_ARRAY (GNUNET_DBUS_SIGNATURE_BYTE));
+ GNUNET_DBUS_push_byte_array (message, &iter_sub, value->q_y, 32);
+ GNUNET_DBUS_push_close_variant (message, iter, &iter_sub);
+ };
+};
+
+void
+GNUNET_CRYPTO_DBUS_push_eddsa_public_key (
+ DBusMessage *message,
+ DBusMessageIter *iter,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *value)
+{
+ DBusMessageIter iter_sub;
+
+ if (GNUNET_DBUS_message_get_pretty (message))
+ {
+ GNUNET_DBUS_push_open_variant (message, iter, &iter_sub,
GNUNET_DBUS_SIGNATURE_STRING);
+ char *encoded = GNUNET_CRYPTO_eddsa_public_key_to_string (value);
+ const char *encoded_const = encoded;
+ GNUNET_DBUS_push_string (message, &iter_sub, &encoded_const);
+ GNUNET_DBUS_push_close_variant (message, iter, &iter_sub);
+ GNUNET_free (encoded);
+ }
+ else
+ {
+ GNUNET_DBUS_push_open_variant (message, iter, &iter_sub,
GNUNET_DBUS_SIGNATURE_ARRAY (GNUNET_DBUS_SIGNATURE_BYTE));
+ GNUNET_DBUS_push_byte_array (message, &iter_sub, value->q_y, 32);
+ GNUNET_DBUS_push_close_variant (message, iter, &iter_sub);
+ };
+};
+
Modified: gnunet-dbus/src/services/Makefile.am
===================================================================
--- gnunet-dbus/src/services/Makefile.am 2014-02-27 21:34:13 UTC (rev
32490)
+++ gnunet-dbus/src/services/Makefile.am 2014-02-28 05:26:46 UTC (rev
32491)
@@ -2,8 +2,8 @@
-I$(top_builddir)/src/lib/include
bin_PROGRAMS = \
- gnunet-service-gns-dbus
- ##gnunet-service-dht-dbus
+ gnunet-service-gns-dbus \
+ gnunet-service-dht-dbus
gnunet_service_gns_dbus_SOURCES = \
gnunet-service-gns-dbus.c
@@ -16,11 +16,15 @@
-lgnunetgns \
-lgnunetutil
-##gnunet_service_dht_dbus_SOURCES = \
- ##gnunet-service-dht-dbus.c
+gnunet_service_dht_dbus_SOURCES = \
+ gnunet-service-dht-dbus.c
-##gnunet_service_dht_dbus_LDADD = \
- ##$(top_builddir)/src/lib/libgnunetdbus.la \
- ##-lgnunetdht \
- ##-lgnunetutil
+gnunet_service_dht_dbus_LDADD = \
+ $(top_builddir)/src/lib/common/libgnunetdbus.la \
+ $(top_builddir)/src/lib/util/libgnunettimedbus.la \
+ $(top_builddir)/src/lib/util/libgnunetcryptodbus.la \
+ $(top_builddir)/src/lib/dht/libgnunetdhtdbus.la \
+ $(top_builddir)/src/lib/block/libgnunetblockdbus.la \
+ -lgnunetdht \
+ -lgnunetutil
Modified: gnunet-dbus/src/services/gnunet-service-dht-dbus.c
===================================================================
--- gnunet-dbus/src/services/gnunet-service-dht-dbus.c 2014-02-27 21:34:13 UTC
(rev 32490)
+++ gnunet-dbus/src/services/gnunet-service-dht-dbus.c 2014-02-28 05:26:46 UTC
(rev 32491)
@@ -9,6 +9,9 @@
#include <gnunet/gnunet_dht_service.h>
#include "gnunet_dbus_lib.h"
+#include "gnunet_dht_dbus_lib.h"
+#include "gnunet_block_dbus_lib.h"
+#include "gnunet_time_dbus_lib.h"
#define LOG(kind, ...) GNUNET_log_from (kind, "dht-dbus", __VA_ARGS__)
@@ -18,8 +21,16 @@
struct GNUNET_DBUS_Client *client;
struct GNUNET_DHT_GetHandle *handle;
char *results_dest;
+ bool pretty;
};
+struct ClientData
+{
+ struct GNUNET_DBUS_ObjectIterator *gets_front;
+ struct GNUNET_DBUS_ObjectIterator *gets_back;
+ struct GNUNET_DHT_Handle *dht_handle;
+};
+
static void
put_return (
void *cls,
@@ -64,16 +75,17 @@
unsigned msg_serial = dbus_message_get_serial (mc->message);
LOG (GNUNET_ERROR_TYPE_DEBUG, "Recieved put from dbus. Method call id %u\n",
msg_serial);
+ DBusMessage *message = mc->message;
DBusMessageIter iter;
- dbus_message_iter_init (mc->message, &iter);
+ dbus_message_iter_init (message, &iter);
DBusMessage *reply = NULL;
- reply = reply ? reply : GNUNET_DBUS_message_iter_pop_hashcode (mc, &iter,
"key", &key);
- reply = reply ? reply : GNUNET_DBUS_message_iter_pop_uint32 (mc, &iter,
"desired_replication_level", &desired_replication_level);
- reply = reply ? reply : GNUNET_DBUS_message_iter_pop_dht_route_option (mc,
&iter, "options", &options);
- reply = reply ? reply : GNUNET_DBUS_message_iter_pop_block_type (mc, &iter,
"type", &type);
- reply = reply ? reply : GNUNET_DBUS_message_iter_pop_bytes (mc, &iter,
"data", (const unsigned char **)&data, &size);
- reply = reply ? reply : GNUNET_DBUS_message_iter_pop_time_absolute (mc,
&iter, "expiry", &expiry);
+ reply = reply ? reply : GNUNET_DBUS_pop_hashcode (message, &iter, "key",
&key);
+ reply = reply ? reply : GNUNET_DBUS_pop_uint32 (message, &iter,
"desired_replication_level", &desired_replication_level);
+ reply = reply ? reply : GNUNET_DHT_DBUS_pop_route_option (message, &iter,
"options", &options);
+ reply = reply ? reply : GNUNET_BLOCK_DBUS_pop_type (message, &iter, "type",
&type);
+ reply = reply ? reply : GNUNET_DBUS_pop_byte_array (message, &iter, "data",
(const unsigned char **)&data, &size);
+ reply = reply ? reply : GNUNET_TIME_DBUS_pop_absolute (message, &iter,
"expiry", &expiry);
if (reply)
{
GNUNET_DBUS_method_context_send_reply (mc, reply);
@@ -81,7 +93,8 @@
};
GNUNET_DBUS_method_context_ref (mc);
- struct GNUNET_DHT_Handle *handle = GNUNET_DBUS_client_get_data (mc->client);
+ struct ClientData *cd = GNUNET_DBUS_client_get_data (mc->client);
+ struct GNUNET_DHT_Handle *handle = cd->dht_handle;
GNUNET_DHT_put (
handle,
@@ -115,29 +128,33 @@
unsigned i;
struct GNUNET_DBUS_Object *request_object = (struct GNUNET_DBUS_Object *)cls;
struct GetRequest *get_request = (struct GetRequest
*)GNUNET_DBUS_object_get_data (request_object);
- DBusMessage *msg = dbus_message_new_method_call (
- GNUNET_DBUS_client_get_unique_name (get_request->client),
- get_request->results_dest,
- "gnu.gnunet.dht.GetReceiver",
- "ReceiveResult");
- DBusMessageIter msg_iter;
- dbus_message_iter_init_append (msg, &msg_iter);
+ struct GNUNET_DBUS_Client *client = get_request->client;
+
+ DBusMessage *message = GNUNET_DBUS_client_create_unicast_signal (
+ client,
+ GNUNET_DBUS_object_get_path (request_object),
+ "gnu.gnunet.dht.get",
+ "result",
+ get_request->pretty);
+
+ DBusMessageIter message_iter;
+ DBusMessageIter message_iter_sub;
+ dbus_message_iter_init_append (message, &message_iter);
- GNUNET_DBUS_message_iter_push_time_absolute (mc, &msg_iter, &expiry);
- GNUNET_DBUS_message_iter_push_hash_code (mc, &msg_iter, key);
- GNUNET_DBUS_message_iter_push_open_array (mc, &msg_iter, &msg_iter_sub,
GNUNET_DBUS_SIGNATURE_PEER_IDENTITY);
+ GNUNET_TIME_DBUS_push_absolute (message, &message_iter, &expiry);
+ GNUNET_DBUS_push_hashcode (message, &message_iter, key);
+ GNUNET_DBUS_push_open_array (message, &message_iter, &message_iter_sub,
GNUNET_DBUS_SIGNATURE_PEER_IDENTITY);
for (i = 0; i < get_path_len; i++)
- GNUNET_DBUS_message_iter_push_peer_identity (mc, &msg_iter_sub, get_path +
i);
- GNUNET_DBUS_message_iter_push_close_array (mc, &msg_iter, &msg_iter_sub);
- GNUNET_DBUS_message_iter_push_open_array (mc, &msg_iter, &msg_iter_sub,
GNUNET_DBUS_SIGNATURE_PEER_IDENTITY);
+ GNUNET_DBUS_push_peer_identity (message, &message_iter_sub, get_path + i);
+ GNUNET_DBUS_push_close_array (message, &message_iter, &message_iter_sub);
+ GNUNET_DBUS_push_open_array (message, &message_iter, &message_iter_sub,
GNUNET_DBUS_SIGNATURE_PEER_IDENTITY);
for (i = 0; i < put_path_len; i++)
- GNUNET_DBUS_message_iter_push_peer_identity (mc, &msg_iter_sub, put_path +
i);
- GNUNET_DBUS_message_iter_push_close_array (mc, &msg_iter, &msg_iter_sub);
- GNUNET_DBUS_message_iter_push_block_type (mc, &msg_iter, &type);
- GNUNET_DBUS_message_iter_push_bytes (mc, &msg_iter, data, size);
- dbus_message_set_no_reply (msg, true);
+ GNUNET_DBUS_push_peer_identity (message, &message_iter_sub, put_path + i);
+ GNUNET_DBUS_push_close_array (message, &message_iter, &message_iter_sub);
+ GNUNET_BLOCK_DBUS_push_type (message, &message_iter, &type);
+ GNUNET_DBUS_push_byte_array (message, &message_iter, data, size);
- GNUNET_DBUS_service_send (get_request->service, msg);
+ GNUNET_DBUS_service_send (get_request->service, message);
}
static void
@@ -148,55 +165,84 @@
struct GNUNET_HashCode key;
uint32_t desired_replication_level;
enum GNUNET_DHT_RouteOption options;
- char *results_dest;
unsigned msg_serial = dbus_message_get_serial (mc->message);
LOG (GNUNET_ERROR_TYPE_DEBUG, "Recieved get_start from dbus. Method call id
%u\n", msg_serial);
+ DBusMessage *message = mc->message;
DBusMessageIter iter;
- dbus_message_iter_init (mc->message, &iter);
+ dbus_message_iter_init (message, &iter);
DBusMessage *reply = NULL;
- reply = reply ? reply : GNUNET_DBUS_message_iter_pop_block_type (mc, &iter,
"type", &type);
- reply = reply ? reply : GNUNET_DBUS_message_iter_pop_hashcode (mc, &iter,
"key", &key);
- reply = reply ? reply : GNUNET_DBUS_message_iter_pop_uint32 (mc, &iter,
"desired_replication_level", &desired_replication_level);
- reply = reply ? reply : GNUNET_DBUS_message_iter_pop_dht_route_option (mc,
&iter, "options", &options);
- reply = reply ? reply : GNUNET_DBUS_message_iter_pop_object_path (mc, &iter,
"results_dest", &results_dest);
+ reply = reply ? reply : GNUNET_BLOCK_DBUS_pop_type (message, &iter, "type",
&type);
+ reply = reply ? reply : GNUNET_DBUS_pop_hashcode (message, &iter, "key",
&key);
+ reply = reply ? reply : GNUNET_DBUS_pop_uint32 (message, &iter,
"desired_replication_level", &desired_replication_level);
+ reply = reply ? reply : GNUNET_DHT_DBUS_pop_route_option (message, &iter,
"options", &options);
if (reply)
{
GNUNET_DBUS_method_context_send_reply (mc, reply);
return;
};
+ //if (GNUNET_DBUS_message_get_pretty_encoded (message))
+ //GNUNET_DBUS_client_set_prefers_pretty_encodings (mc->client, true);
GNUNET_DBUS_method_context_ref (mc);
- struct GNUNET_DHT_Handle *handle = GNUNET_DBUS_client_get_data (mc->client);
+ struct ClientData *cd = GNUNET_DBUS_client_get_data (mc->client);
+ struct GNUNET_DHT_Handle *handle = cd->dht_handle;
- uint32_t request_id = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
0xffffffff);
- char *request_obj_path = GNUNET_asprintf ("/get/%08x", request__id);
struct GetRequest *get_request = GNUNET_new (struct GetRequest);
get_request->service = mc->service;
get_request->client = mc->client;
- GNUNET_DBUT_client_ref (mc->client);
- get_request->results_dest = strdup (results_dest);
- struct GNUNET_DBUS_Object *request_object = GNUNET_DBUS_object_create
(request_obj_path, get_request);
+ get_request->pretty = GNUNET_DBUS_message_get_pretty (message);
+ struct GNUNET_DBUS_Object *request_object = NULL;
+ char *request_obj_path = NULL;
+
+ while (true)
+ {
+ uint32_t request_id = GNUNET_CRYPTO_random_u32
(GNUNET_CRYPTO_QUALITY_WEAK, 0xffffffff);
+ request_obj_path = NULL;
+ GNUNET_asprintf (&request_obj_path, "/get/%08x", request_id);
+ request_object = GNUNET_DBUS_object_create (request_obj_path, get_request);
+ if (! request_object)
+ {
+ LOG (GNUNET_ERROR_TYPE_ERROR, "Failed to create request object.\n");
+ GNUNET_abort ();
+ };
+
+ int succ = GNUNET_DBUS_service_add_object (mc->service, request_object);
+ if (GNUNET_OK == succ)
+ break;
+
+ LOG (GNUNET_ERROR_TYPE_WARNING, "Name %s appears to be taken.
Retrying.\n", request_obj_path);
+ GNUNET_free (request_object);
+ GNUNET_free (request_obj_path);
+ };
+
+ reply = dbus_message_new_method_return (message);
+ DBusMessageIter reply_iter;
+ dbus_message_iter_init_append (reply, &reply_iter);
+ const char *request_obj_path_const = request_obj_path;
+ GNUNET_DBUS_push_object_path (reply, &reply_iter, &request_obj_path_const);
+ GNUNET_DBUS_method_context_send_reply (mc, reply);
+ GNUNET_free (request_obj_path);
+
+ struct GNUNET_DBUS_ObjectIterator *obj_it = GNUNET_new (struct
GNUNET_DBUS_ObjectIterator);
+ obj_it->object = request_object;
+ GNUNET_CONTAINER_DLL_insert (
+ cd->gets_front,
+ cd->gets_back,
+ obj_it);
+
get_request->handle = GNUNET_DHT_get_start (
handle,
type,
- key,
+ &key,
desired_replication_level,
options,
NULL,
0,
get_iter_return,
request_object);
-
- reply = dbus_message_new_method_return (mc->message);
- DBusMessageIter reply_iter;
- dbus_message_iter_init (reply, &reply_iter);
- GNUNET_DBUS_message_iter_push_object_path (&reply_iter, request_obj_path);
-
- GNUNET_DBUS_method_context_send_reply (mc, reply);
- GNUNET_free (obj_path);
};
static void
@@ -206,8 +252,11 @@
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "Creating dht client for %s\n",
GNUNET_DBUS_client_get_unique_name (client));
const struct GNUNET_CONFIGURATION_Handle *cfg =
GNUNET_DBUS_service_get_config (service);
- struct GNUNET_DHT_Handle *handle = GNUNET_DHT_connect (cfg, 32);
- GNUNET_DBUS_client_set_data (client, handle);
+ struct ClientData *cd = GNUNET_new (struct ClientData);
+ cd->dht_handle = GNUNET_DHT_connect (cfg, 32);
+ cd->gets_front = NULL;
+ cd->gets_back = NULL;
+ GNUNET_DBUS_client_set_data (client, cd);
LOG (GNUNET_ERROR_TYPE_DEBUG, "Finished creating DHT client for %s\n",
GNUNET_DBUS_client_get_unique_name (client));
};
@@ -216,8 +265,22 @@
struct GNUNET_DBUS_Service *service,
struct GNUNET_DBUS_Client *client)
{
- (void)service;
- GNUNET_DHT_disconnect (GNUNET_DBUS_client_get_data (client));
+ struct ClientData *cd = GNUNET_DBUS_client_get_data (client);
+ struct GNUNET_DBUS_ObjectIterator *obj_it = cd->gets_front;
+ while (obj_it)
+ {
+ struct GNUNET_DBUS_ObjectIterator *next = obj_it->next;
+ struct GNUNET_DBUS_Object *object = obj_it->object;
+ struct GetRequest *request = GNUNET_DBUS_object_get_data (object);
+
+ GNUNET_DHT_get_stop (request->handle);
+ GNUNET_free (request);
+ GNUNET_DBUS_service_remove_object (service, object);
+ GNUNET_free (obj_it);
+ obj_it = next;
+ };
+ GNUNET_DHT_disconnect (cd->dht_handle);
+ GNUNET_free (cd);
};
static void
@@ -266,11 +329,19 @@
GNUNET_DBUS_interface_add_method (dht_interface, method_put);
GNUNET_DBUS_method_add_arg (method_put, "key",
GNUNET_DBUS_SIGNATURE_HASHCODE);
GNUNET_DBUS_method_add_arg (method_put, "desired_replication_level",
GNUNET_DBUS_SIGNATURE_UINT32);
- GNUNET_DBUS_method_add_arg (method_put, "options",
GNUNET_DBUS_SIGNATURE_DHT_ROUTE_OPTION);
- GNUNET_DBUS_method_add_arg (method_put, "type",
GNUNET_DBUS_SIGNATURE_BLOCK_TYPE);
+ GNUNET_DBUS_method_add_arg (method_put, "options",
GNUNET_DHT_DBUS_SIGNATURE_ROUTE_OPTION);
+ GNUNET_DBUS_method_add_arg (method_put, "type",
GNUNET_BLOCK_DBUS_SIGNATURE_TYPE);
GNUNET_DBUS_method_add_arg (method_put, "data", GNUNET_DBUS_SIGNATURE_ARRAY
(GNUNET_DBUS_SIGNATURE_BYTE));
- GNUNET_DBUS_method_add_arg (method_put, "expiry",
GNUNET_DBUS_SIGNATURE_TIME_ABSOLUTE);
+ GNUNET_DBUS_method_add_arg (method_put, "expiry",
GNUNET_TIME_DBUS_SIGNATURE_ABSOLUTE);
+ struct GNUNET_DBUS_Method *method_get_start = GNUNET_DBUS_method_create
("get_start", get_start);
+ GNUNET_DBUS_interface_add_method (dht_interface, method_get_start);
+ GNUNET_DBUS_method_add_arg (method_get_start, "type",
GNUNET_BLOCK_DBUS_SIGNATURE_TYPE);
+ GNUNET_DBUS_method_add_arg (method_get_start, "key",
GNUNET_DBUS_SIGNATURE_HASHCODE);
+ GNUNET_DBUS_method_add_arg (method_get_start, "desired_replication_level",
GNUNET_DBUS_SIGNATURE_UINT32);
+ GNUNET_DBUS_method_add_arg (method_get_start, "options",
GNUNET_DHT_DBUS_SIGNATURE_ROUTE_OPTION);
+ GNUNET_DBUS_method_add_return_arg (method_get_start, "request_object",
GNUNET_DBUS_SIGNATURE_OBJECT_PATH);
+
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, shutdown_task,
dht_service);
};
Modified: gnunet-dbus/src/services/gnunet-service-gns-dbus.c
===================================================================
--- gnunet-dbus/src/services/gnunet-service-gns-dbus.c 2014-02-27 21:34:13 UTC
(rev 32490)
+++ gnunet-dbus/src/services/gnunet-service-gns-dbus.c 2014-02-28 05:26:46 UTC
(rev 32491)
@@ -68,7 +68,7 @@
DBusMessage *reply = NULL;
reply = reply ? reply : GNUNET_DBUS_pop_string (message, &message_iter,
"name", &name);
reply = reply ? reply : GNUNET_CRYPTO_DBUS_pop_ecdsa_public_key (message,
&message_iter, "zone", &zone);
- reply = reply ? reply : GNUNET_DBUS_pop_uint32 (message, &message_iter,
"type", &type);
+ reply = reply ? reply : GNUNET_GNSRECORD_DBUS_pop_type (message,
&message_iter, "type", &type);
reply = reply ? reply : GNUNET_DBUS_pop_boolean (message, &message_iter,
"only_cached", &only_cached);
if (reply)
{
@@ -155,7 +155,7 @@
GNUNET_DBUS_interface_add_method (gns_interface, gns_method_lookup);
GNUNET_DBUS_method_add_arg (gns_method_lookup, "name",
GNUNET_DBUS_SIGNATURE_STRING);
GNUNET_DBUS_method_add_arg (gns_method_lookup, "zone",
GNUNET_CRYPTO_DBUS_SIGNATURE_ECDSA_PUBLIC_KEY);
- GNUNET_DBUS_method_add_arg (gns_method_lookup, "type",
GNUNET_DBUS_SIGNATURE_UINT32);
+ GNUNET_DBUS_method_add_arg (gns_method_lookup, "type",
GNUNET_GNSRECORD_DBUS_SIGNATURE_TYPE);
GNUNET_DBUS_method_add_arg (gns_method_lookup, "only_cached",
GNUNET_DBUS_SIGNATURE_BOOLEAN);
GNUNET_DBUS_method_add_return_arg (gns_method_lookup, "records",
GNUNET_DBUS_SIGNATURE_ARRAY (GNUNET_GNSRECORD_DBUS_SIGNATURE_DATA));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r32491 - in gnunet-dbus/src: lib/common lib/include lib/util services,
gnunet <=