コード例 #1
0
ファイル: NetBiosSessionService.java プロジェクト: sjroot/lab
  public NetBiosSessionPacket parseRx(Buffer b) {
    NetBiosSessionHeader header = NetBiosSessionHeader.parse(b);
    NetBiosSessionData data = null;

    switch (header.getType()) {
      case PositiveSessionResponse: // positive session response
        data = SessionPositiveResponse.parse(b);
        break;
      case NegativeSessionResponse:
        data = SessionNegativeResponse.parse(b);
        break;
      case RetargetSessionResponse:
        data = SessionRetargetResponse.parse(b);
        break;
      case SessionKeepAlive:
        data = SessionKeepAlive.parse(b);
        break;
      case SessionMessage:
        data = SessionMessage.parse(b);
        break;
      case SessionReassembled:
        data = SessionReassembledData.parse(b);
        break;
      default:
        throw new IllegalStateException("invalid rx type: " + header.getType());
    }

    return new NetBiosSessionPacket(header, data);
  }
コード例 #2
0
ファイル: NetBiosSessionService.java プロジェクト: sjroot/lab
  public NetBiosSessionPacket parseTx(Buffer b) {
    NetBiosSessionHeader header = NetBiosSessionHeader.parse(b);
    NetBiosSessionData data = null;

    switch (header.getType()) {
      case SessionMessage:
        data = SessionMessage.parse(b);
        break;
      case SessionRequest:
        data = SessionRequest.parse(b);
        break;
      case SessionKeepAlive:
        data = SessionKeepAlive.parse(b);
        break;
      case SessionReassembled:
        data = SessionReassembledData.parse(b);
        break;
      default:
        throw new IllegalStateException("invalid tx type: " + header.getType());
    }

    return new NetBiosSessionPacket(header, data);
  }