use of com.exalttech.trex.packets.TrexUdpPacket in project trex-stateless-gui by cisco-system-traffic-generator.
the class UDPTest method getUdpPacket.
/**
* Create UDP packet
*
* @param payload
* @param packetLength
* @param packetData
* @return
* @throws UnknownHostException
*/
private TrexUdpPacket getUdpPacket(Payload payload, int packetLength, PacketData packetData) throws UnknownHostException {
LOG.info("Create UDP Packet");
TrexUdpPacket udpPacket = new TrexUdpPacket();
udpPacket.setSrcPort(packetData.getUdpData().getSrcPort());
udpPacket.setDstPort(packetData.getUdpData().getDstPort());
udpPacket.setLength(packetData.getUdpData().getLength());
udpPacket.setPacketLength(packetLength);
udpPacket.setPayload(payload);
udpPacket.buildPacket();
return udpPacket;
}
use of com.exalttech.trex.packets.TrexUdpPacket in project trex-stateless-gui by cisco-system-traffic-generator.
the class ProtocolData method init.
private void init() {
try {
ethernetPacket = new TrexEthernetPacket();
ipv4Packet = new TrexIpV4Packet();
tcpPacket = new TrexTcpPacket();
udpPacket = new TrexUdpPacket();
} catch (Exception ex) {
LOG.error("Couldn't initialize protocol data", ex);
}
}
use of com.exalttech.trex.packets.TrexUdpPacket in project trex-stateless-gui by cisco-system-traffic-generator.
the class UDPProtocolView method getUDPPacket.
/**
* Return UDP packet
*
* @param payload
* @param packetLength
* @return @throws Exception
*/
public TrexUdpPacket getUDPPacket(Payload payload, int packetLength) throws Exception {
TrexUdpPacket udpPacket = new TrexUdpPacket();
udpPacket.setSrcPort(Util.getPortValue(srcPort.getText()));
udpPacket.setDstPort(Util.getPortValue(dstPort.getText()));
udpPacket.setLength(Util.getIntFromString(length.getText()));
udpPacket.setPacketLength(packetLength);
udpPacket.setPayload(payload);
// build packet
udpPacket.buildPacket();
return udpPacket;
}
Aggregations