aboutsummaryrefslogtreecommitdiffstats
path: root/src/out_buf.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-04-12 16:17:44 +0000
committerlloyd <[email protected]>2008-04-12 16:17:44 +0000
commitdabde92a24671700ac2150c938587c3efd505499 (patch)
tree3e5dc688be68d6c84fad7a6c99fdbd98d93b60c1 /src/out_buf.cpp
parent9cbdc7ee564c802781b82ba907b7dfb187fa52e8 (diff)
Modify areas that still assumed Pipe::message_id was exactly a u32bit.
This was done by replacing Pipe::message_id with a completely opaque type and adding only the necessary operations. In this revision Pipe::message_id does remain a u32bit. However it may become an opaque type in the future. Move the Invalid_Message_Number exception to Pipe since that is the only piece of code which throws it.
Diffstat (limited to 'src/out_buf.cpp')
-rw-r--r--src/out_buf.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/out_buf.cpp b/src/out_buf.cpp
index 2586d65c2..392592705 100644
--- a/src/out_buf.cpp
+++ b/src/out_buf.cpp
@@ -11,7 +11,8 @@ namespace Botan {
/*************************************************
* Read data from a message *
*************************************************/
-u32bit Output_Buffers::read(byte output[], u32bit length, u32bit msg)
+u32bit Output_Buffers::read(byte output[], u32bit length,
+ Pipe::message_id msg)
{
SecureQueue* q = get(msg);
if(q)
@@ -23,7 +24,8 @@ u32bit Output_Buffers::read(byte output[], u32bit length, u32bit msg)
* Peek at data in a message *
*************************************************/
u32bit Output_Buffers::peek(byte output[], u32bit length,
- u32bit stream_offset, u32bit msg) const
+ u32bit stream_offset,
+ Pipe::message_id msg) const
{
SecureQueue* q = get(msg);
if(q)
@@ -34,7 +36,7 @@ u32bit Output_Buffers::peek(byte output[], u32bit length,
/*************************************************
* Check available bytes in a message *
*************************************************/
-u32bit Output_Buffers::remaining(u32bit msg) const
+u32bit Output_Buffers::remaining(Pipe::message_id msg) const
{
SecureQueue* q = get(msg);
if(q)
@@ -67,7 +69,7 @@ void Output_Buffers::retire()
{
delete buffers[0];
buffers.pop_front();
- ++offset;
+ offset = offset + Pipe::message_id(1);
}
else
break;
@@ -77,7 +79,7 @@ void Output_Buffers::retire()
/*************************************************
* Get a particular output queue *
*************************************************/
-SecureQueue* Output_Buffers::get(u32bit msg) const
+SecureQueue* Output_Buffers::get(Pipe::message_id msg) const
{
if(msg < offset)
return 0;
@@ -90,9 +92,9 @@ SecureQueue* Output_Buffers::get(u32bit msg) const
/*************************************************
* Return the total number of messages *
*************************************************/
-u32bit Output_Buffers::message_count() const
+Pipe::message_id Output_Buffers::message_count() const
{
- return (buffers.size() + offset);
+ return (offset + buffers.size());
}
/*************************************************