/** List of TCP connections */
struct list_head list;
+ /** Flags */
+ unsigned int flags;
+
/** Data transfer interface */
struct interface xfer;
- /** Data transfer interface closed flag */
- int xfer_closed;
/** Remote socket address */
struct sockaddr_tcpip peer;
* Equivalent to TS.Recent in RFC 1323 terminology.
*/
uint32_t ts_recent;
- /** Timestamps enabled */
- int timestamps;
/** Transmit queue */
struct list_head queue;
struct retry_timer wait;
};
+/** TCP flags */
+enum tcp_flags {
+ /** TCP data transfer interface has been closed */
+ TCP_XFER_CLOSED = 0x0001,
+ /** TCP timestamps are enabled */
+ TCP_TS_ENABLED = 0x0002,
+};
+
/**
* List of registered TCP connections
*/
/* Close data transfer interface */
intf_shutdown ( &tcp->xfer, rc );
- tcp->xfer_closed = 1;
+ tcp->flags |= TCP_XFER_CLOSED;
/* If we are in CLOSED, or have otherwise not yet received a
* SYN (i.e. we are in LISTEN or SYN_SENT), just delete the
mssopt->length = sizeof ( *mssopt );
mssopt->mss = htons ( TCP_MSS );
}
- if ( ( flags & TCP_SYN ) || tcp->timestamps ) {
+ if ( ( flags & TCP_SYN ) || ( tcp->flags & TCP_TS_ENABLED ) ) {
tsopt = iob_push ( iobuf, sizeof ( *tsopt ) );
memset ( tsopt->nop, TCP_OPTION_NOP, sizeof ( tsopt->nop ) );
tsopt->tsopt.kind = TCP_OPTION_TS;
if ( ! ( tcp->tcp_state & TCP_STATE_RCVD ( TCP_SYN ) ) ) {
tcp->rcv_ack = seq;
if ( options->tsopt )
- tcp->timestamps = 1;
+ tcp->flags |= TCP_TS_ENABLED;
}
/* Ignore duplicate SYN */
tcp->tcp_state |= TCP_STATE_ACKED ( acked_flags );
/* Start sending FIN if we've had all possible data ACKed */
- if ( list_empty ( &tcp->queue ) && tcp->xfer_closed )
+ if ( list_empty ( &tcp->queue ) && ( tcp->flags & TCP_XFER_CLOSED ) )
tcp->tcp_state |= TCP_STATE_SENT ( TCP_FIN );
return 0;