test_class.declarator: pktSerialized = new byte[] { 0x45, 0x20,
              0x00, 0x34, 0x1d, (byte) 0x85, 0x00, 0x00, 0x32, 0x06,
              0x31, 0x1e, 0x4a, 0x7d, 0x2d, 0x6d, (byte) 0xc0, (byte) 0xa8,
              0x01, 0x6f, 0x03, (byte) 0xe1, (byte) 0xc0, 0x32, (byte) 0xe3, (byte) 0xad,
              (byte) 0xee, (byte) 0x88, (byte) 0xb7, (byte) 0xda, (byte) 0xd8, 0x24, (byte) 0x80, 0x10,
              0x01, 0x0b, 0x59, 0x33, 0x00, 0x00, 0x01, 0x01,
              0x08, 0x0a, 0x20, (byte) 0x9a, 0x41, 0x04, 0x07, 0x76,
              0x53, 0x1f}
test_class.modifier: private
test_class.original_string: private byte[] pktSerialized = new byte[] { 0x45, 0x20,
              0x00, 0x34, 0x1d, (byte) 0x85, 0x00, 0x00, 0x32, 0x06,
              0x31, 0x1e, 0x4a, 0x7d, 0x2d, 0x6d, (byte) 0xc0, (byte) 0xa8,
              0x01, 0x6f, 0x03, (byte) 0xe1, (byte) 0xc0, 0x32, (byte) 0xe3, (byte) 0xad,
              (byte) 0xee, (byte) 0x88, (byte) 0xb7, (byte) 0xda, (byte) 0xd8, 0x24, (byte) 0x80, 0x10,
              0x01, 0x0b, 0x59, 0x33, 0x00, 0x00, 0x01, 0x01,
              0x08, 0x0a, 0x20, (byte) 0x9a, 0x41, 0x04, 0x07, 0x76,
              0x53, 0x1f};
test_class.type: byte[]
test_class.var_name: pktSerialized
test_class.file: src/agents/apps/floodlight/floodlight-1.0/src/test/java/net/floodlightcontroller/packet/TCPTest.java
test_class.identifier: TCPTest
test_case.body: @Test
      public void testSerialize() {
          IPacket packet = new IPv4()
          .setDiffServ((byte) 0x20)
          .setIdentification((short) 0x1d85)
          .setFlags((byte) 0x00)
          .setTtl((byte) 50)
          .setSourceAddress("74.125.45.109")
          .setDestinationAddress("192.168.1.111")
          .setPayload(new TCP()
                          .setSourcePort(993)
                          .setDestinationPort(49202)
                          .setSequence(0xe3adee88)
                          .setAcknowledge(0xb7dad824)
                          .setDataOffset((byte) 8)
                          .setFlags((short) 0x10)
                          .setWindowSize((short) 267)
                          .setOptions(new byte[] {0x01, 0x01, 0x08, 0x0a, 0x20, (byte) 0x9a,
                                                  0x41, 0x04, 0x07, 0x76, 0x53, 0x1f})
                          .setPayload(null)
                     );
          byte[] actual = packet.serialize();
          assertTrue(Arrays.equals(pktSerialized, actual));
      }
test_case.class_method_signature: TCPTest.testSerialize()
test_case.full_signature: @Test public void testSerialize()
test_case.identifier: testSerialize
test_case.invocations: setPayload setDestinationAddress setSourceAddress setTtl setFlags setIdentification setDiffServ setPayload setOptions setWindowSize setFlags setDataOffset setAcknowledge setSequence setDestinationPort setSourcePort serialize assertTrue equals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSerialize()
focal_class.declarator: sourcePort
focal_class.modifier: protected
focal_class.original_string: protected TransportPort sourcePort;
focal_class.type: TransportPort
focal_class.var_name: sourcePort
focal_class.declarator: destinationPort
focal_class.modifier: protected
focal_class.original_string: protected TransportPort destinationPort;
focal_class.type: TransportPort
focal_class.var_name: destinationPort
focal_class.declarator: sequence
focal_class.modifier: protected
focal_class.original_string: protected int sequence;
focal_class.type: int
focal_class.var_name: sequence
focal_class.declarator: acknowledge
focal_class.modifier: protected
focal_class.original_string: protected int acknowledge;
focal_class.type: int
focal_class.var_name: acknowledge
focal_class.declarator: dataOffset
focal_class.modifier: protected
focal_class.original_string: protected byte dataOffset;
focal_class.type: byte
focal_class.var_name: dataOffset
focal_class.declarator: flags
focal_class.modifier: protected
focal_class.original_string: protected short flags;
focal_class.type: short
focal_class.var_name: flags
focal_class.declarator: windowSize
focal_class.modifier: protected
focal_class.original_string: protected short windowSize;
focal_class.type: short
focal_class.var_name: windowSize
focal_class.declarator: checksum
focal_class.modifier: protected
focal_class.original_string: protected short checksum;
focal_class.type: short
focal_class.var_name: checksum
focal_class.declarator: urgentPointer
focal_class.modifier: protected
focal_class.original_string: protected short urgentPointer;
focal_class.type: short
focal_class.var_name: urgentPointer
focal_class.declarator: options
focal_class.modifier: protected
focal_class.original_string: protected byte[] options;
focal_class.type: byte[]
focal_class.var_name: options
focal_class.file: src/agents/apps/floodlight/floodlight-1.0/src/main/java/net/floodlightcontroller/packet/TCP.java
focal_class.identifier: TCP
focal_class.class_method_signature: TCP.getSourcePort()
focal_class.full_signature: public TransportPort getSourcePort()
focal_class.identifier: getSourcePort
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: TransportPort
focal_class.signature: TransportPort getSourcePort()
focal_class.class_method_signature: TCP.setSourcePort(TransportPort sourcePort)
focal_class.full_signature: public TCP setSourcePort(TransportPort sourcePort)
focal_class.identifier: setSourcePort
focal_class.modifiers: public
focal_class.parameters: (TransportPort sourcePort)
focal_class.return: TCP
focal_class.signature: TCP setSourcePort(TransportPort sourcePort)
focal_class.class_method_signature: TCP.setSourcePort(int sourcePort)
focal_class.full_signature: public TCP setSourcePort(int sourcePort)
focal_class.identifier: setSourcePort
focal_class.modifiers: public
focal_class.parameters: (int sourcePort)
focal_class.return: TCP
focal_class.signature: TCP setSourcePort(int sourcePort)
focal_class.class_method_signature: TCP.getDestinationPort()
focal_class.full_signature: public TransportPort getDestinationPort()
focal_class.identifier: getDestinationPort
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: TransportPort
focal_class.signature: TransportPort getDestinationPort()
focal_class.class_method_signature: TCP.setDestinationPort(TransportPort destinationPort)
focal_class.full_signature: public TCP setDestinationPort(TransportPort destinationPort)
focal_class.identifier: setDestinationPort
focal_class.modifiers: public
focal_class.parameters: (TransportPort destinationPort)
focal_class.return: TCP
focal_class.signature: TCP setDestinationPort(TransportPort destinationPort)
focal_class.class_method_signature: TCP.setDestinationPort(int destinationPort)
focal_class.full_signature: public TCP setDestinationPort(int destinationPort)
focal_class.identifier: setDestinationPort
focal_class.modifiers: public
focal_class.parameters: (int destinationPort)
focal_class.return: TCP
focal_class.signature: TCP setDestinationPort(int destinationPort)
focal_class.class_method_signature: TCP.getChecksum()
focal_class.full_signature: public short getChecksum()
focal_class.identifier: getChecksum
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: short
focal_class.signature: short getChecksum()
focal_class.class_method_signature: TCP.getSequence()
focal_class.full_signature: public int getSequence()
focal_class.identifier: getSequence
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getSequence()
focal_class.class_method_signature: TCP.setSequence(int seq)
focal_class.full_signature: public TCP setSequence(int seq)
focal_class.identifier: setSequence
focal_class.modifiers: public
focal_class.parameters: (int seq)
focal_class.return: TCP
focal_class.signature: TCP setSequence(int seq)
focal_class.class_method_signature: TCP.getAcknowledge()
focal_class.full_signature: public int getAcknowledge()
focal_class.identifier: getAcknowledge
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getAcknowledge()
focal_class.class_method_signature: TCP.setAcknowledge(int ack)
focal_class.full_signature: public TCP setAcknowledge(int ack)
focal_class.identifier: setAcknowledge
focal_class.modifiers: public
focal_class.parameters: (int ack)
focal_class.return: TCP
focal_class.signature: TCP setAcknowledge(int ack)
focal_class.class_method_signature: TCP.getDataOffset()
focal_class.full_signature: public byte getDataOffset()
focal_class.identifier: getDataOffset
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: byte
focal_class.signature: byte getDataOffset()
focal_class.class_method_signature: TCP.setDataOffset(byte offset)
focal_class.full_signature: public TCP setDataOffset(byte offset)
focal_class.identifier: setDataOffset
focal_class.modifiers: public
focal_class.parameters: (byte offset)
focal_class.return: TCP
focal_class.signature: TCP setDataOffset(byte offset)
focal_class.class_method_signature: TCP.getFlags()
focal_class.full_signature: public short getFlags()
focal_class.identifier: getFlags
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: short
focal_class.signature: short getFlags()
focal_class.class_method_signature: TCP.setFlags(short flags)
focal_class.full_signature: public TCP setFlags(short flags)
focal_class.identifier: setFlags
focal_class.modifiers: public
focal_class.parameters: (short flags)
focal_class.return: TCP
focal_class.signature: TCP setFlags(short flags)
focal_class.class_method_signature: TCP.getWindowSize()
focal_class.full_signature: public short getWindowSize()
focal_class.identifier: getWindowSize
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: short
focal_class.signature: short getWindowSize()
focal_class.class_method_signature: TCP.setWindowSize(short windowSize)
focal_class.full_signature: public TCP setWindowSize(short windowSize)
focal_class.identifier: setWindowSize
focal_class.modifiers: public
focal_class.parameters: (short windowSize)
focal_class.return: TCP
focal_class.signature: TCP setWindowSize(short windowSize)
focal_class.class_method_signature: TCP.getTcpChecksum()
focal_class.full_signature: public short getTcpChecksum()
focal_class.identifier: getTcpChecksum
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: short
focal_class.signature: short getTcpChecksum()
focal_class.class_method_signature: TCP.setTcpChecksum(short checksum)
focal_class.full_signature: public TCP setTcpChecksum(short checksum)
focal_class.identifier: setTcpChecksum
focal_class.modifiers: public
focal_class.parameters: (short checksum)
focal_class.return: TCP
focal_class.signature: TCP setTcpChecksum(short checksum)
focal_class.class_method_signature: TCP.resetChecksum()
focal_class.full_signature: @Override public void resetChecksum()
focal_class.identifier: resetChecksum
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void resetChecksum()
focal_class.class_method_signature: TCP.getUrgentPointer(short urgentPointer)
focal_class.full_signature: public short getUrgentPointer(short urgentPointer)
focal_class.identifier: getUrgentPointer
focal_class.modifiers: public
focal_class.parameters: (short urgentPointer)
focal_class.return: short
focal_class.signature: short getUrgentPointer(short urgentPointer)
focal_class.class_method_signature: TCP.setUrgentPointer(short urgentPointer)
focal_class.full_signature: public TCP setUrgentPointer(short urgentPointer)
focal_class.identifier: setUrgentPointer
focal_class.modifiers: public
focal_class.parameters: (short urgentPointer)
focal_class.return: TCP
focal_class.signature: TCP setUrgentPointer(short urgentPointer)
focal_class.class_method_signature: TCP.getOptions()
focal_class.full_signature: public byte[] getOptions()
focal_class.identifier: getOptions
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: byte[]
focal_class.signature: byte[] getOptions()
focal_class.class_method_signature: TCP.setOptions(byte[] options)
focal_class.full_signature: public TCP setOptions(byte[] options)
focal_class.identifier: setOptions
focal_class.modifiers: public
focal_class.parameters: (byte[] options)
focal_class.return: TCP
focal_class.signature: TCP setOptions(byte[] options)
focal_class.class_method_signature: TCP.setChecksum(short checksum)
focal_class.full_signature: public TCP setChecksum(short checksum)
focal_class.identifier: setChecksum
focal_class.modifiers: public
focal_class.parameters: (short checksum)
focal_class.return: TCP
focal_class.signature: TCP setChecksum(short checksum)
focal_class.class_method_signature: TCP.serialize()
focal_class.full_signature: public byte[] serialize()
focal_class.identifier: serialize
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: byte[]
focal_class.signature: byte[] serialize()
focal_class.class_method_signature: TCP.hashCode()
focal_class.full_signature: @Override public int hashCode()
focal_class.identifier: hashCode
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int hashCode()
focal_class.class_method_signature: TCP.equals(Object obj)
focal_class.full_signature: @Override public boolean equals(Object obj)
focal_class.identifier: equals
focal_class.modifiers: @Override public
focal_class.parameters: (Object obj)
focal_class.return: boolean
focal_class.signature: boolean equals(Object obj)
focal_class.class_method_signature: TCP.deserialize(byte[] data, int offset, int length)
focal_class.full_signature: @Override public IPacket deserialize(byte[] data, int offset, int length)
focal_class.identifier: deserialize
focal_class.modifiers: @Override public
focal_class.parameters: (byte[] data, int offset, int length)
focal_class.return: IPacket
focal_class.signature: IPacket deserialize(byte[] data, int offset, int length)
focal_class.superclass: extends BasePacket
focal_method.body: public byte[] serialize() {
          int length;
          if (dataOffset == 0)
              dataOffset = 5;  // default header length
          length = dataOffset << 2;
          byte[] payloadData = null;
          if (payload != null) {
              payload.setParent(this);
              payloadData = payload.serialize();
              length += payloadData.length;
          }
  
          byte[] data = new byte[length];
          ByteBuffer bb = ByteBuffer.wrap(data);
  
          bb.putShort((short)this.sourcePort.getPort()); //TCP ports are defined to be 16 bits
          bb.putShort((short)this.destinationPort.getPort());
          bb.putInt(this.sequence);
          bb.putInt(this.acknowledge);
          bb.putShort((short) (this.flags | (dataOffset << 12)));
          bb.putShort(this.windowSize);
          bb.putShort(this.checksum);
          bb.putShort(this.urgentPointer);
          if (dataOffset > 5) {
              int padding;
              bb.put(options);
              padding = (dataOffset << 2) - 20 - options.length;
              for (int i = 0; i < padding; i++)
                  bb.put((byte) 0);
          }
          if (payloadData != null)
              bb.put(payloadData);
  
          if (this.parent != null && this.parent instanceof IPv4)
              ((IPv4)this.parent).setProtocol(IpProtocol.TCP);
  
          // compute checksum if needed
          if (this.checksum == 0) {
              bb.rewind();
              int accumulation = 0;
  
              // compute pseudo header mac
              if (this.parent != null && this.parent instanceof IPv4) {
                  IPv4 ipv4 = (IPv4) this.parent;
                  accumulation += ((ipv4.getSourceAddress().getInt() >> 16) & 0xffff)
                          + (ipv4.getSourceAddress().getInt() & 0xffff);
                  accumulation += ((ipv4.getDestinationAddress().getInt() >> 16) & 0xffff)
                          + (ipv4.getDestinationAddress().getInt() & 0xffff);
                  accumulation += ipv4.getProtocol().getIpProtocolNumber() & 0xff;
                  accumulation += length & 0xffff;
              }
  
              for (int i = 0; i < length / 2; ++i) {
                  accumulation += 0xffff & bb.getShort();
              }
              // pad to an even number of shorts
              if (length % 2 > 0) {
                  accumulation += (bb.get() & 0xff) << 8;
              }
  
              accumulation = ((accumulation >> 16) & 0xffff)
                      + (accumulation & 0xffff);
              this.checksum = (short) (~accumulation & 0xffff);
              bb.putShort(16, this.checksum);
          }
          return data;
      }
focal_method.class_method_signature: TCP.serialize()
focal_method.full_signature: public byte[] serialize()
focal_method.identifier: serialize
focal_method.invocations: setParent serialize wrap putShort getPort putShort getPort putInt putInt putShort putShort putShort putShort put put put setProtocol rewind getInt getSourceAddress getInt getSourceAddress getInt getDestinationAddress getInt getDestinationAddress getIpProtocolNumber getProtocol getShort get putShort
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: byte[]
focal_method.signature: byte[] serialize()