Ignore:
Timestamp:
Jan 9, 2016, 12:48:30 PM (9 years ago)
Author:
chronos
Message:
  • Added: New files AppModule, Config, Page and Base.
  • Modified: Some files were normalized to unix line ending characters.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Common/NetworkAddress.php

    r1 r4  
    6060class NetworkAddressIPv6
    6161{
    62         var $Address;
    63         var $Prefix;
     62  var $Address;
     63  var $Prefix;
    6464
    65         function __construct()
    66         {
    67                 $this->Address = 0;
    68                 $this->Prefix = 0;
    69         }
     65  function __construct()
     66  {
     67    $this->Address = 0;
     68    $this->Prefix = 0;
     69  }
    7070
    7171  function AddressToString()
    7272  {
    73         return(inet_ntop($this->Address));
     73    return(inet_ntop($this->Address));
    7474  }
    7575
    7676  function AddressFromString($Value)
    7777  {
    78         $this->Address = inet_pton($Value);
     78    $this->Address = inet_pton($Value);
    7979  }
    8080
    8181  function GetOctets()
    8282  {
    83         $Result = array();
    84         $Data = array_reverse(unpack('C*', $this->Address));
    85         foreach($Data as $Item)
    86         {
     83    $Result = array();
     84    $Data = array_reverse(unpack('C*', $this->Address));
     85    foreach($Data as $Item)
     86    {
    8787
    88                 $Result[] = dechex($Item & 15);
    89                 $Result[] = dechex(($Item >> 4) & 15);
    90         }
    91         return($Result);
     88      $Result[] = dechex($Item & 15);
     89      $Result[] = dechex(($Item >> 4) & 15);
     90    }
     91    return($Result);
    9292  }
    9393
    9494  function EncodeMAC($MAC)
    9595  {
    96         $MAC = explode(':', $MAC);
    97         $Data = unpack('C*', $this->Address);
    98         $Data[9] = hexdec($MAC[0]) ^ 0x02;
    99         $Data[10] = hexdec($MAC[1]);
    100         $Data[11] = hexdec($MAC[2]);
    101         $Data[12] = 0xff;
    102         $Data[13] = 0xfe;
    103         $Data[14] = hexdec($MAC[3]);
    104         $Data[15] = hexdec($MAC[4]);
    105         $Data[16] = hexdec($MAC[5]);
    106         $this->Address = pack_array('C*', $Data);
     96    $MAC = explode(':', $MAC);
     97    $Data = unpack('C*', $this->Address);
     98    $Data[9] = hexdec($MAC[0]) ^ 0x02;
     99    $Data[10] = hexdec($MAC[1]);
     100    $Data[11] = hexdec($MAC[2]);
     101    $Data[12] = 0xff;
     102    $Data[13] = 0xfe;
     103    $Data[14] = hexdec($MAC[3]);
     104    $Data[15] = hexdec($MAC[4]);
     105    $Data[16] = hexdec($MAC[5]);
     106    $this->Address = pack_array('C*', $Data);
    107107  }
    108108
Note: See TracChangeset for help on using the changeset viewer.