summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Pattyn <pattyn.kurt@gmail.com>2013-08-07 23:50:27 +0200
committerKurt Pattyn <pattyn.kurt@gmail.com>2013-08-07 23:50:27 +0200
commit0eda9339735315ffb07daf505889416361ecbfc0 (patch)
tree6dde4d8861bf7e3e6299ff9c3f922b9f696b5166
parent98696b198f1698c10dab9319dab92b8844168c70 (diff)
downloadqtwebsockets-0eda9339735315ffb07daf505889416361ecbfc0.tar.gz
Added inline getCurrentVersion() method (to be used iso V_LATEST)
-rw-r--r--source/websocketprotocol.h32
1 files changed, 17 insertions, 15 deletions
diff --git a/source/websocketprotocol.h b/source/websocketprotocol.h
index 1f98f45..d7ace2e 100644
--- a/source/websocketprotocol.h
+++ b/source/websocketprotocol.h
@@ -80,7 +80,7 @@ namespace WebSocketProtocol
CC_TOO_MUCH_DATA = 1009, //Message too big
CC_MISSING_EXTENSION = 1010, //Mandatory extension missing
CC_BAD_OPERATION = 1011, //Internal server error
- CC_TLS_HANDSHAKE_FAILED = 1015 //TLS handshake failed
+ CC_TLS_HANDSHAKE_FAILED = 1015 //TLS handshake failed
};
enum OpCode
@@ -100,26 +100,28 @@ namespace WebSocketProtocol
OC_RESERVED_V = 0xC,
OC_RESERVED_D = 0xD,
OC_RESERVED_E = 0xE,
- OC_RESERVED_F = 0xF
+ OC_RESERVED_F = 0xF
};
- inline bool isOpCodeReserved(OpCode code)
- {
- return ((code > OC_BINARY) && (code < OC_CLOSE)) || (code > OC_PONG);
- }
- inline bool isCloseCodeValid(int closeCode)
- {
- return (closeCode > 999) && (closeCode < 5000) &&
- (closeCode != CC_RESERVED_1004) && //see RFC6455 7.4.1
- (closeCode != CC_MISSING_STATUS_CODE) &&
- (closeCode != CC_ABNORMAL_DISCONNECTION) &&
- ((closeCode >= 3000) || (closeCode < 1012));
- }
+ inline bool isOpCodeReserved(OpCode code)
+ {
+ return ((code > OC_BINARY) && (code < OC_CLOSE)) || (code > OC_PONG);
+ }
+ inline bool isCloseCodeValid(int closeCode)
+ {
+ return (closeCode > 999) && (closeCode < 5000) &&
+ (closeCode != CC_RESERVED_1004) && //see RFC6455 7.4.1
+ (closeCode != CC_MISSING_STATUS_CODE) &&
+ (closeCode != CC_ABNORMAL_DISCONNECTION) &&
+ ((closeCode >= 3000) || (closeCode < 1012));
+ }
- void mask(QByteArray *payload, quint32 maskingKey);
+ void mask(QByteArray *payload, quint32 maskingKey);
void mask(char *payload, quint64 size, quint32 maskingKey);
+ inline Version getCurrentVersion() { return V_LATEST; }
+
} //end namespace WebSocketProtocol
#endif // WEBSOCKETPROTOCOL_H