BitLab 0.1.0
BitLab: A Browser for the Bitcoin P2P Network and Blockchain
Loading...
Searching...
No Matches
peer_queue.h
Go to the documentation of this file.
1#ifndef __PEER_QUEUE_H
2#define __PEER_QUEUE_H
3
4#define MAX_PEERS 1000
5
6#include <stdbool.h>
7#include <stddef.h>
8
15typedef struct
16{
17 char ip[256];
18 int port;
19} Peer;
20
27void add_peer_to_queue(const char* ip, int port);
28
35
43bool get_peer_from_queue(char* buffer, size_t buffer_size);
44
48void clear_peer_queue();
49
53void print_peer_queue();
54
58Peer* get_peer_queue(int* count);
59
60#endif // __PEER_QUEUE_H
Peer * get_peer_queue(int *count)
Get the peer queue.
Definition peer_queue.c:118
bool get_peer_from_queue(char *buffer, size_t buffer_size)
Get a peer from the queue.
Definition peer_queue.c:80
void add_peer_to_queue(const char *ip, int port)
Add a peer to the queue.
Definition peer_queue.c:15
void clear_peer_queue()
Clear the peer queue.
Definition peer_queue.c:95
void print_peer_queue()
Print the peer queue.
Definition peer_queue.c:103
bool is_peer_queue_empty()
Check if the peer queue is empty.
Definition peer_queue.c:72
The peer structure used to store the peer information obtained by peer discovery process.
Definition peer_queue.h:16
int port
Definition peer_queue.h:18