Esempio n. 1
0
/* Unpack a 32-bit unsigned integer. */
int
cpack_uint32(struct cpack_state *cs, u_int32_t *u)
{
	u_int8_t *next;

	if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
		return -1;

	*u = EXTRACT_LE_32BITS(next);

	/* Move pointer past the u_int32_t. */
	cs->c_next = next + sizeof(*u);
	return 0;
}
Esempio n. 2
0
/* Unpack a 64-bit unsigned integer. */
int
cpack_uint64(netdissect_options *ndo, struct cpack_state *cs, uint64_t *u)
{
	const uint8_t *next;

	if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
		return -1;

	*u = GET_LE_U_8(next);

	/* Move pointer past the uint64_t. */
	cs->c_next = next + sizeof(*u);
	return 0;
}