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