RetroArch
Classes | Macros | Functions | Variables
netplay_handshake.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <boolean.h>
#include <compat/strl.h>
#include <string/stdstring.h>
#include <rhash.h>
#include <retro_timers.h>
#include "netplay_private.h"
#include "../../autosave.h"
#include "../../configuration.h"
#include "../../content.h"
#include "../../retroarch.h"
#include "../../version.h"
Include dependency graph for netplay_handshake.c:

Classes

struct  nick_buf_s
 
struct  password_buf_s
 
struct  info_buf_s
 

Macros

#define RECV(buf, sz)
 

Functions

void netplay_log_connection (const struct sockaddr_storage *their_addr, unsigned slot, const char *nick, char *s, size_t len)
 
uint32_t netplay_impl_magic (void)
 
static uint32_t netplay_platform_magic (void)
 
static bool netplay_endian_mismatch (uint32_t pma, uint32_t pmb)
 
static int simple_rand (void)
 
static void simple_srand (unsigned int seed)
 
static uint32_t simple_rand_uint32 (void)
 
bool netplay_handshake_init_send (netplay_t *netplay, struct netplay_connection *connection)
 
bool netplay_handshake_init (netplay_t *netplay, struct netplay_connection *connection, bool *had_input)
 
static void netplay_handshake_ready (netplay_t *netplay, struct netplay_connection *connection)
 
bool netplay_handshake_info (netplay_t *netplay, struct netplay_connection *connection)
 
bool netplay_handshake_sync (netplay_t *netplay, struct netplay_connection *connection)
 
bool netplay_handshake_pre_nick (netplay_t *netplay, struct netplay_connection *connection, bool *had_input)
 
bool netplay_handshake_pre_password (netplay_t *netplay, struct netplay_connection *connection, bool *had_input)
 
bool netplay_handshake_pre_info (netplay_t *netplay, struct netplay_connection *connection, bool *had_input)
 
bool netplay_handshake_pre_sync (netplay_t *netplay, struct netplay_connection *connection, bool *had_input)
 
bool netplay_handshake (netplay_t *netplay, struct netplay_connection *connection, bool *had_input)
 

Variables

const uint32_t netplay_magic = 0x52414E50
 
static unsigned long simple_rand_next = 1
 
static netplay_thandshake_password_netplay = NULL
 

Macro Definition Documentation

◆ RECV

#define RECV (   buf,
  sz 
)
Value:
recvd = netplay_recv(&connection->recv_packet_buffer, connection->fd, (buf), (sz), false); \
if (recvd >= 0 && recvd < (ssize_t) (sz)) \
{ \
netplay_recv_reset(&connection->recv_packet_buffer); \
return true; \
} \
else if (recvd < 0)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:8418
ssize_t netplay_recv(struct socket_buffer *sbuf, int sockfd, void *buf, size_t len, bool block)
Definition: netplay_buf.c:245

Function Documentation

◆ netplay_endian_mismatch()

static bool netplay_endian_mismatch ( uint32_t  pma,
uint32_t  pmb 
)
static

netplay_endian_mismatch

Do the platform magics mismatch on endianness?

Here is the caller graph for this function:

◆ netplay_handshake()

bool netplay_handshake ( netplay_t netplay,
struct netplay_connection connection,
bool had_input 
)

netplay_handshake

Data receiver for all handshake states.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_handshake_info()

bool netplay_handshake_info ( netplay_t netplay,
struct netplay_connection connection 
)

netplay_handshake_info

Send an INFO command.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_handshake_init()

bool netplay_handshake_init ( netplay_t netplay,
struct netplay_connection connection,
bool had_input 
)

netplay_handshake_init

Data receiver for the initial part of the handshake, i.e., waiting for the netplay header.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_handshake_init_send()

bool netplay_handshake_init_send ( netplay_t netplay,
struct netplay_connection connection 
)

netplay_handshake_init_send

Initialize our handshake and send the first part of the handshake protocol.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_handshake_pre_info()

bool netplay_handshake_pre_info ( netplay_t netplay,
struct netplay_connection connection,
bool had_input 
)

netplay_handshake_pre_info

Data receiver for the third stage of server handshake, receiving the password.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_handshake_pre_nick()

bool netplay_handshake_pre_nick ( netplay_t netplay,
struct netplay_connection connection,
bool had_input 
)

netplay_handshake_pre_nick

Data receiver for the second stage of handshake, receiving the other side's nickname.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_handshake_pre_password()

bool netplay_handshake_pre_password ( netplay_t netplay,
struct netplay_connection connection,
bool had_input 
)

netplay_handshake_pre_password

Data receiver for the third, optional stage of server handshake, receiving the password and sending core/content info.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_handshake_pre_sync()

bool netplay_handshake_pre_sync ( netplay_t netplay,
struct netplay_connection connection,
bool had_input 
)

netplay_handshake_pre_sync

Data receiver for the client's third handshake stage, receiving the synchronization information.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_handshake_ready()

static void netplay_handshake_ready ( netplay_t netplay,
struct netplay_connection connection 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_handshake_sync()

bool netplay_handshake_sync ( netplay_t netplay,
struct netplay_connection connection 
)

netplay_handshake_sync

Send a SYNC command.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_impl_magic()

uint32_t netplay_impl_magic ( void  )

netplay_impl_magic:

A pseudo-hash of the RetroArch and Netplay version, so only compatible versions play together.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_log_connection()

void netplay_log_connection ( const struct sockaddr_storage their_addr,
unsigned  slot,
const char *  nick,
char *  s,
size_t  len 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ netplay_platform_magic()

static uint32_t netplay_platform_magic ( void  )
static

netplay_platform_magic

Just enough info to tell us if our platforms mismatch: Endianness and a couple of type sizes.

Format: bit 31: Reserved bit 30: 1 for big endian bits 29-15: sizeof(size_t) bits 14-0: sizeof(long)

Here is the caller graph for this function:

◆ simple_rand()

static int simple_rand ( void  )
static
Here is the caller graph for this function:

◆ simple_rand_uint32()

static uint32_t simple_rand_uint32 ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ simple_srand()

static void simple_srand ( unsigned int  seed)
static
Here is the caller graph for this function:

Variable Documentation

◆ handshake_password_netplay

netplay_t* handshake_password_netplay = NULL
static

◆ netplay_magic

const uint32_t netplay_magic = 0x52414E50

◆ simple_rand_next

unsigned long simple_rand_next = 1
static