Modified Rsv enum values to PascalCase values
This commit is contained in:
parent
4304310430
commit
69e057969b
@ -4,8 +4,8 @@
|
|||||||
*
|
*
|
||||||
* The MIT License
|
* The MIT License
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2013 sta.blockhead
|
* Copyright (c) 2012-2014 sta.blockhead
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
* in the Software without restriction, including without limitation the rights
|
* in the Software without restriction, including without limitation the rights
|
||||||
@ -15,7 +15,7 @@
|
|||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
* all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
@ -28,11 +28,11 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace WebSocketSharp {
|
namespace WebSocketSharp
|
||||||
|
{
|
||||||
internal enum Rsv : byte
|
internal enum Rsv : byte
|
||||||
{
|
{
|
||||||
OFF = 0x0,
|
Off = 0x0,
|
||||||
ON = 0x1
|
On = 0x1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,9 +80,9 @@ namespace WebSocketSharp
|
|||||||
Fin fin, Opcode opcode, Mask mask, PayloadData payload, bool compressed)
|
Fin fin, Opcode opcode, Mask mask, PayloadData payload, bool compressed)
|
||||||
{
|
{
|
||||||
Fin = fin;
|
Fin = fin;
|
||||||
Rsv1 = isData (opcode) && compressed ? Rsv.ON : Rsv.OFF;
|
Rsv1 = isData (opcode) && compressed ? Rsv.On : Rsv.Off;
|
||||||
Rsv2 = Rsv.OFF;
|
Rsv2 = Rsv.Off;
|
||||||
Rsv3 = Rsv.OFF;
|
Rsv3 = Rsv.Off;
|
||||||
Opcode = opcode;
|
Opcode = opcode;
|
||||||
Mask = mask;
|
Mask = mask;
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ namespace WebSocketSharp
|
|||||||
|
|
||||||
internal bool IsCompressed {
|
internal bool IsCompressed {
|
||||||
get {
|
get {
|
||||||
return Rsv1 == Rsv.ON;
|
return Rsv1 == Rsv.On;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ namespace WebSocketSharp
|
|||||||
internal bool IsPerMessageCompressed {
|
internal bool IsPerMessageCompressed {
|
||||||
get {
|
get {
|
||||||
var opcode = Opcode;
|
var opcode = Opcode;
|
||||||
return (opcode == Opcode.BINARY || opcode == Opcode.TEXT) && Rsv1 == Rsv.ON;
|
return (opcode == Opcode.BINARY || opcode == Opcode.TEXT) && Rsv1 == Rsv.On;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,11 +377,11 @@ namespace WebSocketSharp
|
|||||||
// FIN
|
// FIN
|
||||||
var fin = (header [0] & 0x80) == 0x80 ? Fin.Final : Fin.More;
|
var fin = (header [0] & 0x80) == 0x80 ? Fin.Final : Fin.More;
|
||||||
// RSV1
|
// RSV1
|
||||||
var rsv1 = (header [0] & 0x40) == 0x40 ? Rsv.ON : Rsv.OFF;
|
var rsv1 = (header [0] & 0x40) == 0x40 ? Rsv.On : Rsv.Off;
|
||||||
// RSV2
|
// RSV2
|
||||||
var rsv2 = (header [0] & 0x20) == 0x20 ? Rsv.ON : Rsv.OFF;
|
var rsv2 = (header [0] & 0x20) == 0x20 ? Rsv.On : Rsv.Off;
|
||||||
// RSV3
|
// RSV3
|
||||||
var rsv3 = (header [0] & 0x10) == 0x10 ? Rsv.ON : Rsv.OFF;
|
var rsv3 = (header [0] & 0x10) == 0x10 ? Rsv.On : Rsv.Off;
|
||||||
// Opcode
|
// Opcode
|
||||||
var opcode = (Opcode) (header [0] & 0x0f);
|
var opcode = (Opcode) (header [0] & 0x0f);
|
||||||
// MASK
|
// MASK
|
||||||
@ -392,7 +392,7 @@ namespace WebSocketSharp
|
|||||||
// Check if correct frame.
|
// Check if correct frame.
|
||||||
var incorrect = isControl (opcode) && fin == Fin.More
|
var incorrect = isControl (opcode) && fin == Fin.More
|
||||||
? "A control frame is fragmented."
|
? "A control frame is fragmented."
|
||||||
: !isData (opcode) && rsv1 == Rsv.ON
|
: !isData (opcode) && rsv1 == Rsv.On
|
||||||
? "A non data frame is compressed."
|
? "A non data frame is compressed."
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user