43#define LOG(kind, ...) \
44 GNUNET_log_from (kind, "testing-core-connect", __VA_ARGS__)
53 "Received message (%" PRIu64
", %" PRIu64
", %s) - going to call handlers\n",
61 "We received a message from ourself!\n");
108 "Connected to core, own pid: %s\n",
128 "A new connection was established with peer %s\n",
134 "size of connect_state: %lu of channel: %lu\n",
142 " (That's us - connection was established to ourself)\n");
151 "Inserting channel into list\n");
156 "Peer at list head: %s\n",
159 "Peer at list tail: %s\n",
181 connect_cb_struct->
callback (connect_cb_struct->
cls,
213 "Channel from peer %s (peer_cls) disconnects\n",
254 .version_max = { 1, 0 },
255 .version_min = { 1, 0 },
259 "(%s) Going to connect to core\n",
268 GNUNET_TESTING_ARM_get_trait_config (
270 &connect_state->
cfg))
300 char *arm_service_label)
struct GNUNET_MQ_MessageHandlers handlers[]
struct GNUNET_MQ_Handle * mq
struct GNUNET_MessageHeader * msg
static int ret
Final status code.
static char * peer_id
Option –peer.
static struct GNUNET_TESTING_Interpreter * is
struct GNUNET_PeerIdentity my_identity
Our peer identity.
Core service; the main API for encrypted P2P communications.
struct GNUNET_TESTING_Trait GNUNET_CORE_TESTING_make_trait_connect(const struct GNUNET_TESTING_CORE_ConnectState *value)
void(* GNUNET_TESTING_CORE_handle_msg)(void *cls, struct GNUNET_TESTING_CORE_Channel *channel, const struct GNUNET_TESTING_CORE_Message *msg)
struct GNUNET_TESTING_Command GNUNET_TESTING_command_new_ac(void *cls, const char *label, GNUNET_TESTING_CommandRunRoutine run, GNUNET_TESTING_CommandCleanupRoutine cleanup, GNUNET_TESTING_CommandGetTraits traits, struct GNUNET_TESTING_AsyncContext *ac)
Create a new command that may be asynchronous.
void GNUNET_TESTING_async_finish(struct GNUNET_TESTING_AsyncContext *ac)
The asynchronous command of ac has finished.
#define GNUNET_TESTING_FAIL(is)
Print failing line number and trigger shutdown.
const struct GNUNET_TESTING_Command * GNUNET_TESTING_interpreter_lookup_command(struct GNUNET_TESTING_Interpreter *is, const char *label)
Lookup command by label.
struct GNUNET_TESTING_Trait GNUNET_TESTING_trait_end(void)
"end" of traits array.
enum GNUNET_GenericReturnValue GNUNET_TESTING_get_trait(const struct GNUNET_TESTING_Trait *traits, const void **ret, const char *trait, unsigned int index)
Obtain value of a trait from a command.
GNUNET_CORE_PeerClass
The peer class gives a hint about the capabilities of a peer.
struct GNUNET_CORE_Handle * GNUNET_CORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, GNUNET_CORE_StartupCallback init, GNUNET_CORE_ConnectEventHandler connects, GNUNET_CORE_DisconnectEventHandler disconnects, const struct GNUNET_MQ_MessageHandler *handlers, struct GNUNET_CORE_ServiceInfo *service_info)
Connect to the core service.
void GNUNET_CORE_disconnect(struct GNUNET_CORE_Handle *handle)
Disconnect from the core service.
@ GNUNET_CORE_SERVICE_TEST
Identifier for testing the api.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
GNUNET_GenericReturnValue
Named constants for return values.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
Gnunet service info - identifying compatibility with a range of version of a service communicating ov...
enum GNUNET_CORE_Service service
Identifier of the service on top of CORE.
Handle to a message queue.
Message handler for a specific message type.
The identity of the host (wraps the signing key of the peer).
struct GNUNET_MQ_Handle * mq
struct GNUNET_TESTING_CORE_ConnectState * connect_state
struct GNUNET_PeerIdentity peer_id
GNUNET_TESTING_CORE_connect_cb callback
struct GNUNET_TESTING_CORE_ConnectCb * connect_cbs
Connect callback TODO we probably only need a single one.
GNUNET_TESTING_CORE_handle_msg * recv_handlers
Receive callback.
struct GNUNET_TESTING_AsyncContext ac
struct GNUNET_TESTING_CORE_Channel * channels_tail
struct GNUNET_TESTING_CORE_Channel * channels_head
uint32_t recv_handlers_len
struct GNUNET_CORE_Handle * h
enum GNUNET_GenericReturnValue finished
const struct GNUNET_CONFIGURATION_Handle * cfg
struct GNUNET_PeerIdentity peer_id
A command to be run by the interpreter.
struct GNUNET_TESTING_CommandLabel label
Label for the command.
Global state of the interpreter, used by a command to access information about other commands.
A struct GNUNET_TESTING_Trait can be used to exchange data between cmds.
unsigned int index
Index number associated with the trait.
static enum GNUNET_GenericReturnValue traits(void *cls, const void **ret, const char *trait, unsigned int index)
This function prepares an array with traits.
static void exec_connect_run(void *cls, struct GNUNET_TESTING_Interpreter *is)
static void * connect_cb(void *cls, const struct GNUNET_PeerIdentity *peer_id, struct GNUNET_MQ_Handle *mq, enum GNUNET_CORE_PeerClass class)
const struct GNUNET_TESTING_Command GNUNET_TESTING_CORE_cmd_connect(const char *label, const char *node_id, char *arm_service_label)
static void init_cb(void *cls, const struct GNUNET_PeerIdentity *my_identity)
static void exec_connect_cleanup(void *cls)
static void disconnect_cb(void *cls, const struct GNUNET_PeerIdentity *peer, void *peer_cls)
static enum GNUNET_GenericReturnValue connect_traits(void *cls, const void **ret, const char *trait, unsigned int index)
This function prepares an array with traits.
#define LOG(kind,...)
Generic logging shortcut.
static void handle_test(void *cls, const struct GNUNET_TESTING_CORE_Message *msg)