diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2016-07-16 15:19:53 +0200 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2016-07-16 15:19:53 +0200 |
commit | bf372706c469764d59e9f29c39e3ecbebd72b8d2 (patch) | |
tree | 0f0e296e2d50e4a7faf99ae6fa428d2681e81ea1 /src/libstrongswan/bio | |
parent | 518dd33c94e041db0444c7d1f33da363bb8e3faf (diff) | |
download | vyos-strongswan-bf372706c469764d59e9f29c39e3ecbebd72b8d2.tar.gz vyos-strongswan-bf372706c469764d59e9f29c39e3ecbebd72b8d2.zip |
Imported Upstream version 5.5.0
Diffstat (limited to 'src/libstrongswan/bio')
-rw-r--r-- | src/libstrongswan/bio/bio_reader.c | 58 | ||||
-rw-r--r-- | src/libstrongswan/bio/bio_reader.h | 26 | ||||
-rw-r--r-- | src/libstrongswan/bio/bio_writer.c | 14 | ||||
-rw-r--r-- | src/libstrongswan/bio/bio_writer.h | 12 |
4 files changed, 55 insertions, 55 deletions
diff --git a/src/libstrongswan/bio/bio_reader.c b/src/libstrongswan/bio/bio_reader.c index 29b9e7279..6e35999ce 100644 --- a/src/libstrongswan/bio/bio_reader.c +++ b/src/libstrongswan/bio/bio_reader.c @@ -43,7 +43,7 @@ struct private_bio_reader_t { chunk_t cleanup; }; -METHOD(bio_reader_t, remaining, u_int32_t, +METHOD(bio_reader_t, remaining, uint32_t, private_bio_reader_t *this) { return this->buf.len; @@ -76,16 +76,16 @@ static inline chunk_t chunk_skip_end(chunk_t chunk, size_t bytes, bool from_end) /** * Returns a pointer to the data to read, optionally from the end */ -static inline u_char *get_ptr_end(private_bio_reader_t *this, u_int32_t len, +static inline u_char *get_ptr_end(private_bio_reader_t *this, uint32_t len, bool from_end) { return from_end ? this->buf.ptr + (this->buf.len - len) : this->buf.ptr; } /** - * Read an u_int8_t from the buffer, optionally from the end of the buffer + * Read an uint8_t from the buffer, optionally from the end of the buffer */ -static bool read_uint8_internal(private_bio_reader_t *this, u_int8_t *res, +static bool read_uint8_internal(private_bio_reader_t *this, uint8_t *res, bool from_end) { if (this->buf.len < 1) @@ -100,9 +100,9 @@ static bool read_uint8_internal(private_bio_reader_t *this, u_int8_t *res, } /** - * Read an u_int16_t from the buffer, optionally from the end + * Read an uint16_t from the buffer, optionally from the end */ -static bool read_uint16_internal(private_bio_reader_t *this, u_int16_t *res, +static bool read_uint16_internal(private_bio_reader_t *this, uint16_t *res, bool from_end) { if (this->buf.len < 2) @@ -117,9 +117,9 @@ static bool read_uint16_internal(private_bio_reader_t *this, u_int16_t *res, } /** - * Read an u_int32_t (only 24-bit) from the buffer, optionally from the end + * Read an uint32_t (only 24-bit) from the buffer, optionally from the end */ -static bool read_uint24_internal(private_bio_reader_t *this, u_int32_t *res, +static bool read_uint24_internal(private_bio_reader_t *this, uint32_t *res, bool from_end) { if (this->buf.len < 3) @@ -134,9 +134,9 @@ static bool read_uint24_internal(private_bio_reader_t *this, u_int32_t *res, } /** - * Read an u_int32_t from the buffer, optionally from the end + * Read an uint32_t from the buffer, optionally from the end */ -static bool read_uint32_internal(private_bio_reader_t *this, u_int32_t *res, +static bool read_uint32_internal(private_bio_reader_t *this, uint32_t *res, bool from_end) { if (this->buf.len < 4) @@ -151,9 +151,9 @@ static bool read_uint32_internal(private_bio_reader_t *this, u_int32_t *res, } /** - * Read an u_int64_t from the buffer, optionally from the end + * Read an uint64_t from the buffer, optionally from the end */ -static bool read_uint64_internal(private_bio_reader_t *this, u_int64_t *res, +static bool read_uint64_internal(private_bio_reader_t *this, uint64_t *res, bool from_end) { if (this->buf.len < 8) @@ -170,7 +170,7 @@ static bool read_uint64_internal(private_bio_reader_t *this, u_int64_t *res, /** * Read a chunk of data from the buffer, optionally from the end */ -static bool read_data_internal(private_bio_reader_t *this, u_int32_t len, +static bool read_data_internal(private_bio_reader_t *this, uint32_t len, chunk_t *res, bool from_end) { if (this->buf.len < len) @@ -185,73 +185,73 @@ static bool read_data_internal(private_bio_reader_t *this, u_int32_t len, } METHOD(bio_reader_t, read_uint8, bool, - private_bio_reader_t *this, u_int8_t *res) + private_bio_reader_t *this, uint8_t *res) { return read_uint8_internal(this, res, FALSE); } METHOD(bio_reader_t, read_uint16, bool, - private_bio_reader_t *this, u_int16_t *res) + private_bio_reader_t *this, uint16_t *res) { return read_uint16_internal(this, res, FALSE); } METHOD(bio_reader_t, read_uint24, bool, - private_bio_reader_t *this, u_int32_t *res) + private_bio_reader_t *this, uint32_t *res) { return read_uint24_internal(this, res, FALSE); } METHOD(bio_reader_t, read_uint32, bool, - private_bio_reader_t *this, u_int32_t *res) + private_bio_reader_t *this, uint32_t *res) { return read_uint32_internal(this, res, FALSE); } METHOD(bio_reader_t, read_uint64, bool, - private_bio_reader_t *this, u_int64_t *res) + private_bio_reader_t *this, uint64_t *res) { return read_uint64_internal(this, res, FALSE); } METHOD(bio_reader_t, read_data, bool, - private_bio_reader_t *this, u_int32_t len, chunk_t *res) + private_bio_reader_t *this, uint32_t len, chunk_t *res) { return read_data_internal(this, len, res, FALSE); } METHOD(bio_reader_t, read_uint8_end, bool, - private_bio_reader_t *this, u_int8_t *res) + private_bio_reader_t *this, uint8_t *res) { return read_uint8_internal(this, res, TRUE); } METHOD(bio_reader_t, read_uint16_end, bool, - private_bio_reader_t *this, u_int16_t *res) + private_bio_reader_t *this, uint16_t *res) { return read_uint16_internal(this, res, TRUE); } METHOD(bio_reader_t, read_uint24_end, bool, - private_bio_reader_t *this, u_int32_t *res) + private_bio_reader_t *this, uint32_t *res) { return read_uint24_internal(this, res, TRUE); } METHOD(bio_reader_t, read_uint32_end, bool, - private_bio_reader_t *this, u_int32_t *res) + private_bio_reader_t *this, uint32_t *res) { return read_uint32_internal(this, res, TRUE); } METHOD(bio_reader_t, read_uint64_end, bool, - private_bio_reader_t *this, u_int64_t *res) + private_bio_reader_t *this, uint64_t *res) { return read_uint64_internal(this, res, TRUE); } METHOD(bio_reader_t, read_data_end, bool, - private_bio_reader_t *this, u_int32_t len, chunk_t *res) + private_bio_reader_t *this, uint32_t len, chunk_t *res) { return read_data_internal(this, len, res, TRUE); } @@ -259,7 +259,7 @@ METHOD(bio_reader_t, read_data_end, bool, METHOD(bio_reader_t, read_data8, bool, private_bio_reader_t *this, chunk_t *res) { - u_int8_t len; + uint8_t len; if (!read_uint8(this, &len)) { @@ -271,7 +271,7 @@ METHOD(bio_reader_t, read_data8, bool, METHOD(bio_reader_t, read_data16, bool, private_bio_reader_t *this, chunk_t *res) { - u_int16_t len; + uint16_t len; if (!read_uint16(this, &len)) { @@ -283,7 +283,7 @@ METHOD(bio_reader_t, read_data16, bool, METHOD(bio_reader_t, read_data24, bool, private_bio_reader_t *this, chunk_t *res) { - u_int32_t len; + uint32_t len; if (!read_uint24(this, &len)) { @@ -295,7 +295,7 @@ METHOD(bio_reader_t, read_data24, bool, METHOD(bio_reader_t, read_data32, bool, private_bio_reader_t *this, chunk_t *res) { - u_int32_t len; + uint32_t len; if (!read_uint32(this, &len)) { diff --git a/src/libstrongswan/bio/bio_reader.h b/src/libstrongswan/bio/bio_reader.h index 475422428..358993c4f 100644 --- a/src/libstrongswan/bio/bio_reader.h +++ b/src/libstrongswan/bio/bio_reader.h @@ -40,7 +40,7 @@ struct bio_reader_t { * * @return number of remaining bytes in buffer */ - u_int32_t (*remaining)(bio_reader_t *this); + uint32_t (*remaining)(bio_reader_t *this); /** * Peek the remaining data, not consuming any bytes. @@ -55,7 +55,7 @@ struct bio_reader_t { * @param res pointer to result * @return TRUE if integer read successfully */ - bool (*read_uint8)(bio_reader_t *this, u_int8_t *res); + bool (*read_uint8)(bio_reader_t *this, uint8_t *res); /** * Read a 16-bit integer from the buffer, advance. @@ -63,7 +63,7 @@ struct bio_reader_t { * @param res pointer to result * @return TRUE if integer read successfully */ - bool (*read_uint16)(bio_reader_t *this, u_int16_t *res); + bool (*read_uint16)(bio_reader_t *this, uint16_t *res); /** * Read a 24-bit integer from the buffer, advance. @@ -71,7 +71,7 @@ struct bio_reader_t { * @param res pointer to result * @return TRUE if integer read successfully */ - bool (*read_uint24)(bio_reader_t *this, u_int32_t *res); + bool (*read_uint24)(bio_reader_t *this, uint32_t *res); /** * Read a 32-bit integer from the buffer, advance. @@ -79,7 +79,7 @@ struct bio_reader_t { * @param res pointer to result * @return TRUE if integer read successfully */ - bool (*read_uint32)(bio_reader_t *this, u_int32_t *res); + bool (*read_uint32)(bio_reader_t *this, uint32_t *res); /** * Read a 64-bit integer from the buffer, advance. @@ -87,7 +87,7 @@ struct bio_reader_t { * @param res pointer to result * @return TRUE if integer read successfully */ - bool (*read_uint64)(bio_reader_t *this, u_int64_t *res); + bool (*read_uint64)(bio_reader_t *this, uint64_t *res); /** * Read a chunk of len bytes, advance. @@ -96,7 +96,7 @@ struct bio_reader_t { * @param res pointer to result, not cloned * @return TRUE if data read successfully */ - bool (*read_data)(bio_reader_t *this, u_int32_t len, chunk_t *res); + bool (*read_data)(bio_reader_t *this, uint32_t len, chunk_t *res); /** * Read a 8-bit integer from the end of the buffer, reduce remaining. @@ -104,7 +104,7 @@ struct bio_reader_t { * @param res pointer to result * @return TRUE if integer read successfully */ - bool (*read_uint8_end)(bio_reader_t *this, u_int8_t *res); + bool (*read_uint8_end)(bio_reader_t *this, uint8_t *res); /** * Read a 16-bit integer from the end of the buffer, reduce remaining. @@ -112,7 +112,7 @@ struct bio_reader_t { * @param res pointer to result * @return TRUE if integer read successfully */ - bool (*read_uint16_end)(bio_reader_t *this, u_int16_t *res); + bool (*read_uint16_end)(bio_reader_t *this, uint16_t *res); /** * Read a 24-bit integer from the end of the buffer, reduce remaining. @@ -120,7 +120,7 @@ struct bio_reader_t { * @param res pointer to result * @return TRUE if integer read successfully */ - bool (*read_uint24_end)(bio_reader_t *this, u_int32_t *res); + bool (*read_uint24_end)(bio_reader_t *this, uint32_t *res); /** * Read a 32-bit integer from the end of the buffer, reduce remaining. @@ -128,7 +128,7 @@ struct bio_reader_t { * @param res pointer to result * @return TRUE if integer read successfully */ - bool (*read_uint32_end)(bio_reader_t *this, u_int32_t *res); + bool (*read_uint32_end)(bio_reader_t *this, uint32_t *res); /** * Read a 64-bit integer from the end of the buffer, reduce remaining. @@ -136,7 +136,7 @@ struct bio_reader_t { * @param res pointer to result * @return TRUE if integer read successfully */ - bool (*read_uint64_end)(bio_reader_t *this, u_int64_t *res); + bool (*read_uint64_end)(bio_reader_t *this, uint64_t *res); /** * Read a chunk of len bytes from the end of the buffer, reduce remaining. @@ -145,7 +145,7 @@ struct bio_reader_t { * @param res ponter to result, not cloned * @return TRUE if data read successfully */ - bool (*read_data_end)(bio_reader_t *this, u_int32_t len, chunk_t *res); + bool (*read_data_end)(bio_reader_t *this, uint32_t len, chunk_t *res); /** * Read a chunk of bytes with a 8-bit length header, advance. diff --git a/src/libstrongswan/bio/bio_writer.c b/src/libstrongswan/bio/bio_writer.c index 152d9ce22..a21b376cf 100644 --- a/src/libstrongswan/bio/bio_writer.c +++ b/src/libstrongswan/bio/bio_writer.c @@ -65,7 +65,7 @@ static inline void increase(private_bio_writer_t *this, size_t required) } METHOD(bio_writer_t, write_uint8, void, - private_bio_writer_t *this, u_int8_t value) + private_bio_writer_t *this, uint8_t value) { increase(this, 1); this->buf.ptr[this->used] = value; @@ -73,7 +73,7 @@ METHOD(bio_writer_t, write_uint8, void, } METHOD(bio_writer_t, write_uint16, void, - private_bio_writer_t *this, u_int16_t value) + private_bio_writer_t *this, uint16_t value) { increase(this, 2); htoun16(this->buf.ptr + this->used, value); @@ -81,7 +81,7 @@ METHOD(bio_writer_t, write_uint16, void, } METHOD(bio_writer_t, write_uint24, void, - private_bio_writer_t *this, u_int32_t value) + private_bio_writer_t *this, uint32_t value) { increase(this, 3); value = htonl(value); @@ -90,7 +90,7 @@ METHOD(bio_writer_t, write_uint24, void, } METHOD(bio_writer_t, write_uint32, void, - private_bio_writer_t *this, u_int32_t value) + private_bio_writer_t *this, uint32_t value) { increase(this, 4); htoun32(this->buf.ptr + this->used, value); @@ -98,7 +98,7 @@ METHOD(bio_writer_t, write_uint32, void, } METHOD(bio_writer_t, write_uint64, void, - private_bio_writer_t *this, u_int64_t value) + private_bio_writer_t *this, uint64_t value) { increase(this, 8); htoun64(this->buf.ptr + this->used, value); @@ -166,7 +166,7 @@ METHOD(bio_writer_t, wrap16, void, METHOD(bio_writer_t, wrap24, void, private_bio_writer_t *this) { - u_int32_t len; + uint32_t len; increase(this, 3); memmove(this->buf.ptr + 3, this->buf.ptr, this->used); @@ -221,7 +221,7 @@ METHOD(bio_writer_t, destroy, void, /** * See header */ -bio_writer_t *bio_writer_create(u_int32_t bufsize) +bio_writer_t *bio_writer_create(uint32_t bufsize) { private_bio_writer_t *this; diff --git a/src/libstrongswan/bio/bio_writer.h b/src/libstrongswan/bio/bio_writer.h index 2ac4f3556..b6e3db730 100644 --- a/src/libstrongswan/bio/bio_writer.h +++ b/src/libstrongswan/bio/bio_writer.h @@ -40,35 +40,35 @@ struct bio_writer_t { * * @param value value to append */ - void (*write_uint8)(bio_writer_t *this, u_int8_t value); + void (*write_uint8)(bio_writer_t *this, uint8_t value); /** * Append a 16-bit integer to the buffer. * * @param value value to append */ - void (*write_uint16)(bio_writer_t *this, u_int16_t value); + void (*write_uint16)(bio_writer_t *this, uint16_t value); /** * Append a 24-bit integer to the buffer. * * @param value value to append */ - void (*write_uint24)(bio_writer_t *this, u_int32_t value); + void (*write_uint24)(bio_writer_t *this, uint32_t value); /** * Append a 32-bit integer to the buffer. * * @param value value to append */ - void (*write_uint32)(bio_writer_t *this, u_int32_t value); + void (*write_uint32)(bio_writer_t *this, uint32_t value); /** * Append a 64-bit integer to the buffer. * * @param value value to append */ - void (*write_uint64)(bio_writer_t *this, u_int64_t value); + void (*write_uint64)(bio_writer_t *this, uint64_t value); /** * Append a chunk of data without a length header. @@ -166,6 +166,6 @@ struct bio_writer_t { * * @param bufsize initially allocated buffer size */ -bio_writer_t *bio_writer_create(u_int32_t bufsize); +bio_writer_t *bio_writer_create(uint32_t bufsize); #endif /** BIO_WRITER_H_ @}*/ |