|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1982, 1986 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution is only permitted until one year after the first shipment ! 6: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and ! 7: * binary forms are permitted provided that: (1) source distributions retain ! 8: * this entire copyright notice and comment, and (2) distributions including ! 9: * binaries display the following acknowledgement: This product includes ! 10: * software developed by the University of California, Berkeley and its ! 11: * contributors'' in the documentation or other materials provided with the ! 12: * distribution and in all advertising materials mentioning features or use ! 13: * of this software. Neither the name of the University nor the names of ! 14: * its contributors may be used to endorse or promote products derived from ! 15: * this software without specific prior written permission. ! 16: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 17: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 18: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 19: * ! 20: * @(#)ip_var.h 7.7 (Berkeley) 6/28/90 ! 21: */ ! 22: ! 23: /* ! 24: * Overlay for ip header used by other protocols (tcp, udp). ! 25: */ ! 26: struct ipovly { ! 27: caddr_t ih_next, ih_prev; /* for protocol sequence q's */ ! 28: u_char ih_x1; /* (unused) */ ! 29: u_char ih_pr; /* protocol */ ! 30: short ih_len; /* protocol length */ ! 31: struct in_addr ih_src; /* source internet address */ ! 32: struct in_addr ih_dst; /* destination internet address */ ! 33: }; ! 34: ! 35: /* ! 36: * Ip reassembly queue structure. Each fragment ! 37: * being reassembled is attached to one of these structures. ! 38: * They are timed out after ipq_ttl drops to 0, and may also ! 39: * be reclaimed if memory becomes tight. ! 40: */ ! 41: struct ipq { ! 42: struct ipq *next,*prev; /* to other reass headers */ ! 43: u_char ipq_ttl; /* time for reass q to live */ ! 44: u_char ipq_p; /* protocol of this fragment */ ! 45: u_short ipq_id; /* sequence id for reassembly */ ! 46: struct ipasfrag *ipq_next,*ipq_prev; ! 47: /* to ip headers of fragments */ ! 48: struct in_addr ipq_src,ipq_dst; ! 49: }; ! 50: ! 51: /* ! 52: * Ip header, when holding a fragment. ! 53: * ! 54: * Note: ipf_next must be at same offset as ipq_next above ! 55: */ ! 56: struct ipasfrag { ! 57: #if BYTE_ORDER == LITTLE_ENDIAN ! 58: u_char ip_hl:4, ! 59: ip_v:4; ! 60: #endif ! 61: #if BYTE_ORDER == BIG_ENDIAN ! 62: u_char ip_v:4, ! 63: ip_hl:4; ! 64: #endif ! 65: u_char ipf_mff; /* copied from (ip_off&IP_MF) */ ! 66: short ip_len; ! 67: u_short ip_id; ! 68: short ip_off; ! 69: u_char ip_ttl; ! 70: u_char ip_p; ! 71: u_short ip_sum; ! 72: struct ipasfrag *ipf_next; /* next fragment */ ! 73: struct ipasfrag *ipf_prev; /* previous fragment */ ! 74: }; ! 75: ! 76: /* ! 77: * Structure stored in mbuf in inpcb.ip_options ! 78: * and passed to ip_output when ip options are in use. ! 79: * The actual length of the options (including ipopt_dst) ! 80: * is in m_len. ! 81: */ ! 82: #define MAX_IPOPTLEN 40 ! 83: ! 84: struct ipoption { ! 85: struct in_addr ipopt_dst; /* first-hop dst if source routed */ ! 86: char ipopt_list[MAX_IPOPTLEN]; /* options proper */ ! 87: }; ! 88: ! 89: struct ipstat { ! 90: long ips_total; /* total packets received */ ! 91: long ips_badsum; /* checksum bad */ ! 92: long ips_tooshort; /* packet too short */ ! 93: long ips_toosmall; /* not enough data */ ! 94: long ips_badhlen; /* ip header length < data size */ ! 95: long ips_badlen; /* ip length < ip header length */ ! 96: long ips_fragments; /* fragments received */ ! 97: long ips_fragdropped; /* frags dropped (dups, out of space) */ ! 98: long ips_fragtimeout; /* fragments timed out */ ! 99: long ips_forward; /* packets forwarded */ ! 100: long ips_cantforward; /* packets rcvd for unreachable dest */ ! 101: long ips_redirectsent; /* packets forwarded on same net */ ! 102: long ips_noproto; /* unknown or unsupported protocol */ ! 103: long ips_delivered; /* packets consumed here */ ! 104: long ips_localout; /* total ip packets generated here */ ! 105: long ips_odropped; /* lost packets due to nobufs, etc. */ ! 106: long ips_reassembled; /* total packets reassembled ok */ ! 107: long ips_fragmented; /* output packets fragmented ok */ ! 108: long ips_ofragments; /* output fragments created */ ! 109: long ips_cantfrag; /* don't fragment flag was set, etc. */ ! 110: }; ! 111: ! 112: #ifdef KERNEL ! 113: /* flags passed to ip_output as last parameter */ ! 114: #define IP_FORWARDING 0x1 /* most of ip header exists */ ! 115: #define IP_ROUTETOIF SO_DONTROUTE /* bypass routing tables */ ! 116: #define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */ ! 117: ! 118: struct ipstat ipstat; ! 119: struct ipq ipq; /* ip reass. queue */ ! 120: u_short ip_id; /* ip packet ctr, for ids */ ! 121: ! 122: struct mbuf *ip_srcroute(); ! 123: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.