/*
This file is part of GNUnet
- (C) 2008--2013 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2008--2013 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
GNUNET_assert (OP_PEER_DESTROY == opc->type);
GNUNET_assert (NULL != peer);
opc->state = OPC_STATE_STARTED;
- msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerDestroyMessage));
+ msg = GNUNET_new (struct GNUNET_TESTBED_PeerDestroyMessage);
msg->header.size = htons (sizeof (struct GNUNET_TESTBED_PeerDestroyMessage));
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_DESTROY_PEER);
msg->peer_id = htonl (peer->unique_id);
GNUNET_assert (NULL != (peer = data->peer));
GNUNET_assert ((TESTBED_PS_CREATED == peer->state) || (TESTBED_PS_STOPPED == peer->state));
opc->state = OPC_STATE_STARTED;
- msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerStartMessage));
+ msg = GNUNET_new (struct GNUNET_TESTBED_PeerStartMessage);
msg->header.size = htons (sizeof (struct GNUNET_TESTBED_PeerStartMessage));
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_START_PEER);
msg->peer_id = htonl (peer->unique_id);
GNUNET_assert (NULL != (peer = data->peer));
GNUNET_assert (TESTBED_PS_STARTED == peer->state);
opc->state = OPC_STATE_STARTED;
- msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerStopMessage));
+ msg = GNUNET_new (struct GNUNET_TESTBED_PeerStopMessage);
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_STOP_PEER);
msg->header.size = htons (sizeof (struct GNUNET_TESTBED_PeerStopMessage));
msg->peer_id = htonl (peer->unique_id);
opc->state = OPC_STATE_STARTED;
data = opc->data;
GNUNET_assert (NULL != data);
- msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_OverlayConnectMessage));
+ msg = GNUNET_new (struct GNUNET_TESTBED_OverlayConnectMessage);
msg->header.size =
htons (sizeof (struct GNUNET_TESTBED_OverlayConnectMessage));
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT);
struct OperationContext *opc;
static uint32_t id_gen;
- peer = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Peer));
+ peer = GNUNET_new (struct GNUNET_TESTBED_Peer);
peer->controller = controller;
peer->host = host;
peer->unique_id = id_gen++;
peer->state = TESTBED_PS_INVALID;
- data = GNUNET_malloc (sizeof (struct PeerCreateData));
+ data = GNUNET_new (struct PeerCreateData);
data->host = host;
data->cfg = cfg;
data->cb = cb;
data->cls = cls;
data->peer = peer;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->c = controller;
opc->data = data;
opc->id = GNUNET_TESTBED_get_next_op_id (controller);
struct OperationContext *opc;
struct PeerEventData *data;
- data = GNUNET_malloc (sizeof (struct PeerEventData));
+ data = GNUNET_new (struct PeerEventData);
data->peer = peer;
data->pcc = pcc;
data->pcc_cls = pcc_cls;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->c = peer->controller;
opc->data = data;
opc->op_cls = op_cls;
struct OperationContext *opc;
struct PeerEventData *data;
- data = GNUNET_malloc (sizeof (struct PeerEventData));
+ data = GNUNET_new (struct PeerEventData);
data->peer = peer;
data->pcc = pcc;
data->pcc_cls = pcc_cls;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->c = peer->controller;
opc->data = data;
opc->op_cls = op_cls;
GNUNET_assert (GNUNET_TESTBED_PIT_GENERIC != pit);
GNUNET_assert (NULL != cb);
- data = GNUNET_malloc (sizeof (struct PeerInfoData));
+ data = GNUNET_new (struct PeerInfoData);
data->peer = peer;
data->pit = pit;
data->cb = cb;
data->cb_cls = cb_cls;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->c = peer->controller;
opc->data = data;
opc->type = OP_PEER_INFO;
struct PeerReconfigureData *data;
size_t csize;
- data = GNUNET_malloc (sizeof (struct PeerReconfigureData));
+ data = GNUNET_new (struct PeerReconfigureData);
data->peer = peer;
data->config = GNUNET_CONFIGURATION_serialize (cfg, &csize);
if (NULL == data->config)
return NULL;
}
data->cfg_size = (uint16_t) csize;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->c = peer->controller;
opc->data = data;
opc->type = OP_PEER_RECONFIGURE;
{
struct OperationContext *opc;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->data = peer;
opc->c = peer->controller;
opc->id = GNUNET_TESTBED_get_next_op_id (peer->controller);
struct OverlayConnectData *data;
GNUNET_assert ((TESTBED_PS_STARTED == p1->state) && (TESTBED_PS_STARTED == p2->state));
- data = GNUNET_malloc (sizeof (struct OverlayConnectData));
+ data = GNUNET_new (struct OverlayConnectData);
data->p1 = p1;
data->p2 = p2;
data->cb = cb;
data->cb_cls = cb_cls;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->data = data;
opc->c = p1->controller;
opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
msize += sizeof (struct GNUNET_TESTBED_ManagePeerServiceMessage);
if (GNUNET_SERVER_MAX_MESSAGE_SIZE < msize)
return NULL;
- data = GNUNET_malloc (sizeof (struct ManageServiceData));
+ data = GNUNET_new (struct ManageServiceData);
data->cb = cb;
data->cb_cls = cb_cls;
data->peer = peer;
data->service_name = GNUNET_strdup (service_name);
data->start = start;
data->msize = (uint16_t) msize;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc = GNUNET_new (struct OperationContext);
opc->data = data;
opc->c = peer->controller;
opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);