diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-08-29 16:19:27 +0400 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-08-29 16:25:57 +0400 |
commit | 653f62a709cdc50f18c3924b8db824d98ebcbffb (patch) | |
tree | 41a63748fbe3e3a9f03f3e57f531bc8ab96829e1 /src/node_crypto_bio.h | |
parent | 8e596c4e15f64b53d66e91079ed733821fb3e88d (diff) |
crypto: remove NodeBIO::GetMethod()
Remove NodeBIO::GetMethod() and replace calls to BIO_new() with calls
to the new NodeBIO::New() function.
This commit basically reshuffles some code in order to make it explicit
that the NodeBIO BIO_METHOD is const.
Diffstat (limited to 'src/node_crypto_bio.h')
-rw-r--r-- | src/node_crypto_bio.h | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/node_crypto_bio.h b/src/node_crypto_bio.h index 906489fcc91..865c7ca6c3c 100644 --- a/src/node_crypto_bio.h +++ b/src/node_crypto_bio.h @@ -29,10 +29,6 @@ namespace node { class NodeBIO { public: - static inline BIO_METHOD* GetMethod() { - return &method_; - } - NodeBIO() : length_(0), read_head_(&head_), write_head_(&head_) { // Loop head head_.next_ = &head_; @@ -40,13 +36,7 @@ class NodeBIO { ~NodeBIO(); - static int New(BIO* bio); - static int Free(BIO* bio); - static int Read(BIO* bio, char* out, int len); - static int Write(BIO* bio, const char* data, int len); - static int Puts(BIO* bio, const char* str); - static int Gets(BIO* bio, char* out, int size); - static long Ctrl(BIO* bio, int cmd, long num, void* ptr); + static BIO* New(); // Allocate new buffer for write if needed void TryAllocateForWrite(); @@ -89,10 +79,19 @@ class NodeBIO { return static_cast<NodeBIO*>(bio->ptr); } - protected: + private: + static int New(BIO* bio); + static int Free(BIO* bio); + static int Read(BIO* bio, char* out, int len); + static int Write(BIO* bio, const char* data, int len); + static int Puts(BIO* bio, const char* str); + static int Gets(BIO* bio, char* out, int size); + static long Ctrl(BIO* bio, int cmd, long num, void* ptr); + // NOTE: Size is maximum TLS frame length, this is required if we want // to fit whole ClientHello into one Buffer of NodeBIO. static const size_t kBufferLength = 16 * 1024 + 5; + static const BIO_METHOD method; class Buffer { public: @@ -109,8 +108,6 @@ class NodeBIO { Buffer head_; Buffer* read_head_; Buffer* write_head_; - - static BIO_METHOD method_; }; } // namespace node |