williamr@2: /* TCP_SEQ.H williamr@2: * williamr@2: * Portions copyright (c) 1997-1999 Symbian Ltd. All rights reserved. williamr@2: */ williamr@2: williamr@2: /* williamr@2: * Copyright (c) 1982, 1986 Regents of the University of California. williamr@2: * All rights reserved. The Berkeley software License Agreement williamr@2: * specifies the terms and conditions for redistribution. williamr@2: */ williamr@2: williamr@2: /** @file williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: williamr@2: #ifndef _NETINET_TCP_SEQ_H williamr@2: #define _NETINET_TCP_SEQ_H williamr@2: williamr@2: #ifdef __cplusplus williamr@2: extern "C" { williamr@2: #endif williamr@2: williamr@2: /** williamr@2: TCP sequence numbers are 32 bit integers operated williamr@2: on with modular arithmetic. These macros can be williamr@2: used to compare such integers. williamr@2: */ williamr@2: #define SEQ_LT(a, b) ((int)((a)-(b)) < 0) williamr@2: #define SEQ_LEQ(a, b) ((int)((a)-(b)) <= 0) williamr@2: #define SEQ_GT(a, b) ((int)((a)-(b)) > 0) williamr@2: #define SEQ_GEQ(a, b) ((int)((a)-(b)) >= 0) williamr@2: williamr@2: /** williamr@2: Macros to initialize tcp sequence numbers for williamr@2: send and receive from initial send and receive williamr@2: sequence numbers. williamr@2: */ williamr@2: #define tcp_rcvseqinit(tp) \ williamr@2: (tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1 williamr@2: williamr@2: #define tcp_sendseqinit(tp) \ williamr@2: (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \ williamr@2: (tp)->iss williamr@2: williamr@2: #define TCP_ISSINCR (125*1024) /* increment for tcp_iss each second */ williamr@2: williamr@2: #ifdef __cplusplus williamr@2: } williamr@2: #endif williamr@2: williamr@2: #endif /* _NETINET_TCP_SEQ_H */