Embedded Web Server for the CR16
National Semiconductor
Jeff Wright
15
The application may request TCP to open an active or passive connection, indicated by
setting or clearing the TCP_ACTIVE flag. An active open is one in which TCP will initiate a
connection by sending a SYN segment to a peer. In contrast, a passive open is one where
TCP waits for such a SYN segment from a peer. Although both active and passive opens are
supported, a server, by definition, awaits connection requests from a peer, and will
therefore issue a passive open command to TCP.
UWORD LocPort;
UWORD ForPort;
QUADB_T ForIP;
QUADB_T LocIP;
UWORD TCPState;
SNDUNA;
SNDNXT;
UWORD SNDWINSZ;
UWORD SNDURGPTR;
SNDISS;
RCVNXT;
UWORD RCVWINSZ;
UWORD RCVURGPTR;
RCVIRS;
struct crsock_t *CRSOCKNext;
struct crsock_t *CRSOCKPrev;
UWORD LocPort;
UWORD ForPort;
QUADB_T ForIP;
QUADB_T LocIP;
UWORD TCPState;
SNDUNA;
SNDNXT;
UWORD SNDWINSZ;
UWORD SNDURGPTR;
SNDISS;
RCVNXT;
UWORD RCVWINSZ;
UWORD RCVURGPTR;
RCVIRS;
struct crsock_t *CRSOCKNext;
struct crsock_t *CRSOCKPrev;
*NULL
CRSOCK_T *CRSockList =
TCPDeleteSoc (CRSOCK_T *)
CRSOCK_T *TCPCreateSoc ( )
UWORD LocPort;
UWORD ForPort;
QUADB_T
ForIP;
QUADB_T
LocIP;
UWORD TCPState;
SNDUNA;
SNDNXT;
UWORD SNDWINSZ;
UWORD SNDURGPTR;
SNDISS;
RCVNXT;
UWORD RCVWINSZ;
UWORD RCVURGPTR;
RCVIRS;
struct crsock_t *CRSOCKNext;
struct crsock_t *CRSOCKPrev
;
UWORD LocPort;
UWORD ForPort
;
QUADB_T ForIP;
QUADB_T LocIP;
UWORD TCPState
;
SNDUNA;
SNDNXT;
UWORD SNDWINSZ;
UWORD SNDURGPTR;
SNDISS;
RCVNXT;
UWORD RCVWINSZ;
UWORD RCVURGPTR;
RCVIRS;
struct crsock_t *
CRSOCKNext;
struct crsock_t *
CRSOCKPrev;
*NULL
CRSOCK_T
CRSOCKTbl[MAX_SOCKETS] =
Figure 8. TCP Socket List
3.
The TCP Segment.
Once receiving data to transmit, TCP will partition the data into one or more segments,
depending upon both the size of the data and the availability of such segments. Just like
the TCP Control Block, segments are created and deleted as needed. Once a segment is
created it is placed on the active queue (XmitQList) to await ACKnowledgment. If and when
it is acknowledged, it is deleted, or, returned to the list of available segments
(XmitQFreeList). As shown in Figure 9, as they are created, TCP segments are linked
together, forming the linked-list of active segments.