1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * Copyright (c) 1982, 1986 Regents of the University of California. 3*0Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement 4*0Sstevel@tonic-gate * specifies the terms and conditions for redistribution. 5*0Sstevel@tonic-gate */ 6*0Sstevel@tonic-gate 7*0Sstevel@tonic-gate #ifndef _NETINET_TCP_SEQ_H 8*0Sstevel@tonic-gate #define _NETINET_TCP_SEQ_H 9*0Sstevel@tonic-gate 10*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 11*0Sstevel@tonic-gate /* tcp_seq.h 1.7 88/08/19 SMI; from UCB 7.1 6/5/85 */ 12*0Sstevel@tonic-gate 13*0Sstevel@tonic-gate #ifdef __cplusplus 14*0Sstevel@tonic-gate extern "C" { 15*0Sstevel@tonic-gate #endif 16*0Sstevel@tonic-gate 17*0Sstevel@tonic-gate /* 18*0Sstevel@tonic-gate * TCP sequence numbers are 32 bit integers operated 19*0Sstevel@tonic-gate * on with modular arithmetic. These macros can be 20*0Sstevel@tonic-gate * used to compare such integers. 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate #define SEQ_LT(a, b) ((int32_t)((a)-(b)) < 0) 23*0Sstevel@tonic-gate #define SEQ_LEQ(a, b) ((int32_t)((a)-(b)) <= 0) 24*0Sstevel@tonic-gate #define SEQ_GT(a, b) ((int32_t)((a)-(b)) > 0) 25*0Sstevel@tonic-gate #define SEQ_GEQ(a, b) ((int32_t)((a)-(b)) >= 0) 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate /* 28*0Sstevel@tonic-gate * Macros to initialize tcp sequence numbers for 29*0Sstevel@tonic-gate * send and receive from initial send and receive 30*0Sstevel@tonic-gate * sequence numbers. 31*0Sstevel@tonic-gate */ 32*0Sstevel@tonic-gate #define tcp_rcvseqinit(tp) \ 33*0Sstevel@tonic-gate (tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1 34*0Sstevel@tonic-gate 35*0Sstevel@tonic-gate #define tcp_sendseqinit(tp) \ 36*0Sstevel@tonic-gate (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \ 37*0Sstevel@tonic-gate (tp)->iss 38*0Sstevel@tonic-gate 39*0Sstevel@tonic-gate #define TCP_ISSINCR (125*1024) /* increment for tcp_iss each second */ 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate #ifdef __cplusplus 42*0Sstevel@tonic-gate } 43*0Sstevel@tonic-gate #endif 44*0Sstevel@tonic-gate 45*0Sstevel@tonic-gate #endif /* _NETINET_TCP_SEQ_H */ 46