aboutsummaryrefslogtreecommitdiffstats
path: root/src/pipe.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/pipe.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/pipe.cpp')
-rw-r--r--src/pipe.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/pipe.cpp b/src/pipe.cpp
index b740e049d..228dc3a22 100644
--- a/src/pipe.cpp
+++ b/src/pipe.cpp
@@ -6,9 +6,20 @@
#include <botan/pipe.h>
#include <botan/out_buf.h>
#include <botan/secqueue.h>
+#include <botan/parsing.h>
namespace Botan {
+/*************************************************
+* Constructor for Invalid_Message_Number *
+*************************************************/
+Pipe::Invalid_Message_Number::Invalid_Message_Number(const std::string& where,
+ message_id msg)
+ {
+ set_msg("Pipe::" + where + ": Invalid message number " +
+ to_string(msg));
+ }
+
namespace {
/*************************************************
@@ -276,7 +287,7 @@ void Pipe::pop()
/*************************************************
* Return the number of messages in this Pipe *
*************************************************/
-u32bit Pipe::message_count() const
+Pipe::message_id Pipe::message_count() const
{
return outputs->message_count();
}
@@ -284,7 +295,10 @@ u32bit Pipe::message_count() const
/*************************************************
* Static Member Variables *
*************************************************/
-const Pipe::message_id Pipe::LAST_MESSAGE = static_cast<Pipe::message_id>(-2);
-const Pipe::message_id Pipe::DEFAULT_MESSAGE = static_cast<Pipe::message_id>(-1);
+const Pipe::message_id Pipe::LAST_MESSAGE =
+ static_cast<Pipe::message_id>(-2);
+
+const Pipe::message_id Pipe::DEFAULT_MESSAGE =
+ static_cast<Pipe::message_id>(-1);
}