NetSim Source Code Help
Loading...
Searching...
No Matches
TCP_Socket.c File Reference
#include "main.h"
#include "TCP.h"
#include "List.h"
Include dependency graph for TCP_Socket.c:

Go to the source code of this file.

Data Structures

struct  stru_socket_list
 

Macros

#define SOCKET_LIST_ALLOC()   (PSOCKET_LIST)list_alloc(sizeof(SOCKET_LIST),offsetof(SOCKET_LIST,ele))
 
#define SOCKET_LIST_NEXT(sl)   (PSOCKET_LIST)LIST_NEXT(sl)
 

Typedefs

typedef struct stru_socket_list SOCKET_LIST
 
typedef struct stru_socket_listPSOCKET_LIST
 

Functions

static bool compare_socketaddr (PSOCKETADDRESS sa1, PSOCKETADDRESS sa2)
 
static bool compare_socket (PNETSIM_SOCKET s1, PNETSIM_SOCKET s2)
 
static PSOCKET_LIST find_socket_list (NETSIM_ID devid, PNETSIM_SOCKET s)
 
void add_to_socket_list (NETSIM_ID devId, PNETSIM_SOCKET s)
 
void remove_from_socket_list (NETSIM_ID devId, PNETSIM_SOCKET s)
 
PNETSIM_SOCKET find_socket (NETSIM_ID devId, NETSIM_IPAddress srcIP, NETSIM_IPAddress destIP, UINT16 srcPort, UINT16 destPort)
 
PNETSIM_SOCKET get_Remotesocket (NETSIM_ID d, PSOCKETADDRESS addr)
 
PNETSIM_SOCKET find_socket_at_source (NetSim_PACKET *packet)
 
PNETSIM_SOCKET find_socket_at_dest (NetSim_PACKET *packet)
 
PNETSIM_SOCKET tcp_create_socket ()
 
void tcp_close_socket (PNETSIM_SOCKET s, NETSIM_ID devId)
 
void tcp_connect (PNETSIM_SOCKET s, PSOCKETADDRESS localAddr, PSOCKETADDRESS remoteAddr)
 
void tcp_bind (PNETSIM_SOCKET s, PSOCKETADDRESS addr)
 
void tcp_listen (PNETSIM_SOCKET s, void(*listen_callback)(PNETSIM_SOCKET, NetSim_PACKET *))
 
PNETSIM_SOCKET tcp_accept (PNETSIM_SOCKET s, NetSim_PACKET *p)
 
void close_all_socket (NETSIM_ID devId)
 
void tcp_close (PNETSIM_SOCKET s)
 

Variables

static UINT socket_id = 0
 

Macro Definition Documentation

◆ SOCKET_LIST_ALLOC

#define SOCKET_LIST_ALLOC ( )    (PSOCKET_LIST)list_alloc(sizeof(SOCKET_LIST),offsetof(SOCKET_LIST,ele))

Definition at line 33 of file TCP_Socket.c.

◆ SOCKET_LIST_NEXT

#define SOCKET_LIST_NEXT (   sl)    (PSOCKET_LIST)LIST_NEXT(sl)

Definition at line 34 of file TCP_Socket.c.

Typedef Documentation

◆ PSOCKET_LIST

typedef struct stru_socket_list * PSOCKET_LIST

◆ SOCKET_LIST

typedef struct stru_socket_list SOCKET_LIST

Function Documentation

◆ add_to_socket_list()

void add_to_socket_list ( NETSIM_ID  devId,
PNETSIM_SOCKET  s 
)

Definition at line 94 of file TCP_Socket.c.

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

◆ close_all_socket()

void close_all_socket ( NETSIM_ID  devId)

Definition at line 275 of file TCP_Socket.c.

Here is the call graph for this function:

◆ compare_socket()

static bool compare_socket ( PNETSIM_SOCKET  s1,
PNETSIM_SOCKET  s2 
)
static

Definition at line 44 of file TCP_Socket.c.

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

◆ compare_socketaddr()

static bool compare_socketaddr ( PSOCKETADDRESS  sa1,
PSOCKETADDRESS  sa2 
)
static

Definition at line 38 of file TCP_Socket.c.

Here is the caller graph for this function:

◆ find_socket()

PNETSIM_SOCKET find_socket ( NETSIM_ID  devId,
NETSIM_IPAddress  srcIP,
NETSIM_IPAddress  destIP,
UINT16  srcPort,
UINT16  destPort 
)

Definition at line 117 of file TCP_Socket.c.

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

◆ find_socket_at_dest()

PNETSIM_SOCKET find_socket_at_dest ( NetSim_PACKET packet)

Definition at line 164 of file TCP_Socket.c.

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

◆ find_socket_at_source()

PNETSIM_SOCKET find_socket_at_source ( NetSim_PACKET packet)

Definition at line 155 of file TCP_Socket.c.

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

◆ find_socket_list()

static PSOCKET_LIST find_socket_list ( NETSIM_ID  devid,
PNETSIM_SOCKET  s 
)
static

Definition at line 81 of file TCP_Socket.c.

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

◆ get_Remotesocket()

PNETSIM_SOCKET get_Remotesocket ( NETSIM_ID  d,
PSOCKETADDRESS  addr 
)

Definition at line 140 of file TCP_Socket.c.

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

◆ remove_from_socket_list()

void remove_from_socket_list ( NETSIM_ID  devId,
PNETSIM_SOCKET  s 
)

Definition at line 107 of file TCP_Socket.c.

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

◆ tcp_accept()

PNETSIM_SOCKET tcp_accept ( PNETSIM_SOCKET  s,
NetSim_PACKET p 
)

Definition at line 231 of file TCP_Socket.c.

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

◆ tcp_bind()

void tcp_bind ( PNETSIM_SOCKET  s,
PSOCKETADDRESS  addr 
)

Definition at line 216 of file TCP_Socket.c.

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

◆ tcp_close()

void tcp_close ( PNETSIM_SOCKET  s)

Definition at line 286 of file TCP_Socket.c.

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

◆ tcp_close_socket()

void tcp_close_socket ( PNETSIM_SOCKET  s,
NETSIM_ID  devId 
)

Definition at line 187 of file TCP_Socket.c.

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

◆ tcp_connect()

void tcp_connect ( PNETSIM_SOCKET  s,
PSOCKETADDRESS  localAddr,
PSOCKETADDRESS  remoteAddr 
)

Definition at line 206 of file TCP_Socket.c.

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

◆ tcp_create_socket()

PNETSIM_SOCKET tcp_create_socket ( )

Definition at line 180 of file TCP_Socket.c.

Here is the caller graph for this function:

◆ tcp_listen()

void tcp_listen ( PNETSIM_SOCKET  s,
void(*)(PNETSIM_SOCKET, NetSim_PACKET *)  listen_callback 
)

Definition at line 224 of file TCP_Socket.c.

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

Variable Documentation

◆ socket_id

UINT socket_id = 0
static

Definition at line 36 of file TCP_Socket.c.