Go to the documentation of this file.00001 #ifndef __IP_H__
00002 #define __IP_H__
00003
00004 #include <inttypes.h>
00005 #include <arpa/inet.h>
00006
00007 #define _noalign
00008
00009 #define IP_VERSION 0
00010
00011 #define IP_VERSION_AND_HEADERLENGTH 0
00012 #define IPV4_TYPE_OF_SERVICE 1
00013 #define IPV4_LENGTH 2
00014 #define IPV4_IDENTFICATION 4
00015 #define IPV4_FLAGS_AND_FRAGMENT_OFSET 6
00016 #define IPV4_TTL 8
00017 #define IPV4_PROTOCOL 9
00018 #define IPV4_CHECKSUM 10
00019 #define IPV4_SOURCE 12
00020 #define IPV4_DESTINATION 16
00021
00022
00023
00024 #define IP_PROT_UDP 17
00025 #define IP_PROT_TCP 11
00026 #define IP_PROT_ICMP 1
00027
00028
00029
00030 #define ICMP_TYPE 0
00031 #define ICMP_CODE 1
00032 #define ICMP_CRC 2
00033 #define ICMP_ECHO_IDENTIFIER 4
00034 #define ICMP_ECHO_SEQNUMBER 6
00035 #define ICMP_DATA 8
00036
00037 #define ICMP_ECHO_REQUEST 8
00038 #define ICMP_ECHO_REPLY 0
00039
00040
00041
00042
00043
00044 #define GET_UINT16(buffer,position) ( ntohs( *(_noalign uint16_t *)(buffer+position) ) )
00045 #define GET_UINT32(buffer,position) ( ntohl( *(_noalign uint32_t *)(buffer+position) ) )
00046
00047 #define SET_UINT16(buffer,position,data) ( *( _noalign uint16_t *)(buffer+position)=htons(data) )
00048 #define SET_UINT32(buffer,position,data) ( *( _noalign uint32_t *)(buffer+position)=htonl(data) )
00049
00050
00051
00052 #endif // __IP_H__