00001 /* 00002 * Copyright (c) 1982, 1986, 1993 00003 * The Regents of the University of California. All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 1. Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * 2. Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * 3. Neither the name of the University nor the names of its contributors 00014 * may be used to endorse or promote products derived from this software 00015 * without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00018 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00021 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00022 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00023 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00024 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00025 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00026 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00027 * SUCH DAMAGE. 00028 * 00029 * @(#)tcpip.h 8.1 (Berkeley) 6/10/93 00030 * tcpip.h,v 1.3 1994/08/21 05:27:40 paul Exp 00031 */ 00032 00033 #ifndef _TCPIP_H_ 00034 #define _TCPIP_H_ 00035 00036 /* 00037 * Tcp+ip header, after ip options removed. 00038 */ 00039 struct tcpiphdr { 00040 struct ipovly ti_i; /* overlaid ip structure */ 00041 struct tcphdr ti_t; /* tcp header */ 00042 }; 00043 #define ti_mbuf ti_i.ih_mbuf.mptr 00044 #define ti_x1 ti_i.ih_x1 00045 #define ti_pr ti_i.ih_pr 00046 #define ti_len ti_i.ih_len 00047 #define ti_src ti_i.ih_src 00048 #define ti_dst ti_i.ih_dst 00049 #define ti_sport ti_t.th_sport 00050 #define ti_dport ti_t.th_dport 00051 #define ti_seq ti_t.th_seq 00052 #define ti_ack ti_t.th_ack 00053 #define ti_x2 ti_t.th_x2 00054 #define ti_off ti_t.th_off 00055 #define ti_flags ti_t.th_flags 00056 #define ti_win ti_t.th_win 00057 #define ti_sum ti_t.th_sum 00058 #define ti_urp ti_t.th_urp 00059 00060 #define tcpiphdr2qlink(T) ((struct qlink*)(((char*)(T)) - sizeof(struct qlink))) 00061 #define qlink2tcpiphdr(Q) ((struct tcpiphdr*)(((char*)(Q)) + sizeof(struct qlink))) 00062 #define tcpiphdr_next(T) qlink2tcpiphdr(tcpiphdr2qlink(T)->next) 00063 #define tcpiphdr_prev(T) qlink2tcpiphdr(tcpiphdr2qlink(T)->prev) 00064 #define tcpfrag_list_first(T) qlink2tcpiphdr((T)->seg_next) 00065 #define tcpfrag_list_end(F, T) (tcpiphdr2qlink(F) == (struct qlink*)(T)) 00066 #define tcpfrag_list_empty(T) ((T)->seg_next == (struct tcpiphdr*)(T)) 00067 00068 /* 00069 * Just a clean way to get to the first byte 00070 * of the packet 00071 */ 00072 struct tcpiphdr_2 { 00073 struct tcpiphdr dummy; 00074 char first_char; 00075 }; 00076 00077 #endif