Upgrade ietf-{inet,yang}-types to 2013-07-15
[bgpcep.git] / bgp / bmp-impl / src / main / java / org / opendaylight / protocol / bmp / impl / BmpMessageHeaderDecoder.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.protocol.bmp.impl;
10
11 import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
12
13 public class BmpMessageHeaderDecoder extends LengthFieldBasedFrameDecoder {
14
15     private static final int MAX_FRAME_SIZE = 65535;
16
17     private static final int VERSION_SIZE = 1;
18
19     private static final int LENGTH_SIZE = 4;
20
21     /*
22
23     0 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
24     +-+-+-+-+-+-+-+-+
25     |    Version    |
26     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
27     |                        Message Length                         |
28     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
29     |   Msg. Type   |
30     +---------------+
31
32     */
33
34     public BmpMessageHeaderDecoder() {
35         super(MAX_FRAME_SIZE, VERSION_SIZE, LENGTH_SIZE, -VERSION_SIZE - LENGTH_SIZE, 0);
36     }
37 }