Shadow Network Framework  0.0.1-alpha
C Server Library for Shadow Network Framework
Loading...
Searching...
No Matches
clt.h File Reference

This file Defines everything related to handling Clients. More...

Go to the source code of this file.

Data Structures

struct  SNF_Client_t
 The structure for each saved client. More...
 

Typedefs

typedef struct SNF_Client_t SNF_CLT
 Shortened definiton of struct SNF_Client_t .
 

Functions

void snf_clt_init (int ht_min_Size)
 Initialises the HashTable that saves the clients.
 
SNF_CLTsnf_clt_new (int Sockfd)
 Creates (and allocates) a new Client using their Sockfd, with a default SNF_CLT::UUID with the value of "00000000-0000-0000-0000-000000000000".
 
void snf_clt_free (SNF_CLT *Client)
 Frees the allocated SNF_CLT.
 
SNF_CLTsnf_clt_get_sockfd (int Sockfd)
 Searches for a SNF_CLT depending on their SNF_CLT::sock.
 
SNF_CLTsnf_clt_get_uuid (const char *uuid)
 Searches for a SNF_CLT depending on their SNF_CLT::UUID.
 
int snf_clt_check_sockfd (int Sockfd)
 Checks the existance of a SNF_CLT depending on their SNF_CLT::sock.
 
int snf_clt_check_uuid (const char *uuid)
 Checks the existance of a SNF_CLT depending on their SNF_CLT::UUID.
 
void * snf_clt_handle_new (void *arg)
 Handles new incoming Clients.
 
void * snf_clt_handle (void *arg)
 Handles existing Clients.
 
void snf_clt_connect (SNF_CLT *Client)
 Function to be called upon Client Connection.
 
void snf_clt_reconnect (SNF_CLT *Client)
 Function to be called upon Client Re-Connection.
 
void snf_clt_disconnect (SNF_CLT *Client)
 Function to be called upon Client Disconnection.
 

Detailed Description

This file Defines everything related to handling Clients.

Typedef Documentation

◆ SNF_CLT

typedef struct SNF_Client_t SNF_CLT

Shortened definiton of struct SNF_Client_t .

Function Documentation

◆ snf_clt_init()

void snf_clt_init ( int ht_min_Size)
extern

Initialises the HashTable that saves the clients.

Parameters
ht_min_SizeThe HashTable's length ( See note )
Note
ht_min_Size isnt (in most cases) the same as the true size of HashTable length

See snf_hashtable_inis() .

◆ snf_clt_new()

SNF_CLT * snf_clt_new ( int Sockfd)
extern

Creates (and allocates) a new Client using their Sockfd, with a default SNF_CLT::UUID with the value of "00000000-0000-0000-0000-000000000000".

Parameters
SockfdThe Client's SNF_CLT::sock ( Client's Socket Discriptor )
Returns
the new SNF_CLT Instance.
Note
Free with snf_clt_free

◆ snf_clt_free()

void snf_clt_free ( SNF_CLT * Client)
extern

Frees the allocated SNF_CLT.

Parameters
ClientThe SNF_CLT instance to be free'd.
Warning
Make sure you closed the SNF_CLT::sock if you have no use for it.

◆ snf_clt_get_sockfd()

SNF_CLT * snf_clt_get_sockfd ( int Sockfd)
extern

Searches for a SNF_CLT depending on their SNF_CLT::sock.

Parameters
SockfdThe socket descriptor to search with
Returns
SNF_CLT address pointer where it's value could be:
Warning
NOT YET IMPLEMENTED. DO NOT USE.

◆ snf_clt_get_uuid()

SNF_CLT * snf_clt_get_uuid ( const char * uuid)
extern

Searches for a SNF_CLT depending on their SNF_CLT::UUID.

Parameters
uuidThe socket descriptor to search with
Returns
SNF_CLT address pointer where it's value could be:
Warning
NOT YET IMPLEMENTED. DO NOT USE.

◆ snf_clt_check_sockfd()

int snf_clt_check_sockfd ( int Sockfd)
extern

Checks the existance of a SNF_CLT depending on their SNF_CLT::sock.

Parameters
SockfdThe socket descriptor to search with
Returns
An Integer dipicting the check's result:
  • 1 if found
  • 0 if not found.
Warning
NOT YET IMPLEMENTED. DO NOT USE.

◆ snf_clt_check_uuid()

int snf_clt_check_uuid ( const char * uuid)
extern

Checks the existance of a SNF_CLT depending on their SNF_CLT::UUID.

Parameters
uuidThe socket descriptor to search with
Returns
An Integer dipicting the check's result:
  • 1 if found
  • 0 if not found.
Warning
NOT YET IMPLEMENTED. DO NOT USE.

◆ snf_clt_handle_new()

void * snf_clt_handle_new ( void * arg)
extern

Handles new incoming Clients.

Parameters
argnew Clitent's address ( SNF_CLT pointer)
Returns
NULL
Warning
Core Function in network.c do not use it elsewhere.

◆ snf_clt_handle()

void * snf_clt_handle ( void * arg)
extern

Handles existing Clients.

Parameters
argnew Clitent's address ( SNF_CLT pointer)
Returns
NULL
Warning
Core Function in network.c do not use it elsewhere.

◆ snf_clt_connect()

void snf_clt_connect ( SNF_CLT * Client)
extern

Function to be called upon Client Connection.

Parameters
ClientConnecting Client( SNF_CLT pointer)
Warning
Core Function in clt.c do not use it elsewhere.

◆ snf_clt_reconnect()

void snf_clt_reconnect ( SNF_CLT * Client)
extern

Function to be called upon Client Re-Connection.

Parameters
ClientRe-Connecting Client
Warning
Core Function in clt.c do not use it elsewhere.

◆ snf_clt_disconnect()

void snf_clt_disconnect ( SNF_CLT * Client)
extern

Function to be called upon Client Disconnection.

Parameters
ClientDisconnecting Client.
Warning
Core Function in clt.c do not use it elsewhere.