View Javadoc
1   /*
2    * Copyright 2014 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  
17  package io.netty.handler.codec.haproxy;
18  
19  final class HAProxyConstants {
20  
21      /**
22       * Command byte constants
23       */
24      static final byte COMMAND_LOCAL_BYTE = 0x00;
25      static final byte COMMAND_PROXY_BYTE = 0x01;
26  
27      /**
28       * Version byte constants
29       */
30      static final byte VERSION_ONE_BYTE = 0x10;
31      static final byte VERSION_TWO_BYTE = 0x20;
32  
33      /**
34       * Transport protocol byte constants
35       */
36      static final byte TRANSPORT_UNSPEC_BYTE = 0x00;
37      static final byte TRANSPORT_STREAM_BYTE = 0x01;
38      static final byte TRANSPORT_DGRAM_BYTE = 0x02;
39  
40      /**
41       * Address family byte constants
42       */
43      static final byte AF_UNSPEC_BYTE = 0x00;
44      static final byte AF_IPV4_BYTE = 0x10;
45      static final byte AF_IPV6_BYTE = 0x20;
46      static final byte AF_UNIX_BYTE = 0x30;
47  
48      /**
49       * Transport protocol and address family byte constants
50       */
51      static final byte TPAF_UNKNOWN_BYTE = 0x00;
52      static final byte TPAF_TCP4_BYTE = 0x11;
53      static final byte TPAF_TCP6_BYTE = 0x21;
54      static final byte TPAF_UDP4_BYTE = 0x12;
55      static final byte TPAF_UDP6_BYTE = 0x22;
56      static final byte TPAF_UNIX_STREAM_BYTE = 0x31;
57      static final byte TPAF_UNIX_DGRAM_BYTE = 0x32;
58  
59      /**
60       * V2 protocol binary header prefix
61       */
62      static final byte[] BINARY_PREFIX = {
63              (byte) 0x0D,
64              (byte) 0x0A,
65              (byte) 0x0D,
66              (byte) 0x0A,
67              (byte) 0x00,
68              (byte) 0x0D,
69              (byte) 0x0A,
70              (byte) 0x51,
71              (byte) 0x55,
72              (byte) 0x49,
73              (byte) 0x54,
74              (byte) 0x0A
75      };
76  
77      static final byte[] TEXT_PREFIX = {
78              (byte) 'P',
79              (byte) 'R',
80              (byte) 'O',
81              (byte) 'X',
82              (byte) 'Y',
83      };
84  
85      private HAProxyConstants() { }
86  }