#define VERBOSE GNUNET_NO
-#define START_ARM GNUNET_YES
-
/**
* How long until we give up on passing the test?
*/
struct PeerContext
{
struct GNUNET_CONFIGURATION_Handle *cfg;
-#if START_ARM
struct GNUNET_OS_Process *arm_proc;
-#endif
};
struct Wanted
{
struct GNUNET_CONTAINER_MetaData *meta;
- GNUNET_HashCode *sender;
+ struct GNUNET_HashCode *sender;
/**
* Alternative meta/sender is used when we expect join/leave notification
*/
struct GNUNET_CONTAINER_MetaData *meta2;
- GNUNET_HashCode *sender2;
+ struct GNUNET_HashCode *sender2;
char *msg;
static struct PeerContext p3;
-static GNUNET_HashCode alice;
+static struct GNUNET_HashCode alice;
-static GNUNET_HashCode bob;
+static struct GNUNET_HashCode bob;
-static GNUNET_HashCode carol;
+static struct GNUNET_HashCode carol;
static struct GNUNET_CHAT_Room *alice_room;
static int is_p2p;
-struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *bob_public_key = NULL;
+static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *bob_public_key;
static void
setup_peer (struct PeerContext *p, const char *cfgname)
{
+ char *binary;
+
+ binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
p->cfg = GNUNET_CONFIGURATION_create ();
-#if START_ARM
p->arm_proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary,
"gnunet-service-arm",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
"-c", cfgname, NULL);
-#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
+ GNUNET_free (binary);
}
static void
stop_arm (struct PeerContext *p)
{
-#if START_ARM
if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ARM process %u stopped\n",
GNUNET_OS_process_get_pid (p->arm_proc));
- GNUNET_OS_process_close (p->arm_proc);
+ GNUNET_OS_process_destroy (p->arm_proc);
p->arm_proc = NULL;
-#endif
GNUNET_CONFIGURATION_destroy (p->cfg);
}
enum GNUNET_CHAT_MsgOptions options)
{
struct Wanted *want = cls;
- GNUNET_HashCode sender;
+ struct GNUNET_HashCode sender;
#if VERBOSE
printf ("%s - told that %s has %s\n", want->me,
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
&sender);
/* entertain both primary and an alternative sender/meta */
- if (((0 == memcmp (&sender, want->sender, sizeof (GNUNET_HashCode))) ||
+ if (((0 == memcmp (&sender, want->sender, sizeof (struct GNUNET_HashCode))) ||
((want->sender2 != NULL) &&
- (0 == memcmp (&sender, want->sender2, sizeof (GNUNET_HashCode))))) &&
+ (0 == memcmp (&sender, want->sender2, sizeof (struct GNUNET_HashCode))))) &&
(((member_info == NULL) && (want->meta == NULL)) ||
((member_info != NULL) &&
(((want->meta != NULL) &&
{
/* remember Bob's public key, we need it to send private message */
if (NULL == bob_public_key &&
- (0 == memcmp (&bob, want->sender, sizeof (GNUNET_HashCode))))
+ (0 == memcmp (&bob, want->sender, sizeof (struct GNUNET_HashCode))))
bob_public_key =
GNUNET_memdup (member_id,
sizeof (struct
if (want->sender2 != NULL)
{
/* flush alternative sender */
- if (0 == memcmp (&sender, want->sender, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (&sender, want->sender, sizeof (struct GNUNET_HashCode)))
{
want->sender = want->sender2;
want->meta = want->meta2;
static int
receive_cb (void *cls, struct GNUNET_CHAT_Room *room,
- const GNUNET_HashCode * sender,
+ const struct GNUNET_HashCode * sender,
const struct GNUNET_CONTAINER_MetaData *meta, const char *message,
struct GNUNET_TIME_Absolute timestamp,
enum GNUNET_CHAT_MsgOptions options)
if ((want->msg != NULL) && (0 == strcmp (message, want->msg)) &&
(((sender == NULL) && (want->sender == NULL)) ||
((sender != NULL) && (want->sender != NULL) &&
- (0 == memcmp (sender, want->sender, sizeof (GNUNET_HashCode))))) &&
+ (0 == memcmp (sender, want->sender, sizeof (struct GNUNET_HashCode))))) &&
(GNUNET_CONTAINER_meta_data_test_equal (meta, want->meta)) &&
(options == want->opt) &&
/* Not == since the library sets the actual timestamp, so it may be
"test-chat",
"-c",
"test_chat_data.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
};
GNUNET_log_setup ("test_chat",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
if (strstr (argv[0], "p2p") != NULL)
{