1 /* $Id: ip.c,v 1.1 2005/12/12 18:14:22 nobunaga Exp $ 
 
   3 Copyright (C) 2002 Marc Kirchner <kirchner@stud.fh-heilbronn.de>
 
   5 This library is free software; you can redistribute it and/or
 
   6 modify it under the terms of the GNU Lesser General Public
 
   7 License as published by the Free Software Foundation; either
 
   8 version 2.1 of the License, or (at your option) any later version.
 
  10 This library is distributed in the hope that it will be useful,
 
  11 but WITHOUT ANY WARRANTY; without even the implied warranty of
 
  12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
  13 Lesser General Public License for more details.
 
  15 You should have received a copy of the GNU Lesser General Public
 
  16 License along with this library; if not, write to the Free Software
 
  17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
  23 pkt_ip_header(struct packet *pkt,
 
  24                 unsigned int iphdr_len,
 
  27                 unsigned short int total_len,
 
  28                 unsigned short int id,
 
  29                 unsigned short int frag_off,
 
  31                 unsigned char protocol,
 
  32                 unsigned short int cksum,
 
  41         ip = (struct ip *) pkt->pkt_ptr;
 
  43         ip->ip_hl = iphdr_len;
 
  46         ip->ip_len = htons(total_len);
 
  47         ip->ip_id = htons(id);
 
  48         ip->ip_off = htons(frag_off);
 
  51         ip->ip_src.s_addr = saddr;
 
  52         ip->ip_dst.s_addr = daddr;