1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[bittorrent] enum bittorrent_message_id -> bittorrent_message_id_T

This commit is contained in:
Witold Filipczyk 2022-01-28 16:55:27 +01:00
parent 23d687d7f6
commit 04b2dce53f
4 changed files with 12 additions and 10 deletions

View File

@ -57,10 +57,10 @@ get_peer_id(bittorrent_id_T peer_id)
}
char *
get_peer_message(enum bittorrent_message_id message_id)
get_peer_message(bittorrent_message_id_T message_id)
{
static struct {
enum bittorrent_message_id message_id;
bittorrent_message_id_T message_id;
char *name;
} messages[] = {
{ BITTORRENT_MESSAGE_INCOMPLETE, "incomplete" },

View File

@ -100,6 +100,8 @@ enum bittorrent_message_id {
BITTORRENT_MESSAGE_CANCEL = 8,
};
typedef char bittorrent_message_id_T;
/** The peer request matches information sent in the request and cancel messages
* in the peer-wire protocol. See the piece cache header file (cache.h) for more
* information about the cloned flag. */
@ -112,7 +114,7 @@ struct bittorrent_peer_request {
uint16_t block; /**< The block index in the piece. */
enum bittorrent_message_id id; /**< ID of queued pending message. */
bittorrent_message_id_T id; /**< ID of queued pending message. */
unsigned int cloned:1; /**< The request was cloned. */
unsigned int requested:1; /**< Whether it has been requested. */
@ -397,7 +399,7 @@ void done_bittorrent_message(struct bittorrent_message *message);
/* ************************************************************************** */
char *get_peer_id(bittorrent_id_T peer);
char *get_peer_message(enum bittorrent_message_id message_id);
char *get_peer_message(bittorrent_message_id_T message_id);
/* ************************************************************************** */
/* Peer request management: */

View File

@ -363,7 +363,7 @@ do_send_bittorrent_peer_message(struct bittorrent_peer_connection *peer,
* connection struct to disappear from under us. */
void
send_bittorrent_peer_message(struct bittorrent_peer_connection *peer,
enum bittorrent_message_id message_id, ...)
bittorrent_message_id_T message_id, ...)
{
struct bittorrent_peer_request message_store, *message = &message_store;
va_list args;
@ -430,12 +430,12 @@ get_bittorrent_peer_integer(struct read_buffer *buffer, int offset)
return ntohl(*((uint32_t *) (buffer->data + offset)));
}
static enum bittorrent_message_id
static bittorrent_message_id_T
check_bittorrent_peer_message(struct bittorrent_peer_connection *peer,
struct read_buffer *buffer, uint32_t *length)
{
uint32_t message_length;
enum bittorrent_message_id message_id;
bittorrent_message_id_T message_id;
*length = 0;
@ -464,7 +464,7 @@ check_bittorrent_peer_message(struct bittorrent_peer_connection *peer,
static enum bittorrent_state
read_bittorrent_peer_message(struct bittorrent_peer_connection *peer,
enum bittorrent_message_id message_id,
bittorrent_message_id_T message_id,
struct read_buffer *buffer, uint32_t message_length,
int *write_errno)
{
@ -641,7 +641,7 @@ read_bittorrent_peer_data(struct socket *socket, struct read_buffer *buffer)
/* All messages atleast contains an integer prefix. */
while (buffer->length > sizeof(uint32_t)) {
enum bittorrent_message_id message_id;
bittorrent_message_id_T message_id;
uint32_t length;
int write_errno = 0;

View File

@ -25,7 +25,7 @@ update_bittorrent_peer_connection_stats(struct bittorrent_peer_connection *peer,
void
send_bittorrent_peer_message(struct bittorrent_peer_connection *peer,
enum bittorrent_message_id message_id, ...);
bittorrent_message_id_T message_id, ...);
static void inline
set_bittorrent_peer_interested(struct bittorrent_peer_connection *peer)