Use standard C99 types
authorEric Andersen <andersen@codepoet.org>
Fri, 30 Jan 2004 23:45:53 +0000 (23:45 -0000)
committerEric Andersen <andersen@codepoet.org>
Fri, 30 Jan 2004 23:45:53 +0000 (23:45 -0000)
19 files changed:
networking/udhcp/arpping.c
networking/udhcp/arpping.h
networking/udhcp/clientpacket.c
networking/udhcp/dhcpc.c
networking/udhcp/dhcpc.h
networking/udhcp/dhcpd.c
networking/udhcp/dhcpd.h
networking/udhcp/files.c
networking/udhcp/leases.c
networking/udhcp/leases.h
networking/udhcp/options.c
networking/udhcp/options.h
networking/udhcp/packet.c
networking/udhcp/packet.h
networking/udhcp/script.c
networking/udhcp/serverpacket.c
networking/udhcp/serverpacket.h
networking/udhcp/socket.c
networking/udhcp/socket.h

index 363408d..f2e3768 100644 (file)
@@ -29,7 +29,7 @@
  */  
 
 /* FIXME: match response against chaddr */
-int arpping(u_int32_t yiaddr, u_int32_t ip, unsigned char *mac, char *interface)
+int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface)
 {
 
        int     timeout = 2;
@@ -91,7 +91,7 @@ int arpping(u_int32_t yiaddr, u_int32_t ip, unsigned char *mac, char *interface)
                        if (recv(s, &arp, sizeof(arp), 0) < 0 ) rv = 0;
                        if (arp.operation == htons(ARPOP_REPLY) && 
                            bcmp(arp.tHaddr, mac, 6) == 0 && 
-                           *((u_int *) arp.sInaddr) == yiaddr) {
+                           *((uint32_t *) arp.sInaddr) == yiaddr) {
                                DEBUG(LOG_INFO, "Valid arp reply receved for this address");
                                rv = 0;
                                break;
index 92b828d..99413aa 100644 (file)
 
 struct arpMsg {
        struct ethhdr ethhdr;                   /* Ethernet header */
-       u_short htype;                          /* hardware type (must be ARPHRD_ETHER) */
-       u_short ptype;                          /* protocol type (must be ETH_P_IP) */
-       u_char  hlen;                           /* hardware address length (must be 6) */
-       u_char  plen;                           /* protocol address length (must be 4) */
-       u_short operation;                      /* ARP opcode */
-       u_char  sHaddr[6];                      /* sender's hardware address */
-       u_char  sInaddr[4];                     /* sender's IP address */
-       u_char  tHaddr[6];                      /* target's hardware address */
-       u_char  tInaddr[4];                     /* target's IP address */
-       u_char  pad[18];                        /* pad for min. Ethernet payload (60 bytes) */
+       uint16_t htype;                         /* hardware type (must be ARPHRD_ETHER) */
+       uint16_t ptype;                         /* protocol type (must be ETH_P_IP) */
+       uint8_t  hlen;                          /* hardware address length (must be 6) */
+       uint8_t  plen;                          /* protocol address length (must be 4) */
+       uint16_t operation;                     /* ARP opcode */
+       uint8_t  sHaddr[6];                     /* sender's hardware address */
+       uint8_t  sInaddr[4];                    /* sender's IP address */
+       uint8_t  tHaddr[6];                     /* target's hardware address */
+       uint8_t  tInaddr[4];                    /* target's IP address */
+       uint8_t  pad[18];                       /* pad for min. Ethernet payload (60 bytes) */
 };
 
 /* function prototypes */
-int arpping(u_int32_t yiaddr, u_int32_t ip, unsigned char *arp, char *interface);
+int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *arp, char *interface);
 
 #endif
index 5cbe79e..6838c07 100644 (file)
@@ -78,7 +78,7 @@ static void init_packet(struct dhcpMessage *packet, char type)
        memcpy(packet->chaddr, client_config.arp, 6);
        add_option_string(packet->options, client_config.clientid);
        if (client_config.hostname) add_option_string(packet->options, client_config.hostname);
-       add_option_string(packet->options, (unsigned char *) &vendor_id);
+       add_option_string(packet->options, (uint8_t *) &vendor_id);
 }
 
 
@@ -179,8 +179,8 @@ int get_raw_packet(struct dhcpMessage *payload, int fd)
 {
        int bytes;
        struct udp_dhcp_packet packet;
-       u_int32_t source, dest;
-       u_int16_t check;
+       uint32_t source, dest;
+       uint16_t check;
 
        memset(&packet, 0, sizeof(struct udp_dhcp_packet));
        bytes = read(fd, &packet, sizeof(struct udp_dhcp_packet));
@@ -207,7 +207,7 @@ int get_raw_packet(struct dhcpMessage *payload, int fd)
        if (packet.ip.protocol != IPPROTO_UDP || packet.ip.version != IPVERSION ||
            packet.ip.ihl != sizeof(packet.ip) >> 2 || packet.udp.dest != htons(CLIENT_PORT) ||
            bytes > (int) sizeof(struct udp_dhcp_packet) ||
-           ntohs(packet.udp.len) != (short) (bytes - sizeof(packet.ip))) {
+           ntohs(packet.udp.len) != (uint16_t) (bytes - sizeof(packet.ip))) {
                DEBUG(LOG_INFO, "unrelated/bogus packet");
                return -2;
        }
index a180cc5..2ba42d2 100644 (file)
@@ -179,7 +179,7 @@ int udhcpc_main(int argc, char *argv[])
 int main(int argc, char *argv[])
 #endif
 {
-       unsigned char *temp, *message;
+       uint8_t *temp, *message;
        unsigned long t1 = 0, t2 = 0, xid = 0;
        unsigned long start = 0, lease;
        fd_set rfds;
index 7145cbd..9c4aa95 100644 (file)
@@ -25,10 +25,10 @@ struct client_config_t {
        char *interface;                /* The name of the interface to use */
        char *pidfile;                  /* Optionally store the process ID */
        char *script;                   /* User script to run at dhcp events */
-       unsigned char *clientid;        /* Optional client id to use */
-       unsigned char *hostname;        /* Optional hostname to use */
+       uint8_t *clientid;              /* Optional client id to use */
+       uint8_t *hostname;              /* Optional hostname to use */
        int ifindex;                    /* Index number of the interface to use */
-       unsigned char arp[6];           /* Our arp address */
+       uint8_t arp[6];                 /* Our arp address */
 };
 
 extern struct client_config_t client_config;
index aabab38..8c944f2 100644 (file)
@@ -62,9 +62,9 @@ int main(int argc, char *argv[])
        int server_socket = -1;
        int bytes, retval;
        struct dhcpMessage packet;
-       unsigned char *state;
-       unsigned char *server_id, *requested;
-       u_int32_t server_id_align, requested_align;
+       uint8_t *state;
+       uint8_t *server_id, *requested;
+       uint32_t server_id_align, requested_align;
        unsigned long timeout_end;
        struct option_set *option;
        struct dhcpOfferedAddr *lease;
index d53a809..9256344 100644 (file)
 #define SNAME_FIELD            2
 
 /* miscellaneous defines */
-#define MAC_BCAST_ADDR         (unsigned char *) "\xff\xff\xff\xff\xff\xff"
+#define MAC_BCAST_ADDR         (uint8_t *) "\xff\xff\xff\xff\xff\xff"
 #define OPT_CODE 0
 #define OPT_LEN 1
 #define OPT_DATA 2
 
 struct option_set {
-       unsigned char *data;
+       uint8_t *data;
        struct option_set *next;
 };
 
 struct server_config_t {
-       u_int32_t server;               /* Our IP, in network order */
-       u_int32_t start;                /* Start address of leases, network order */
-       u_int32_t end;                  /* End of leases, network order */
+       uint32_t server;                /* Our IP, in network order */
+       uint32_t start;         /* Start address of leases, network order */
+       uint32_t end;                   /* End of leases, network order */
        struct option_set *options;     /* List of DHCP options loaded from the config file */
        char *interface;                /* The name of the interface to use */
        int ifindex;                    /* Index number of the interface to use */
-       unsigned char arp[6];           /* Our arp address */
+       uint8_t arp[6];         /* Our arp address */
        unsigned long lease;            /* lease time in seconds (host order) */
        unsigned long max_leases;       /* maximum number of leases (including reserved address) */
        char remaining;                 /* should the lease file be interpreted as lease time remaining, or
@@ -121,7 +121,7 @@ struct server_config_t {
        char *lease_file;
        char *pidfile;
        char *notify_file;              /* What to run whenever leases are written */
-       u_int32_t siaddr;               /* next server bootp option */
+       uint32_t siaddr;                /* next server bootp option */
        char *sname;                    /* bootp server name */
        char *boot_file;                /* bootp boot file option */
 };     
index 6d72863..0802bb3 100644 (file)
@@ -52,7 +52,7 @@ static int read_str(const char *line, void *arg)
 
 static int read_u32(const char *line, void *arg)
 {
-       u_int32_t *dest = arg;
+       uint32_t *dest = arg;
        char *endptr;
        *dest = strtoul(line, &endptr, 0);
        return endptr[0] == '\0';
@@ -83,8 +83,8 @@ static int read_opt(const char *const_line, void *arg)
        int retval = 0, length;
        char buffer[8];
        char *line;
-       u_int16_t *result_u16 = (u_int16_t *) buffer;
-       u_int32_t *result_u32 = (u_int32_t *) buffer;
+       uint16_t *result_u16 = (uint16_t *) buffer;
+       uint32_t *result_u32 = (uint32_t *) buffer;
 
        /* Cheat, the only const line we'll actually get is "" */
        line = (char *) const_line;
index add114f..dce0566 100644 (file)
 #include "common.h"
 
 
-unsigned char blank_chaddr[] = {[0 ... 15] = 0};
+uint8_t blank_chaddr[] = {[0 ... 15] = 0};
 
 /* clear every lease out that chaddr OR yiaddr matches and is nonzero */
-void clear_lease(u_int8_t *chaddr, u_int32_t yiaddr)
+void clear_lease(uint8_t *chaddr, uint32_t yiaddr)
 {
        unsigned int i, j;
        
@@ -35,7 +35,7 @@ void clear_lease(u_int8_t *chaddr, u_int32_t yiaddr)
 
 
 /* add a lease into the table, clearing out any old ones */
-struct dhcpOfferedAddr *add_lease(u_int8_t *chaddr, u_int32_t yiaddr, unsigned long lease)
+struct dhcpOfferedAddr *add_lease(uint8_t *chaddr, uint32_t yiaddr, unsigned long lease)
 {
        struct dhcpOfferedAddr *oldest;
        
@@ -80,7 +80,7 @@ struct dhcpOfferedAddr *oldest_expired_lease(void)
 
 
 /* Find the first lease that matches chaddr, NULL if no match */
-struct dhcpOfferedAddr *find_lease_by_chaddr(u_int8_t *chaddr)
+struct dhcpOfferedAddr *find_lease_by_chaddr(uint8_t *chaddr)
 {
        unsigned int i;
 
@@ -92,7 +92,7 @@ struct dhcpOfferedAddr *find_lease_by_chaddr(u_int8_t *chaddr)
 
 
 /* Find the first lease that matches yiaddr, NULL is no match */
-struct dhcpOfferedAddr *find_lease_by_yiaddr(u_int32_t yiaddr)
+struct dhcpOfferedAddr *find_lease_by_yiaddr(uint32_t yiaddr)
 {
        unsigned int i;
 
@@ -104,7 +104,7 @@ struct dhcpOfferedAddr *find_lease_by_yiaddr(u_int32_t yiaddr)
 
 
 /* check is an IP is taken, if it is, add it to the lease table */
-static int check_ip(u_int32_t addr)
+static int check_ip(uint32_t addr)
 {
        struct in_addr temp;
 
@@ -120,9 +120,9 @@ static int check_ip(u_int32_t addr)
 
 /* find an assignable address, it check_expired is true, we check all the expired leases as well.
  * Maybe this should try expired leases by age... */
-u_int32_t find_address(int check_expired) 
+uint32_t find_address(int check_expired) 
 {
-       u_int32_t addr, ret;
+       uint32_t addr, ret;
        struct dhcpOfferedAddr *lease = NULL;           
 
        addr = ntohl(server_config.start); /* addr is in host order here */
index 24d8608..b13fa72 100644 (file)
@@ -4,20 +4,20 @@
 
 
 struct dhcpOfferedAddr {
-       u_int8_t chaddr[16];
-       u_int32_t yiaddr;       /* network order */
-       u_int32_t expires;      /* host order */
+       uint8_t chaddr[16];
+       uint32_t yiaddr;        /* network order */
+       uint32_t expires;       /* host order */
 };
 
-extern unsigned char blank_chaddr[];
+extern uint8_t blank_chaddr[];
 
-void clear_lease(u_int8_t *chaddr, u_int32_t yiaddr);
-struct dhcpOfferedAddr *add_lease(u_int8_t *chaddr, u_int32_t yiaddr, unsigned long lease);
+void clear_lease(uint8_t *chaddr, uint32_t yiaddr);
+struct dhcpOfferedAddr *add_lease(uint8_t *chaddr, uint32_t yiaddr, unsigned long lease);
 int lease_expired(struct dhcpOfferedAddr *lease);
 struct dhcpOfferedAddr *oldest_expired_lease(void);
-struct dhcpOfferedAddr *find_lease_by_chaddr(u_int8_t *chaddr);
-struct dhcpOfferedAddr *find_lease_by_yiaddr(u_int32_t yiaddr);
-u_int32_t find_address(int check_expired);
+struct dhcpOfferedAddr *find_lease_by_chaddr(uint8_t *chaddr);
+struct dhcpOfferedAddr *find_lease_by_yiaddr(uint32_t yiaddr);
+uint32_t find_address(int check_expired);
 
 
 #endif
index 32deeab..1bdf257 100644 (file)
@@ -59,10 +59,10 @@ int option_lengths[] = {
 
 
 /* get an option with bounds checking (warning, not aligned). */
-unsigned char *get_option(struct dhcpMessage *packet, int code)
+uint8_t *get_option(struct dhcpMessage *packet, int code)
 {
        int i, length;
-       unsigned char *optionptr;
+       uint8_t *optionptr;
        int over = 0, done = 0, curr = OPTION_FIELD;
        
        optionptr = packet->options;
@@ -114,7 +114,7 @@ unsigned char *get_option(struct dhcpMessage *packet, int code)
 
 
 /* return the position of the 'end' option (no bounds checking) */
-int end_option(unsigned char *optionptr) 
+int end_option(uint8_t *optionptr) 
 {
        int i = 0;
        
@@ -128,7 +128,7 @@ int end_option(unsigned char *optionptr)
 
 /* add an option string to the options (an option string contains an option code,
  * length, then data) */
-int add_option_string(unsigned char *optionptr, unsigned char *string)
+int add_option_string(uint8_t *optionptr, uint8_t *string)
 {
        int end = end_option(optionptr);
        
@@ -145,17 +145,17 @@ int add_option_string(unsigned char *optionptr, unsigned char *string)
 
 
 /* add a one to four byte option to a packet */
-int add_simple_option(unsigned char *optionptr, unsigned char code, u_int32_t data)
+int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data)
 {
        char length = 0;
        int i;
-       unsigned char option[2 + 4];
-       unsigned char *u8;
-       u_int16_t *u16;
-       u_int32_t *u32;
-       u_int32_t aligned;
-       u8 = (unsigned char *) &aligned;
-       u16 = (u_int16_t *) &aligned;
+       uint8_t option[2 + 4];
+       uint8_t *u8;
+       uint16_t *u16;
+       uint32_t *u32;
+       uint32_t aligned;
+       u8 = (uint8_t *) &aligned;
+       u16 = (uint16_t *) &aligned;
        u32 = &aligned;
 
        for (i = 0; dhcp_options[i].code; i++)
index a626658..fbe54c8 100644 (file)
@@ -24,16 +24,16 @@ enum {
 struct dhcp_option {
        char name[10];
        char flags;
-       unsigned char code;
+       uint8_t code;
 };
 
 extern struct dhcp_option dhcp_options[];
 extern int option_lengths[];
 
-unsigned char *get_option(struct dhcpMessage *packet, int code);
-int end_option(unsigned char *optionptr);
-int add_option_string(unsigned char *optionptr, unsigned char *string);
-int add_simple_option(unsigned char *optionptr, unsigned char code, u_int32_t data);
+uint8_t *get_option(struct dhcpMessage *packet, int code);
+int end_option(uint8_t *optionptr);
+int add_option_string(uint8_t *optionptr, uint8_t *string);
+int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data);
 struct option_set *find_option(struct option_set *opt_list, char code);
 void attach_option(struct option_set **opt_list, struct dhcp_option *option, char *buffer, int length);
 
index 32b4894..a3c7ae1 100644 (file)
@@ -69,7 +69,7 @@ int get_packet(struct dhcpMessage *packet, int fd)
        
        if (packet->op == BOOTREQUEST && (vendor = get_option(packet, DHCP_VENDOR))) {
                for (i = 0; broken_vendors[i][0]; i++) {
-                       if (vendor[OPT_LEN - 2] == (unsigned char) strlen(broken_vendors[i]) &&
+                       if (vendor[OPT_LEN - 2] == (uint8_t) strlen(broken_vendors[i]) &&
                            !strncmp(vendor, broken_vendors[i], vendor[OPT_LEN - 2])) {
                                DEBUG(LOG_INFO, "broken client (%s), forcing broadcast",
                                        broken_vendors[i]);
@@ -83,13 +83,13 @@ int get_packet(struct dhcpMessage *packet, int fd)
 }
 
 
-u_int16_t checksum(void *addr, int count)
+uint16_t checksum(void *addr, int count)
 {
        /* Compute Internet Checksum for "count" bytes
         *         beginning at location "addr".
         */
        register int32_t sum = 0;
-       u_int16_t *source = (u_int16_t *) addr;
+       uint16_t *source = (uint16_t *) addr;
 
        while (count > 1)  {
                /*  This is the inner loop */
@@ -101,8 +101,8 @@ u_int16_t checksum(void *addr, int count)
        if (count > 0) {
                /* Make sure that the left-over byte is added correctly both
                 * with little and big endian hosts */
-               u_int16_t tmp = 0;
-               *(unsigned char *) (&tmp) = * (unsigned char *) source;
+               uint16_t tmp = 0;
+               *(uint8_t *) (&tmp) = * (uint8_t *) source;
                sum += tmp;
        }
        /*  Fold 32-bit sum to 16 bits */
@@ -114,8 +114,8 @@ u_int16_t checksum(void *addr, int count)
 
 
 /* Constuct a ip/udp header for a packet, and specify the source and dest hardware address */
-int raw_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port,
-                  u_int32_t dest_ip, int dest_port, unsigned char *dest_arp, int ifindex)
+int raw_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port,
+                  uint32_t dest_ip, int dest_port, uint8_t *dest_arp, int ifindex)
 {
        int fd;
        int result;
@@ -167,8 +167,8 @@ int raw_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port
 
 
 /* Let the kernel do all the work for packet generation */
-int kernel_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port,
-                  u_int32_t dest_ip, int dest_port)
+int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port,
+                  uint32_t dest_ip, int dest_port)
 {
        int n = 1;
        int fd, result;
index 1a263ef..22c4d09 100644 (file)
@@ -5,22 +5,22 @@
 #include <netinet/ip.h>
 
 struct dhcpMessage {
-       u_int8_t op;
-       u_int8_t htype;
-       u_int8_t hlen;
-       u_int8_t hops;
-       u_int32_t xid;
-       u_int16_t secs;
-       u_int16_t flags;
-       u_int32_t ciaddr;
-       u_int32_t yiaddr;
-       u_int32_t siaddr;
-       u_int32_t giaddr;
-       u_int8_t chaddr[16];
-       u_int8_t sname[64];
-       u_int8_t file[128];
-       u_int32_t cookie;
-       u_int8_t options[308]; /* 312 - cookie */ 
+       uint8_t op;
+       uint8_t htype;
+       uint8_t hlen;
+       uint8_t hops;
+       uint32_t xid;
+       uint16_t secs;
+       uint16_t flags;
+       uint32_t ciaddr;
+       uint32_t yiaddr;
+       uint32_t siaddr;
+       uint32_t giaddr;
+       uint8_t chaddr[16];
+       uint8_t sname[64];
+       uint8_t file[128];
+       uint32_t cookie;
+       uint8_t options[308]; /* 312 - cookie */ 
 };
 
 struct udp_dhcp_packet {
@@ -31,11 +31,11 @@ struct udp_dhcp_packet {
 
 void init_header(struct dhcpMessage *packet, char type);
 int get_packet(struct dhcpMessage *packet, int fd);
-u_int16_t checksum(void *addr, int count);
-int raw_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port,
-                  u_int32_t dest_ip, int dest_port, unsigned char *dest_arp, int ifindex);
-int kernel_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port,
-                  u_int32_t dest_ip, int dest_port);
+uint16_t checksum(void *addr, int count);
+int raw_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port,
+                  uint32_t dest_ip, int dest_port, uint8_t *dest_arp, int ifindex);
+int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port,
+                  uint32_t dest_ip, int dest_port);
 
 
 #endif
index 24688b5..b7d7862 100644 (file)
@@ -55,7 +55,7 @@ static inline int upper_length(int length, int opt_index)
 }
 
 
-static int sprintip(char *dest, char *pre, unsigned char *ip)
+static int sprintip(char *dest, char *pre, uint8_t *ip)
 {
        return sprintf(dest, "%s%d.%d.%d.%d", pre, ip[0], ip[1], ip[2], ip[3]);
 }
@@ -74,12 +74,12 @@ static int mton(struct in_addr *mask)
 
 
 /* Fill dest with the text of option 'option'. */
-static void fill_options(char *dest, unsigned char *option, struct dhcp_option *type_p)
+static void fill_options(char *dest, uint8_t *option, struct dhcp_option *type_p)
 {
        int type, optlen;
-       u_int16_t val_u16;
+       uint16_t val_u16;
        int16_t val_s16;
-       u_int32_t val_u32;
+       uint32_t val_u32;
        int32_t val_s32;
        int len = option[OPT_LEN - 2];
 
@@ -138,7 +138,7 @@ static char **fill_envp(struct dhcpMessage *packet)
        int num_options = 0;
        int i, j;
        char **envp;
-       unsigned char *temp;
+       uint8_t *temp;
        struct in_addr subnet;
        char over = 0;
 
@@ -168,7 +168,7 @@ static char **fill_envp(struct dhcpMessage *packet)
        if (packet == NULL) return envp;
 
        envp[j] = xmalloc(sizeof("ip=255.255.255.255"));
-       sprintip(envp[j++], "ip=", (unsigned char *) &packet->yiaddr);
+       sprintip(envp[j++], "ip=", (uint8_t *) &packet->yiaddr);
 
 
        for (i = 0; dhcp_options[i].code; i++) {
@@ -186,7 +186,7 @@ static char **fill_envp(struct dhcpMessage *packet)
        }
        if (packet->siaddr) {
                envp[j] = xmalloc(sizeof("siaddr=255.255.255.255"));
-               sprintip(envp[j++], "siaddr=", (unsigned char *) &packet->siaddr);
+               sprintip(envp[j++], "siaddr=", (uint8_t *) &packet->siaddr);
        }
        if (!(over & FILE_FIELD) && packet->file[0]) {
                /* watch out for invalid packets */
index 32d3c80..d39e6ba 100644 (file)
@@ -43,8 +43,8 @@ static int send_packet_to_relay(struct dhcpMessage *payload)
 /* send a packet to a specific arp address and ip address by creating our own ip packet */
 static int send_packet_to_client(struct dhcpMessage *payload, int force_broadcast)
 {
-       unsigned char *chaddr;
-       u_int32_t ciaddr;
+       uint8_t *chaddr;
+       uint32_t ciaddr;
        
        if (force_broadcast) {
                DEBUG(LOG_INFO, "broadcasting packet to client (NAK)");
@@ -108,8 +108,8 @@ int sendOffer(struct dhcpMessage *oldpacket)
 {
        struct dhcpMessage packet;
        struct dhcpOfferedAddr *lease = NULL;
-       u_int32_t req_align, lease_time_align = server_config.lease;
-       unsigned char *req, *lease_time;
+       uint32_t req_align, lease_time_align = server_config.lease;
+       uint8_t *req, *lease_time;
        struct option_set *curr;
        struct in_addr addr;
 
@@ -196,12 +196,12 @@ int sendNAK(struct dhcpMessage *oldpacket)
 }
 
 
-int sendACK(struct dhcpMessage *oldpacket, u_int32_t yiaddr)
+int sendACK(struct dhcpMessage *oldpacket, uint32_t yiaddr)
 {
        struct dhcpMessage packet;
        struct option_set *curr;
-       unsigned char *lease_time;
-       u_int32_t lease_time_align = server_config.lease;
+       uint8_t *lease_time;
+       uint32_t lease_time_align = server_config.lease;
        struct in_addr addr;
 
        init_packet(&packet, oldpacket, DHCPACK);
index 233d449..9024928 100644 (file)
@@ -5,7 +5,7 @@
 
 int sendOffer(struct dhcpMessage *oldpacket);
 int sendNAK(struct dhcpMessage *oldpacket);
-int sendACK(struct dhcpMessage *oldpacket, u_int32_t yiaddr);
+int sendACK(struct dhcpMessage *oldpacket, uint32_t yiaddr);
 int send_inform(struct dhcpMessage *oldpacket);
 
 
index c19838a..582f0fc 100644 (file)
@@ -44,7 +44,7 @@
 #include "socket.h"
 #include "common.h"
 
-int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char *arp)
+int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp)
 {
        int fd;
        struct ifreq ifr;
@@ -90,7 +90,7 @@ int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char
 }
 
 
-int listen_socket(unsigned int ip, int port, char *inf)
+int listen_socket(uint32_t ip, int port, char *inf)
 {
        struct ifreq interface;
        int fd;
index d259ef7..66179d4 100644 (file)
@@ -2,7 +2,7 @@
 #ifndef _SOCKET_H
 #define _SOCKET_H
 
-int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char *arp);
-int listen_socket(unsigned int ip, int port, char *inf);
+int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp);
+int listen_socket(uint32_t ip, int port, char *inf);
 
 #endif