📄 tcplib.c
字号:
/* tcpLib.c - tcp protocol interface library *//* Copyright 1984-1997 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01b,31jan97,vin added new variable for connection timeout.01a,20jan97,vin written*//*DESCRIPTIONThis library contains the interface to the tcp protocol. The TCP protocolis configured in this library. The routine tcpLibInit() is responsible for configuring the tcp protocolwith various parameters.INCLUDE FILES: netLib.h.pG "Network"NOMANUAL*//* includes */#include "vxWorks.h"#include "netLib.h"#include "net/protosw.h"#include "net/domain.h"#include "net/mbuf.h"#include "netinet/in.h"#include "netinet/in_systm.h"#include "netinet/in_pcb.h"#include "netinet/ip.h"#include "netinet/ip_var.h"#include "netinet/tcp.h"#include "netinet/tcp_fsm.h"#include "netinet/tcp_seq.h"#include "netinet/tcp_timer.h"#include "netinet/tcp_var.h"#include "netinet/tcpip.h"#include "netinet/tcp_debug.h"/* externs */IMPORT int _protoSwIndex;IMPORT struct protosw inetsw [IP_PROTO_NUM_MAX]; IMPORT int tcp_do_rfc1323;IMPORT u_long tcp_sendspace;IMPORT u_long tcp_recvspace;IMPORT int tcp_keepinit;IMPORT int tcprexmtthresh;IMPORT int tcp_mssdflt;IMPORT int tcp_rttdflt;IMPORT int tcp_keepidle;IMPORT int tcp_keepcnt;/* globals *//* defines *//* typedefs *//* locals */STATUS tcpLibInit ( TCP_CFG_PARAMS * tcpCfg /* tcp configuration parameters */ ) { FAST struct protosw * pProtoSwitch; if (_protoSwIndex >= sizeof(inetsw)/sizeof(inetsw[0])) return (ERROR) ; pProtoSwitch = &inetsw [_protoSwIndex]; if (pProtoSwitch->pr_domain != NULL) return (OK); /* already initialized */ pProtoSwitch->pr_type = SOCK_STREAM; pProtoSwitch->pr_domain = &inetdomain; pProtoSwitch->pr_protocol = IPPROTO_TCP; pProtoSwitch->pr_flags = PR_CONNREQUIRED | PR_WANTRCVD; pProtoSwitch->pr_input = tcp_input; pProtoSwitch->pr_output = 0; pProtoSwitch->pr_ctlinput = tcp_ctlinput; pProtoSwitch->pr_ctloutput = tcp_ctloutput; pProtoSwitch->pr_usrreq = tcp_usrreq; pProtoSwitch->pr_init = tcp_init; pProtoSwitch->pr_fasttimo = tcp_fasttimo; pProtoSwitch->pr_slowtimo = tcp_slowtimo; pProtoSwitch->pr_drain = tcp_drain; pProtoSwitch->pr_sysctl = 0; _protoSwIndex++; /* initialize tcp configuration parameters */ tcp_do_rfc1323 = (tcpCfg->tcpCfgFlags & TCP_DO_RFC1323) ? TRUE : FALSE; tcp_sendspace = tcpCfg->tcpSndSpace; tcp_recvspace = tcpCfg->tcpRcvSpace; tcp_keepinit = tcpCfg->tcpConnectTime; tcprexmtthresh = tcpCfg->tcpReTxThresh; tcp_mssdflt = tcpCfg->tcpMssDflt; tcp_rttdflt = tcpCfg->tcpRttDflt; tcp_keepidle = tcpCfg->tcpKeepIdle; tcp_keepcnt = tcpCfg->tcpKeepCnt; return (OK); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -