slirp: Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int types

There is no need to have a second set of integral types.
Replace them by the standard types from stdint.h.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
diff --git a/cksum.c b/cksum.c
index 195b49d..42adba3 100644
--- a/cksum.c
+++ b/cksum.c
@@ -51,23 +51,23 @@
 
 int cksum(struct mbuf *m, int len)
 {
-    register u_int16_t *w;
+    register uint16_t *w;
     register int sum = 0;
     register int mlen = 0;
     int byte_swapped = 0;
 
     union {
-        u_int8_t c[2];
-        u_int16_t s;
+        uint8_t c[2];
+        uint16_t s;
     } s_util;
     union {
-        u_int16_t s[2];
-        u_int32_t l;
+        uint16_t s[2];
+        uint32_t l;
     } l_util;
 
     if (m->m_len == 0)
         goto cont;
-    w = mtod(m, u_int16_t *);
+    w = mtod(m, uint16_t *);
 
     mlen = m->m_len;
 
@@ -82,8 +82,8 @@
     if ((1 & (long)w) && (mlen > 0)) {
         REDUCE;
         sum <<= 8;
-        s_util.c[0] = *(u_int8_t *)w;
-        w = (u_int16_t *)((int8_t *)w + 1);
+        s_util.c[0] = *(uint8_t *)w;
+        w = (uint16_t *)((int8_t *)w + 1);
         mlen--;
         byte_swapped = 1;
     }
@@ -130,14 +130,14 @@
         REDUCE;
         sum <<= 8;
         if (mlen == -1) {
-            s_util.c[1] = *(u_int8_t *)w;
+            s_util.c[1] = *(uint8_t *)w;
             sum += s_util.s;
             mlen = 0;
         } else
 
             mlen = -1;
     } else if (mlen == -1)
-        s_util.c[0] = *(u_int8_t *)w;
+        s_util.c[0] = *(uint8_t *)w;
 
 cont:
 #ifdef DEBUG
diff --git a/ip.h b/ip.h
index 4a227d3..5392c7e 100644
--- a/ip.h
+++ b/ip.h
@@ -51,17 +51,17 @@
 #define NTOHL(d) ((d) = ntohl((d)))
 #endif
 #ifndef NTOHS
-#define NTOHS(d) ((d) = ntohs((u_int16_t)(d)))
+#define NTOHS(d) ((d) = ntohs((uint16_t)(d)))
 #endif
 #ifndef HTONL
 #define HTONL(d) ((d) = htonl((d)))
 #endif
 #ifndef HTONS
-#define HTONS(d) ((d) = htons((u_int16_t)(d)))
+#define HTONS(d) ((d) = htons((uint16_t)(d)))
 #endif
 #endif
 
-typedef u_int32_t n_long; /* long as received from the net */
+typedef uint32_t n_long; /* long as received from the net */
 
 /*
  * Definitions for internet protocol version 4.
@@ -80,16 +80,16 @@
     u_int ip_hl : 4, /* header length */
         ip_v : 4; /* version */
 #endif
-    u_int8_t ip_tos; /* type of service */
-    u_int16_t ip_len; /* total length */
-    u_int16_t ip_id; /* identification */
-    u_int16_t ip_off; /* fragment offset field */
+    uint8_t ip_tos; /* type of service */
+    uint16_t ip_len; /* total length */
+    uint16_t ip_id; /* identification */
+    uint16_t ip_off; /* fragment offset field */
 #define IP_DF 0x4000 /* don't fragment flag */
 #define IP_MF 0x2000 /* more fragments flag */
 #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
-    u_int8_t ip_ttl; /* time to live */
-    u_int8_t ip_p; /* protocol */
-    u_int16_t ip_sum; /* checksum */
+    uint8_t ip_ttl; /* time to live */
+    uint8_t ip_p; /* protocol */
+    uint16_t ip_sum; /* checksum */
     struct in_addr ip_src, ip_dst; /* source and dest address */
 } __attribute__((packed));
 
@@ -136,9 +136,9 @@
  * Time stamp option structure.
  */
 struct ip_timestamp {
-    u_int8_t ipt_code; /* IPOPT_TS */
-    u_int8_t ipt_len; /* size of structure (variable) */
-    u_int8_t ipt_ptr; /* index of current entry */
+    uint8_t ipt_code; /* IPOPT_TS */
+    uint8_t ipt_len; /* size of structure (variable) */
+    uint8_t ipt_ptr; /* index of current entry */
 #ifdef HOST_WORDS_BIGENDIAN
     u_int ipt_oflw : 4, /* overflow counter */
         ipt_flg : 4; /* flags, see below */
@@ -198,9 +198,9 @@
  */
 struct ipovly {
     struct mbuf_ptr ih_mbuf; /* backpointer to mbuf */
-    u_int8_t ih_x1; /* (unused) */
-    u_int8_t ih_pr; /* protocol */
-    u_int16_t ih_len; /* protocol length */
+    uint8_t ih_x1; /* (unused) */
+    uint8_t ih_pr; /* protocol */
+    uint16_t ih_len; /* protocol length */
     struct in_addr ih_src; /* source internet address */
     struct in_addr ih_dst; /* destination internet address */
 } __attribute__((packed));
@@ -215,9 +215,9 @@
 struct ipq {
     struct qlink frag_link; /* to ip headers of fragments */
     struct qlink ip_link; /* to other reass headers */
-    u_int8_t ipq_ttl; /* time for reass q to live */
-    u_int8_t ipq_p; /* protocol of this fragment */
-    u_int16_t ipq_id; /* sequence id for reassembly */
+    uint8_t ipq_ttl; /* time for reass q to live */
+    uint8_t ipq_p; /* protocol of this fragment */
+    uint16_t ipq_id; /* sequence id for reassembly */
     struct in_addr ipq_src, ipq_dst;
 } __attribute__((packed));
 
diff --git a/ip_icmp.h b/ip_icmp.h
index ddeaa7b..f035dc5 100644
--- a/ip_icmp.h
+++ b/ip_icmp.h
@@ -38,7 +38,7 @@
  * Per RFC 792, September 1981.
  */
 
-typedef u_int32_t n_time;
+typedef uint32_t n_time;
 
 /*
  * Structure of an icmp header.
diff --git a/ip_input.c b/ip_input.c
index e595455..8c0372e 100644
--- a/ip_input.c
+++ b/ip_input.c
@@ -467,7 +467,7 @@
     register struct in_ifaddr *ia;
     int opt, optlen, cnt, off, code, type, forward = 0;
     struct in_addr *sin, dst;
-    typedef u_int32_t n_time;
+    typedef uint32_t n_time;
     n_time ntime;
 
     dst = ip->ip_dst;
diff --git a/ip_output.c b/ip_output.c
index 1f07540..64f0d9a 100644
--- a/ip_output.c
+++ b/ip_output.c
@@ -74,9 +74,9 @@
     /*
      * If small enough for interface, can just send directly.
      */
-    if ((u_int16_t)ip->ip_len <= IF_MTU) {
-        ip->ip_len = htons((u_int16_t)ip->ip_len);
-        ip->ip_off = htons((u_int16_t)ip->ip_off);
+    if ((uint16_t)ip->ip_len <= IF_MTU) {
+        ip->ip_len = htons((uint16_t)ip->ip_len);
+        ip->ip_off = htons((uint16_t)ip->ip_off);
         ip->ip_sum = 0;
         ip->ip_sum = cksum(m, hlen);
 
@@ -109,7 +109,7 @@
          */
         m0 = m;
         mhlen = sizeof(struct ip);
-        for (off = hlen + len; off < (u_int16_t)ip->ip_len; off += len) {
+        for (off = hlen + len; off < (uint16_t)ip->ip_len; off += len) {
             register struct ip *mhip;
             m = m_get(slirp);
             if (m == NULL) {
@@ -124,18 +124,18 @@
             mhip->ip_off = ((off - hlen) >> 3) + (ip->ip_off & ~IP_MF);
             if (ip->ip_off & IP_MF)
                 mhip->ip_off |= IP_MF;
-            if (off + len >= (u_int16_t)ip->ip_len)
-                len = (u_int16_t)ip->ip_len - off;
+            if (off + len >= (uint16_t)ip->ip_len)
+                len = (uint16_t)ip->ip_len - off;
             else
                 mhip->ip_off |= IP_MF;
-            mhip->ip_len = htons((u_int16_t)(len + mhlen));
+            mhip->ip_len = htons((uint16_t)(len + mhlen));
 
             if (m_copy(m, m0, off, len) < 0) {
                 error = -1;
                 goto sendorfree;
             }
 
-            mhip->ip_off = htons((u_int16_t)mhip->ip_off);
+            mhip->ip_off = htons((uint16_t)mhip->ip_off);
             mhip->ip_sum = 0;
             mhip->ip_sum = cksum(m, mhlen);
             *mnext = m;
@@ -146,9 +146,9 @@
          * and updating header, then send each fragment (in order).
          */
         m = m0;
-        m_adj(m, hlen + firstlen - (u_int16_t)ip->ip_len);
-        ip->ip_len = htons((u_int16_t)m->m_len);
-        ip->ip_off = htons((u_int16_t)(ip->ip_off | IP_MF));
+        m_adj(m, hlen + firstlen - (uint16_t)ip->ip_len);
+        ip->ip_len = htons((uint16_t)m->m_len);
+        ip->ip_off = htons((uint16_t)(ip->ip_off | IP_MF));
         ip->ip_sum = 0;
         ip->ip_sum = cksum(m, hlen);
     sendorfree:
diff --git a/main.h b/main.h
index 44e0618..04fb93b 100644
--- a/main.h
+++ b/main.h
@@ -14,7 +14,7 @@
 extern int slirp_socket;
 extern int slirp_socket_unit;
 extern int slirp_socket_port;
-extern u_int32_t slirp_socket_addr;
+extern uint32_t slirp_socket_addr;
 extern char *slirp_socket_passwd;
 extern int ctty_closed;
 
diff --git a/misc.h b/misc.h
index 63e4327..f76986c 100644
--- a/misc.h
+++ b/misc.h
@@ -37,24 +37,24 @@
 #define EMU_NOCONNECT 0x10 /* Don't connect */
 
 struct tos_t {
-    u_int16_t lport;
-    u_int16_t fport;
-    u_int8_t tos;
-    u_int8_t emu;
+    uint16_t lport;
+    uint16_t fport;
+    uint8_t tos;
+    uint8_t emu;
 };
 
 struct emu_t {
-    u_int16_t lport;
-    u_int16_t fport;
-    u_int8_t tos;
-    u_int8_t emu;
+    uint16_t lport;
+    uint16_t fport;
+    uint8_t tos;
+    uint8_t emu;
     struct emu_t *next;
 };
 
 extern int x_port, x_server, x_display;
 
 int show_x(char *, struct socket *);
-void redir_x(u_int32_t, int, int, int);
+void redir_x(uint32_t, int, int, int);
 void slirp_insque(void *, void *);
 void slirp_remque(void *);
 int add_exec(struct ex_list **, int, char *, struct in_addr, int);
diff --git a/slirp.h b/slirp.h
index 1c93b8a..a0efeff 100644
--- a/slirp.h
+++ b/slirp.h
@@ -233,7 +233,7 @@
 
     /* ip states */
     struct ipq ipq; /* ip reass. queue */
-    u_int16_t ip_id; /* ip packet ctr, for ids */
+    uint16_t ip_id; /* ip packet ctr, for ids */
 
     /* bootp/dhcp states */
     BOOTPClient bootp_clients[NB_BOOTP_CLIENTS];
@@ -243,7 +243,7 @@
     struct socket tcb;
     struct socket *tcp_last_so;
     tcp_seq tcp_iss; /* tcp initial send seq # */
-    u_int32_t tcp_now; /* for RFC 1323 timestamps */
+    uint32_t tcp_now; /* for RFC 1323 timestamps */
 
     /* udp states */
     struct socket udb;
@@ -340,7 +340,7 @@
 int tcp_fconnect(struct socket *);
 void tcp_connect(struct socket *);
 int tcp_attach(struct socket *);
-u_int8_t tcp_tos(struct socket *);
+uint8_t tcp_tos(struct socket *);
 int tcp_emu(struct socket *, struct mbuf *);
 int tcp_ctl(struct socket *);
 struct tcpcb *tcp_drop(struct tcpcb *tp, int err);
diff --git a/slirp_config.h b/slirp_config.h
index f97c3f9..8385557 100644
--- a/slirp_config.h
+++ b/slirp_config.h
@@ -134,12 +134,6 @@
 /* Define if your compiler doesn't like prototypes */
 #undef NO_PROTOTYPES
 
-/* Define if you don't have u_int32_t etc. typedef'd */
-#undef NEED_TYPEDEFS
-#ifdef __sun__
-#define NEED_TYPEDEFS
-#endif
-
 /* Define to sizeof(char) */
 #define SIZEOF_CHAR 1
 
diff --git a/socket.c b/socket.c
index 569fd84..c920000 100644
--- a/socket.c
+++ b/socket.c
@@ -586,8 +586,8 @@
 /*
  * Listen for incoming TCP connections
  */
-struct socket *tcp_listen(Slirp *slirp, u_int32_t haddr, u_int hport,
-                          u_int32_t laddr, u_int lport, int flags)
+struct socket *tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport,
+                          uint32_t laddr, u_int lport, int flags)
 {
     struct sockaddr_in addr;
     struct socket *so;
diff --git a/socket.h b/socket.h
index 9b31e52..7f67581 100644
--- a/socket.h
+++ b/socket.h
@@ -31,11 +31,11 @@
     int so_urgc;
     struct in_addr so_faddr; /* foreign host table entry */
     struct in_addr so_laddr; /* local host table entry */
-    u_int16_t so_fport; /* foreign port */
-    u_int16_t so_lport; /* local port */
+    uint16_t so_fport; /* foreign port */
+    uint16_t so_lport; /* local port */
 
-    u_int8_t so_iptos; /* Type of service */
-    u_int8_t so_emu; /* Is the socket emulated? */
+    uint8_t so_iptos; /* Type of service */
+    uint8_t so_emu; /* Is the socket emulated? */
 
     u_char so_type; /* Type of socket, UDP or TCP */
     int so_state; /* internal state flags SS_*, below */
@@ -91,7 +91,7 @@
 int sowrite(struct socket *);
 void sorecvfrom(struct socket *);
 int sosendto(struct socket *, struct mbuf *);
-struct socket *tcp_listen(Slirp *, u_int32_t, u_int, u_int32_t, u_int, int);
+struct socket *tcp_listen(Slirp *, uint32_t, u_int, uint32_t, u_int, int);
 void soisfconnecting(register struct socket *);
 void soisfconnected(register struct socket *);
 void sofwdrain(struct socket *);
diff --git a/tcp.h b/tcp.h
index 2f994e2..9c69be4 100644
--- a/tcp.h
+++ b/tcp.h
@@ -33,7 +33,7 @@
 #ifndef _TCP_H_
 #define _TCP_H_
 
-typedef u_int32_t tcp_seq;
+typedef uint32_t tcp_seq;
 
 #define PR_SLOWHZ 2 /* 2 slow timeouts per second (approx) */
 #define PR_FASTHZ 5 /* 5 fast timeouts per second (not important) */
@@ -46,8 +46,8 @@
  * Per RFC 793, September, 1981.
  */
 struct tcphdr {
-    u_int16_t th_sport; /* source port */
-    u_int16_t th_dport; /* destination port */
+    uint16_t th_sport; /* source port */
+    uint16_t th_dport; /* destination port */
     tcp_seq th_seq; /* sequence number */
     tcp_seq th_ack; /* acknowledgement number */
 #ifdef HOST_WORDS_BIGENDIAN
@@ -57,16 +57,16 @@
     u_int th_x2 : 4, /* (unused) */
         th_off : 4; /* data offset */
 #endif
-    u_int8_t th_flags;
+    uint8_t th_flags;
 #define TH_FIN 0x01
 #define TH_SYN 0x02
 #define TH_RST 0x04
 #define TH_PUSH 0x08
 #define TH_ACK 0x10
 #define TH_URG 0x20
-    u_int16_t th_win; /* window */
-    u_int16_t th_sum; /* checksum */
-    u_int16_t th_urp; /* urgent pointer */
+    uint16_t th_win; /* window */
+    uint16_t th_sum; /* checksum */
+    uint16_t th_urp; /* urgent pointer */
 };
 
 #include "tcp_var.h"
diff --git a/tcp_input.c b/tcp_input.c
index 1483d1d..b63c28a 100644
--- a/tcp_input.c
+++ b/tcp_input.c
@@ -281,7 +281,7 @@
     tcpiphdr2qlink(ti)->next = tcpiphdr2qlink(ti)->prev = NULL;
     memset(&ti->ti_i.ih_mbuf, 0, sizeof(struct mbuf_ptr));
     ti->ti_x1 = 0;
-    ti->ti_len = htons((u_int16_t)tlen);
+    ti->ti_len = htons((uint16_t)tlen);
     len = sizeof(struct ip) + tlen;
     if (cksum(m, len)) {
         goto drop;
@@ -1283,7 +1283,7 @@
 static void tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt,
                           struct tcpiphdr *ti)
 {
-    u_int16_t mss;
+    uint16_t mss;
     int opt, optlen;
 
     DEBUG_CALL("tcp_dooptions");
diff --git a/tcp_output.c b/tcp_output.c
index 39d84d1..61b38c4 100644
--- a/tcp_output.c
+++ b/tcp_output.c
@@ -262,11 +262,11 @@
     if (flags & TH_SYN) {
         tp->snd_nxt = tp->iss;
         if ((tp->t_flags & TF_NOOPT) == 0) {
-            u_int16_t mss;
+            uint16_t mss;
 
             opt[0] = TCPOPT_MAXSEG;
             opt[1] = 4;
-            mss = htons((u_int16_t)tcp_mss(tp, 0));
+            mss = htons((uint16_t)tcp_mss(tp, 0));
             memcpy((caddr_t)(opt + 2), (caddr_t)&mss, sizeof(mss));
             optlen = 4;
         }
@@ -363,10 +363,10 @@
         win = (long)TCP_MAXWIN << tp->rcv_scale;
     if (win < (long)(tp->rcv_adv - tp->rcv_nxt))
         win = (long)(tp->rcv_adv - tp->rcv_nxt);
-    ti->ti_win = htons((u_int16_t)(win >> tp->rcv_scale));
+    ti->ti_win = htons((uint16_t)(win >> tp->rcv_scale));
 
     if (SEQ_GT(tp->snd_up, tp->snd_una)) {
-        ti->ti_urp = htons((u_int16_t)(tp->snd_up - ntohl(ti->ti_seq)));
+        ti->ti_urp = htons((uint16_t)(tp->snd_up - ntohl(ti->ti_seq)));
         ti->ti_flags |= TH_URG;
     } else
         /*
@@ -382,7 +382,7 @@
      * checksum extended header and data.
      */
     if (len + optlen)
-        ti->ti_len = htons((u_int16_t)(sizeof(struct tcphdr) + optlen + len));
+        ti->ti_len = htons((uint16_t)(sizeof(struct tcphdr) + optlen + len));
     ti->ti_sum = cksum(m, (int)(hdrlen + len));
 
     /*
diff --git a/tcp_subr.c b/tcp_subr.c
index 9b10419..922d443 100644
--- a/tcp_subr.c
+++ b/tcp_subr.c
@@ -137,8 +137,8 @@
         a = b;           \
         b = t;           \
     }
-        xchg(ti->ti_dst.s_addr, ti->ti_src.s_addr, u_int32_t);
-        xchg(ti->ti_dport, ti->ti_sport, u_int16_t);
+        xchg(ti->ti_dst.s_addr, ti->ti_src.s_addr, uint32_t);
+        xchg(ti->ti_dport, ti->ti_sport, uint16_t);
 #undef xchg
     }
     ti->ti_len = htons((u_short)(sizeof(struct tcphdr) + tlen));
@@ -153,9 +153,9 @@
     ti->ti_off = sizeof(struct tcphdr) >> 2;
     ti->ti_flags = flags;
     if (tp)
-        ti->ti_win = htons((u_int16_t)(win >> tp->rcv_scale));
+        ti->ti_win = htons((uint16_t)(win >> tp->rcv_scale));
     else
-        ti->ti_win = htons((u_int16_t)win);
+        ti->ti_win = htons((uint16_t)win);
     ti->ti_urp = 0;
     ti->ti_sum = 0;
     ti->ti_sum = cksum(m, tlen);
@@ -490,7 +490,7 @@
 /*
  * Return TOS according to the above table
  */
-u_int8_t tcp_tos(struct socket *so)
+uint8_t tcp_tos(struct socket *so)
 {
     int i = 0;
     struct emu_t *emup;
@@ -545,7 +545,7 @@
     Slirp *slirp = so->slirp;
     u_int n1, n2, n3, n4, n5, n6;
     char buff[257];
-    u_int32_t laddr;
+    uint32_t laddr;
     u_int lport;
     char *bptr;
 
diff --git a/tcp_var.h b/tcp_var.h
index 6c1745f..a71b7bd 100644
--- a/tcp_var.h
+++ b/tcp_var.h
@@ -75,9 +75,9 @@
     tcp_seq snd_wl1; /* window update seg seq number */
     tcp_seq snd_wl2; /* window update seg ack number */
     tcp_seq iss; /* initial send sequence number */
-    u_int32_t snd_wnd; /* send window */
+    uint32_t snd_wnd; /* send window */
     /* receive sequence variables */
-    u_int32_t rcv_wnd; /* receive window */
+    uint32_t rcv_wnd; /* receive window */
     tcp_seq rcv_nxt; /* receive next */
     tcp_seq rcv_up; /* receive urgent pointer */
     tcp_seq irs; /* initial receive sequence number */
@@ -92,11 +92,11 @@
                       */
     /* congestion control (for slow start, source quench, retransmit after loss)
      */
-    u_int32_t snd_cwnd; /* congestion-controlled window */
-    u_int32_t snd_ssthresh; /* snd_cwnd size threshold for
-                             * for slow start exponential to
-                             * linear switch
-                             */
+    uint32_t snd_cwnd; /* congestion-controlled window */
+    uint32_t snd_ssthresh; /* snd_cwnd size threshold for
+                            * for slow start exponential to
+                            * linear switch
+                            */
     /*
      * transmit timing stuff.  See below for scale of srtt and rttvar.
      * "Variance" is actually smoothed difference.
@@ -107,7 +107,7 @@
     short t_srtt; /* smoothed round-trip time */
     short t_rttvar; /* variance in round-trip time */
     u_short t_rttmin; /* minimum rtt allowed */
-    u_int32_t max_sndwnd; /* largest window peer has offered */
+    uint32_t max_sndwnd; /* largest window peer has offered */
 
     /* out-of-band data */
     char t_oobflags; /* have some */
@@ -121,8 +121,8 @@
     u_char rcv_scale; /* window scaling for recv window */
     u_char request_r_scale; /* pending window scaling */
     u_char requested_s_scale;
-    u_int32_t ts_recent; /* timestamp echo data */
-    u_int32_t ts_recent_age; /* when last updated */
+    uint32_t ts_recent; /* timestamp echo data */
+    uint32_t ts_recent_age; /* when last updated */
     tcp_seq last_ack_sent;
 };
 
diff --git a/tftp.c b/tftp.c
index 4e27132..27381c9 100644
--- a/tftp.c
+++ b/tftp.c
@@ -93,8 +93,8 @@
     return -1;
 }
 
-static int tftp_read_data(struct tftp_session *spt, u_int16_t block_nr,
-                          u_int8_t *buf, int len)
+static int tftp_read_data(struct tftp_session *spt, uint16_t block_nr,
+                          uint8_t *buf, int len)
 {
     int fd;
     int bytes_read = 0;
@@ -156,7 +156,7 @@
     return 0;
 }
 
-static void tftp_send_error(struct tftp_session *spt, u_int16_t errorcode,
+static void tftp_send_error(struct tftp_session *spt, uint16_t errorcode,
                             const char *msg, struct tftp_t *recv_tp)
 {
     struct sockaddr_in saddr, daddr;
@@ -194,7 +194,7 @@
     tftp_session_terminate(spt);
 }
 
-static int tftp_send_data(struct tftp_session *spt, u_int16_t block_nr,
+static int tftp_send_data(struct tftp_session *spt, uint16_t block_nr,
                           struct tftp_t *recv_tp)
 {
     struct sockaddr_in saddr, daddr;
diff --git a/tftp.h b/tftp.h
index 23ed366..2663d1c 100644
--- a/tftp.h
+++ b/tftp.h
@@ -16,17 +16,17 @@
 struct tftp_t {
     struct ip ip;
     struct udphdr udp;
-    u_int16_t tp_op;
+    uint16_t tp_op;
     union {
         struct {
-            u_int16_t tp_block_nr;
-            u_int8_t tp_buf[512];
+            uint16_t tp_block_nr;
+            uint8_t tp_buf[512];
         } tp_data;
         struct {
-            u_int16_t tp_error_code;
-            u_int8_t tp_msg[512];
+            uint16_t tp_error_code;
+            uint8_t tp_msg[512];
         } tp_error;
-        u_int8_t tp_buf[512 + 2];
+        uint8_t tp_buf[512 + 2];
     } x;
 };
 
@@ -35,7 +35,7 @@
     char *filename;
 
     struct in_addr client_ip;
-    u_int16_t client_port;
+    uint16_t client_port;
 
     int timestamp;
 };
diff --git a/udp.c b/udp.c
index 7eceea0..8f053c6 100644
--- a/udp.c
+++ b/udp.c
@@ -41,7 +41,7 @@
 #include <slirp.h>
 #include "ip_icmp.h"
 
-static u_int8_t udp_tos(struct socket *so);
+static uint8_t udp_tos(struct socket *so);
 
 void udp_init(Slirp *slirp)
 {
@@ -86,7 +86,7 @@
      * Make mbuf data length reflect UDP length.
      * If not enough data to reflect UDP length, drop.
      */
-    len = ntohs((u_int16_t)uh->uh_ulen);
+    len = ntohs((uint16_t)uh->uh_ulen);
 
     if (ip->ip_len != len) {
         if (len > ip->ip_len) {
@@ -313,7 +313,7 @@
 static const struct tos_t udptos[] = { { 0, 53, IPTOS_LOWDELAY, 0 }, /* DNS */
                                        { 0, 0, 0, 0 } };
 
-static u_int8_t udp_tos(struct socket *so)
+static uint8_t udp_tos(struct socket *so)
 {
     int i = 0;
 
@@ -329,8 +329,8 @@
     return 0;
 }
 
-struct socket *udp_listen(Slirp *slirp, u_int32_t haddr, u_int hport,
-                          u_int32_t laddr, u_int lport, int flags)
+struct socket *udp_listen(Slirp *slirp, uint32_t haddr, u_int hport,
+                          uint32_t laddr, u_int lport, int flags)
 {
     struct sockaddr_in addr;
     struct socket *so;
diff --git a/udp.h b/udp.h
index 2c4a146..3ff4d97 100644
--- a/udp.h
+++ b/udp.h
@@ -41,10 +41,10 @@
  * Per RFC 768, September, 1981.
  */
 struct udphdr {
-    u_int16_t uh_sport; /* source port */
-    u_int16_t uh_dport; /* destination port */
+    uint16_t uh_sport; /* source port */
+    uint16_t uh_dport; /* destination port */
     int16_t uh_ulen; /* udp length */
-    u_int16_t uh_sum; /* udp checksum */
+    uint16_t uh_sum; /* udp checksum */
 };
 
 /*
@@ -78,7 +78,7 @@
 int udp_output(struct socket *, struct mbuf *, struct sockaddr_in *);
 int udp_attach(struct socket *);
 void udp_detach(struct socket *);
-struct socket *udp_listen(Slirp *, u_int32_t, u_int, u_int32_t, u_int, int);
+struct socket *udp_listen(Slirp *, uint32_t, u_int, uint32_t, u_int, int);
 int udp_output2(struct socket *so, struct mbuf *m, struct sockaddr_in *saddr,
                 struct sockaddr_in *daddr, int iptos);
 #endif