NetSim Source Code Help
Loading...
Searching...
No Matches
TCP_Header.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  stru_tcp_option
 
struct  stru_tcp_header
 
struct  stru_mss_option
 
struct  stru_sack_permitted_option
 
struct  stru_sack_data
 
struct  stru_sack_option
 
struct  stru_tcp_extra_option
 
struct  stru_tcp_window_scale_option
 
struct  stru_tcp_timestamp_option
 

Macros

#define _NETSIM_TCP_HEADER_H_
 
#define PNETSIM_SOCKET   void*
 
#define TCP_HDR_SIZE   20
 
#define MAX_TCP_OPT_LEN   40
 
#define MAX_TCP_HDR_SIZE   (TCP_HDR_SIZE+MAX_TCP_OPT_LEN)
 
#define MSS_OPTION_LEN   4
 
#define SACKPERMITTED_OPTION_LEN   2
 
#define SACKDATA_LEN   8
 
#define SACK_OPTION_FIX_LEN   2
 
#define SACK_OPTION_LEN(n)   ((UINT8)(SACK_OPTION_FIX_LEN+(n)*SACKDATA_LEN))
 
#define get_sack_data_count(sack)   ((sack->len-SACK_OPTION_FIX_LEN)/SACKDATA_LEN)
 
#define EXTRA_OPTION_LEN   1
 
#define WSOPT_LEN   3
 
#define TSOPT_LEN   10
 

Typedefs

typedef enum enum_tcp_packet TCPPACKET
 
typedef enum enum_tcp_option TCP_OPTION
 
typedef struct stru_tcp_option TCPOPTION
 
typedef struct stru_tcp_optionPTCPOPTION
 
typedef struct stru_tcp_header TCP_SEGMENT_HDR
 
typedef struct stru_tcp_headerPTCP_SEGMENT_HDR
 
typedef struct stru_mss_option MSS_OPTION
 
typedef struct stru_mss_optionPMSS_OPTION
 
typedef struct stru_sack_permitted_option SACKPERMITTED_OPTION
 
typedef struct stru_sack_permitted_optionPSACKPERMITTED_OPTION
 
typedef struct stru_sack_data SACKDATA
 
typedef struct stru_sack_dataPSACKDATA
 
typedef struct stru_sack_option SACK_OPTION
 
typedef struct stru_sack_optionPSACK_OPTION
 
typedef struct stru_tcp_extra_option EXTRA_OPTION
 
typedef struct stru_tcp_extra_optionPEXTRA_OPTION
 
typedef struct stru_tcp_window_scale_option Wsopt
 
typedef struct stru_tcp_window_scale_optionPWsopt
 
typedef struct stru_tcp_timestamp_option TSopt
 
typedef struct stru_tcp_timestamp_optionPTSopt
 

Enumerations

enum  enum_tcp_packet {
  TCPPACKET_SYN = TX_PROTOCOL_TCP * 100 + 1 , TCPPACKET_SYNACK , TCPPACKET_FIN , TCPPACKET_RST ,
  TCPPACKET_ACK
}
 
enum  enum_tcp_option {
  TCP_OPTION_END , TCP_OPTION_NOOPERATION , TCP_OPTION_MSS , TCP_OPTION_WINDOW_SCALE ,
  TCP_OPTION_SACK_PERMITTED , TCP_OPTION_SACK , TCP_OPTION_ECHO , TCP_OPTION_ECHOREPLY ,
  TCP_OPTION_TIMESTAMP
}
 

Functions

static PTCP_SEGMENT_HDR TCP_GET_SEGMENT_HDR (NetSim_PACKET *packet)
 
PTCP_SEGMENT_HDR copy_tcp_hdr (PTCP_SEGMENT_HDR hdr)
 
void free_tcp_hdr (PTCP_SEGMENT_HDR hdr)
 
void * get_tcp_option (PTCP_SEGMENT_HDR hdr, TCP_OPTION type)
 
void set_tcp_option (PTCP_SEGMENT_HDR hdr, void *option, TCP_OPTION type, UINT32 size)
 
void set_sack_option (PNETSIM_SOCKET s, PTCP_SEGMENT_HDR hdr, double time)
 
void receive_sack_option (PNETSIM_SOCKET s, PTCP_SEGMENT_HDR hdr)
 
void set_window_scaling (PNETSIM_SOCKET s, PWsopt opt)
 
void set_timestamp_value (PNETSIM_SOCKET s, PTCP_SEGMENT_HDR hdr, PTSopt opt)
 

Macro Definition Documentation

◆ _NETSIM_TCP_HEADER_H_

#define _NETSIM_TCP_HEADER_H_

Definition at line 17 of file TCP_Header.h.

◆ EXTRA_OPTION_LEN

#define EXTRA_OPTION_LEN   1

Definition at line 152 of file TCP_Header.h.

◆ get_sack_data_count

#define get_sack_data_count (   sack)    ((sack->len-SACK_OPTION_FIX_LEN)/SACKDATA_LEN)

Definition at line 146 of file TCP_Header.h.

◆ MAX_TCP_HDR_SIZE

#define MAX_TCP_HDR_SIZE   (TCP_HDR_SIZE+MAX_TCP_OPT_LEN)

Definition at line 105 of file TCP_Header.h.

◆ MAX_TCP_OPT_LEN

#define MAX_TCP_OPT_LEN   40

Definition at line 104 of file TCP_Header.h.

◆ MSS_OPTION_LEN

#define MSS_OPTION_LEN   4

Definition at line 122 of file TCP_Header.h.

◆ PNETSIM_SOCKET

#define PNETSIM_SOCKET   void*

Definition at line 24 of file TCP_Header.h.

◆ SACK_OPTION_FIX_LEN

#define SACK_OPTION_FIX_LEN   2

Definition at line 144 of file TCP_Header.h.

◆ SACK_OPTION_LEN

#define SACK_OPTION_LEN (   n)    ((UINT8)(SACK_OPTION_FIX_LEN+(n)*SACKDATA_LEN))

Definition at line 145 of file TCP_Header.h.

◆ SACKDATA_LEN

#define SACKDATA_LEN   8

Definition at line 136 of file TCP_Header.h.

◆ SACKPERMITTED_OPTION_LEN

#define SACKPERMITTED_OPTION_LEN   2

Definition at line 129 of file TCP_Header.h.

◆ TCP_HDR_SIZE

#define TCP_HDR_SIZE   20

Definition at line 103 of file TCP_Header.h.

◆ TSOPT_LEN

#define TSOPT_LEN   10

Definition at line 169 of file TCP_Header.h.

◆ WSOPT_LEN

#define WSOPT_LEN   3

Definition at line 160 of file TCP_Header.h.

Typedef Documentation

◆ EXTRA_OPTION

◆ MSS_OPTION

typedef struct stru_mss_option MSS_OPTION

◆ PEXTRA_OPTION

◆ PMSS_OPTION

typedef struct stru_mss_option * PMSS_OPTION

◆ PSACK_OPTION

typedef struct stru_sack_option * PSACK_OPTION

◆ PSACKDATA

typedef struct stru_sack_data * PSACKDATA

◆ PSACKPERMITTED_OPTION

◆ PTCP_SEGMENT_HDR

◆ PTCPOPTION

typedef struct stru_tcp_option* PTCPOPTION

◆ PTSopt

◆ PWsopt

◆ SACK_OPTION

typedef struct stru_sack_option SACK_OPTION

◆ SACKDATA

typedef struct stru_sack_data SACKDATA

◆ SACKPERMITTED_OPTION

◆ TCP_OPTION

◆ TCP_SEGMENT_HDR

◆ TCPOPTION

typedef struct stru_tcp_option TCPOPTION

◆ TCPPACKET

typedef enum enum_tcp_packet TCPPACKET

◆ TSopt

◆ Wsopt

Enumeration Type Documentation

◆ enum_tcp_option

Enumerator
TCP_OPTION_END 
TCP_OPTION_NOOPERATION 
TCP_OPTION_MSS 
TCP_OPTION_WINDOW_SCALE 
TCP_OPTION_SACK_PERMITTED 
TCP_OPTION_SACK 
TCP_OPTION_ECHO 
TCP_OPTION_ECHOREPLY 
TCP_OPTION_TIMESTAMP 

Definition at line 36 of file TCP_Header.h.

◆ enum_tcp_packet

Enumerator
TCPPACKET_SYN 
TCPPACKET_SYNACK 
TCPPACKET_FIN 
TCPPACKET_RST 
TCPPACKET_ACK 

Definition at line 27 of file TCP_Header.h.

Function Documentation

◆ copy_tcp_hdr()

PTCP_SEGMENT_HDR copy_tcp_hdr ( PTCP_SEGMENT_HDR  hdr)

Definition at line 493 of file TCP_Packet.c.

Here is the call graph for this function:

◆ free_tcp_hdr()

void free_tcp_hdr ( PTCP_SEGMENT_HDR  hdr)

Definition at line 576 of file TCP_Packet.c.

Here is the call graph for this function:

◆ get_tcp_option()

void * get_tcp_option ( PTCP_SEGMENT_HDR  hdr,
TCP_OPTION  type 
)

Definition at line 65 of file TCP_Packet.c.

Here is the caller graph for this function:

◆ receive_sack_option()

void receive_sack_option ( PNETSIM_SOCKET  s,
PTCP_SEGMENT_HDR  hdr 
)

Definition at line 280 of file SACK.c.

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

◆ set_sack_option()

void set_sack_option ( PNETSIM_SOCKET  s,
PTCP_SEGMENT_HDR  hdr,
double  time 
)

Definition at line 68 of file SACK.c.

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

◆ set_tcp_option()

void set_tcp_option ( PTCP_SEGMENT_HDR  hdr,
void *  option,
TCP_OPTION  type,
UINT32  size 
)

Definition at line 45 of file TCP_Packet.c.

Here is the caller graph for this function:

◆ set_timestamp_value()

void set_timestamp_value ( PNETSIM_SOCKET  s,
PTCP_SEGMENT_HDR  hdr,
PTSopt  opt 
)

Definition at line 427 of file TCB.c.

Here is the caller graph for this function:

◆ set_window_scaling()

void set_window_scaling ( PNETSIM_SOCKET  s,
PWsopt  opt 
)

Definition at line 18 of file WindowScale.c.

Here is the caller graph for this function:

◆ TCP_GET_SEGMENT_HDR()

static PTCP_SEGMENT_HDR TCP_GET_SEGMENT_HDR ( NetSim_PACKET packet)
static

Definition at line 107 of file TCP_Header.h.

Here is the caller graph for this function: