|
BitLab 0.1.0
BitLab: A Browser for the Bitcoin P2P Network and Blockchain
|
#include <stdbool.h>#include <stddef.h>Go to the source code of this file.
Data Structures | |
| struct | Peer |
| The peer structure used to store the peer information obtained by peer discovery process. More... | |
Macros | |
| #define | MAX_PEERS 1000 |
Functions | |
| void | add_peer_to_queue (const char *ip, int port) |
| Add a peer to the queue. | |
| bool | is_peer_queue_empty () |
| Check if the peer queue is empty. | |
| bool | get_peer_from_queue (char *buffer, size_t buffer_size) |
| Get a peer from the queue. | |
| void | clear_peer_queue () |
| Clear the peer queue. | |
| void | print_peer_queue () |
| Print the peer queue. | |
| Peer * | get_peer_queue (int *count) |
| Get the peer queue. | |
| #define MAX_PEERS 1000 |
Definition at line 4 of file peer_queue.h.
| void add_peer_to_queue | ( | const char * | ip, |
| int | port | ||
| ) |
Add a peer to the queue.
| ip | The IP address of the peer. |
| port | The port of the peer. |
Definition at line 15 of file peer_queue.c.
References BITLAB_LOG, Peer::ip, LOG_INFO, log_message(), LOG_WARN, MAX_PEERS, peer_queue, peer_queue_end, peer_queue_mutex, peer_queue_start, and Peer::port.
Referenced by handle_peer_discovery(), and send_getaddr_and_wait().
| void clear_peer_queue | ( | ) |
Clear the peer queue.
Definition at line 95 of file peer_queue.c.
References peer_queue_end, peer_queue_mutex, and peer_queue_start.
| bool get_peer_from_queue | ( | char * | buffer, |
| size_t | buffer_size | ||
| ) |
Get a peer from the queue.
| buffer | The buffer to store the peer. |
| buffer_size | The size of the buffer. |
Definition at line 80 of file peer_queue.c.
References MAX_PEERS, peer_queue, peer_queue_end, peer_queue_mutex, and peer_queue_start.
| Peer * get_peer_queue | ( | int * | count | ) |
Get the peer queue.
Definition at line 118 of file peer_queue.c.
References MAX_PEERS, peer_queue, peer_queue_end, peer_queue_mutex, and peer_queue_start.
Referenced by send_addr().
| bool is_peer_queue_empty | ( | ) |
Check if the peer queue is empty.
Definition at line 72 of file peer_queue.c.
References peer_queue_end, peer_queue_mutex, and peer_queue_start.
| void print_peer_queue | ( | ) |
Print the peer queue.
Definition at line 103 of file peer_queue.c.
References guarded_print_line(), MAX_PEERS, peer_queue, peer_queue_end, peer_queue_mutex, and peer_queue_start.
Referenced by cli_peer_discovery().