All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.pkts.packet.TransportPacketFactory Maven / Gradle / Ivy

There is a newer version: 3.0.10
Show newest version
/**
 * 
 */
package io.pkts.packet;

import io.pkts.buffer.Buffer;
import io.pkts.protocol.IllegalProtocolException;
import io.pkts.protocol.Protocol;


/**
 * 
 * @author [email protected]
 */
public interface TransportPacketFactory {

    /**
     * Create a new {@link TransportPacket}.
     * 
     * @param protocol
     *            which protocol, currently only {@link Protocol#UDP} and
     *            {@link Protocol#TCP} are supported
     * @param srcAddress
     *            the source address.
     * @param srcPort
     *            the source port
     * @param destAddress
     *            the destination address
     * @param destPort
     *            the destination port
     * @param payload
     *            the payload or null if none
     * @return a newly created {@link TransportPacket}
     * @throws IllegalArgumentException
     * @throws {@link IllegalProtocolException} in case any other protocol but
     *         {@link Protocol#UDP} or {@link Protocol#TCP} was specified.
     */
    TransportPacket create(Protocol protocol, String srcAddress, int srcPort, String destAddress, int destPort,
            Buffer payload) throws IllegalArgumentException, IllegalProtocolException;

    /**
     * Create a new {@link TransportPacket}.
     * 
     * @param protocol
     *            which protocol, currently only {@link Protocol#UDP} and
     *            {@link Protocol#TCP} are supported
     * @param srcAddress
     *            the source address.
     * @param srcPort
     *            the source port
     * @param destAddress
     *            the destination address
     * @param destPort
     *            the destination port
     * @param payload
     *            the payload or null if none
     * @return a newly created {@link TransportPacket}
     * @throws IllegalArgumentException
     * @throws {@link IllegalProtocolException} in case any other protocol but
     *         {@link Protocol#UDP} or {@link Protocol#TCP} was specified.
     */
    TransportPacket create(Protocol protocol, byte[] srcAddress, int srcPort, byte[] destAddress, int destPort,
            Buffer payload) throws IllegalArgumentException, IllegalProtocolException;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy