Use standard unsigned integer types
This commit is contained in:
@@ -79,7 +79,7 @@ METHOD(host_t, get_sockaddr_len, socklen_t*,
|
||||
METHOD(host_t, is_anyaddr, bool,
|
||||
private_host_t *this)
|
||||
{
|
||||
static const u_int8_t zeroes[IPV6_LEN];
|
||||
static const uint8_t zeroes[IPV6_LEN];
|
||||
|
||||
switch (this->address.sa_family)
|
||||
{
|
||||
@@ -119,7 +119,7 @@ int host_printf_hook(printf_hook_data_t *data, printf_hook_spec_t *spec,
|
||||
else
|
||||
{
|
||||
void *address;
|
||||
u_int16_t port;
|
||||
uint16_t port;
|
||||
int len;
|
||||
|
||||
address = &this->address6.sin6_addr;
|
||||
@@ -191,7 +191,7 @@ METHOD(host_t, get_family, int,
|
||||
return this->address.sa_family;
|
||||
}
|
||||
|
||||
METHOD(host_t, get_port, u_int16_t,
|
||||
METHOD(host_t, get_port, uint16_t,
|
||||
private_host_t *this)
|
||||
{
|
||||
switch (this->address.sa_family)
|
||||
@@ -212,7 +212,7 @@ METHOD(host_t, get_port, u_int16_t,
|
||||
}
|
||||
|
||||
METHOD(host_t, set_port, void,
|
||||
private_host_t *this, u_int16_t port)
|
||||
private_host_t *this, uint16_t port)
|
||||
{
|
||||
switch (this->address.sa_family)
|
||||
{
|
||||
@@ -334,7 +334,7 @@ static private_host_t *host_create_empty(void)
|
||||
/*
|
||||
* Create a %any host with port
|
||||
*/
|
||||
static host_t *host_create_any_port(int family, u_int16_t port)
|
||||
static host_t *host_create_any_port(int family, uint16_t port)
|
||||
{
|
||||
host_t *this;
|
||||
|
||||
@@ -347,7 +347,7 @@ static host_t *host_create_any_port(int family, u_int16_t port)
|
||||
* Described in header.
|
||||
*/
|
||||
host_t *host_create_from_string_and_family(char *string, int family,
|
||||
u_int16_t port)
|
||||
uint16_t port)
|
||||
{
|
||||
union {
|
||||
struct sockaddr_in v4;
|
||||
@@ -415,7 +415,7 @@ host_t *host_create_from_string_and_family(char *string, int family,
|
||||
/*
|
||||
* Described in header.
|
||||
*/
|
||||
host_t *host_create_from_string(char *string, u_int16_t port)
|
||||
host_t *host_create_from_string(char *string, uint16_t port)
|
||||
{
|
||||
return host_create_from_string_and_family(string, AF_UNSPEC, port);
|
||||
}
|
||||
@@ -455,7 +455,7 @@ host_t *host_create_from_sockaddr(sockaddr_t *sockaddr)
|
||||
/*
|
||||
* Described in header.
|
||||
*/
|
||||
host_t *host_create_from_dns(char *string, int af, u_int16_t port)
|
||||
host_t *host_create_from_dns(char *string, int af, uint16_t port)
|
||||
{
|
||||
host_t *this;
|
||||
|
||||
@@ -474,7 +474,7 @@ host_t *host_create_from_dns(char *string, int af, u_int16_t port)
|
||||
/*
|
||||
* Described in header.
|
||||
*/
|
||||
host_t *host_create_from_chunk(int family, chunk_t address, u_int16_t port)
|
||||
host_t *host_create_from_chunk(int family, chunk_t address, uint16_t port)
|
||||
{
|
||||
private_host_t *this;
|
||||
|
||||
@@ -646,7 +646,7 @@ host_t *host_create_netmask(int family, int netbits)
|
||||
if (bytes < len)
|
||||
{
|
||||
memset(target + bytes, 0x00, len - bytes);
|
||||
target[bytes] = (u_int8_t)(0xff << bits);
|
||||
target[bytes] = (uint8_t)(0xff << bits);
|
||||
}
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
@@ -99,14 +99,14 @@ struct host_t {
|
||||
*
|
||||
* @return port number
|
||||
*/
|
||||
u_int16_t (*get_port) (host_t *this);
|
||||
uint16_t (*get_port) (host_t *this);
|
||||
|
||||
/**
|
||||
* Set the port of this host
|
||||
*
|
||||
* @param port port number
|
||||
*/
|
||||
void (*set_port) (host_t *this, u_int16_t port);
|
||||
void (*set_port) (host_t *this, uint16_t port);
|
||||
|
||||
/**
|
||||
* Compare the ips of two hosts hosts.
|
||||
@@ -137,7 +137,7 @@ struct host_t {
|
||||
* @param port port number
|
||||
* @return host_t, NULL if string not an address.
|
||||
*/
|
||||
host_t *host_create_from_string(char *string, u_int16_t port);
|
||||
host_t *host_create_from_string(char *string, uint16_t port);
|
||||
|
||||
/**
|
||||
* Same as host_create_from_string(), but with the option to enforce a family.
|
||||
@@ -148,7 +148,7 @@ host_t *host_create_from_string(char *string, u_int16_t port);
|
||||
* @return host_t, NULL if string not an address.
|
||||
*/
|
||||
host_t *host_create_from_string_and_family(char *string, int family,
|
||||
u_int16_t port);
|
||||
uint16_t port);
|
||||
|
||||
/**
|
||||
* Constructor to create a host_t from a DNS name.
|
||||
@@ -158,7 +158,7 @@ host_t *host_create_from_string_and_family(char *string, int family,
|
||||
* @param port port number
|
||||
* @return host_t, NULL lookup failed
|
||||
*/
|
||||
host_t *host_create_from_dns(char *string, int family, u_int16_t port);
|
||||
host_t *host_create_from_dns(char *string, int family, uint16_t port);
|
||||
|
||||
/**
|
||||
* Constructor to create a host_t object from an address chunk.
|
||||
@@ -170,7 +170,7 @@ host_t *host_create_from_dns(char *string, int family, u_int16_t port);
|
||||
* @param port port number
|
||||
* @return host_t, NULL if family not supported/chunk invalid
|
||||
*/
|
||||
host_t *host_create_from_chunk(int family, chunk_t address, u_int16_t port);
|
||||
host_t *host_create_from_chunk(int family, chunk_t address, uint16_t port);
|
||||
|
||||
/**
|
||||
* Constructor to create a host_t object from a sockaddr struct
|
||||
|
||||
@@ -42,7 +42,7 @@ struct private_packet_t {
|
||||
/**
|
||||
* DSCP value on packet
|
||||
*/
|
||||
u_int8_t dscp;
|
||||
uint8_t dscp;
|
||||
|
||||
/**
|
||||
* message data
|
||||
@@ -94,13 +94,13 @@ METHOD(packet_t, set_data, void,
|
||||
this->adjusted_data = this->data = data;
|
||||
}
|
||||
|
||||
METHOD(packet_t, get_dscp, u_int8_t,
|
||||
METHOD(packet_t, get_dscp, uint8_t,
|
||||
private_packet_t *this)
|
||||
{
|
||||
return this->dscp;
|
||||
}
|
||||
METHOD(packet_t, set_dscp, void,
|
||||
private_packet_t *this, u_int8_t value)
|
||||
private_packet_t *this, uint8_t value)
|
||||
{
|
||||
this->dscp = value;
|
||||
}
|
||||
|
||||
@@ -85,14 +85,14 @@ struct packet_t {
|
||||
*
|
||||
* @return DSCP value
|
||||
*/
|
||||
u_int8_t (*get_dscp)(packet_t *this);
|
||||
uint8_t (*get_dscp)(packet_t *this);
|
||||
|
||||
/**
|
||||
* Set the DiffServ Code Point to use on this packet.
|
||||
*
|
||||
* @param value DSCP value
|
||||
*/
|
||||
void (*set_dscp)(packet_t *this, u_int8_t value);
|
||||
void (*set_dscp)(packet_t *this, uint8_t value);
|
||||
|
||||
/**
|
||||
* Increase the offset where the actual packet data starts.
|
||||
|
||||
@@ -96,7 +96,7 @@ struct private_tun_device_t {
|
||||
/**
|
||||
* Netmask for address
|
||||
*/
|
||||
u_int8_t netmask;
|
||||
uint8_t netmask;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -105,7 +105,7 @@ struct private_tun_device_t {
|
||||
#if __FreeBSD__ >= 10
|
||||
|
||||
static bool set_address_and_mask(struct in_aliasreq *ifra, host_t *addr,
|
||||
u_int8_t netmask)
|
||||
uint8_t netmask)
|
||||
{
|
||||
host_t *mask;
|
||||
|
||||
@@ -132,7 +132,7 @@ static bool set_address_and_mask(struct in_aliasreq *ifra, host_t *addr,
|
||||
* on FreeBSD 10 an newer.
|
||||
*/
|
||||
static bool set_address_impl(private_tun_device_t *this, host_t *addr,
|
||||
u_int8_t netmask)
|
||||
uint8_t netmask)
|
||||
{
|
||||
struct in_aliasreq ifra;
|
||||
|
||||
@@ -171,7 +171,7 @@ static bool set_address_impl(private_tun_device_t *this, host_t *addr,
|
||||
* Set the address using the classic SIOCSIFADDR etc. commands on other systems.
|
||||
*/
|
||||
static bool set_address_impl(private_tun_device_t *this, host_t *addr,
|
||||
u_int8_t netmask)
|
||||
uint8_t netmask)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
host_t *mask;
|
||||
@@ -218,7 +218,7 @@ static bool set_address_impl(private_tun_device_t *this, host_t *addr,
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
METHOD(tun_device_t, set_address, bool,
|
||||
private_tun_device_t *this, host_t *addr, u_int8_t netmask)
|
||||
private_tun_device_t *this, host_t *addr, uint8_t netmask)
|
||||
{
|
||||
if (!set_address_impl(this, addr, netmask))
|
||||
{
|
||||
@@ -231,7 +231,7 @@ METHOD(tun_device_t, set_address, bool,
|
||||
}
|
||||
|
||||
METHOD(tun_device_t, get_address, host_t*,
|
||||
private_tun_device_t *this, u_int8_t *netmask)
|
||||
private_tun_device_t *this, uint8_t *netmask)
|
||||
{
|
||||
if (netmask && this->address)
|
||||
{
|
||||
@@ -326,7 +326,7 @@ METHOD(tun_device_t, write_packet, bool,
|
||||
#ifdef __APPLE__
|
||||
/* UTUN's expect the packets to be prepended by a 32-bit protocol number
|
||||
* instead of parsing the packet again, we assume IPv4 for now */
|
||||
u_int32_t proto = htonl(AF_INET);
|
||||
uint32_t proto = htonl(AF_INET);
|
||||
packet = chunk_cata("cc", chunk_from_thing(proto), packet);
|
||||
#endif
|
||||
s = write(this->tunfd, packet.ptr, packet.len);
|
||||
@@ -364,7 +364,7 @@ METHOD(tun_device_t, read_packet, bool,
|
||||
data.len = len;
|
||||
#ifdef __APPLE__
|
||||
/* UTUN's prepend packets with a 32-bit protocol number */
|
||||
data = chunk_skip(data, sizeof(u_int32_t));
|
||||
data = chunk_skip(data, sizeof(uint32_t));
|
||||
#endif
|
||||
*packet = chunk_clone(data);
|
||||
return TRUE;
|
||||
|
||||
@@ -60,7 +60,7 @@ struct tun_device_t {
|
||||
* @param netmask the netmask to use
|
||||
* @return TRUE if operation successful
|
||||
*/
|
||||
bool (*set_address)(tun_device_t *this, host_t *addr, u_int8_t netmask);
|
||||
bool (*set_address)(tun_device_t *this, host_t *addr, uint8_t netmask);
|
||||
|
||||
/**
|
||||
* Get the IP address previously assigned to using set_address().
|
||||
@@ -68,7 +68,7 @@ struct tun_device_t {
|
||||
* @param netmask pointer receiving the configured netmask, or NULL
|
||||
* @return address previously set, NULL if none
|
||||
*/
|
||||
host_t* (*get_address)(tun_device_t *this, u_int8_t *netmask);
|
||||
host_t* (*get_address)(tun_device_t *this, uint8_t *netmask);
|
||||
|
||||
/**
|
||||
* Bring the TUN device up
|
||||
|
||||
Reference in New Issue
Block a user