channel.pipeline().addLast(new DatagramDnsResponseDecoder()); channel.pipeline().addLast(new SimpleChannelInboundHandler<DnsResponse>() { @Override
@Override protected void decode(ChannelHandlerContext ctx, DatagramPacket packet, List<Object> out) throws Exception { final ByteBuf buf = packet.content(); final DnsResponse response = newResponse(packet, buf); boolean success = false; try { final int questionCount = buf.readUnsignedShort(); final int answerCount = buf.readUnsignedShort(); final int authorityRecordCount = buf.readUnsignedShort(); final int additionalRecordCount = buf.readUnsignedShort(); decodeQuestions(response, buf, questionCount); decodeRecords(response, DnsSection.ANSWER, buf, answerCount); decodeRecords(response, DnsSection.AUTHORITY, buf, authorityRecordCount); decodeRecords(response, DnsSection.ADDITIONAL, buf, additionalRecordCount); out.add(response); success = true; } finally { if (!success) { response.release(); } } }
@Override protected void decode(ChannelHandlerContext ctx, DatagramPacket packet, List<Object> out) throws Exception { final ByteBuf buf = packet.content(); final DnsResponse response = newResponse(packet, buf); boolean success = false; try { final int questionCount = buf.readUnsignedShort(); final int answerCount = buf.readUnsignedShort(); final int authorityRecordCount = buf.readUnsignedShort(); final int additionalRecordCount = buf.readUnsignedShort(); decodeQuestions(response, buf, questionCount); decodeRecords(response, DnsSection.ANSWER, buf, answerCount); decodeRecords(response, DnsSection.AUTHORITY, buf, authorityRecordCount); decodeRecords(response, DnsSection.ADDITIONAL, buf, additionalRecordCount); out.add(response); success = true; } finally { if (!success) { response.release(); } } }
private static final DatagramDnsResponseDecoder DECODER = new DatagramDnsResponseDecoder(); private static final DatagramDnsQueryEncoder ENCODER = new DatagramDnsQueryEncoder();
@Override protected void decode(ChannelHandlerContext ctx, DatagramPacket packet, List<Object> out) throws Exception { final ByteBuf buf = packet.content(); final DnsResponse response = newResponse(packet, buf); boolean success = false; try { final int questionCount = buf.readUnsignedShort(); final int answerCount = buf.readUnsignedShort(); final int authorityRecordCount = buf.readUnsignedShort(); final int additionalRecordCount = buf.readUnsignedShort(); decodeQuestions(response, buf, questionCount); decodeRecords(response, DnsSection.ANSWER, buf, answerCount); decodeRecords(response, DnsSection.AUTHORITY, buf, authorityRecordCount); decodeRecords(response, DnsSection.ADDITIONAL, buf, additionalRecordCount); out.add(response); success = true; } finally { if (!success) { response.release(); } } }
private static final DatagramDnsResponseDecoder DECODER = new DatagramDnsResponseDecoder(); private static final DatagramDnsQueryEncoder ENCODER = new DatagramDnsQueryEncoder();
@Override protected void decode(ChannelHandlerContext ctx, DatagramPacket packet, List<Object> out) throws Exception { final ByteBuf buf = packet.content(); final DnsResponse response = newResponse(packet, buf); boolean success = false; try { final int questionCount = buf.readUnsignedShort(); final int answerCount = buf.readUnsignedShort(); final int authorityRecordCount = buf.readUnsignedShort(); final int additionalRecordCount = buf.readUnsignedShort(); decodeQuestions(response, buf, questionCount); decodeRecords(response, DnsSection.ANSWER, buf, answerCount); decodeRecords(response, DnsSection.AUTHORITY, buf, authorityRecordCount); decodeRecords(response, DnsSection.ADDITIONAL, buf, additionalRecordCount); out.add(response); success = true; } finally { if (!success) { response.release(); } } }
channel.pipeline().addLast(new DatagramDnsResponseDecoder()); channel.pipeline().addLast(new SimpleChannelInboundHandler<DnsResponse>() { @Override
@Override protected void decode(ChannelHandlerContext ctx, DatagramPacket packet, List<Object> out) throws Exception { final ByteBuf buf = packet.content(); final DnsResponse response = newResponse(packet, buf); boolean success = false; try { final int questionCount = buf.readUnsignedShort(); final int answerCount = buf.readUnsignedShort(); final int authorityRecordCount = buf.readUnsignedShort(); final int additionalRecordCount = buf.readUnsignedShort(); decodeQuestions(response, buf, questionCount); decodeRecords(response, DnsSection.ANSWER, buf, answerCount); decodeRecords(response, DnsSection.AUTHORITY, buf, authorityRecordCount); decodeRecords(response, DnsSection.ADDITIONAL, buf, additionalRecordCount); out.add(response); success = true; } finally { if (!success) { response.release(); } } }
private static final DatagramDnsResponseDecoder DECODER = new DatagramDnsResponseDecoder(); private static final DatagramDnsQueryEncoder ENCODER = new DatagramDnsQueryEncoder();
private static final DatagramDnsResponseDecoder DECODER = new DatagramDnsResponseDecoder(); private static final DatagramDnsQueryEncoder ENCODER = new DatagramDnsQueryEncoder();