1 /* 2 * Copyright (c) 1982, 1986 Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are permitted 6 * provided that this notice is preserved and that due credit is given 7 * to the University of California at Berkeley. The name of the University 8 * may not be used to endorse or promote products derived from this 9 * software without specific prior written permission. This software 10 * is provided ``as is'' without express or implied warranty. 11 * 12 * @(#)tcp_seq.h 7.2 (Berkeley) 12/07/87 13 */ 14 15 /* 16 * TCP sequence numbers are 32 bit integers operated 17 * on with modular arithmetic. These macros can be 18 * used to compare such integers. 19 */ 20 #define SEQ_LT(a,b) ((int)((a)-(b)) < 0) 21 #define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) 22 #define SEQ_GT(a,b) ((int)((a)-(b)) > 0) 23 #define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0) 24 25 /* 26 * Macros to initialize tcp sequence numbers for 27 * send and receive from initial send and receive 28 * sequence numbers. 29 */ 30 #define tcp_rcvseqinit(tp) \ 31 (tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1 32 33 #define tcp_sendseqinit(tp) \ 34 (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \ 35 (tp)->iss 36 37 #define TCP_ISSINCR (125*1024) /* increment for tcp_iss each second */ 38 39 #ifdef KERNEL 40 tcp_seq tcp_iss; /* tcp initial send seq # */ 41 #endif 42