2 * Copyright (c) 2014 Contextream, Inc. 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.lispflowmapping.lisp.serializer;
10 import java.nio.ByteBuffer;
12 import org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializer;
13 import org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializerContext;
14 import org.opendaylight.lispflowmapping.lisp.util.ByteUtil;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
17 public class EidRecordSerializer {
19 private static final EidRecordSerializer INSTANCE = new EidRecordSerializer();
21 // Private constructor prevents instantiation from other classes
22 private EidRecordSerializer() {
25 public static EidRecordSerializer getInstance() {
29 public Eid deserialize(ByteBuffer requestBuffer) {
30 /* byte reserved = */requestBuffer.get();
31 short maskLength = (short) (ByteUtil.getUnsignedByte(requestBuffer));
32 LispAddressSerializerContext ctx = new LispAddressSerializerContext(maskLength);
33 return LispAddressSerializer.getInstance().deserializeEid(requestBuffer, ctx);