Actually add ipv4 header for ipv4 support
This commit is contained in:
parent
b890d54c8f
commit
abbace3df4
53
net/ipv4.h
Normal file
53
net/ipv4.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#ifndef MINIMAL_IPV4_H
|
||||||
|
#define MINIMAL_IPV4_H
|
||||||
|
// From kernel header in.h
|
||||||
|
// location: uapi/linux/in.h or linux/in.h (older kerns) or /usr/include/netinet/in.h (installed path)
|
||||||
|
|
||||||
|
#include "../sys.h"
|
||||||
|
#include "../int.h"
|
||||||
|
|
||||||
|
struct in_addr {
|
||||||
|
uint32_t s_addr;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
|
||||||
|
struct sockaddr_in {
|
||||||
|
unsigned short sin_family; // address family: AF_INET
|
||||||
|
uint16_t sin_port; // port in network byte order
|
||||||
|
struct in_addr sin_addr; // internet address
|
||||||
|
// Padding to match the size of struct sockaddr
|
||||||
|
unsigned char sin_zero[8];
|
||||||
|
};
|
||||||
|
/* Address to accept any incoming messages. */
|
||||||
|
#define INADDR_ANY ((unsigned long int) 0x00000000)
|
||||||
|
|
||||||
|
/* Standard well-defined IP protocols. */
|
||||||
|
enum {
|
||||||
|
IPPROTO_IP = 0, /* Dummy protocol for TCP */
|
||||||
|
IPPROTO_ICMP = 1, /* Internet Control Message Protocol */
|
||||||
|
IPPROTO_IGMP = 2, /* Internet Group Management Protocol */
|
||||||
|
IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */
|
||||||
|
IPPROTO_TCP = 6, /* Transmission Control Protocol */
|
||||||
|
IPPROTO_EGP = 8, /* Exterior Gateway Protocol */
|
||||||
|
IPPROTO_PUP = 12, /* PUP protocol */
|
||||||
|
IPPROTO_UDP = 17, /* User Datagram Protocol */
|
||||||
|
IPPROTO_IDP = 22, /* XNS IDP protocol */
|
||||||
|
IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol */
|
||||||
|
IPPROTO_RSVP = 46, /* RSVP protocol */
|
||||||
|
IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */
|
||||||
|
|
||||||
|
IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */
|
||||||
|
|
||||||
|
IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */
|
||||||
|
IPPROTO_AH = 51, /* Authentication Header protocol */
|
||||||
|
IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET */
|
||||||
|
IPPROTO_PIM = 103, /* Protocol Independent Multicast */
|
||||||
|
|
||||||
|
IPPROTO_COMP = 108, /* Compression Header protocol */
|
||||||
|
IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */
|
||||||
|
|
||||||
|
IPPROTO_RAW = 255, /* Raw IP packets */
|
||||||
|
IPPROTO_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MINIMAL_IPV4_H
|
||||||
Loading…
x
Reference in New Issue
Block a user