source: ocsinventory-agent/trunk/fuentes/resources/ipdiscover/ipdiscover.h @ 468

Last change on this file since 468 was 468, checked in by mabarracus, 4 years ago

Copyt trusty code

File size: 1.5 KB
Line 
1/*
2###############################################################################
3##OCSInventory Version NG Beta
4##Copyleft Pascal DANEK 2006
5##Web : http://ocsinventory.sourceforge.net
6##
7##This code is open source and may be copied and modified as long as the source
8##code is always made freely available.
9##Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
10################################################################################
11*/
12
13#include <sys/socket.h>
14#include <linux/if_ether.h>
15#include <stdio.h>
16#include <string.h>
17#include <stdlib.h>
18#include <netinet/in.h>
19#include <arpa/inet.h>
20#include <unistd.h>
21#include <linux/if_packet.h>
22#include <ctype.h>
23#include <sys/types.h>
24#include <sys/socket.h>
25#include <linux/sockios.h>
26#include <sys/ioctl.h>
27#include <net/if.h>
28#include <fcntl.h>
29#include <time.h>
30#include <netdb.h>
31
32#ifndef ARPHRD_ETHER
33#define ARPHRD_ETHER 1
34#endif
35#ifndef ARPOP_REQUEST
36#define ARPOP_REQUEST 1
37#endif
38#ifndef ARPOP_REPLY
39#define ARPOP_REPLY 2
40#endif
41
42#define VERSION 5
43#define NAME_RES_LATENCY 1000000
44#define REQUEST_LATENCY_DEFAULT 100000
45
46/* Trame ARP */
47struct arphdr{
48  unsigned short arp_hrdad; 
49        unsigned short arp_prot;
50        unsigned char arp_halen;
51        unsigned char arp_prlen;
52        unsigned short arp_opcode;
53   
54        unsigned char ar_sha[ETH_ALEN];
55        unsigned char ar_sip[4];
56        unsigned char ar_tha[ETH_ALEN];
57        unsigned char ar_tip[4];
58};
59 
60/* Ethernet header*/
61struct Packet{
62        struct ethhdr ethhdr;
63        struct arphdr arphdr;
64};
65typedef struct Packet packet;
Note: See TracBrowser for help on using the repository browser.