Mario Kart 64
Loading...
Searching...
No Matches
networking.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_net.h>
#include "networking.h"
#include "main.h"
Include dependency graph for networking.c:

Macros

#define BUFFER_SIZE   10240
 

Functions

void ConnectToServer (char *ip, uint16_t port, char *username)
 
void set_username (const char *username)
 
void networking_init (char *ip, uint16_t port)
 
int networking_loop (void *data)
 
void networking_ready_up (bool value)
 
void handleReceivedData (const char *buffer, size_t bufSize)
 
void networking_cleanup (SDLNet_SocketSet socketSet)
 
void networking_disconnect (void)
 

Variables

NetworkClient dummyClient
 
NetworkClientlocalClient = NULL
 
NetworkClient clients [NETWORK_MAX_PLAYERS]
 
Network gNetwork
 
SDL_Thread * sNetworkThread
 
bool threadStarted = false
 
int isNetworkingThreadEnabled = true
 
void(* remoteConnectedHandler )(void)
 

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE   10240

Function Documentation

◆ ConnectToServer()

void ConnectToServer ( char * ip,
uint16_t port,
char * username )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleReceivedData()

void handleReceivedData ( const char * buffer,
size_t bufSize )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ networking_cleanup()

void networking_cleanup ( SDLNet_SocketSet socketSet)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ networking_disconnect()

void networking_disconnect ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ networking_init()

void networking_init ( char * ip,
uint16_t port )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ networking_loop()

int networking_loop ( void * data)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ networking_ready_up()

void networking_ready_up ( bool value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_username()

void set_username ( const char * username)
Here is the caller graph for this function:

Variable Documentation

◆ clients

◆ dummyClient

NetworkClient dummyClient

◆ gNetwork

Network gNetwork
Initial value:
= {
.enabled = false,
.tcpSocket = NULL,
.address = { 0, 64010 },
.localPlayer = &gPlayerOne,
.isConnected = false,
.loaded = false,
.playersLoaded = false,
.gameStarted = false,
}
Player * gPlayerOne
Definition main.c:79
#define NULL
Definition miniaudio.h:3851

◆ isNetworkingThreadEnabled

int isNetworkingThreadEnabled = true

◆ localClient

NetworkClient* localClient = NULL

◆ remoteConnectedHandler

void(* remoteConnectedHandler) (void) ( void )

◆ sNetworkThread

SDL_Thread* sNetworkThread

◆ threadStarted

bool threadStarted = false