mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Remove some magic numbers
This commit is contained in:
parent
6e6f2bfdbe
commit
28e331b5fd
@ -152,13 +152,13 @@ bool netplay_handshake_init_send(netplay_t *netplay, struct netplay_connection *
|
||||
struct nick_buf_s
|
||||
{
|
||||
uint32_t cmd[2];
|
||||
char nick[32];
|
||||
char nick[NETPLAY_NICK_LEN];
|
||||
};
|
||||
|
||||
struct password_buf_s
|
||||
{
|
||||
uint32_t cmd[2];
|
||||
char password[64];
|
||||
char password[NETPLAY_PASS_HASH_LEN];
|
||||
};
|
||||
|
||||
#define RECV(buf, sz) \
|
||||
@ -175,7 +175,7 @@ static netplay_t *handshake_password_netplay;
|
||||
static void handshake_password(void *ignore, const char *line)
|
||||
{
|
||||
struct password_buf_s password_buf;
|
||||
char password[8+128]; /* 8 for salt, 128 for password */
|
||||
char password[8+NETPLAY_PASS_LEN]; /* 8 for salt, 128 for password */
|
||||
uint32_t cmd[2];
|
||||
netplay_t *netplay = handshake_password_netplay;
|
||||
struct netplay_connection *connection = &netplay->connections[0];
|
||||
@ -456,7 +456,7 @@ bool netplay_handshake_pre_nick(netplay_t *netplay, struct netplay_connection *c
|
||||
bool netplay_handshake_pre_password(netplay_t *netplay, struct netplay_connection *connection, bool *had_input)
|
||||
{
|
||||
struct password_buf_s password_buf, corr_password_buf;
|
||||
char password[8+128]; /* 8 for salt, 128 for password */
|
||||
char password[8+NETPLAY_PASS_LEN]; /* 8 for salt */
|
||||
ssize_t recvd;
|
||||
char msg[512];
|
||||
|
||||
|
@ -42,6 +42,10 @@
|
||||
#define RARCH_DEFAULT_PORT 55435
|
||||
#define RARCH_DEFAULT_NICK "Anonymous"
|
||||
|
||||
#define NETPLAY_NICK_LEN 32
|
||||
#define NETPLAY_PASS_LEN 128
|
||||
#define NETPLAY_PASS_HASH_LEN 64 /* length of a SHA-256 hash */
|
||||
|
||||
#define PREV_PTR(x) ((x) == 0 ? netplay->buffer_size - 1 : (x) - 1)
|
||||
#define NEXT_PTR(x) ((x + 1) % netplay->buffer_size)
|
||||
|
||||
@ -246,7 +250,7 @@ struct netplay_connection
|
||||
struct sockaddr_storage addr;
|
||||
|
||||
/* Nickname of peer */
|
||||
char nick[32];
|
||||
char nick[NETPLAY_NICK_LEN];
|
||||
|
||||
/* Salt associated with password transaction */
|
||||
uint32_t salt;
|
||||
@ -270,13 +274,13 @@ struct netplay
|
||||
bool is_server;
|
||||
|
||||
/* Our nickname */
|
||||
char nick[32];
|
||||
char nick[NETPLAY_NICK_LEN];
|
||||
|
||||
/* TCP connection for listening (server only) */
|
||||
int listen_fd;
|
||||
|
||||
/* Password required to connect (server only) */
|
||||
char password[128];
|
||||
char password[NETPLAY_PASS_LEN];
|
||||
|
||||
/* Our player number */
|
||||
uint32_t self_player;
|
||||
|
Loading…
x
Reference in New Issue
Block a user