2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.openflowjava.protocol.api.util;
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.opendaylight.yangtools.yang.common.Uint32;
12 import org.opendaylight.yangtools.yang.common.Uint8;
15 * Stores common constants.
17 * @author michal.polkorab
19 public interface EncodeConstants {
21 /** Default OF padding (in bytes). */
24 /** OpenFlow v1.0 wire protocol number. */
25 byte OF10_VERSION_ID = 0x01;
27 /** OpenFlow v1.0 wire protocol number as Uint8. */
28 @NonNull Uint8 OF_VERSION_1_0 = Uint8.valueOf(OF10_VERSION_ID);
30 /** OpenFlow v1.3 wire protocol number. */
31 byte OF13_VERSION_ID = 0x04;
33 /** OpenFlow v1.3 wire protocol number as Uint8. */
34 @NonNull Uint8 OF_VERSION_1_3 = Uint8.valueOf(OF13_VERSION_ID);
36 /** OpenFlow v1.4 wire protocol number. */
37 byte OF14_VERSION_ID = 0x05;
39 /** OpenFlow v1.4 wire protocol number as Uint8. */
40 @NonNull Uint8 OF_VERSION_1_4 = Uint8.valueOf(OF14_VERSION_ID);
42 /** OpenFlow v1.5 wire protocol number. */
43 byte OF15_VERSION_ID = 0x06;
45 /** OpenFlow v1.5 wire protocol number as Uint8. */
46 @NonNull Uint8 OF_VERSION_1_5 = Uint8.valueOf(OF15_VERSION_ID);
48 /** OpenFlow Hello message type value. */
49 byte OF_HELLO_MESSAGE_TYPE_VALUE = 0;
51 /** OpenFlow PacketIn message type value. */
52 byte OF_PACKETIN_MESSAGE_TYPE_VALUE = 10;
54 /** Index of length in Openflow header. */
55 int OFHEADER_LENGTH_INDEX = 2;
57 /** Size of Openflow header. */
58 int OFHEADER_SIZE = 8;
60 /** Zero length - used when the length is updated later. */
63 /** Length of mac address. */
64 byte MAC_ADDRESS_LENGTH = 6;
66 /** Number of groups in ipv4 address. */
67 byte GROUPS_IN_IPV4_ADDRESS = 4;
69 /** Number of groups in ipv6 address. */
70 byte GROUPS_IN_IPV6_ADDRESS = 8;
72 /** Length of ipv6 address in bytes. */
73 byte SIZE_OF_IPV6_ADDRESS_IN_BYTES = 8 * Short.SIZE / Byte.SIZE;
75 /** Length of 3 bytes. */
76 byte SIZE_OF_3_BYTES = 3;
78 /** Empty (zero) int value. */
81 /** Common experimenter value. */
82 int EXPERIMENTER_VALUE = 0xFFFF;
84 /** OF v1.0 maximal port name length. */
85 byte MAX_PORT_NAME_LENGTH = 16;
87 // ONF Approved Extensions Constants.
89 /** Experimenter ID of ONF approved extensions. */
90 Uint32 ONF_EXPERIMENTER_ID = Uint32.valueOf(0x4F4E4600).intern();
92 /** ONFOXM_ET_TCP_FLAGS value. */
93 int ONFOXM_ET_TCP_FLAGS = 42;