Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) [2021] [Peking University]
* [BDWare DOIP SDK] is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
package org.bdware.dogp.codec;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageCodec;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bdware.doip.codec.exception.MessageCodecException;
import java.util.List;
// USED In Address System
// Handle Request opcode = 1; Response opcode = 2, filled with dest(ip: port, 6bytes, big endian)
// USED In Client And Server n77
public class DOGPMessageCodec extends ByteToMessageCodec {
static Logger LOGGER = LogManager.getLogger(DOGPMessageCodec.class);
@Override
protected void encode(ChannelHandlerContext ctx, DOGPMessage msg, ByteBuf out) throws Exception {
dogpMsgToBytes(msg, out);
}
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List