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>
This commit is contained in:
parent
1fc3dc2930
commit
b6dce92e89
@ -47,23 +47,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;
|
||||
|
||||
@ -78,8 +78,8 @@ int cksum(struct mbuf *m, int len)
|
||||
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;
|
||||
}
|
||||
@ -111,14 +111,14 @@ int cksum(struct mbuf *m, int len)
|
||||
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
|
||||
|
38
slirp/ip.h
38
slirp/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 @@ struct ip {
|
||||
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 @@ struct ip {
|
||||
* 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 qlink {
|
||||
*/
|
||||
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 ipovly {
|
||||
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));
|
||||
|
||||
|
@ -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.
|
||||
|
@ -477,7 +477,7 @@ ip_dooptions(m)
|
||||
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;
|
||||
|
@ -75,9 +75,9 @@ ip_output(struct socket *so, struct mbuf *m0)
|
||||
/*
|
||||
* 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);
|
||||
|
||||
@ -110,7 +110,7 @@ ip_output(struct socket *so, struct mbuf *m0)
|
||||
*/
|
||||
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) {
|
||||
@ -125,18 +125,18 @@ ip_output(struct socket *so, struct mbuf *m0)
|
||||
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;
|
||||
@ -147,9 +147,9 @@ ip_output(struct socket *so, struct mbuf *m0)
|
||||
* 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:
|
||||
|
@ -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;
|
||||
|
||||
|
20
slirp/misc.h
20
slirp/misc.h
@ -37,24 +37,24 @@ void do_wait(int);
|
||||
#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;
|
||||
struct emu_t *next;
|
||||
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);
|
||||
|
@ -233,7 +233,7 @@ struct Slirp {
|
||||
|
||||
/* 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 Slirp {
|
||||
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;
|
||||
@ -339,7 +339,7 @@ void tcp_sockclosed(struct tcpcb *);
|
||||
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);
|
||||
|
@ -133,12 +133,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
|
||||
|
||||
|
@ -580,7 +580,7 @@ sosendto(struct socket *so, struct mbuf *m)
|
||||
* Listen for incoming TCP connections
|
||||
*/
|
||||
struct socket *
|
||||
tcp_listen(Slirp *slirp, u_int32_t haddr, u_int hport, u_int32_t laddr,
|
||||
tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr,
|
||||
u_int lport, int flags)
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
|
@ -31,11 +31,11 @@ struct socket {
|
||||
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 */
|
||||
@ -83,7 +83,7 @@ int sosendoob(struct socket *);
|
||||
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,
|
||||
struct socket * tcp_listen(Slirp *, uint32_t, u_int, uint32_t, u_int,
|
||||
int);
|
||||
void soisfconnecting(register struct socket *);
|
||||
void soisfconnected(register struct socket *);
|
||||
|
14
slirp/tcp.h
14
slirp/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 @@ typedef u_int32_t tcp_seq;
|
||||
* 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 @@ struct tcphdr {
|
||||
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"
|
||||
|
@ -280,7 +280,7 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso)
|
||||
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;
|
||||
@ -1289,7 +1289,7 @@ drop:
|
||||
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");
|
||||
|
@ -263,11 +263,11 @@ send:
|
||||
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;
|
||||
}
|
||||
@ -364,10 +364,10 @@ send:
|
||||
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
|
||||
/*
|
||||
@ -383,7 +383,7 @@ send:
|
||||
* checksum extended header and data.
|
||||
*/
|
||||
if (len + optlen)
|
||||
ti->ti_len = htons((u_int16_t)(sizeof (struct tcphdr) +
|
||||
ti->ti_len = htons((uint16_t)(sizeof (struct tcphdr) +
|
||||
optlen + len));
|
||||
ti->ti_sum = cksum(m, (int)(hdrlen + len));
|
||||
|
||||
|
@ -134,8 +134,8 @@ tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m,
|
||||
m->m_len = sizeof (struct tcpiphdr);
|
||||
tlen = 0;
|
||||
#define xchg(a,b,type) { type t; t=a; 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));
|
||||
@ -150,9 +150,9 @@ tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m,
|
||||
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);
|
||||
@ -491,7 +491,7 @@ static struct emu_t *tcpemu = NULL;
|
||||
/*
|
||||
* Return TOS according to the above table
|
||||
*/
|
||||
u_int8_t
|
||||
uint8_t
|
||||
tcp_tos(struct socket *so)
|
||||
{
|
||||
int i = 0;
|
||||
@ -548,7 +548,7 @@ tcp_emu(struct socket *so, struct mbuf *m)
|
||||
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;
|
||||
|
||||
|
@ -75,9 +75,9 @@ struct tcpcb {
|
||||
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 */
|
||||
@ -91,8 +91,8 @@ struct tcpcb {
|
||||
* used to recognize retransmits
|
||||
*/
|
||||
/* 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
|
||||
uint32_t snd_cwnd; /* congestion-controlled window */
|
||||
uint32_t snd_ssthresh; /* snd_cwnd size threshold for
|
||||
* for slow start exponential to
|
||||
* linear switch
|
||||
*/
|
||||
@ -106,7 +106,7 @@ struct tcpcb {
|
||||
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 */
|
||||
@ -120,8 +120,8 @@ struct tcpcb {
|
||||
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;
|
||||
|
||||
};
|
||||
|
@ -92,8 +92,8 @@ static int tftp_session_find(Slirp *slirp, struct tftp_t *tp)
|
||||
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;
|
||||
@ -155,7 +155,7 @@ static int tftp_send_oack(struct tftp_session *spt,
|
||||
}
|
||||
|
||||
static void tftp_send_error(struct tftp_session *spt,
|
||||
u_int16_t errorcode, const char *msg,
|
||||
uint16_t errorcode, const char *msg,
|
||||
struct tftp_t *recv_tp)
|
||||
{
|
||||
struct sockaddr_in saddr, daddr;
|
||||
@ -194,7 +194,7 @@ out:
|
||||
}
|
||||
|
||||
static int tftp_send_data(struct tftp_session *spt,
|
||||
u_int16_t block_nr,
|
||||
uint16_t block_nr,
|
||||
struct tftp_t *recv_tp)
|
||||
{
|
||||
struct sockaddr_in saddr, daddr;
|
||||
|
14
slirp/tftp.h
14
slirp/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 @@ struct tftp_session {
|
||||
char *filename;
|
||||
|
||||
struct in_addr client_ip;
|
||||
u_int16_t client_port;
|
||||
uint16_t client_port;
|
||||
|
||||
int timestamp;
|
||||
};
|
||||
|
@ -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)
|
||||
@ -88,7 +88,7 @@ udp_input(register struct mbuf *m, int iphlen)
|
||||
* 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) {
|
||||
@ -321,7 +321,7 @@ static const struct tos_t udptos[] = {
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static u_int8_t
|
||||
static uint8_t
|
||||
udp_tos(struct socket *so)
|
||||
{
|
||||
int i = 0;
|
||||
@ -339,7 +339,7 @@ udp_tos(struct socket *so)
|
||||
}
|
||||
|
||||
struct socket *
|
||||
udp_listen(Slirp *slirp, u_int32_t haddr, u_int hport, u_int32_t laddr,
|
||||
udp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr,
|
||||
u_int lport, int flags)
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
|
10
slirp/udp.h
10
slirp/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 */
|
||||
int16_t uh_ulen; /* udp length */
|
||||
u_int16_t uh_sum; /* udp checksum */
|
||||
uint16_t uh_sport; /* source port */
|
||||
uint16_t uh_dport; /* destination port */
|
||||
int16_t uh_ulen; /* udp length */
|
||||
uint16_t uh_sum; /* udp checksum */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -78,7 +78,7 @@ void udp_input(register struct mbuf *, int);
|
||||
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,
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user