Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


added network server files
[palacios.git] / misc / network_servers / vtl / net_util.h
1 #ifndef __NET_UTIL_H
2 #define __NET_UTIL_H 1
3
4 #ifdef linux
5 #include <sys/socket.h>
6 #include <sys/types.h> 
7 #include <netinet/in.h>
8 #elif WIN32
9
10 #endif
11
12 // 14 (ethernet frame) + 20 bytes
13 struct HEADERS {
14   char ethernetdest[6];
15   char ethernetsrc[6];
16   unsigned char ethernettype[2]; // indicates layer 3 protocol type
17   char ip[20];
18 };
19
20 struct IPHEADER {
21   unsigned char junk[9];
22   unsigned char protocol[1];
23   unsigned char checksum[2];
24
25   union {
26     // for getting the address information both in binary format and long format
27     unsigned char src[4];
28     unsigned long srcl;
29   };
30
31   union {
32     unsigned char dest[4];
33     unsigned long destl;
34   };
35
36 };
37
38 // this is used to extract the IP address from the IP header in conventional form
39 struct IPADDRESS {
40   unsigned char a1,a2,a3,a4;
41 };
42
43
44 void do_binary_to_string(unsigned char* ip,char* buffer);
45 void do_ipaddress_to_string(IPADDRESS ipaddress,char* buffer);
46 void do_binary_to_ipaddress(unsigned char* ip,IPADDRESS& ipaddress);
47 //char* return_ip_protocol(unsigned char protocol);
48
49
50
51 #endif