123192Smckusick /* 223192Smckusick * Copyright (c) 1982 Regents of the University of California. 323192Smckusick * All rights reserved. The Berkeley software License Agreement 423192Smckusick * specifies the terms and conditions for redistribution. 523192Smckusick * 6*25203Skarels * @(#)tcp_seq.h 6.3 (Berkeley) 10/15/85 723192Smckusick */ 85124Swnj 95124Swnj /* 105124Swnj * TCP sequence numbers are 32 bit integers operated 115124Swnj * on with modular arithmetic. These macros can be 125124Swnj * used to compare such integers. 135124Swnj */ 145124Swnj #define SEQ_LT(a,b) ((int)((a)-(b)) < 0) 155124Swnj #define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) 165124Swnj #define SEQ_GT(a,b) ((int)((a)-(b)) > 0) 175124Swnj #define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0) 185124Swnj 195124Swnj /* 205124Swnj * Macros to initialize tcp sequence numbers for 215124Swnj * send and receive from initial send and receive 225124Swnj * sequence numbers. 235124Swnj */ 245124Swnj #define tcp_rcvseqinit(tp) \ 25*25203Skarels (tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1 265124Swnj 275124Swnj #define tcp_sendseqinit(tp) \ 285124Swnj (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \ 295124Swnj (tp)->iss 305124Swnj 31*25203Skarels #define TCP_ISSINCR 128 /* increment for tcp_iss each second */ 325124Swnj 335124Swnj #ifdef KERNEL 345124Swnj tcp_seq tcp_iss; /* tcp initial send seq # */ 355124Swnj #endif 36