Parses a chunk of inbound data into discrete transmissions.  The
headers for these transmissions are decoded and the payload data
is dispatched to the appropriate method for processing.
@param transmissionData A chunk of transmission data to be parsed.
548846
public void parse(WsByteBuffer transmissionData)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parse", transmissionData);
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, transmissionData, "transmissionBuffer");

      needMoreData = false;
      boolean encounteredError = false;

      while(!needMoreData && !encounteredError)
      {
         switch(state)
         {
            case(STATE_PARSING_PRIMARY_HEADER):
               parsePrimaryHeader(transmissionData);
               break;
            case(STATE_PARSING_CONVERSATION_HEADER):
               parseConversationHeader(transmissionData);
               break;
            case(STATE_PARSING_SEGMENT_START_HEADER):
               parseSegmentStartHeader(transmissionData);
               break;
            case(STATE_PARSING_PRIMARY_ONLY_PAYLOAD):
               parsePrimaryOnlyPayload(transmissionData);
               break;
            case(STATE_PARSE_CONVERSATION_PAYLOAD):
               parseConversationPayload(transmissionData);
               break;
            case(STATE_PARSE_SEGMENT_START_PAYLOAD):
               parseSegmentStartPayload(transmissionData);
               break;
            case(STATE_PARSE_SEGMENT_MIDDLE_PAYLOAD):
               parseSegmentMiddlePayload(transmissionData);
               break;
            case(STATE_PARSE_SEGMENT_END_PAYLOAD):
               parseSegmentEndPayload(transmissionData);
               break;
            case(STATE_ERROR):
               encounteredError = true;
               break;
            default:
               if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "got into default branch of parse() method case statement");
               throwable = new SIErrorException("Should not have entered default branch of parse() method case statement");
               FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSE_01);
               state = STATE_ERROR;
               break;
         }
      }

      if (encounteredError)
      {
         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "encountered error parsing");
         if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, throwable);
         connection.invalidate(false, throwable, "parse error while parsing transmission");  // D224570
      }
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parse");
   }
243920
private static void onDataRead(ChannelHandlerContext ctx, Http2DataFrame data) throws Exception {
        if (data.isEndStream()) {
            sendResponse(ctx, data.content());
        } else {
            // We do not send back the response to the remote-peer, so we need to release it.
            data.release();
        }
    }
416960
@Override
  protected void channelRead0(final ChannelHandlerContext ctx, final HttpObject msg) throws Exception {
    if (msg instanceof HttpContent) {
      HttpContent content = (HttpContent) msg;
      decodeChunk((InetSocketAddress) ctx.channel().remoteAddress(), content.content());
    }
  }
1345869
@Override
    public void send(PayloadData payloadData) throws Exception {
        if (logger.isDebugEnabled()) {
            logger.debug(String.format("Tx : Ass=%s %s", this.getName(), payloadData));
        }

        NettySctpChannelInboundHandlerAdapter handler = checkSocketIsOpen();

        final ByteBuf byteBuf = payloadData.getByteBuf();
        if (this.ipChannelType == IpChannelType.SCTP) {
            SctpMessage sctpMessage = new SctpMessage(payloadData.getPayloadProtocolId(), payloadData.getStreamNumber(),
                    payloadData.isUnordered(), byteBuf);
            handler.writeAndFlush(sctpMessage);
        } else {
            handler.writeAndFlush(byteBuf);
        }
    }
257906
private void send(ByteBuffer data) {
    try {
      this.socket.send(new DatagramPacket(
              data.array(),
              data.capacity(),
              this.address));
    } catch (IOException ioe) {
      logger.info("Error sending datagram packet to tracker at {}: {}.", this.address, ioe.getMessage());
    }
  }
452550
private void handleSendDataRequest(SerialMessage incomingMessage) {
		logger.trace("Handle Message Send Data Request");
		
		int callbackId = incomingMessage.getMessagePayloadByte(0);
		TransmissionState status = TransmissionState.getTransmissionState(incomingMessage.getMessagePayloadByte(1));
		SerialMessage originalMessage = this.lastSentMessage;
		
		if (status == null) {
			logger.warn("Transmission state not found, ignoring.");
			return;
		}

		logger.debug("CallBack ID = {}", callbackId);
		logger.debug(String.format("Status = %s (0x%02x)", status.getLabel(), status.getKey()));
		
		if (originalMessage == null || originalMessage.getCallbackId() != callbackId) {
			logger.warn("Already processed another send data request for this callback Id, ignoring.");
			return;
		}
		
		switch (status) {
			case COMPLETE_OK:
				ZWaveNode node = this.getNode(originalMessage.getMessageNode());
				node.resetResendCount();
				
				// in case we received a ping response and the node is alive, we proceed with the next node stage for this node.
				if (node != null && node.getNodeStage() == NodeStage.NODEBUILDINFO_PING) {
					node.advanceNodeStage();
				}
				if (incomingMessage.getMessageClass() == originalMessage.getExpectedReply() && !incomingMessage.isTransActionCanceled()) {
					notifyEventListeners(new ZWaveEvent(ZWaveEventType.TRANSACTION_COMPLETED_EVENT, this.lastSentMessage.getMessageNode(), 1, this.lastSentMessage));
					transactionCompleted.release();
					logger.trace("Released. Transaction completed permit count -> {}", transactionCompleted.availablePermits());
				}
				return;
			case COMPLETE_NO_ACK:
			case COMPLETE_FAIL:
			case COMPLETE_NOT_IDLE:
			case COMPLETE_NOROUTE:
				try {
					handleFailedSendDataRequest(originalMessage);
				} finally {
					transactionCompleted.release();
					logger.trace("Released. Transaction completed permit count -> {}", transactionCompleted.availablePermits());
				}
			default:
		}
	}
343906
@Override
    public <T> T readDataAsObject() throws IOException {
        Data data = readData();
        return data == null ? null : (T) serializationService.toObject(data);
    }
157709
private void onDataRead(int streamId, ByteBuf data, int padding, boolean endOfStream) {
    flowControlPing().onDataRead(data.readableBytes(), padding);
    NettyClientStream.TransportState stream = clientStream(requireHttp2Stream(streamId));
    stream.transportDataReceived(data, endOfStream);
    if (keepAliveManager != null) {
      keepAliveManager.onDataReceived();
    }
  }
916383
@Override
	public void setData(final byte[] data, final int offset)
	{
		if (offset < 0 || offset > data.length)
			throw new KNXIllegalArgumentException("illegal offset " + offset);
		toDPT(data, offset);
	}
539093
protected synchronized void do_send(final OtpOutputStream header,
            final OtpOutputStream payload) throws IOException {
        try {
            if (traceLevel >= sendThreshold) {
                // Need to decode header and output buffer to show trace
                // message!
                // First make OtpInputStream, then decode.
                try {
                    final OtpErlangObject h = header.getOtpInputStream(5)
                            .read_any();
                    System.out.println("-> " + headerType(h) + " " + h);

                    OtpErlangObject o = payload.getOtpInputStream(0).read_any();
                    System.out.println("   " + o);
                    o = null;
                } catch (final OtpErlangDecodeException e) {
                    System.out.println("   " + "can't decode output buffer:"
                            + e);
                }
            }

            // group flush op in favour of possible ssh-tunneled stream
            OutputStream out = socket.getOutputStream();
            header.writeTo(out);
            payload.writeTo(out);
            out.flush();
        } catch (final IOException e) {
            close();
            throw e;
        }
    }
108969
public void sendData(InputStream in) throws ResponseException {
        if(con.isClosed()) return;

        Socket socket = null;
        try {
            socket = conHandler.createDataSocket();
            dataConnections.add(socket);
            OutputStream out = socket.getOutputStream();

            byte[] buffer = new byte[bufferSize];
            int len;
            while((len = in.read(buffer)) != -1) {
                Utils.write(out, buffer, len, conHandler.isAsciiMode());
                bytesTransferred += len;
            }

            out.flush();
            Utils.closeQuietly(out);
            Utils.closeQuietly(in);
            Utils.closeQuietly(socket);
        } catch(SocketException ex) {
            throw new ResponseException(426, "Transfer aborted");
        } catch(IOException ex) {
            throw new ResponseException(425, "An error occurred while transferring the data");
        } finally {
            onUpdate();
            if(socket != null) dataConnections.remove(socket);
        }
    }
858995
private void setRingbufferData(
            RingbufferMergeData fromMergeData,
            RingbufferContainer<Object, Object> toContainer) {
        boolean storeEnabled = toContainer.getStore().isEnabled();
        Data[] storeItems = storeEnabled ? new Data[fromMergeData.size()] : null;

        toContainer.setHeadSequence(fromMergeData.getHeadSequence());
        toContainer.setTailSequence(fromMergeData.getTailSequence());

        for (long seq = fromMergeData.getHeadSequence(); seq <= fromMergeData.getTailSequence(); seq++) {
            final Object resultValue = fromMergeData.read(seq);
            toContainer.set(seq, resultValue);
            if (storeEnabled) {
                storeItems[(int) (seq - fromMergeData.getHeadSequence())] = serializationService.toData(resultValue);
            }
        }
        if (storeEnabled) {
            toContainer.getStore()
                    .storeAll(fromMergeData.getHeadSequence(), storeItems);
        }
    }
845094
@Override
  public T decode(final byte[] data) {
    final WakeTuplePBuf tuple;
    try {
      tuple = WakeTuplePBuf.parseFrom(data);
    } catch (final InvalidProtocolBufferException e) {
      e.printStackTrace();
      throw new RemoteRuntimeException(e);
    }

    final String className = tuple.getClassName();
    final byte[] message = tuple.getData().toByteArray();
    final Class<?> clazz;
    try {
      clazz = Class.forName(className);
    } catch (final ClassNotFoundException e) {
      e.printStackTrace();
      throw new RemoteRuntimeException(e);
    }
    return clazzToDecoderMap.get(clazz).decode(message);
  }
1260009
private void pack(String data) {
        byte[] bytes = data.getBytes(Constants.UTF8);
        buffer.put(getLengthDescriptor(bytes.length));
        buffer.put(bytes);
    }
14372
public void decode(ByteBuffer buffer, boolean moreData) throws HpackException {
        while (buffer.hasRemaining()) {
            int originalPos = buffer.position();
            byte b = buffer.get();
            if ((b & 0b10000000) != 0) {
                first = false;
                //if the first bit is set it is an indexed header field
                buffer.position(buffer.position() - 1); //unget the byte
                int index = Hpack.decodeInteger(buffer, 7); //prefix is 7
                if (index == -1) {
                    if(!moreData) {
                        throw UndertowMessages.MESSAGES.hpackFailed();
                    }
                    buffer.position(originalPos);
                    return;
                } else if(index == 0) {
                    throw UndertowMessages.MESSAGES.zeroNotValidHeaderTableIndex();
                }
                handleIndex(index);
            } else if ((b & 0b01000000) != 0) {
                first = false;
                //Literal Header Field with Incremental Indexing
                HttpString headerName = readHeaderName(buffer, 6);
                if (headerName == null) {
                    if(!moreData) {
                        throw UndertowMessages.MESSAGES.hpackFailed();
                    }
                    buffer.position(originalPos);
                    return;
                }
                String headerValue = readHpackString(buffer);
                if (headerValue == null) {
                    if(!moreData) {
                        throw UndertowMessages.MESSAGES.hpackFailed();
                    }
                    buffer.position(originalPos);
                    return;
                }
                headerEmitter.emitHeader(headerName, headerValue, false);
                addEntryToHeaderTable(new HeaderField(headerName, headerValue));
            } else if ((b & 0b11110000) == 0) {
                first = false;
                //Literal Header Field without Indexing
                HttpString headerName = readHeaderName(buffer, 4);
                if (headerName == null) {
                    if(!moreData) {
                        throw UndertowMessages.MESSAGES.hpackFailed();
                    }
                    buffer.position(originalPos);
                    return;
                }
                String headerValue = readHpackString(buffer);
                if (headerValue == null) {
                    if(!moreData) {
                        throw UndertowMessages.MESSAGES.hpackFailed();
                    }
                    buffer.position(originalPos);
                    return;
                }
                headerEmitter.emitHeader(headerName, headerValue, false);
            } else if ((b & 0b11110000) == 0b00010000) {
                first = false;
                //Literal Header Field never indexed
                HttpString headerName = readHeaderName(buffer, 4);
                if (headerName == null) {
                    buffer.position(originalPos);
                    return;
                }
                String headerValue = readHpackString(buffer);
                if (headerValue == null) {
                    if(!moreData) {
                        throw UndertowMessages.MESSAGES.hpackFailed();
                    }
                    buffer.position(originalPos);
                    return;
                }
                headerEmitter.emitHeader(headerName, headerValue, true);
            } else if ((b & 0b11100000) == 0b00100000) {
                if(!first) {
                    throw new HpackException();
                }
                //context update max table size change
                if (!handleMaxMemorySizeChange(buffer, originalPos)) {
                    return;
                }
            } else {
                throw UndertowMessages.MESSAGES.invalidHpackEncoding(b);
            }
        }
        if(!moreData) {
            first = true;
        }
    }
923231
@Override
    public void inValidStreamId(org.mobicents.protocols.api.PayloadData payloadData) {
        logger.error(String
                .format("Tx : PayloadData with streamNumber=%d which is greater than or equal to maxSequenceNumber=%d. Droping PayloadData=%s",
                        payloadData.getStreamNumber(), this.maxOutboundStreams, payloadData));
    }
1177844
public void setNodeData(byte[] nodeData)
    {
        this.nodeData = (nodeData != null) ? Arrays.copyOf(nodeData, nodeData.length) : null;
    }