All pastes #479319 Raw Edit

Something

public php v1 · immutable
·published 2007-05-09 17:43 UTC
rendered paste body
<?php/* * Ethernet (IEEE 802.3) * * Ethernet II () * * Destination Addr: (00:00:00:00:00:00) * Source Addr: (00:00:00:00:00:00) * EtherType: IP (0x0800) */class ethernet {  public $destination;  public $source;  public $ethertype;  public function __construct() {    $args = func_get_args();    if (gettype($args[0]) === 'string') {      $this->packet = $args[0];    }    switch (substr($this->packet, 0, 2)) {      case ("\x80\x00"):        /* 0x0800 	Internet Protocol, Version 4 (IPv4) */        echo 'Internet Protocol, Version 4 (IPv4)' . "\n";        break;      case ("\x08\x06"):        /* 0x0806 	Address Resolution Protocol (ARP) */        echo 'Address Resolution Protocol (ARP)' . "\n";        break;      case ("\x80\x35"):        /* 0x8035 	Reverse Address Resolution Protocol (RARP) */        echo 'Reverse Address Resolution Protocol (RARP)' . "\n";        break;      case ("\x80\x9b"):        /* 0x809b 	AppleTalk (Ethertalk) */        echo 'AppleTalk (Ethertalk)' . "\n";        break;      case ("\x80\xf3"):        /* 0x80f3 	AppleTalk Address Resolution Protocol (AARP) */        echo 'AppleTalk Address Resolution Protocol (AARP)' . "\n";        break;      case ("\x81\x00"):        /* 0x8100 	IEEE 802.1Q-tagged frame */        echo 'IEEE 802.1Q-tagged frame' . "\n";        break;      case ("\x81\x37"):        /* 0x8137 	Novell IPX (alt) */        echo 'Novell IPX (alt)' . "\n";        break;      case ("\x81\x38"):        /* 0x8138 	Novell */        echo 'Novell' . "\n";        break;      case ("\x86\xdd"):        /* 0x86DD 	Internet Protocol, Version 6 (IPv6) */        echo 'Internet Protocol, Version 6 (IPv6)' . "\n";        break;      case ("\x88\x47"):        /* 0x8847 	MPLS unicast */        echo 'MPLS unicast' . "\n";        break;      case ("\x88\x48"):        /* 0x8848 	MPLS multicast */        echo 'MPLS multicast' . "\n";        break;      case ("\x88\x63"):        /* 0x8863 	PPPoE Discovery Stage */        echo 'PPPoE Discovery Stage' . "\n";        break;      case ("\x88\x64"):        /* 0x8864 	PPPoE Session Stage */        echo 'PPPoE Session Stage' . "\n";        break;      case ("\x88\x8e"):        /* 0x888E 	EAP over LAN (IEEE 802.1X) */        echo 'EAP over LAN (IEEE 802.1X)' . "\n";        break;      case ("\x88\x9a"):        /* 0x889A 	HyperSCSI (SCSI over Ethernet) */        echo 'HyperSCSI (SCSI over Ethernet)' . "\n";        break;      case ("\x88\xa2"):        /* 0x88A2 	ATA over Ethernet */        echo 'ATA over Ethernet' . "\n";        break;      case ("\x88\xe5"):        /* 0x88E5 	MAC security (IEEE 802.1AE) */        echo 'MAC security (IEEE 802.1AE)' . "\n";        break;      default:        echo '' . "\n";        break;    }  }}$packet = "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";$eth = new ethernet($packet)?>infotech:/home/barryd/Projects/PHP/phpCOMPACT/classes # php5 class.ethernet.phpInternet Protocol, Version 4 (IPv4)infotech:/home/barryd/Projects/PHP/phpCOMPACT/classes #