GNUnet  0.19.4
testbed_api_peers.h File Reference

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

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.

39 {
44 
49 
54 
59 };
@ TESTBED_PS_INVALID
State to signify that this peer is invalid.
@ TESTBED_PS_STOPPED
The peer is stopped.
@ TESTBED_PS_CREATED
The peer has been created.
@ TESTBED_PS_STARTED
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.

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);
347  msg->operation_id = GNUNET_htonll (operation_id);
348  return msg;
349 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static char * peer_id
Option –peer.
Definition: gnunet-cadet.c:42
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:37
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_INFORMATION
Message to get a peer's information.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
Message sent from client to testing service to obtain the configuration of a peer.
Definition: testbed.h:582
uint64_t operation_id
Operation ID that is used to identify this operation.
Definition: testbed.h:596

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

Referenced by opstart_peer_getinfo(), and opstart_service_connect().

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.

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_tail
Peer list DLL tail.
static struct GNUNET_TESTBED_Peer * peer_list_head
Peer list DLL head.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.

References GNUNET_CONTAINER_DLL_insert_tail, peer, peer_list_head, and peer_list_tail.

Referenced by handle_peer_create_success().

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.

67 {
69 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.

References GNUNET_CONTAINER_DLL_remove, peer, peer_list_head, and peer_list_tail.

Referenced by GNUNET_TESTBED_cleanup_peers_(), and handle_opsuccess().

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.

77 {
78  struct GNUNET_TESTBED_Peer *peer;
79 
80  while (NULL != (peer = peer_list_head))
81  {
83  GNUNET_free (peer);
84  }
85 }
#define GNUNET_free(ptr)
Wrapper around free.
A peer controlled by the testing framework.
void GNUNET_TESTBED_peer_deregister_(struct GNUNET_TESTBED_Peer *peer)
Removes a peer from the peer list.

References GNUNET_free, GNUNET_TESTBED_peer_deregister_(), peer, and peer_list_head.

Referenced by handle_opsuccess().

Here is the call graph for this function:
Here is the caller graph for this function: