2005-02-09 Paul Jakma <paul.jakma@sun.com>
* (global) Update code to match stream.h changes.
stream_get_putp effectively replaced with stream_get_endp.
stream_forward renamed to stream_forward_getp.
stream_forward_endp introduced to replace some previous
setting/manual twiddling of putp by daemons.
* lib/stream.h: Remove putp. Update reference to putp with endp.
Add stream_forward_endp, which daemons were doing manually.
Rename stream_forward to stream_forward_getp.
lib/stream.c: Remove/update references to putp.
introduce stream_forward_endp.
diff --git a/isisd/isis_tlv.c b/isisd/isis_tlv.c
index 84f36c9..bc65363 100644
--- a/isisd/isis_tlv.c
+++ b/isisd/isis_tlv.c
@@ -751,7 +751,7 @@
add_tlv (u_char tag, u_char len, u_char * value, struct stream *stream)
{
- if (STREAM_SIZE (stream) - stream_get_putp (stream) < (unsigned) len + 2)
+ if (STREAM_SIZE (stream) - stream_get_endp (stream) < (unsigned) len + 2)
{
zlog_warn ("No room for TLV of type %d", tag);
return ISIS_WARNING;
@@ -1065,7 +1065,6 @@
int
tlv_add_padding (struct stream *stream)
{
- unsigned long putp, endp;
int fullpads, i, left;
/*
@@ -1078,15 +1077,10 @@
goto err;
if (!stream_putc (stream, (u_char) 255)) /* LENGHT */
goto err;
- endp = stream_get_endp (stream);
- putp = stream_get_putp (stream);
- if (putp != endp)
- zlog_warn ("tvl_add_padding endp %ld while putp %ld", endp, putp);
- stream_set_putp (stream, putp + 255); /* VALUE */
- stream->endp = stream->putp;
+ stream_forward_endp (stream, 255); /* VALUE */
}
- left = STREAM_SIZE (stream) - stream_get_putp (stream);
+ left = STREAM_SIZE (stream) - stream_get_endp (stream);
if (left < 2)
return ISIS_OK;
@@ -1100,8 +1094,7 @@
stream_putc (stream, PADDING);
stream_putc (stream, left - 2);
- stream_set_putp (stream, stream_get_putp (stream) + left - 2);
- stream->endp = stream->putp;
+ stream_forward_endp (stream, left - 2);
return ISIS_OK;