Use standard unsigned integer types
This commit is contained in:
@@ -123,7 +123,7 @@ static bool read_error(vici_conn_t *conn, int err)
|
||||
/**
|
||||
* Handle a command response message
|
||||
*/
|
||||
static bool handle_response(vici_conn_t *conn, u_int32_t len)
|
||||
static bool handle_response(vici_conn_t *conn, uint32_t len)
|
||||
{
|
||||
chunk_t buf;
|
||||
|
||||
@@ -140,11 +140,11 @@ static bool handle_response(vici_conn_t *conn, u_int32_t len)
|
||||
/**
|
||||
* Dispatch received event message
|
||||
*/
|
||||
static bool handle_event(vici_conn_t *conn, u_int32_t len)
|
||||
static bool handle_event(vici_conn_t *conn, uint32_t len)
|
||||
{
|
||||
vici_message_t *message;
|
||||
event_t *event;
|
||||
u_int8_t namelen;
|
||||
uint8_t namelen;
|
||||
char name[257], *buf;
|
||||
|
||||
if (len < sizeof(namelen))
|
||||
@@ -198,8 +198,8 @@ static bool handle_event(vici_conn_t *conn, u_int32_t len)
|
||||
CALLBACK(on_read, bool,
|
||||
vici_conn_t *conn, stream_t *stream)
|
||||
{
|
||||
u_int32_t len;
|
||||
u_int8_t op;
|
||||
uint32_t len;
|
||||
uint8_t op;
|
||||
ssize_t hlen;
|
||||
|
||||
hlen = stream->read(stream, &len, sizeof(len), FALSE);
|
||||
@@ -358,8 +358,8 @@ vici_res_t* vici_submit(vici_req_t *req, vici_conn_t *conn)
|
||||
vici_message_t *message;
|
||||
vici_res_t *res;
|
||||
chunk_t data;
|
||||
u_int32_t len;
|
||||
u_int8_t namelen, op;
|
||||
uint32_t len;
|
||||
uint8_t namelen, op;
|
||||
|
||||
message = req->b->finalize(req->b);
|
||||
if (!message)
|
||||
@@ -678,8 +678,8 @@ void vici_free_res(vici_res_t *res)
|
||||
int vici_register(vici_conn_t *conn, char *name, vici_event_cb_t cb, void *user)
|
||||
{
|
||||
event_t *event;
|
||||
u_int32_t len;
|
||||
u_int8_t namelen, op;
|
||||
uint32_t len;
|
||||
uint8_t namelen, op;
|
||||
int ret = 1;
|
||||
|
||||
op = cb ? VICI_EVENT_REGISTER : VICI_EVENT_UNREGISTER;
|
||||
|
||||
@@ -32,7 +32,7 @@ static void echo_inbound(void *user, u_int id, chunk_t buf)
|
||||
|
||||
ck_assert_int_eq(data->id, id);
|
||||
/* count number of bytes, including the header */
|
||||
data->bytes += buf.len + sizeof(u_int32_t);
|
||||
data->bytes += buf.len + sizeof(uint32_t);
|
||||
/* echo back data chunk */
|
||||
data->s->send(data->s, id, chunk_clone(buf));
|
||||
}
|
||||
@@ -81,7 +81,7 @@ START_TEST(test_echo)
|
||||
0x00,0x00,0x00,0x0A, 0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x02A,
|
||||
);
|
||||
char buf[m.len];
|
||||
u_int32_t len;
|
||||
uint32_t len;
|
||||
|
||||
lib->processor->set_threads(lib->processor, 4);
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ static bool have_vips_from_pool(mem_pool_t *pool, linked_list_t *vips)
|
||||
enumerator_t *enumerator;
|
||||
host_t *host;
|
||||
chunk_t start, end, current;
|
||||
u_int32_t size;
|
||||
uint32_t size;
|
||||
bool found = FALSE;
|
||||
|
||||
host = pool->get_base(pool);
|
||||
@@ -477,10 +477,10 @@ CALLBACK(pool_li, bool,
|
||||
{
|
||||
if (host->get_family(host) == AF_INET)
|
||||
{ /* IPv4 attributes contain a subnet mask */
|
||||
u_int32_t netmask = 0;
|
||||
uint32_t netmask = 0;
|
||||
|
||||
if (mask)
|
||||
{ /* shifting u_int32_t by 32 or more is undefined */
|
||||
{ /* shifting uint32_t by 32 or more is undefined */
|
||||
mask = 32 - mask;
|
||||
netmask = htonl((0xFFFFFFFF >> mask) << mask);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
/**
|
||||
* Magic value for an undefined lifetime
|
||||
*/
|
||||
#define LFT_UNDEFINED (~(u_int64_t)0)
|
||||
#define LFT_UNDEFINED (~(uint64_t)0)
|
||||
|
||||
/**
|
||||
* Default IKE rekey time
|
||||
@@ -72,7 +72,7 @@
|
||||
/**
|
||||
* Undefined replay window
|
||||
*/
|
||||
#define REPLAY_UNDEFINED (~(u_int32_t)0)
|
||||
#define REPLAY_UNDEFINED (~(uint32_t)0)
|
||||
|
||||
typedef struct private_vici_config_t private_vici_config_t;
|
||||
|
||||
@@ -242,7 +242,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
request_data_t *request;
|
||||
auth_cfg_t *cfg;
|
||||
u_int32_t round;
|
||||
uint32_t round;
|
||||
} auth_data_t;
|
||||
|
||||
/**
|
||||
@@ -259,20 +259,20 @@ static void free_auth_data(auth_data_t *data)
|
||||
*/
|
||||
typedef struct {
|
||||
request_data_t *request;
|
||||
u_int32_t version;
|
||||
uint32_t version;
|
||||
bool aggressive;
|
||||
bool encap;
|
||||
bool mobike;
|
||||
bool send_certreq;
|
||||
bool pull;
|
||||
cert_policy_t send_cert;
|
||||
u_int64_t dpd_delay;
|
||||
u_int64_t dpd_timeout;
|
||||
uint64_t dpd_delay;
|
||||
uint64_t dpd_timeout;
|
||||
fragmentation_t fragmentation;
|
||||
unique_policy_t unique;
|
||||
u_int32_t keyingtries;
|
||||
u_int32_t local_port;
|
||||
u_int32_t remote_port;
|
||||
uint32_t keyingtries;
|
||||
uint32_t local_port;
|
||||
uint32_t remote_port;
|
||||
char *local_addrs;
|
||||
char *remote_addrs;
|
||||
linked_list_t *local;
|
||||
@@ -281,10 +281,10 @@ typedef struct {
|
||||
linked_list_t *children;
|
||||
linked_list_t *vips;
|
||||
char *pools;
|
||||
u_int64_t reauth_time;
|
||||
u_int64_t rekey_time;
|
||||
u_int64_t over_time;
|
||||
u_int64_t rand_time;
|
||||
uint64_t reauth_time;
|
||||
uint64_t rekey_time;
|
||||
uint64_t over_time;
|
||||
uint64_t rand_time;
|
||||
} peer_data_t;
|
||||
|
||||
/**
|
||||
@@ -428,15 +428,15 @@ typedef struct {
|
||||
bool ipcomp;
|
||||
bool policies;
|
||||
ipsec_mode_t mode;
|
||||
u_int32_t replay_window;
|
||||
uint32_t replay_window;
|
||||
action_t dpd_action;
|
||||
action_t start_action;
|
||||
action_t close_action;
|
||||
u_int32_t reqid;
|
||||
u_int32_t tfc;
|
||||
uint32_t reqid;
|
||||
uint32_t tfc;
|
||||
mark_t mark_in;
|
||||
mark_t mark_out;
|
||||
u_int64_t inactivity;
|
||||
uint64_t inactivity;
|
||||
linked_list_t *proposals;
|
||||
linked_list_t *local_ts;
|
||||
linked_list_t *remote_ts;
|
||||
@@ -568,8 +568,8 @@ CALLBACK(parse_ts, bool,
|
||||
struct protoent *protoent;
|
||||
struct servent *svc;
|
||||
long int p;
|
||||
u_int16_t from = 0, to = 0xffff;
|
||||
u_int8_t proto = 0;
|
||||
uint16_t from = 0, to = 0xffff;
|
||||
uint8_t proto = 0;
|
||||
|
||||
if (!vici_stringify(v, buf, sizeof(buf)))
|
||||
{
|
||||
@@ -613,7 +613,7 @@ CALLBACK(parse_ts, bool,
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
proto = (u_int8_t)p;
|
||||
proto = (uint8_t)p;
|
||||
}
|
||||
}
|
||||
if (streq(port, "opaque"))
|
||||
@@ -809,10 +809,10 @@ CALLBACK(parse_action, bool,
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a u_int32_t
|
||||
* Parse a uint32_t
|
||||
*/
|
||||
CALLBACK(parse_uint32, bool,
|
||||
u_int32_t *out, chunk_t v)
|
||||
uint32_t *out, chunk_t v)
|
||||
{
|
||||
char buf[16], *end;
|
||||
u_long l;
|
||||
@@ -831,10 +831,10 @@ CALLBACK(parse_uint32, bool,
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a u_int64_t
|
||||
* Parse a uint64_t
|
||||
*/
|
||||
CALLBACK(parse_uint64, bool,
|
||||
u_int64_t *out, chunk_t v)
|
||||
uint64_t *out, chunk_t v)
|
||||
{
|
||||
char buf[16], *end;
|
||||
unsigned long long l;
|
||||
@@ -856,7 +856,7 @@ CALLBACK(parse_uint64, bool,
|
||||
* Parse a relative time
|
||||
*/
|
||||
CALLBACK(parse_time, bool,
|
||||
u_int64_t *out, chunk_t v)
|
||||
uint64_t *out, chunk_t v)
|
||||
{
|
||||
char buf[16], *end;
|
||||
u_long l;
|
||||
@@ -906,7 +906,7 @@ CALLBACK(parse_time, bool,
|
||||
* Parse byte volume
|
||||
*/
|
||||
CALLBACK(parse_bytes, bool,
|
||||
u_int64_t *out, chunk_t v)
|
||||
uint64_t *out, chunk_t v)
|
||||
{
|
||||
char buf[16], *end;
|
||||
unsigned long long l;
|
||||
@@ -968,7 +968,7 @@ CALLBACK(parse_mark, bool,
|
||||
* Parse TFC padding option
|
||||
*/
|
||||
CALLBACK(parse_tfc, bool,
|
||||
u_int32_t *out, chunk_t v)
|
||||
uint32_t *out, chunk_t v)
|
||||
{
|
||||
if (chunk_equals(v, chunk_from_str("mtu")))
|
||||
{
|
||||
@@ -1649,12 +1649,12 @@ CALLBACK(peer_sn, bool,
|
||||
/**
|
||||
* Find reqid of an existing CHILD_SA
|
||||
*/
|
||||
static u_int32_t find_reqid(child_cfg_t *cfg)
|
||||
static uint32_t find_reqid(child_cfg_t *cfg)
|
||||
{
|
||||
enumerator_t *enumerator, *children;
|
||||
child_sa_t *child_sa;
|
||||
ike_sa_t *ike_sa;
|
||||
u_int32_t reqid;
|
||||
uint32_t reqid;
|
||||
|
||||
reqid = charon->traps->find_reqid(charon->traps, cfg);
|
||||
if (reqid)
|
||||
@@ -1723,7 +1723,7 @@ static void clear_start_action(private_vici_config_t *this, char *peer_name,
|
||||
enumerator_t *enumerator, *children;
|
||||
child_sa_t *child_sa;
|
||||
ike_sa_t *ike_sa;
|
||||
u_int32_t id = 0, others;
|
||||
uint32_t id = 0, others;
|
||||
array_t *ids = NULL, *ikeids = NULL;
|
||||
char *name;
|
||||
|
||||
|
||||
@@ -507,12 +507,12 @@ CALLBACK(redirect, vici_message_t*,
|
||||
/**
|
||||
* Find reqid of an existing CHILD_SA
|
||||
*/
|
||||
static u_int32_t find_reqid(child_cfg_t *cfg)
|
||||
static uint32_t find_reqid(child_cfg_t *cfg)
|
||||
{
|
||||
enumerator_t *enumerator, *children;
|
||||
child_sa_t *child_sa;
|
||||
ike_sa_t *ike_sa;
|
||||
u_int32_t reqid;
|
||||
uint32_t reqid;
|
||||
|
||||
reqid = charon->traps->find_reqid(charon->traps, cfg);
|
||||
if (reqid)
|
||||
@@ -583,7 +583,7 @@ CALLBACK(uninstall, vici_message_t*,
|
||||
{
|
||||
child_sa_t *child_sa;
|
||||
enumerator_t *enumerator;
|
||||
u_int32_t reqid = 0;
|
||||
uint32_t reqid = 0;
|
||||
char *child;
|
||||
|
||||
child = request->get_str(request, NULL, "child");
|
||||
|
||||
@@ -119,10 +119,10 @@ static void send_op(private_vici_dispatcher_t *this, u_int id,
|
||||
bio_writer_t *writer;
|
||||
u_int len;
|
||||
|
||||
len = sizeof(u_int8_t);
|
||||
len = sizeof(uint8_t);
|
||||
if (name)
|
||||
{
|
||||
len += sizeof(u_int8_t) + strlen(name);
|
||||
len += sizeof(uint8_t) + strlen(name);
|
||||
}
|
||||
if (message)
|
||||
{
|
||||
@@ -308,7 +308,7 @@ CALLBACK(inbound, void,
|
||||
{
|
||||
bio_reader_t *reader;
|
||||
chunk_t chunk;
|
||||
u_int8_t type;
|
||||
uint8_t type;
|
||||
char name[257];
|
||||
|
||||
reader = bio_reader_create(data);
|
||||
|
||||
@@ -137,7 +137,7 @@ typedef struct {
|
||||
METHOD(enumerator_t, parse_enumerate, bool,
|
||||
parse_enumerator_t *this, vici_type_t *out, char **name, chunk_t *value)
|
||||
{
|
||||
u_int8_t type;
|
||||
uint8_t type;
|
||||
chunk_t data;
|
||||
|
||||
if (!this->reader->remaining(this->reader) ||
|
||||
|
||||
@@ -86,8 +86,8 @@ static void list_child(private_vici_query_t *this, vici_builder_t *b,
|
||||
child_sa_t *child, time_t now)
|
||||
{
|
||||
time_t t;
|
||||
u_int64_t bytes, packets;
|
||||
u_int16_t alg, ks;
|
||||
uint64_t bytes, packets;
|
||||
uint16_t alg, ks;
|
||||
proposal_t *proposal;
|
||||
enumerator_t *enumerator;
|
||||
traffic_selector_t *ts;
|
||||
@@ -152,7 +152,7 @@ static void list_child(private_vici_query_t *this, vici_builder_t *b,
|
||||
b->add_kv(b, "packets-in", "%" PRIu64, packets);
|
||||
if (t)
|
||||
{
|
||||
b->add_kv(b, "use-in", "%"PRIu64, (u_int64_t)(now - t));
|
||||
b->add_kv(b, "use-in", "%"PRIu64, (uint64_t)(now - t));
|
||||
}
|
||||
|
||||
child->get_usestats(child, FALSE, &t, &bytes, &packets);
|
||||
@@ -160,7 +160,7 @@ static void list_child(private_vici_query_t *this, vici_builder_t *b,
|
||||
b->add_kv(b, "packets-out", "%"PRIu64, packets);
|
||||
if (t)
|
||||
{
|
||||
b->add_kv(b, "use-out", "%"PRIu64, (u_int64_t)(now - t));
|
||||
b->add_kv(b, "use-out", "%"PRIu64, (uint64_t)(now - t));
|
||||
}
|
||||
|
||||
t = child->get_lifetime(child, FALSE);
|
||||
@@ -272,7 +272,7 @@ static void list_ike(private_vici_query_t *this, vici_builder_t *b,
|
||||
ike_sa_id_t *id;
|
||||
identification_t *eap;
|
||||
proposal_t *proposal;
|
||||
u_int16_t alg, ks;
|
||||
uint16_t alg, ks;
|
||||
host_t *host;
|
||||
|
||||
b->add_kv(b, "uniqueid", "%u", ike_sa->get_unique_id(ike_sa));
|
||||
|
||||
@@ -95,11 +95,11 @@ typedef struct {
|
||||
/** bytes of length header sent/received */
|
||||
u_char hdrlen;
|
||||
/** bytes of length header */
|
||||
char hdr[sizeof(u_int32_t)];
|
||||
char hdr[sizeof(uint32_t)];
|
||||
/** send/receive buffer on heap */
|
||||
chunk_t buf;
|
||||
/** bytes sent/received in buffer */
|
||||
u_int32_t done;
|
||||
uint32_t done;
|
||||
} msg_buf_t;
|
||||
|
||||
/**
|
||||
@@ -411,7 +411,7 @@ CALLBACK(on_write, bool,
|
||||
static bool do_read(private_vici_socket_t *this, entry_t *entry,
|
||||
stream_t *stream, char *errmsg, size_t errlen)
|
||||
{
|
||||
u_int32_t msglen;
|
||||
uint32_t msglen;
|
||||
ssize_t len;
|
||||
|
||||
/* assemble the length header first */
|
||||
|
||||
Reference in New Issue
Block a user