-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathip.h
More file actions
36 lines (30 loc) · 648 Bytes
/
Copy pathip.h
File metadata and controls
36 lines (30 loc) · 648 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef IP_H
#define IP_H
#include <string.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include "ethernet.h"
#define IP_CHAR_LEN 16
#define HEX 0
#define INTEGER 1
#define BUF_SIZ 65535
typedef struct ip_hdr
{
uint8_t version:4;
uint8_t ihl:4;
uint8_t type_of_service;
uint16_t total_length;
uint16_t identification;
uint16_t fragment_offset;
uint8_t ttl;
uint8_t protocol;
uint16_t hdr_checksum;
uint32_t source_address;
uint32_t destination_address;
// options
// padding
} Ip_h;
void ip_hdr_dbg(struct ip_hdr *ip_header, int dump_form);
#endif