Search in sources :

Example 1 with TrexUdpPacket

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;
}
Also used : TrexUdpPacket(com.exalttech.trex.packets.TrexUdpPacket)

Example 2 with TrexUdpPacket

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);
    }
}
Also used : TrexIpV4Packet(com.exalttech.trex.packets.TrexIpV4Packet) TrexEthernetPacket(com.exalttech.trex.packets.TrexEthernetPacket) TrexTcpPacket(com.exalttech.trex.packets.TrexTcpPacket) TrexUdpPacket(com.exalttech.trex.packets.TrexUdpPacket)

Example 3 with TrexUdpPacket

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;
}
Also used : TrexUdpPacket(com.exalttech.trex.packets.TrexUdpPacket)

Aggregations

TrexUdpPacket (com.exalttech.trex.packets.TrexUdpPacket)3 TrexEthernetPacket (com.exalttech.trex.packets.TrexEthernetPacket)1 TrexIpV4Packet (com.exalttech.trex.packets.TrexIpV4Packet)1 TrexTcpPacket (com.exalttech.trex.packets.TrexTcpPacket)1