Examples of TcpPacket


Examples of jpcap.packet.TCPPacket

      System.exit(0);
    }
    int index=Integer.parseInt(args[0]);
    JpcapSender sender=JpcapSender.openDevice(devices[index]);

    TCPPacket p=new TCPPacket(12,34,56,78,false,false,false,false,true,true,true,true,10,10);
    p.setIPv4Parameter(0,false,false,false,0,false,false,false,0,1010101,100,IPPacket.IPPROTO_TCP,
      InetAddress.getByName("www.microsoft.com"),InetAddress.getByName("www.google.com"));
    p.data=("data").getBytes();
   
    EthernetPacket ether=new EthernetPacket();
    ether.frametype=EthernetPacket.ETHERTYPE_IP;
View Full Code Here

Examples of jpcap.packet.TCPPacket

      System.exit(0);
    }
    int index=Integer.parseInt(args[0]);
    JpcapSender sender=JpcapSender.openDevice(devices[index]);

    TCPPacket p=new TCPPacket(12,34,56,78,false,false,false,false,true,true,true,true,10,10);
    p.setIPv6Parameter(1, 2, IPPacket.IPPROTO_TCP, 3,
      Inet6Address.getByName("fe80:0:0:0:30d5:2afd:7f3c:a522"),Inet6Address.getByName("fe80:0:0:0:30d5:2afd:7f3c:a522"));
    p.data=("data").getBytes();
   
    EthernetPacket ether=new EthernetPacket();
    ether.frametype=EthernetPacket.ETHERTYPE_IP;
View Full Code Here

Examples of net.sourceforge.jpcap.net.TCPPacket

      if(packet instanceof TCPPacket) {
        //Log.debug("["+this.getClass().getName()+"] packet is a TCPPacket");
        carnipacket.strTransportProtocol = Constants.strTCP;
        carnipacket.intTransportProtocol = Constants.intTCP;

        TCPPacket tcpPacket = (TCPPacket)packet;   
        //carnipacket.senderAddress = (IPAddress) IPAddress.getByName(tcpPacket.getSourceAddress());
        //carnipacket.receiverAddress = (IPAddress) IPAddress.getByName(tcpPacket.getDestinationAddress());
        carnipacket.senderAddress = new IPAddress(tcpPacket.getSourceAddress());
        carnipacket.receiverAddress = new IPAddress(tcpPacket.getDestinationAddress());
        carnipacket.senderPort = tcpPacket.getSourcePort();
        carnipacket.receiverPort = tcpPacket.getDestinationPort();
        carnipacket.data = packet.getData()
        carnipacket.ipHeader = ((IPPacket)packet).getIPHeader()
        carnipacket.tcpHeader = packet.getHeader();
        carnipacket.date = packet.getTimeval().getDate();
        carnipacket.ipIdentification = ((IPPacket)packet).getId();
//        System.out.println("[Core] Sec: "+ tcpPacket.getSequenceNumber() +
//            " (rSec: "+ (tcpPacket.getSequenceNumber() + tcpPacket.getPayloadDataLength()) + ")" +
//            " Ack: "+tcpPacket.getAcknowledgementNumber() +
//            " Len: "+tcpPacket.getPayloadDataLength());
//        carnipacket.jpTCPPacket = tcpPacket;
       
        carnipacket.setTcpSequenceNumber(tcpPacket.getSequenceNumber());       
        carnipacket.setTcpAcknowledgementNumber(tcpPacket.getAcknowledgementNumber());       
        carnipacket.setSyn(tcpPacket.isSyn());
        carnipacket.setAck(tcpPacket.isAck());
        carnipacket.setPsh(tcpPacket.isPsh());
        carnipacket.setRst(tcpPacket.isRst());
        carnipacket.setFin(tcpPacket.isFin());       
        carnipacket.setIpLength(((IPPacket) tcpPacket).getLength());
        carnipacket.setIpHeaderLength(((IPPacket) tcpPacket).getIPHeaderLength());
        carnipacket.setTcpHeaderLength(tcpPacket.getHeaderLength());
        carnipacket.setTcpWindowSize(tcpPacket.getWindowSize());
        carnipacket.setTcpPayloadDataLength(tcpPacket.getPayloadDataLength());
        carnipacket.setReceiverMacAddress(tcpPacket.getDestinationHwAddress());
        carnipacket.setSenderMacAddress(tcpPacket.getSourceHwAddress());

        PacketCacheThread.instance().addPacket(carnipacket);
       
      //handle UDP packets
      } else if(packet instanceof UDPPacket) {
View Full Code Here

Examples of org.hxzon.netprotocol.packet.TcpPacket

        new EthernetPacket();
        new VlanPacket();
        new GoosePacket();
        new SvPacket();
        new Ip4Packet();
        new TcpPacket();
        new UdpPacket();
        new TpktPacket();
        new CotpPacket();
        new OsiSessionPacket();
        new ArpPacket();
View Full Code Here

Examples of org.hxzon.netprotocol.packet.TcpPacket

    private static Map<Integer, CotpPacketGroup> groups = new HashMap<Integer, CotpPacketGroup>();

    public static void addCotpPacket(CotpPacket cotpPacket) {
        Ip4Packet ip4Packet = null;
        TcpPacket tcpPacket = null;
        for (IPacket parent = cotpPacket.getSrcPacket();;) {
            if (parent instanceof Ip4Packet) {
                ip4Packet = (Ip4Packet) parent;
                break;
            } else if (parent instanceof TcpPacket) {
                tcpPacket = (TcpPacket) parent;
            }
            parent = parent.getSrcPacket();
        }
        if (ip4Packet == null || tcpPacket == null) {
            return;
        }
        int protocolCode = ip4Packet.fetchProtocolCode().getValue();
        long sourceIp = ip4Packet.fetchSourceIp().getValue();
        long destIp = ip4Packet.fetchDestIp().getValue();
        int sourcePort = tcpPacket.fetchSourcePort().getValue();
        int destPort = tcpPacket.fetchDestPort().getValue();
        int key = new HashCodeBuilder().append(protocolCode).append(sourceIp).append(destIp).append(sourcePort).append(destPort).toHashCode();
        CotpPacketGroup group = groups.get(key);
        if (group == null && !cotpPacket.isLastUnit()) {
            group = new CotpPacketGroup(key);
            groups.put(key, group);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.