Package com.fineqt.fpb.lib.api.util

Examples of com.fineqt.fpb.lib.api.util.EncodeException


          //计算Checksum
          byte[] checksum = FpbUtils.internetChecksum(headerData);
          buffer.position(startOffset + CHECKSUM_FIELD_OFFSET);
          buffer.putByte(checksum);
        } catch (BitBufferException e) {
          throw new EncodeException(targetTypeMeta,
              MetaException.CODE.BIT_BUFFER_EXCEPTION_ERROR, e);
        }
        //恢复Position
        buffer.position(curPosition);
        return result;
View Full Code Here


          //计算Checksum
          byte[] checksum = FpbUtils.internetChecksum(pseudoBlock);
          buffer.position(startOffset + ICMP_CHECKSUM_FIELD_OFFSET);
          buffer.putByte(checksum);
        } catch (BitBufferException e) {
          throw new EncodeException(targetTypeMeta,
              MetaException.CODE.BIT_BUFFER_EXCEPTION_ERROR, e);
        }
        //恢复Position
        buffer.position(curPosition);
        return result;
View Full Code Here

      ByteBuffer byteBuffer = ByteBuffer.wrap(pseudoBlock);
      //取得上层IPV6协议的头部字段
      IRecordSetValue ipv6Header = (IRecordSetValue)cxt.getFieldStackMap().peekField(
          Ipv6TypeEVExtFactory.HEADER_FIELD);
      if (ipv6Header == null) {
        throw new EncodeException(targetTypeMeta,
            MetaException.CODE.FIELD_NOT_FOUND_IN_STACK_ERROR,
            Ipv6TypeEVExtFactory.HEADER_FIELD);
      }
      IOctetstringValue address;
      //Source Address
View Full Code Here

          //计算Checksum
          byte[] checksum = FpbUtils.internetChecksum(headerData);
          buffer.position(startOffset + CHECKSUM_FIELD_OFFSET);
          buffer.putByte(checksum);
        } catch (BitBufferException e) {
          throw new EncodeException(targetTypeMeta,
              MetaException.CODE.BIT_BUFFER_EXCEPTION_ERROR, e);
        }
        //回复Position
        buffer.position(curPosition);
        return result;
View Full Code Here

                Ipv6TypeEVExtFactory.HEADER_FIELD);
            if (ipHeader != null) {
              pseudoBlock = createV6PseudoHeader(cxt, (IContainerValue)value,
                  ipHeader, upperPrtlBytes, startOffset);
            } else {
              throw new EncodeException(targetTypeMeta,
                  MetaException.CODE.LOWER_LAYER_PROTOCOL_WRONG_ERROR,
                  "Ipv4Protocol or Ipv6Protocol");
            }
          }
          //计算Checksum
          byte[] checksum = FpbUtils.internetChecksum(pseudoBlock);
          if (isUdp) {
            buffer.position(startOffset + UDP_CHECKSUM_FIELD_OFFSET);
            //UDP的特殊处理0x0000->0xFFFF
            if (checksum[0] == 0 && checksum[1] == 0) {
              checksum[0] = (byte)0xFF;
              checksum[1] = (byte)0xFF;
            }
          } else {
            buffer.position(startOffset + TCP_CHECKSUM_FIELD_OFFSET);
          }
          buffer.putByte(checksum);
        } catch (BitBufferException e) {
          throw new EncodeException(targetTypeMeta,
              MetaException.CODE.BIT_BUFFER_EXCEPTION_ERROR, e);
        }
        //恢复Position
        buffer.position(curPosition);
        return result;
View Full Code Here

TOP

Related Classes of com.fineqt.fpb.lib.api.util.EncodeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.