tcp_lib.c File Reference

#include "inet.h"
#include "buf.h"
#include "clock.h"
#include "event.h"
#include "io.h"
#include "type.h"
#include "assert.h"
#include "tcp_int.h"

Include dependency graph for tcp_lib.c:

Go to the source code of this file.

Functions

THIS_FILE PUBLIC int tcp_LEmod4G (u32_t n1, u32_t n2)
PUBLIC int tcp_GEmod4G (u32_t n1, u32_t n2)
PUBLIC int tcp_Lmod4G (u32_t n1, u32_t n2)
PUBLIC int tcp_Gmod4G (u32_t n1, u32_t n2)
PUBLIC void tcp_extract_ipopt (tcp_conn_t *tcp_conn, ip_hdr_t *ip_hdr)
PUBLIC void tcp_extract_tcpopt (tcp_conn_t *tcp_conn, tcp_hdr_t *tcp_hdr, size_t *mssp)
PUBLIC u16_t tcp_pack_oneCsum (ip_hdr_t *ip_hdr, acc_t *tcp_pack)
PUBLIC void tcp_get_ipopt (tcp_conn_t *tcp_conn, ip_hdropt_t *ip_hdropt)
PUBLIC void tcp_get_tcpopt (tcp_conn_t *tcp_conn, tcp_hdropt_t *tcp_hdropt)
PUBLIC acc_ttcp_make_header (tcp_conn_t *tcp_conn, ip_hdr_t **ref_ip_hdr, tcp_hdr_t **ref_tcp_hdr, acc_t *data)
PUBLIC void tcp_print_state (tcp_conn_t *tcp_conn)
PUBLIC int tcp_check_conn (tcp_conn_t *tcp_conn)
PUBLIC void tcp_print_pack (ip_hdr_t *ip_hdr, tcp_hdr_t *tcp_hdr)
PUBLIC void tcp_print_conn (tcp_conn_t *tcp_conn)


Function Documentation

PUBLIC int tcp_check_conn tcp_conn_t tcp_conn  ) 
 

Definition at line 322 of file tcp_lib.c.

References assert, bf_bufsize(), DIFBLOCK, FALSE, printf, size, TCF_FIN_RECV, TCF_FIN_SENT, tcp_GEmod4G, tcp_Lmod4G, tcp_print_conn(), TCS_CLOSED, TCS_LISTEN, TCS_SYN_RECEIVED, TCS_SYN_SENT, and TRUE.

Referenced by process_data(), tcp_close_connection(), tcp_frag2conn(), tcp_send_timeout(), and tcp_shutdown().

PUBLIC void tcp_extract_ipopt tcp_conn_t tcp_conn,
ip_hdr_t ip_hdr
 

Definition at line 51 of file tcp_lib.c.

References DBLOCK, IH_IHL_MASK, ip_hdr::ih_vers_ihl, IP_MIN_HDR_SIZE, and printf.

Referenced by create_RST(), and tcp_frag2conn().

PUBLIC void tcp_extract_tcpopt tcp_conn_t tcp_conn,
tcp_hdr_t tcp_hdr,
size_t mssp
 

Definition at line 64 of file tcp_lib.c.

References cp, DBLOCK, i, printf, TCP_MIN_HDR_SIZE, TCP_OPT_CCNEW, TCP_OPT_EOL, TCP_OPT_MSS, TCP_OPT_NOP, TCP_OPT_SACKOK, TCP_OPT_TS, TCP_OPT_WSOPT, tcp_hdr::th_data_off, TH_DO_MASK, and type.

Referenced by create_RST(), and tcp_frag2conn().

PUBLIC int tcp_GEmod4G u32_t  n1,
u32_t  n2
 

Definition at line 28 of file tcp_lib.c.

References L.

PUBLIC void tcp_get_ipopt tcp_conn_t tcp_conn,
ip_hdropt_t ip_hdropt
 

Definition at line 168 of file tcp_lib.c.

References DBLOCK, ip_hdropt::iho_opt_siz, and printf.

Referenced by tcp_make_header().

PUBLIC void tcp_get_tcpopt tcp_conn_t tcp_conn,
tcp_hdropt_t tcp_hdropt
 

Definition at line 182 of file tcp_lib.c.

References bf_bufsize(), bf_pack(), memcpy(), ptr2acc_data, TCP_OPT_EOL, tcp_hdropt::tho_data, and tcp_hdropt::tho_opt_siz.

Referenced by tcp_make_header().

PUBLIC int tcp_Gmod4G u32_t  n1,
u32_t  n2
 

Definition at line 44 of file tcp_lib.c.

References L.

THIS_FILE PUBLIC int tcp_LEmod4G u32_t  n1,
u32_t  n2
 

Definition at line 20 of file tcp_lib.c.

References L.

PUBLIC int tcp_Lmod4G u32_t  n1,
u32_t  n2
 

Definition at line 36 of file tcp_lib.c.

References L.

PUBLIC acc_t* tcp_make_header tcp_conn_t tcp_conn,
ip_hdr_t **  ref_ip_hdr,
tcp_hdr_t **  ref_tcp_hdr,
acc_t data
 

Definition at line 207 of file tcp_lib.c.

References acc::acc_next, assert, bf_afree(), bf_memreq(), data, DBLOCK, htons, HTONS, IH_DONT_FRAG, ip_hdr::ih_dst, ip_hdr::ih_flags_fragoff, ip_hdr::ih_proto, ip_hdr::ih_src, ip_hdr::ih_tos, ip_hdr::ih_ttl, ip_hdr::ih_vers_ihl, ip_hdropt::iho_data, ip_hdropt::iho_opt_siz, IP_MIN_HDR_SIZE, IPPROTO_TCP, memcpy(), printf, ptr2acc_data, TCF_PMTU, tcp_get_ipopt(), tcp_get_tcpopt(), TCP_MIN_HDR_SIZE, TCS_CLOSED, tcp_hdr::th_chksum, tcp_hdr::th_data_off, tcp_hdr::th_dstport, tcp_hdr::th_flags, tcp_hdr::th_seq_nr, tcp_hdr::th_srcport, tcp_hdr::th_window, tcp_hdropt::tho_data, and tcp_hdropt::tho_opt_siz.

Referenced by create_RST(), and make_pack().

PUBLIC u16_t tcp_pack_oneCsum ip_hdr_t ip_hdr,
acc_t tcp_pack
 

Definition at line 122 of file tcp_lib.c.

References acc::acc_length, acc::acc_next, htons, HTONS, IH_IHL_MASK, IPPROTO_TCP, length, ntohs, oneC_sum(), ptr2acc_data, and sum().

Referenced by create_RST(), and make_pack().

PUBLIC void tcp_print_conn tcp_conn_t tcp_conn  ) 
 

Definition at line 519 of file tcp_lib.c.

References ntohs, printf, TCF_BSD_URG, TCF_FIN_RECV, TCF_FIN_SENT, TCF_INUSE, TCF_MORE2WRITE, TCF_NO_PUSH, TCF_PMTU, TCF_PUSH_NOW, TCF_RCV_PUSH, TCF_SEND_ACK, tcp_fd, tcp_fd_table, tcp_print_state(), and writeIpAddr().

Referenced by make_pack(), process_data(), tcp_check_conn(), tcp_close_connection(), tcp_frag2conn(), tcp_send_timeout(), and tcp_shutdown().

PUBLIC void tcp_print_pack ip_hdr_t ip_hdr,
tcp_hdr_t tcp_hdr
 

Definition at line 483 of file tcp_lib.c.

References assert, ntohl, ntohs, printf, TCP_MIN_HDR_SIZE, tcp_hdr::th_ack_nr, tcp_hdr::th_data_off, TH_DO_MASK, tcp_hdr::th_dstport, tcp_hdr::th_flags, tcp_hdr::th_seq_nr, tcp_hdr::th_srcport, tcp_hdr::th_urgptr, tcp_hdr::th_window, THF_ACK, THF_FIN, THF_PSH, THF_RST, THF_SYN, THF_URG, and writeIpAddr().

Referenced by create_RST(), and tcp_frag2conn().

PUBLIC void tcp_print_state tcp_conn_t tcp_conn  ) 
 

Definition at line 298 of file tcp_lib.c.

References printf, TCF_INUSE, tcp_conn_table, TCS_CLOSED, TCS_CLOSING, TCS_ESTABLISHED, TCS_LISTEN, TCS_SYN_RECEIVED, and TCS_SYN_SENT.

Referenced by create_RST(), tcp_close_connection(), tcp_frag2conn(), and tcp_print_conn().


Generated on Fri Apr 14 23:21:26 2006 for minix by  doxygen 1.4.6