ascii-chat 0.8.38
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
packets.c File Reference

Ring consensus packet definitions and helpers. More...

Go to the source code of this file.

Functions

const char * consensus_packet_type_name (uint16_t type)
 
size_t consensus_get_min_packet_size (uint16_t type)
 

Detailed Description

Ring consensus packet definitions and helpers.

Definition in file packets.c.

Function Documentation

◆ consensus_get_min_packet_size()

size_t consensus_get_min_packet_size ( uint16_t  type)

Definition at line 26 of file packets.c.

26 {
27 switch (type) {
28 case 6100: // PACKET_TYPE_RING_MEMBERS
29 return sizeof(acip_ring_members_t);
30 case 6101: // PACKET_TYPE_STATS_COLLECTION_START
31 return sizeof(acip_stats_collection_start_t);
32 case 6102: // PACKET_TYPE_STATS_UPDATE
33 return sizeof(acip_stats_update_t);
34 case 6103: // PACKET_TYPE_RING_ELECTION_RESULT
35 return sizeof(acip_ring_election_result_t);
36 case 6104: // PACKET_TYPE_STATS_ACK
37 return sizeof(acip_stats_ack_t);
38 default:
39 return 0;
40 }
41}

◆ consensus_packet_type_name()

const char * consensus_packet_type_name ( uint16_t  type)

Definition at line 9 of file packets.c.

9 {
10 switch (type) {
11 case 6100: // PACKET_TYPE_RING_MEMBERS
12 return "RING_MEMBERS";
13 case 6101: // PACKET_TYPE_STATS_COLLECTION_START
14 return "STATS_COLLECTION_START";
15 case 6102: // PACKET_TYPE_STATS_UPDATE
16 return "STATS_UPDATE";
17 case 6103: // PACKET_TYPE_RING_ELECTION_RESULT
18 return "RING_ELECTION_RESULT";
19 case 6104: // PACKET_TYPE_STATS_ACK
20 return "STATS_ACK";
21 default:
22 return "UNKNOWN_CONSENSUS_PACKET";
23 }
24}