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;
12 * Interface for factory for parsing and serializing protocol specific messages. Needs to be implemented by a protocol
13 * specific message factory. The methods put/parse should delegate parsing to specific message parsers, e.g.
14 * OpenMessageParser etc.
16 * @param <T> type of messages created by this factory
18 * @deprecated Interact with Netty 4.0 directly, by subclassing {@link io.netty.handler.codec.ByteToMessageCodec} or
22 public interface ProtocolMessageFactory<T> {
25 * Parses message from byte array. Requires specific protocol message header object to parse the header.
27 * @param bytes byte array from which the message will be parsed
28 * @return List of specific protocol messages
29 * @throws DeserializerException if some parsing error occurs
30 * @throws DocumentedException if some documented error occurs
32 T parse(byte[] bytes) throws DeserializerException, DocumentedException;
35 * Serializes protocol specific message to byte array.
37 * @param msg message to be serialized.
38 * @return byte array resulting message