GNUnet  0.10.x
Data Structures | Enumerations | Functions
testbed_api_peers.h File Reference

internal API to access the 'peers' subsystem More...

#include "gnunet_testbed_service.h"
#include "gnunet_helper_lib.h"
Include dependency graph for testbed_api_peers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GNUNET_TESTBED_Peer
 A peer controlled by the testing framework. More...
 
struct  PeerCreateData
 Data for the OperationType OP_PEER_CREATE. More...
 
struct  PeerEventData
 Data for OperationType OP_PEER_START and OP_PEER_STOP. More...
 
struct  PeerDestroyData
 Data for the OperationType OP_PEER_DESTROY;. More...
 
struct  PeerInfoData
 Data for the OperationType OP_PEER_INFO. More...
 
struct  PeerReconfigureData
 Data for the operations of type OP_PEER_RECONFIGURE. More...
 
struct  OverlayConnectData
 Data structure for OperationType OP_OVERLAY_CONNECT. More...
 
struct  ManageServiceData
 

Enumerations

enum  PeerState { TESTBED_PS_INVALID, TESTBED_PS_CREATED, TESTBED_PS_STARTED, TESTBED_PS_STOPPED }
 Enumeration of possible states a peer could be in. More...
 

Functions

struct GNUNET_TESTBED_PeerGetConfigurationMessageGNUNET_TESTBED_generate_peergetconfig_msg_ (uint32_t peer_id, uint64_t operation_id)
 Generate PeerGetConfigurationMessage. More...
 
void GNUNET_TESTBED_peer_register_ (struct GNUNET_TESTBED_Peer *peer)
 Adds a peer to the peer list. More...
 
void GNUNET_TESTBED_peer_deregister_ (struct GNUNET_TESTBED_Peer *peer)
 Removes a peer from the peer list. More...
 
void GNUNET_TESTBED_cleanup_peers_ (void)
 Frees all peers. More...
 

Detailed Description

internal API to access the 'peers' subsystem

Author
Christian Grothoff
Sree Harsha Totakura

Definition in file testbed_api_peers.h.

Enumeration Type Documentation

◆ PeerState

enum PeerState

Enumeration of possible states a peer could be in.

Enumerator
TESTBED_PS_INVALID 

State to signify that this peer is invalid.

TESTBED_PS_CREATED 

The peer has been created.

TESTBED_PS_STARTED 

The peer is running.

TESTBED_PS_STOPPED 

The peer is stopped.

Definition at line 38 of file testbed_api_peers.h.

38  {
43 
48 
53 
58 };
The peer is stopped.
The peer has been created.
State to signify that this peer is invalid.
The peer is running.

Function Documentation

◆ GNUNET_TESTBED_generate_peergetconfig_msg_()

struct GNUNET_TESTBED_PeerGetConfigurationMessage* GNUNET_TESTBED_generate_peergetconfig_msg_ ( uint32_t  peer_id,
uint64_t  operation_id 
)

Generate PeerGetConfigurationMessage.

Parameters
peer_idthe id of the peer whose information we have to get
operation_idthe ip of the operation that should be represented in the message
Returns
the PeerGetConfigurationMessage

Definition at line 335 of file testbed_api_peers.c.

References GNUNET_htonll(), GNUNET_malloc, GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_INFORMATION, GNUNET_TESTBED_PeerGetConfigurationMessage::header, msg, GNUNET_TESTBED_PeerGetConfigurationMessage::operation_id, GNUNET_TESTBED_PeerGetConfigurationMessage::peer_id, GNUNET_MessageHeader::size, and GNUNET_MessageHeader::type.

Referenced by opstart_peer_getinfo(), and opstart_service_connect().

337 {
339 
340  msg =
341  GNUNET_malloc(sizeof
343  msg->header.size =
344  htons(sizeof(struct GNUNET_TESTBED_PeerGetConfigurationMessage));
346  msg->peer_id = htonl(peer_id);
348  return msg;
349 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
Message sent from client to testing service to obtain the configuration of a peer.
Definition: testbed.h:563
static char * peer_id
Option –peer.
Definition: gnunet-cadet.c:42
uint32_t peer_id
Unique ID for the peer.
Definition: testbed.h:572
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
uint64_t operation_id
Operation ID that is used to identify this operation.
Definition: testbed.h:577
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_INFORMATION.
Definition: testbed.h:567
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:35
#define GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_INFORMATION
Message to get a peer's information.
#define GNUNET_malloc(size)
Wrapper around malloc.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_peer_register_()

void GNUNET_TESTBED_peer_register_ ( struct GNUNET_TESTBED_Peer peer)

Adds a peer to the peer list.

Parameters
peerthe peer to add to the peer list

Definition at line 54 of file testbed_api_peers.c.

References GNUNET_CONTAINER_DLL_insert_tail.

Referenced by handle_peer_create_success().

55 {
57 }
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
static struct GNUNET_TESTBED_Peer * peer_list_head
Peer list DLL head.
static struct GNUNET_TESTBED_Peer * peer_list_tail
Peer list DLL tail.
Here is the caller graph for this function:

◆ GNUNET_TESTBED_peer_deregister_()

void GNUNET_TESTBED_peer_deregister_ ( struct GNUNET_TESTBED_Peer peer)

Removes a peer from the peer list.

Parameters
peerthe peer to remove

Definition at line 66 of file testbed_api_peers.c.

References GNUNET_CONTAINER_DLL_remove.

Referenced by GNUNET_TESTBED_cleanup_peers_(), and handle_opsuccess().

67 {
69 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
static struct GNUNET_TESTBED_Peer * peer_list_head
Peer list DLL head.
static struct GNUNET_TESTBED_Peer * peer_list_tail
Peer list DLL tail.
Here is the caller graph for this function:

◆ GNUNET_TESTBED_cleanup_peers_()

void GNUNET_TESTBED_cleanup_peers_ ( void  )

Frees all peers.

Definition at line 76 of file testbed_api_peers.c.

References GNUNET_free, GNUNET_TESTBED_peer_deregister_(), and peer.

Referenced by handle_opsuccess().

77 {
78  struct GNUNET_TESTBED_Peer *peer;
79 
80  while (NULL != (peer = peer_list_head))
81  {
83  GNUNET_free(peer);
84  }
85 }
void GNUNET_TESTBED_peer_deregister_(struct GNUNET_TESTBED_Peer *peer)
Removes a peer from the peer list.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
static struct GNUNET_TESTBED_Peer * peer_list_head
Peer list DLL head.
A peer controlled by the testing framework.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function: