1 /**
2 * TLS Protocol Constants
3 * 
4 * Copyright:
5 * (C) 2004-2010,2015 Jack Lloyd
6 * (C) 2014-2015 Etienne Cimon
7 *
8 * License:
9 * Botan is released under the Simplified BSD License (see LICENSE.md)
10 */
11 module botan.tls.magic;
12 
13 import botan.constants;
14 static if (BOTAN_HAS_TLS):
15 package:
16 
17 /**
18 * Protocol Constants for TLS
19 */
20 alias SizeLimits = size_t;
21 enum : SizeLimits {
22     TLS_HEADER_SIZE     = 5,
23     DTLS_HEADER_SIZE    = TLS_HEADER_SIZE + 8,
24 
25     MAX_PLAINTEXT_SIZE  = 16*1024,
26     MAX_COMPRESSED_SIZE = MAX_PLAINTEXT_SIZE + 1024,
27     MAX_CIPHERTEXT_SIZE = MAX_COMPRESSED_SIZE + 1024,
28 }
29 
30 alias ConnectionSide = ubyte;
31 enum : ConnectionSide { CLIENT = 1, SERVER = 2 }
32 
33 alias RecordType = ubyte;
34 enum : RecordType {
35     NO_RECORD             = 0,
36     CHANGE_CIPHER_SPEC    = 20,
37     ALERT                 = 21,
38     HANDSHAKE             = 22,
39     APPLICATION_DATA      = 23,
40     HEARTBEAT             = 24
41 }
42 
43 alias HandshakeType = ubyte;
44 enum : HandshakeType {
45     HELLO_REQUEST         = 0,
46     CLIENT_HELLO          = 1,
47     SERVER_HELLO          = 2,
48     HELLO_VERIFY_REQUEST  = 3,
49     NEW_SESSION_TICKET    = 4, // RFC 5077
50     CERTIFICATE           = 11,
51     SERVER_KEX            = 12,
52     CERTIFICATE_REQUEST   = 13,
53     SERVER_HELLO_DONE     = 14,
54     CERTIFICATE_VERIFY    = 15,
55     CLIENT_KEX            = 16,
56     FINISHED              = 20,
57 
58     CERTIFICATE_URL       = 21,
59     CERTIFICATE_STATUS    = 22,
60 
61     CHANNEL_ID            = 203,
62     HANDSHAKE_CCS         = 254, // Not a wire value
63     HANDSHAKE_NONE        = 255  // Null value
64 }
65 
66 alias CompressionMethod = ubyte;
67 enum : CompressionMethod {
68     NO_COMPRESSION        = 0x00,
69     DEFLATE_COMPRESSION   = 0x01
70 }