diff options
author | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-17 20:20:11 +0000 |
---|---|---|
committer | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-17 20:20:11 +0000 |
commit | 4ba51e2ab55061b8750c904c2aeca19899ac02ee (patch) | |
tree | 189758309a3f0da6fbc22ecf506ead3d216f7aed /net/curvecp/packetizer.h | |
parent | e941a283e5b107f0c0a3595d0b6e11d7259d833f (diff) | |
download | chromium_src-4ba51e2ab55061b8750c904c2aeca19899ac02ee.zip chromium_src-4ba51e2ab55061b8750c904c2aeca19899ac02ee.tar.gz chromium_src-4ba51e2ab55061b8750c904c2aeca19899ac02ee.tar.bz2 |
An initial curvecp implementation. This code is not complete, but does
have a basic unittest. Crypto code is not yet implemented.
Landing so that we can collaborate on this more.
BUG=none
TEST=curvecp_unittests
Review URL: http://codereview.chromium.org/7039014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85667 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/curvecp/packetizer.h')
-rw-r--r-- | net/curvecp/packetizer.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/net/curvecp/packetizer.h b/net/curvecp/packetizer.h new file mode 100644 index 0000000..30d6c29 --- /dev/null +++ b/net/curvecp/packetizer.h @@ -0,0 +1,51 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_CURVECP_PACKETIZER_H_ +#define NET_CURVECP_PACKETIZER_H_ +#pragma once + +#include "base/basictypes.h" +#include "base/scoped_ptr.h" +#include "net/base/completion_callback.h" +#include "net/curvecp/connection_key.h" + +namespace net { + +class IPEndPoint; + +class Packetizer { + public: + class Listener { + public: + virtual ~Listener() {} + // Callback for new connections. + virtual void OnConnection(ConnectionKey key) = 0; + virtual void OnMessage(Packetizer* packetizer, + ConnectionKey key, + unsigned char* msg, + size_t length) = 0; + }; + + virtual ~Packetizer() {} + + // Send a message on a connection. + virtual int SendMessage(ConnectionKey key, + const char* data, + size_t length, + CompletionCallback* callback) = 0; + + // Close an existing connection. + virtual void Close(ConnectionKey key) = 0; + + virtual int GetPeerAddress(IPEndPoint* addresses) const = 0; + + // Returns the current maximum message size which can be fit into the next + // message payload to be sent on the packetizer. + virtual int max_message_payload() const = 0; +}; + +} // namespace net + +#endif // NET_CURVECP_PACKETIZER_H_ |