Index: net/websockets/websocket_frame.h |
diff --git a/net/websockets/websocket_frame.h b/net/websockets/websocket_frame.h |
index 9f7c7fd6fc26b471fd38cc8db84a7f2f95ea9068..94f4ede680254dde32a0ba2f163531acf401b915 100644 |
--- a/net/websockets/websocket_frame.h |
+++ b/net/websockets/websocket_frame.h |
@@ -86,6 +86,12 @@ struct WebSocketMaskingKey { |
char key[WebSocketFrameHeader::kMaskingKeyLength]; |
}; |
+// Returns the size of WebSocket frame header. The size of WebSocket frame |
+// header varies from 2 bytes to 14 bytes depending on the payload length |
+// and maskedness. |
+NET_EXPORT_PRIVATE int GetWebSocketFrameHeaderSize( |
+ const WebSocketFrameHeader& header); |
+ |
// Writes wire format of a WebSocket frame header into |output|, and returns |
// the number of bytes written. |
// |
@@ -98,10 +104,10 @@ struct WebSocketMaskingKey { |
// (possibly generated by GenerateWebSocketMaskingKey() function below). |
// Otherwise, |masking_key| must be NULL. |
// |
-// |buffer| should have enough size to contain the frame header. Size of a |
-// frame header varies from 2 bytes to 14 bytes depending on the payload length |
-// and maskedness. If the size of |buffer| is insufficient, this function |
-// returns ERR_INVALID_ARGUMENT and does not write any data to |buffer|. |
+// |buffer| should have enough size to contain the frame header. |
+// GetWebSocketFrameHeaderSize() can be used to know the size of header |
+// beforehand. If the size of |buffer| is insufficient, this function returns |
+// ERR_INVALID_ARGUMENT and does not write any data to |buffer|. |
NET_EXPORT_PRIVATE int WriteWebSocketFrameHeader( |
const WebSocketFrameHeader& header, |
const WebSocketMaskingKey* masking_key, |