2006-04-24 17:42:49 +02:00
|
|
|
#ifndef _GPXE_IP_H
|
|
|
|
#define _GPXE_IP_H
|
2006-03-24 18:22:09 +01:00
|
|
|
|
|
|
|
/** @file
|
|
|
|
*
|
|
|
|
* IP protocol
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-06-18 00:36:27 +02:00
|
|
|
#include <ip.h>
|
2006-06-30 10:52:03 +02:00
|
|
|
#include <gpxe/retry.h>
|
2007-01-10 21:38:20 +01:00
|
|
|
#include <gpxe/hotplug.h>
|
2006-06-18 00:36:27 +02:00
|
|
|
|
2006-06-25 07:16:54 +02:00
|
|
|
/* IP constants */
|
|
|
|
|
2007-01-03 21:48:52 +01:00
|
|
|
#define IP_VER 0x40
|
2006-06-25 07:16:54 +02:00
|
|
|
#define IP_MASK_VER 0xf0
|
|
|
|
#define IP_MASK_HLEN 0x0f
|
2006-06-30 10:52:03 +02:00
|
|
|
#define IP_MASK_OFFSET 0x1fff
|
|
|
|
#define IP_MASK_DONOTFRAG 0x4000
|
|
|
|
#define IP_MASK_MOREFRAGS 0x2000
|
2006-06-25 07:16:54 +02:00
|
|
|
#define IP_PSHLEN 12
|
|
|
|
|
|
|
|
/* IP header defaults */
|
|
|
|
#define IP_TOS 0
|
|
|
|
#define IP_TTL 64
|
|
|
|
|
2006-06-30 10:52:03 +02:00
|
|
|
#define IP_FRAG_PKB_SIZE 1500
|
|
|
|
#define IP_FRAG_TIMEOUT 50
|
|
|
|
|
2006-06-28 11:59:27 +02:00
|
|
|
/* IP4 pseudo header */
|
|
|
|
struct ipv4_pseudo_header {
|
|
|
|
struct in_addr src;
|
|
|
|
struct in_addr dest;
|
|
|
|
uint8_t zero_padding;
|
|
|
|
uint8_t protocol;
|
|
|
|
uint16_t len;
|
|
|
|
};
|
2006-06-25 07:16:54 +02:00
|
|
|
|
2007-01-10 21:38:20 +01:00
|
|
|
/** An IPv4 address/routing table entry */
|
|
|
|
struct ipv4_miniroute {
|
|
|
|
/** List of miniroutes */
|
|
|
|
struct list_head list;
|
|
|
|
|
|
|
|
/** Network device */
|
|
|
|
struct net_device *netdev;
|
|
|
|
/** Reference to network device */
|
|
|
|
struct reference netdev_ref;
|
|
|
|
|
|
|
|
/** IPv4 address */
|
|
|
|
struct in_addr address;
|
|
|
|
/** Subnet mask */
|
|
|
|
struct in_addr netmask;
|
|
|
|
/** Gateway address */
|
|
|
|
struct in_addr gateway;
|
|
|
|
};
|
|
|
|
|
2006-06-30 10:52:03 +02:00
|
|
|
/* Fragment reassembly buffer */
|
|
|
|
struct frag_buffer {
|
|
|
|
/* Identification number */
|
|
|
|
uint16_t ident;
|
|
|
|
/* Source network address */
|
|
|
|
struct in_addr src;
|
|
|
|
/* Destination network address */
|
|
|
|
struct in_addr dest;
|
|
|
|
/* Reassembled packet buffer */
|
|
|
|
struct pk_buff *frag_pkb;
|
|
|
|
/* Reassembly timer */
|
|
|
|
struct retry_timer frag_timer;
|
|
|
|
/* List of fragment reassembly buffers */
|
|
|
|
struct list_head list;
|
|
|
|
};
|
|
|
|
|
2006-06-25 07:16:54 +02:00
|
|
|
struct pk_buff;
|
|
|
|
struct net_device;
|
2006-04-30 04:08:42 +02:00
|
|
|
struct net_protocol;
|
2006-06-28 17:43:08 +02:00
|
|
|
struct tcpip_protocol;
|
2006-03-24 18:22:09 +01:00
|
|
|
|
2007-01-10 21:38:20 +01:00
|
|
|
extern struct list_head ipv4_miniroutes;
|
|
|
|
|
2006-04-30 04:08:42 +02:00
|
|
|
extern struct net_protocol ipv4_protocol;
|
2006-03-24 18:22:09 +01:00
|
|
|
|
2006-06-16 02:19:46 +02:00
|
|
|
extern int add_ipv4_address ( struct net_device *netdev,
|
|
|
|
struct in_addr address, struct in_addr netmask,
|
|
|
|
struct in_addr gateway );
|
|
|
|
extern void del_ipv4_address ( struct net_device *netdev );
|
2006-06-25 07:16:54 +02:00
|
|
|
|
2006-04-24 17:42:49 +02:00
|
|
|
#endif /* _GPXE_IP_H */
|