Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
71b306bf
Commit
71b306bf
authored
May 18, 1999
by
Brian Wellington
Browse files
add isc_buffer_{get,put}uint8
parent
2eed8ba8
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/isc/buffer.c
View file @
71b306bf
...
...
@@ -277,6 +277,40 @@ isc_buffer_compact(isc_buffer_t *b) {
b
->
used
=
length
;
}
isc_uint8_t
isc_buffer_getuint8
(
isc_buffer_t
*
b
)
{
unsigned
char
*
cp
;
isc_uint8_t
result
;
/*
* Read an unsigned 8-bit integer from 'b' and return it.
*/
REQUIRE
(
VALID_BUFFER
(
b
));
REQUIRE
(
b
->
used
-
b
->
current
>=
1
);
cp
=
b
->
base
;
cp
+=
b
->
current
;
b
->
current
+=
1
;
result
=
((
unsigned
int
)(
cp
[
0
]));
return
(
result
);
}
void
isc_buffer_putuint8
(
isc_buffer_t
*
b
,
isc_uint8_t
val
)
{
unsigned
char
*
cp
;
REQUIRE
(
VALID_BUFFER
(
b
));
REQUIRE
(
b
->
used
+
1
<=
b
->
length
);
cp
=
b
->
base
;
cp
+=
b
->
used
;
b
->
used
+=
1
;
cp
[
0
]
=
(
val
&
0x00ff
);
}
isc_uint16_t
isc_buffer_getuint16
(
isc_buffer_t
*
b
)
{
unsigned
char
*
cp
;
...
...
lib/isc/include/isc/buffer.h
View file @
71b306bf
...
...
@@ -422,6 +422,40 @@ isc_buffer_compact(isc_buffer_t *b);
* are those of the remaining region (as it was before the call).
*/
isc_uint8_t
isc_buffer_getuint8
(
isc_buffer_t
*
b
);
/*
* Read an unsigned 8-bit integer from 'b' and return it.
*
* Requires:
*
* 'b' is a valid buffer.
*
* The length of the available region of 'b' is at least 1.
*
* Ensures:
*
* The current pointer in 'b' is advanced by 1.
*
* Returns:
*
* A 8-bit unsigned integer.
*/
void
isc_buffer_putuint8
(
isc_buffer_t
*
b
,
isc_uint8_t
val
);
/*
* Store an unsigned 8-bit integer from 'val' into 'b'.
*
* Requires:
* 'b' is a valid buffer.
*
* The length of the unused region of 'b' is at least 1.
*
* Ensures:
* The used pointer in 'b' is advanced by 1.
*/
isc_uint16_t
isc_buffer_getuint16
(
isc_buffer_t
*
b
);
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment