| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_TOOLS_BALSA_BUFFER_INTERFACE_H__ | 5 #ifndef NET_TOOLS_BALSA_BUFFER_INTERFACE_H__ |
| 6 #define NET_TOOLS_BALSA_BUFFER_INTERFACE_H__ | 6 #define NET_TOOLS_BALSA_BUFFER_INTERFACE_H__ |
| 7 | 7 |
| 8 namespace net { | 8 namespace net { |
| 9 | 9 |
| 10 class BufferInterface { | 10 class BufferInterface { |
| 11 public: | 11 public: |
| 12 | |
| 13 // Returns the bytes which can be read from the buffer. There is no | 12 // Returns the bytes which can be read from the buffer. There is no |
| 14 // guarantee that the bytes are contiguous. | 13 // guarantee that the bytes are contiguous. |
| 15 virtual int ReadableBytes() const = 0; | 14 virtual int ReadableBytes() const = 0; |
| 16 | 15 |
| 17 // Summary: | 16 // Summary: |
| 18 // returns the size of this buffer | 17 // returns the size of this buffer |
| 19 // Returns: | 18 // Returns: |
| 20 // size of this buffer. | 19 // size of this buffer. |
| 21 virtual int BufferSize() const = 0; | 20 virtual int BufferSize() const = 0; |
| 22 | 21 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 48 | 47 |
| 49 // Summary: | 48 // Summary: |
| 50 // Gets a pointer which can be written to (assigned to). | 49 // Gets a pointer which can be written to (assigned to). |
| 51 // this pointer (and size) can be used in functions like | 50 // this pointer (and size) can be used in functions like |
| 52 // recv() or read(), etc. | 51 // recv() or read(), etc. |
| 53 // If *size is zero upon returning from this function, that it | 52 // If *size is zero upon returning from this function, that it |
| 54 // is unsafe to dereference *ptr. | 53 // is unsafe to dereference *ptr. |
| 55 // Args: | 54 // Args: |
| 56 // ptr - assigned a pointer to which we can write | 55 // ptr - assigned a pointer to which we can write |
| 57 // size - the amount of data (in bytes) that it is safe to write to ptr. | 56 // size - the amount of data (in bytes) that it is safe to write to ptr. |
| 58 virtual void GetWritablePtr(char **ptr, int* size) const = 0; | 57 virtual void GetWritablePtr(char** ptr, int* size) const = 0; |
| 59 | 58 |
| 60 // Summary: | 59 // Summary: |
| 61 // Gets a pointer which can be read from | 60 // Gets a pointer which can be read from |
| 62 // this pointer (and size) can be used in functions like | 61 // this pointer (and size) can be used in functions like |
| 63 // send() or write(), etc. | 62 // send() or write(), etc. |
| 64 // If *size is zero upon returning from this function, that it | 63 // If *size is zero upon returning from this function, that it |
| 65 // is unsafe to dereference *ptr. | 64 // is unsafe to dereference *ptr. |
| 66 // Args: | 65 // Args: |
| 67 // ptr - assigned a pointer from which we may read | 66 // ptr - assigned a pointer from which we may read |
| 68 // size - the amount of data (in bytes) that it is safe to read | 67 // size - the amount of data (in bytes) that it is safe to read |
| 69 virtual void GetReadablePtr(char **ptr, int* size) const = 0; | 68 virtual void GetReadablePtr(char** ptr, int* size) const = 0; |
| 70 | 69 |
| 71 // Summary: | 70 // Summary: |
| 72 // Reads bytes out of the buffer, and writes them into 'bytes'. | 71 // Reads bytes out of the buffer, and writes them into 'bytes'. |
| 73 // Returns the number of bytes read. | 72 // Returns the number of bytes read. |
| 74 // Consumes bytes from the buffer (possibly, but not necessarily | 73 // Consumes bytes from the buffer (possibly, but not necessarily |
| 75 // rendering them free) | 74 // rendering them free) |
| 76 // Args: | 75 // Args: |
| 77 // bytes - the pointer into which bytes are read from this buffer | 76 // bytes - the pointer into which bytes are read from this buffer |
| 78 // and written into | 77 // and written into |
| 79 // size - number of bytes which are read and copied. | 78 // size - number of bytes which are read and copied. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 110 |
| 112 virtual ~BufferInterface() {} | 111 virtual ~BufferInterface() {} |
| 113 | 112 |
| 114 protected: | 113 protected: |
| 115 BufferInterface() {} | 114 BufferInterface() {} |
| 116 }; | 115 }; |
| 117 | 116 |
| 118 } // namespace net | 117 } // namespace net |
| 119 | 118 |
| 120 #endif // NET_TOOLS_BALSA_BUFFER_INTERFACE__H__ | 119 #endif // NET_TOOLS_BALSA_BUFFER_INTERFACE__H__ |
| 121 | |
| OLD | NEW |