packet.h

Go to the documentation of this file.
00001 #ifndef _PACKET_H
00002 #define _PACKET_H
00003 
00004 #include <netinet/udp.h>
00005 #include <netinet/ip.h>
00006 
00007 struct dhcpMessage {
00008         u_int8_t op;
00009         u_int8_t htype;
00010         u_int8_t hlen;
00011         u_int8_t hops;
00012         u_int32_t xid;
00013         u_int16_t secs;
00014         u_int16_t flags;
00015         u_int32_t ciaddr;
00016         u_int32_t yiaddr;
00017         u_int32_t siaddr;
00018         u_int32_t giaddr;
00019         u_int8_t chaddr[16];
00020         u_int8_t sname[64];
00021         u_int8_t file[128];
00022         u_int32_t cookie;
00023         u_int8_t options[308]; /* 312 - cookie */ 
00024 };
00025 
00026 struct udp_dhcp_packet {
00027         struct iphdr ip;
00028         struct udphdr udp;
00029         struct dhcpMessage data;
00030 };
00031 
00032 void init_header(struct dhcpMessage *packet, char type);
00033 int get_packet(struct dhcpMessage *packet, int fd);
00034 u_int16_t checksum(void *addr, int count);
00035 int raw_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port,
00036                    u_int32_t dest_ip, int dest_port, unsigned char *dest_arp, int ifindex);
00037 int kernel_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port,
00038                    u_int32_t dest_ip, int dest_port);
00039 
00040 
00041 #endif

Generated on Tue Jan 15 12:24:45 2008 for Dynamics 0.8.1.Dynamo.1 by  doxygen 1.5.1