2 * Copyright (c) 2013 Cisco Systems, 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.protocol.framework;
11 * Interface for factory for parsing and serializing protocol specific messages. Needs to be implemented by a protocol
12 * specific message factory. The methods put/parse should delegate parsing to specific message parsers, e.g.
13 * OpenMessageParser etc.
15 public interface ProtocolMessageFactory {
18 * Parses message from byte array. Requires specific protocol message header object to parse the header.
20 * @param bytes byte array from which the message will be parsed
21 * @param msgHeader protocol specific message header to parse the header
22 * @return specific protocol message
23 * @throws DeserializerException if some parsing error occurs
24 * @throws DocumentedException if some documented error occurs
26 public ProtocolMessage parse(final byte[] bytes) throws DeserializerException, DocumentedException;
29 * Serializes protocol specific message to byte array.
31 * @param msg message to be serialized.
32 * @return byte array resulting message
34 public byte[] put(final ProtocolMessage msg);