A collection of macros, structs, and enums to represent packet types and headers.
More...
#include <sys/types.h>
#include <arpa/inet.h>
Go to the source code of this file.
|
#define | IP_MAXPACKET 65535 |
|
#define | __LITTLE_ENDIAN 1 |
|
#define | __BIG_ENDIAN 2 |
|
#define | ICMP_DATA_SIZE 28 |
|
#define | ICMP_ZERO_HEADER_SIZE 10 |
|
#define | ICMP_ELEVEN_HEADER_SIZE 36 |
|
#define | IP_RF 0x8000 |
| reserved fragment flag
|
|
#define | IP_DF 0x4000 |
| dont fragment flag
|
|
#define | IP_MF 0x2000 |
| more fragments flag
|
|
#define | IP_OFFMASK 0x1fff |
| mask for fragmenting bits
|
|
#define | ETHER_ADDR_LEN 6 |
|
#define | ICMP_TYPE_ECHO_REPLY 0 |
|
#define | ICMP_TYPE_DEST_UNREACH 3 |
|
#define | ICMP_TYPE_ECHO_REQUEST 8 |
|
#define | ICMP_TYPE_TIME_EXCEEDED 11 |
|
#define | ICMP_CODE_NET_UNREACH 0 |
|
#define | ICMP_CODE_HOST_UNREACH 1 |
|
#define | ICMP_CODE_PROTO_UNREACH 2 |
|
#define | ICMP_CODE_PORT_UNREACH 3 |
|
#define | ICMP_CODE_TTL_EXPIRED 0 |
|
#define | IP_PROTO_ICMP 0x0001 |
|
#define | IPV4_HEADER_LEN 20 |
|
#define | ICMP_HEADER_LEN 8 |
|
#define | sr_IFACE_NAMELEN 32 |
|
|
enum | sr_ip_protocol { ip_protocol_icmp = 0x0001
} |
| Enumeration of useful codes for protocols encapsulated in IP.
|
|
enum | sr_ethertype { ethertype_arp = 0x0806,
ethertype_ip = 0x0800
} |
| Enumeration of useful codes for protocols encapsulated in Ethernet.
|
|
enum | sr_arp_opcode { arp_op_request = 0x0001,
arp_op_reply = 0x0002
} |
| Enumeration of useful codes for ARP operations.
|
|
enum | sr_arp_hrd_fmt { arp_hrd_ethernet = 0x0001
} |
| Enumeration of useful hardware format codes for ARP.
|
|
|
uint8_t | icmp_type |
| icmp type
|
|
uint8_t | icmp_code |
| icmp code, if needed
|
|
uint16_t | icmp_sum |
| icmp checksum
|
|
uint16_t | icmp_id |
| icmp identifier, you shouldn't need to use this
|
|
uint16_t | icmp_seq |
| icmp sequence number, you shouldn't need to use this
|
|
uint16_t | timestamp |
|
uint16_t | data [ICMP_DATA_SIZE/2] |
|
uint16_t | unused |
|
uint16_t | next_mtu |
|
uint8_t | ip_tos |
| type of service
|
|
uint16_t | ip_len |
| total length
|
|
uint16_t | ip_id |
| identification
|
|
uint16_t | ip_off |
| fragment offset field
|
|
uint8_t | ip_ttl |
| time to live
|
|
uint8_t | ip_p |
| protocol of encapsulated packet
|
|
uint16_t | ip_sum |
| IP checksum.
|
|
uint32_t | ip_src |
| src IP address
|
|
uint32_t | ip_dst |
| dest IP address
|
|
uint8_t | ether_dhost [ETHER_ADDR_LEN] |
| destination ethernet address
|
|
uint8_t | ether_shost [ETHER_ADDR_LEN] |
| source ethernet address
|
|
uint16_t | ether_type |
| type (protocol) of encapsulated packet
|
|
enum sr_ip_protocol | __attribute__ |
|
unsigned short | ar_hrd |
| format of hardware address
|
|
unsigned short | ar_pro |
| format of protocol address
|
|
unsigned char | ar_hln |
| length of hardware address
|
|
unsigned char | ar_pln |
| length of protocol address
|
|
unsigned short | ar_op |
| ARP opcode (command)
|
|
unsigned char | ar_sha [ETHER_ADDR_LEN] |
| sender hardware address
|
|
uint32_t | ar_sip |
| sender IP address
|
|
unsigned char | ar_tha [ETHER_ADDR_LEN] |
| target hardware address
|
|
uint32_t | ar_tip |
| target IP address
|
|
A collection of macros, structs, and enums to represent packet types and headers.