Esempio n. 1
0
    public Packet(string type)
    {
        switch (type)
        {
        case "PING ECHO":
        {
            app       = null;
            trans     = new TransLayer("TCP");
            internet  = new InternetLayer("IP");
            netAccess = new NALayer("Ethernet");
            this.type = type;
            break;
        }

        case "PING REPLY":
        {
            app       = null;
            trans     = new TransLayer("TCP");
            internet  = new InternetLayer("IP");
            netAccess = new NALayer("Ethernet");
            this.type = type;
            break;
        }

        case "TEST":
        {
            //null
            break;
        }
        }
    }
Esempio n. 2
0
 public Packet()
 {
     //test case : DEFAULT
     netAccess = new NALayer("Ethernet");
     internet  = new InternetLayer("IP");
     trans     = new TransLayer("TCP");
     app       = new AppLayer("");
 }
Esempio n. 3
0
    public void CreatePacket(string type)
    {
        switch (type)
        {
        case "PING":
        {
            app       = new AppLayer("PING");
            trans     = new TransLayer("");
            internet  = new InternetLayer("IP");
            netAccess = new NALayer("Ethernet");
            this.type = type;
            break;
        }

        case "DHCP":
        {
            app       = new AppLayer("DHCP");
            trans     = new TransLayer("UDP");
            internet  = new InternetLayer("IP");
            netAccess = new NALayer("Ethernet");
            this.type = type;
            break;
        }

        case "ARP":
        {
            app       = new AppLayer("ARP");
            trans     = new TransLayer("");
            internet  = new InternetLayer("IP");
            netAccess = new NALayer("Ethernet");
            this.type = type;
            break;
        }

        case "TEST":
        {
            //null
            break;
        }
        }
    }