Embedded Xinu Operating System
An ongoing research project and educational operating system.
|
Transmission Control Protocol driver. More...
Functions | |
ushort | tcpAlloc (void) |
ushort | tcpChksum (struct packet *pkt, ushort len, struct netaddr *src, struct netaddr *dst) |
devcall | tcpClose (device *devptr) |
devcall | tcpControl (device *devptr, int func, long arg1, long arg2) |
struct tcb * | tcpDemux (ushort dstpt, ushort srcpt, struct netaddr *dstip, struct netaddr *srcip) |
devcall | tcpFree (struct tcb *tcbptr) |
devcall | tcpGetc (device *devptr) |
devcall | tcpInit (device *devptr) |
devcall | tcpOpen (device *devptr, va_list ap) |
devcall | tcpOpenActive (struct tcb *tcbptr) |
devcall | tcpPutc (device *devptr, char ch) |
devcall | tcpRead (device *devptr, void *buf, uint len) |
int | tcpRecv (struct packet *pkt, struct netaddr *src, struct netaddr *dst) |
int | tcpRecvAck (struct packet *pkt, struct tcb *tcbptr) |
int | tcpRecvData (struct packet *pkt, struct tcb *tcbptr) |
int | tcpRecvListen (struct packet *pkt, struct tcb *tcbptr, struct netaddr *src) |
int | tcpRecvOpts (struct packet *pkt, struct tcb *tcbptr) |
int | tcpRecvOther (struct packet *pkt, struct tcb *tcbptr) |
int | tcpRecvRtt (struct tcb *tcbptr) |
int | tcpRecvSynsent (struct packet *pkt, struct tcb *tcbptr) |
bool | tcpRecvValid (struct packet *pkt, struct tcb *tcbptr) |
int | tcpSend (struct tcb *tcbptr, uchar ctrl, uint seqnum, uint acknum, uint datastart, ushort datalen) |
int | tcpSendAck (struct tcb *tcbptr) |
int | tcpSendData (struct tcb *tcbptr) |
int | tcpSendPersist (struct tcb *tcbptr) |
int | tcpSendRst (struct packet *pkt, struct netaddr *src, struct netaddr *dst) |
int | tcpSendRxt (struct tcb *tcbptr) |
int | tcpSendSyn (struct tcb *tcbptr) |
ushort | tcpSendWindow (struct tcb *tcbptr) |
tcpseq | tcpSeqdiff (tcpseq first, tcpseq second) |
int | tcpSetup (struct tcb *tcbptr) |
void | tcpStat (struct tcb *tcbptr) |
thread | tcpTimer (void) |
devcall | tcpTimerPurge (struct tcb *tcbptr, uchar type) |
int | tcpTimerRemain (struct tcb *tcbptr, uchar type) |
devcall | tcpTimerSched (int time, struct tcb *tcbptr, uchar type) |
void | tcpTimerTrigger (uchar type, struct tcb *tcbptr) |
devcall | tcpWrite (device *devptr, void *buf, uint len) |
Transmission Control Protocol driver.
This module provides an interface to the Transmission Control Protocol (TCP).
ushort tcpAlloc | ( | void | ) |
Allocate an available tcp device.
devcall tcpClose | ( | device * | devptr | ) |
Close a TCP device.
devptr | TCP device table entry |
devcall tcpControl | ( | device * | devptr, |
int | func, | ||
long | arg1, | ||
long | arg2 | ||
) |
Control function for TCP devices.
devptr | ethernet device table entry |
func | control function to execute |
arg1 | first argument for the control function |
arg2 | second argument for the control function |
struct tcb* tcpDemux | ( | ushort | dstpt, |
ushort | srcpt, | ||
struct netaddr * | dstip, | ||
struct netaddr * | srcip | ||
) |
Locate the TCP socket for a TCP packet
dstpt | destination port of the TCP packet |
srcpt | source port of the TCP packet |
dstip | destination IP of the TCP packet |
srcip | source IP of the TCP packet |
devcall tcpFree | ( | struct tcb * | tcbptr | ) |
Delete a TCB.
tcbptr | pointer to transmission control block for connection TCB mutex is already held |
devcall tcpGetc | ( | device * | devptr | ) |
Read into a single octet from TCP.
devptr | TCP device table entry |
devcall tcpInit | ( | device * | devptr | ) |
Initialize TCP structures.
devptr | tcp device table entry |
devcall tcpOpen | ( | device * | devptr, |
va_list | ap | ||
) |
Associate a tcp with a network device.
devptr | tcp device table entry |
ap | 2nd argument is the local IP address 3rd argument is the remote IP address 4th argument is the local port (auto-assigned if zero) 5th argument is the remote port (ignored if zero) 6th argument is the mode (TCP_ACTIVE or TCP_PASSIVE) |
devcall tcpOpenActive | ( | struct tcb * | tcbptr | ) |
Actively opens a TCP connection.
tcbptr | TCB for connection |
devcall tcpPutc | ( | device * | devptr, |
char | ch | ||
) |
Write a single octet to send via TCP.
devptr | TCP device table entry |
ch | character to output |
ch
as an unsigned char
cast to an int
on success; SYSERR
on failure. devcall tcpRead | ( | device * | devptr, |
void * | buf, | ||
uint | len | ||
) |
Read into a buffer from TCP.
devptr | TCP device table entry |
buf | buffer to read octets into |
len | size of the buffer |
int tcpRecv | ( | struct packet * | pkt, |
struct netaddr * | src, | ||
struct netaddr * | dst | ||
) |
Processes an incoming TCP packet. See RFC 793, pg 65 for an overview of the TCP packet arrival algorithm.
pkt | incoming packet |
src | source of incoming packet |
dst | destination of incoming packet |
int tcpRecvAck | ( | struct packet * | pkt, |
struct tcb * | tcbptr | ||
) |
Process an ackowledgement of data in an incoming TCP segment for a connection which has been fully established.
pkt | incoming packet |
tcbptr | pointer to transmission control block for connection TCB mutex is already held TCB mutex is still held |
int tcpRecvData | ( | struct packet * | pkt, |
struct tcb * | tcbptr | ||
) |
Processes the data in an incoming packet for a TCP connection. Function based on RFC 763, pg 73-76.
pkt | incoming packet |
tcbptr | pointer to transmission control block for connection |
int tcpRecvListen | ( | struct packet * | pkt, |
struct tcb * | tcbptr, | ||
struct netaddr * | src | ||
) |
Processes an incoming packet for a TCP connection in the LISTEN state.
pkt | incoming packet |
tcbptr | pointer to transmission control block for connection |
src | source IP address |
int tcpRecvOpts | ( | struct packet * | pkt, |
struct tcb * | tcbptr | ||
) |
Processes the options in an incoming packet for a TCP connection.
pkt | incoming packet |
tcbptr | pointer to transmission control block for connection |
int tcpRecvOther | ( | struct packet * | pkt, |
struct tcb * | tcbptr | ||
) |
Processes an incoming packet for a TCP connection in the SYNRECV, ESTAB, FINWT1, FINWT2, CLOSEWT, CLOSING, LASTACK, or TIMEWT state. Function based on RFC 763, pg 69-73.
pkt | incoming packet |
tcbptr | pointer to transmission control block for connection |
int tcpRecvRtt | ( | struct tcb * | tcbptr | ) |
Handle round trip time estimates based on an incoming acknowledgement.
tcbptr | pointer to transmission control block for connection |
int tcpRecvSynsent | ( | struct packet * | pkt, |
struct tcb * | tcbptr | ||
) |
Processes an incoming packet for a TCP connection in the SYNSENT state. Function based on RFC 763, pg 66-68.
pkt | incoming packet |
tcbptr | pointer to transmission control block for connection |
bool tcpRecvValid | ( | struct packet * | pkt, |
struct tcb * | tcbptr | ||
) |
Checks if an incoming TCP segment is valid.
pkt | incoming packet |
tcbptr | pointer to transmission control block for connection TCB mutex is already held TCB mutex is still held |
int tcpSend | ( | struct tcb * | tcbptr, |
uchar | ctrl, | ||
uint | seqnum, | ||
uint | acknum, | ||
uint | datastart, | ||
ushort | datalen | ||
) |
Sends a TCP packet for a TCP connection.
tcbptr | pointer to the transmission control block for connection |
ctrl | control flags to be set |
seqnum | sequence number for the packet |
acknum | acknowledgement number for the packet |
data | data to be included in the packet, NULL if no data |
datalen | length of the data, 0 if no data |
int tcpSendAck | ( | struct tcb * | tcbptr | ) |
Sends an ACK packet to ackowledge all received data for a TCP connection.
tcpptr | pointer to the transmission control block for connection |
int tcpSendData | ( | struct tcb * | tcbptr | ) |
Sends pending outbound data (including SYN and FIN) for a TCP connection, if new data is ready for transmission.
tcpptr | pointer to the transmission control block for connection |
< amount of window filled with data pending ACK
< amount of data pending ACK or transmission
int tcpSendPersist | ( | struct tcb * | tcbptr | ) |
Send a segment to probe a receiver who advertised a window size of 0.
tcpptr | pointer to the transmission control block for connection |
int tcpSendRst | ( | struct packet * | pkt, |
struct netaddr * | src, | ||
struct netaddr * | dst | ||
) |
Sends a reset in response to an incorrect TCP packet
pkt | incoming packet which requires a reset response |
src | source IP address of the packet |
dst | destination IP address of the packet |
int tcpSendRxt | ( | struct tcb * | tcbptr | ) |
Retransmitts a segment of pending outbound data (including SYN and FIN) for a TCP connection.
tcpptr | pointer to the transmission control block for connection |
< amount of data pending ACK
int tcpSendSyn | ( | struct tcb * | tcbptr | ) |
Sends an SYN packet to establish a TCP connection.
tcpptr | pointer to the transmission control block for connection |
ushort tcpSendWindow | ( | struct tcb * | tcbptr | ) |
Calculates the window size to advertise in an outgoing TCP packet.
tcbptr | pointer to transmission control block for connection |
tcpseq tcpSeqdiff | ( | tcpseq | first, |
tcpseq | second | ||
) |
Calculates the difference between two sequence numbers.
first | sequence number that occurs first |
second | sequence number that occurs second |
int tcpSetup | ( | struct tcb * | tcbptr | ) |
Intializes a transmission control block. tcbptr TCB for connection
void tcpStat | ( | struct tcb * | tcbptr | ) |
Transmission Control Protocol status command.
tcbptr | pointer to transmission control block |
thread tcpTimer | ( | void | ) |
TCP timer process to manage timeout and retransmit events.
devcall tcpTimerPurge | ( | struct tcb * | tcbptr, |
uchar | type | ||
) |
Remove all TCP timer events for a particular TCB.
tcbptr | TCB for which to remove all events |
type | type of events to remove, all types are removed if NULL |
int tcpTimerRemain | ( | struct tcb * | tcbptr, |
uchar | type | ||
) |
Determine time reamining for a TCP timer event for a particular TCB.
tcbptr | TCB to which event corresponds |
type | type of timer event |
devcall tcpTimerSched | ( | int | time, |
struct tcb * | tcbptr, | ||
uchar | type | ||
) |
Schedule TCP timer events.
time | milliseconds before timer triggers |
tcbptr | TCB with which event is associated |
type | type of timer event |
void tcpTimerTrigger | ( | uchar | type, |
struct tcb * | tcbptr | ||
) |
Processes TCP timer events.
evtptr | timer event to process |
devcall tcpWrite | ( | device * | devptr, |
void * | buf, | ||
uint | len | ||
) |
Write into a buffer to send via TCP.
devptr | TCP device table entry |
buf | buffer to read octets into |
len | size of the buffer |