diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2016-03-22 13:22:01 +0100 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2016-03-24 18:52:48 +0100 |
commit | b12c53ce77beb8e04b044d0c0dc9249ddba72200 (patch) | |
tree | fc73241398d3ee6850e4aee0d24a863d43abb010 /src/libcharon/plugins/ha/ha_kernel.c | |
parent | b210369314cd1e0f889fd1b73dae4d45baa968a8 (diff) | |
download | strongswan-b12c53ce77beb8e04b044d0c0dc9249ddba72200.tar.bz2 strongswan-b12c53ce77beb8e04b044d0c0dc9249ddba72200.tar.xz |
Use standard unsigned integer types
Diffstat (limited to 'src/libcharon/plugins/ha/ha_kernel.c')
-rw-r--r-- | src/libcharon/plugins/ha/ha_kernel.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/libcharon/plugins/ha/ha_kernel.c b/src/libcharon/plugins/ha/ha_kernel.c index bd43dc351..061741eb7 100644 --- a/src/libcharon/plugins/ha/ha_kernel.c +++ b/src/libcharon/plugins/ha/ha_kernel.c @@ -15,8 +15,8 @@ #include "ha_kernel.h" -typedef u_int32_t u32; -typedef u_int8_t u8; +typedef uint32_t u32; +typedef uint8_t u8; #include <sys/utsname.h> #include <string.h> @@ -115,9 +115,9 @@ static jhash_version_t get_jhash_version() /** * jhash algorithm of two words, as used in kernel (using 0 as initval) */ -static u_int32_t jhash(jhash_version_t version, u_int32_t a, u_int32_t b) +static uint32_t jhash(jhash_version_t version, uint32_t a, uint32_t b) { - u_int32_t c = 0; + uint32_t c = 0; switch (version) { @@ -162,7 +162,7 @@ static u_int32_t jhash(jhash_version_t version, u_int32_t a, u_int32_t b) /** * Segmentate a calculated hash */ -static u_int hash2segment(private_ha_kernel_t *this, u_int64_t hash) +static u_int hash2segment(private_ha_kernel_t *this, uint64_t hash) { return ((hash * this->count) >> 32) + 1; } @@ -170,11 +170,11 @@ static u_int hash2segment(private_ha_kernel_t *this, u_int64_t hash) /** * Get a host as an integer for hashing */ -static u_int32_t host2int(host_t *host) +static uint32_t host2int(host_t *host) { if (host->get_family(host) == AF_INET) { - return *(u_int32_t*)host->get_address(host).ptr; + return *(uint32_t*)host->get_address(host).ptr; } return 0; } @@ -183,7 +183,7 @@ METHOD(ha_kernel_t, get_segment, u_int, private_ha_kernel_t *this, host_t *host) { unsigned long hash; - u_int32_t addr; + uint32_t addr; addr = host2int(host); hash = jhash(this->version, ntohl(addr), 0); @@ -192,10 +192,10 @@ METHOD(ha_kernel_t, get_segment, u_int, } METHOD(ha_kernel_t, get_segment_spi, u_int, - private_ha_kernel_t *this, host_t *host, u_int32_t spi) + private_ha_kernel_t *this, host_t *host, uint32_t spi) { unsigned long hash; - u_int32_t addr; + uint32_t addr; addr = host2int(host); hash = jhash(this->version, ntohl(addr), ntohl(spi)); |