Facebook
From Cobalt Shama, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 269
  1.  
  2. struct frame {
  3.  
  4.         //ethernet frame
  5.  
  6.         // --------------------------------------------------
  7.         // |  MAC destination  |  MAC source  |  Ethertype  |
  8.         // --------------------------------------------------
  9.         // |     48 bites      |   48 bites   |   16 bites  |
  10.         // --------------------------------------------------
  11.  
  12.  
  13.         // MAC destination
  14.         unsigned short eth_mac_dst_1, eth_mac_dst_2, eth_mac_dst_3;
  15.  
  16.         // MAC source
  17.         unsigned short eth_mac_src_1, eth_mac_src_2, eth_mac_src_3;
  18.  
  19.         //Ethertype
  20.         unsigned short eth_type;
  21.  
  22. //=======================================================================================
  23.  
  24.  
  25.         //ipv6 packet
  26.  
  27.         // ------------------------------------------------------------------------------------------------------------------------------------------
  28.         // |  Version  |  Traffic Class  |  Flow Label  |  Payload Length  |  Next Header  |  Hop Limit  |  Source Address  |  Destination Address  |
  29.         // ------------------------------------------------------------------------------------------------------------------------------------------
  30.         // |  4 bits   |      2 bits     |   20 bits    |      16 bits     |     8 bits    |   8 bits    |     182 bits     |        182 bits       |
  31.         // ------------------------------------------------------------------------------------------------------------------------------------------
  32.  
  33.  
  34.         // Version, Traffic Class, Flow Label
  35.         unsigned short ver_trf_flw_1, ver_trf_flw_2;
  36.  
  37.         // Payload Length
  38.         unsigned short payload_length;
  39.  
  40.         // Next Header
  41.         unsigned char next_header;
  42.  
  43.         // Hop Limit
  44.         unsigned char hop_limit;
  45.  
  46.         // Source Address
  47.         unsigned short ip6_src_1, ip6_src_2, ip6_src_3, ip6_src_4, ip6_src_5, ip6_src_6, ip6_src_7, ip6_src_8;
  48.  
  49.         // Destination Address
  50.         unsigned short ip6_dst_1, ip6_dst_2, ip6_dst_3, ip6_dst_4, ip6_dst_5, ip6_dst_6, ip6_dst_7, ip6_dst_8;
  51.  
  52. //=======================================================================================
  53.  
  54.         //icmp6
  55.         // -------------------------------------
  56.         // |   Type   |   Code   |   Checksum  |
  57.         // -------------------------------------
  58.         // |  8 bits  |  8 bits  |   16 bits   |
  59.         // -------------------------------------
  60.  
  61.         // Type
  62.         unsigned char icmp_type;
  63.  
  64.         // Code
  65.         unsigned char icmp_code;
  66.  
  67.         // Checksum
  68.         unsigned short icmp_checksum;
  69.  
  70. };