123192Smckusick /* 229151Smckusick * Copyright (c) 1982, 1986 Regents of the University of California. 332789Sbostic * All rights reserved. 423192Smckusick * 5*44487Sbostic * %sccs.include.redist.c% 632789Sbostic * 7*44487Sbostic * @(#)tcp_seq.h 7.4 (Berkeley) 06/28/90 823192Smckusick */ 95124Swnj 105124Swnj /* 115124Swnj * TCP sequence numbers are 32 bit integers operated 125124Swnj * on with modular arithmetic. These macros can be 135124Swnj * used to compare such integers. 145124Swnj */ 155124Swnj #define SEQ_LT(a,b) ((int)((a)-(b)) < 0) 165124Swnj #define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) 175124Swnj #define SEQ_GT(a,b) ((int)((a)-(b)) > 0) 185124Swnj #define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0) 195124Swnj 205124Swnj /* 215124Swnj * Macros to initialize tcp sequence numbers for 225124Swnj * send and receive from initial send and receive 235124Swnj * sequence numbers. 245124Swnj */ 255124Swnj #define tcp_rcvseqinit(tp) \ 2625203Skarels (tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1 275124Swnj 285124Swnj #define tcp_sendseqinit(tp) \ 295124Swnj (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \ 305124Swnj (tp)->iss 315124Swnj 3225204Skarels #define TCP_ISSINCR (125*1024) /* increment for tcp_iss each second */ 335124Swnj 345124Swnj #ifdef KERNEL 355124Swnj tcp_seq tcp_iss; /* tcp initial send seq # */ 365124Swnj #endif 37