Atrinik Client  4.0
Data Structures | Typedefs | Functions | Variables
commands.c File Reference
#include <global.h>
#include <region_map.h>
#include <toolkit/packet.h>
#include <toolkit/path.h>
#include <toolkit/string.h>
#include <toolkit/x11.h>
#include <toolkit/socket_crypto.h>

Go to the source code of this file.

Data Structures

struct  socket_crypto_popup
 

Typedefs

typedef struct socket_crypto_popup socket_crypto_popup_t
 

Functions

void socket_command_book (uint8_t *data, size_t len, size_t pos)
 
void socket_command_setup (uint8_t *data, size_t len, size_t pos)
 
void socket_command_anim (uint8_t *data, size_t len, size_t pos)
 
void socket_command_image (uint8_t *data, size_t len, size_t pos)
 
void socket_command_drawinfo (uint8_t *data, size_t len, size_t pos)
 
void socket_command_target (uint8_t *data, size_t len, size_t pos)
 
void socket_command_stats (uint8_t *data, size_t len, size_t pos)
 
void socket_command_player (uint8_t *data, size_t len, size_t pos)
 
void command_item_update (uint8_t *data, size_t len, size_t *pos, uint32_t flags, object *tmp)
 
void socket_command_item (uint8_t *data, size_t len, size_t pos)
 
void socket_command_item_update (uint8_t *data, size_t len, size_t pos)
 
void socket_command_item_delete (uint8_t *data, size_t len, size_t pos)
 
static void map_play_footstep (void)
 
void socket_command_mapstats (uint8_t *data, size_t len, size_t pos)
 
void socket_command_map (uint8_t *data, size_t len, size_t pos)
 
void socket_command_version (uint8_t *data, size_t len, size_t pos)
 
void socket_command_compressed (uint8_t *data, size_t len, size_t pos)
 
void socket_command_control (uint8_t *data, size_t len, size_t pos)
 
 CASSERT_ARRAY (socket_crypto_popup_texts, SOCKET_CRYPTO_CB_MAX)
 
 CASSERT_ARRAY (socket_crypto_popup_delays, SOCKET_CRYPTO_CB_MAX)
 
static int popup_draw (popup_struct *popup)
 
static int popup_event (popup_struct *popup, SDL_Event *event)
 
static int popup_destroy_callback (popup_struct *popup)
 
static const char * popup_clipboard_copy_func (popup_struct *popup)
 
static void socket_crypto_cb (socket_crypto_t *crypto, const socket_crypto_cb_ctx_t *ctx)
 
static void socket_command_crypto_abort (void)
 
static void socket_command_crypto_hello (uint8_t *data, size_t len, size_t pos)
 
static void socket_command_crypto_key (uint8_t *data, size_t len, size_t pos)
 
static void socket_command_crypto_curves (uint8_t *data, size_t len, size_t pos)
 
static void socket_command_crypto_pubkey (uint8_t *data, size_t len, size_t pos)
 
static void socket_command_crypto_secret (uint8_t *data, size_t len, size_t pos)
 
static void socket_command_crypto_done (uint8_t *data, size_t len, size_t pos)
 
void socket_command_crypto (uint8_t *data, size_t len, size_t pos)
 

Variables

static const char *const socket_crypto_popup_texts []
 
static const int socket_crypto_popup_delays []
 

Detailed Description

Handles commands received by the server. This does not necessarily handle all the commands - some might be in other files.

Definition in file commands.c.

Typedef Documentation

Data associated with a single crypto warning popup.

Function Documentation

static void map_play_footstep ( void  )
static

Plays the footstep sounds when moving on the map.

Definition at line 598 of file commands.c.

static const char* popup_clipboard_copy_func ( popup_struct popup)
static

Function used to get contents for clipboard copy operation.

Parameters
popupPopup.
Returns
Contents to copy.

Definition at line 1155 of file commands.c.

static int popup_destroy_callback ( popup_struct popup)
static

Function used right before the visible popup is destroyed using popup_destroy_visible().

Parameters
popupThe popup.
Returns
1 to proceed with the destruction of the popup, 0 otherwise.

Definition at line 1140 of file commands.c.

static int popup_draw ( popup_struct popup)
static

Function used for drawing on the popup's surface.

Parameters
popupThe popup.
Returns
0 to destroy the popup, 1 otherwise.

Definition at line 1014 of file commands.c.

static int popup_event ( popup_struct popup,
SDL_Event *  event 
)
static

Function used for handling mouse/key events when popup is visible.

Parameters
eventSDL event.
Return values
-1Did not handle the event.
0Did not handle the event, but allow other keyboard events.
1Handled the event.

Definition at line 1109 of file commands.c.

void socket_command_anim ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 76 of file commands.c.

void socket_command_book ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 40 of file commands.c.

void socket_command_compressed ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 931 of file commands.c.

void socket_command_control ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 956 of file commands.c.

void socket_command_crypto ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Handler for the crypto client command.

Definition at line 1527 of file commands.c.

static void socket_command_crypto_abort ( void  )
static

Aborts the connection due to a crypto error.

Definition at line 1187 of file commands.c.

static void socket_command_crypto_curves ( uint8_t *  data,
size_t  len,
size_t  pos 
)
static

Handler for the crypto curves sub-command.

Definition at line 1335 of file commands.c.

static void socket_command_crypto_done ( uint8_t *  data,
size_t  len,
size_t  pos 
)
static

Handler for the crypto done sub-command.

Definition at line 1497 of file commands.c.

static void socket_command_crypto_hello ( uint8_t *  data,
size_t  len,
size_t  pos 
)
static

Handler for the crypto hello sub-command.

Definition at line 1202 of file commands.c.

static void socket_command_crypto_key ( uint8_t *  data,
size_t  len,
size_t  pos 
)
static

Handler for the crypto key sub-command.

Definition at line 1280 of file commands.c.

static void socket_command_crypto_pubkey ( uint8_t *  data,
size_t  len,
size_t  pos 
)
static

Handler for the crypto pubkey sub-command.

Definition at line 1398 of file commands.c.

static void socket_command_crypto_secret ( uint8_t *  data,
size_t  len,
size_t  pos 
)
static

Handler for the crypto secret sub-command.

Definition at line 1455 of file commands.c.

void socket_command_drawinfo ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 134 of file commands.c.

void socket_command_image ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 101 of file commands.c.

void socket_command_item ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 494 of file commands.c.

void socket_command_item_delete ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 585 of file commands.c.

void socket_command_item_update ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 567 of file commands.c.

void socket_command_map ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 648 of file commands.c.

void socket_command_mapstats ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 618 of file commands.c.

void socket_command_player ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 346 of file commands.c.

void socket_command_setup ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 47 of file commands.c.

void socket_command_stats ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 166 of file commands.c.

void socket_command_target ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 153 of file commands.c.

void socket_command_version ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 918 of file commands.c.

static void socket_crypto_cb ( socket_crypto_t *  crypto,
const socket_crypto_cb_ctx_t *  ctx 
)
static

Definition at line 1163 of file commands.c.

Variable Documentation

const int socket_crypto_popup_delays[]
static
Initial value:
= {
20,
60,
}

Number of seconds that must pass before the user can click 'OK' in the crypto warning popup.

Definition at line 1006 of file commands.c.

const char* const socket_crypto_popup_texts[]
static
Initial value:
= {
"The selected server uses a self-signed certificate. This means that it's "
"impossible to verify the authenticity of the server, and someone could be "
"spying on your connection via a forged certificate.\n\n"
"It is strongly recommended NOT to proceed (especially if you've connected "
"to this server before and this warning did not appear then).\n\n"
"Do you want to proceed (and remember this choice)?",
"!!! THE PUBLIC KEY OF THE SERVER HAS CHANGED !!!\n\n"
"This is most likely an indication of an MITM (Man In The Middle) attack. "
"It is also possible the server's public key has just changed.\n\n"
"It is STRONGLY RECOMMENDED [b]NOT[/b] to connect unless you have solid "
"evidence that this is correct (eg, an announcement from the server "
"officials about the change, ideally if this announcement was at least a "
"month in advance).\n\n"
"Do you want to proceed (and remember this choice)?",
}

Text used in the crypto warning popup.

Definition at line 984 of file commands.c.