(b []byte)
| 97 | } |
| 98 | |
| 99 | func decodeIEEE802(b []byte) (Datalink, error) { |
| 100 | var d Datalink |
| 101 | |
| 102 | if len(b) < 14 { |
| 103 | return d, errShortEthernetLength |
| 104 | } |
| 105 | |
| 106 | d.EtherType = uint16(b[13]) | uint16(b[12])<<8 |
| 107 | |
| 108 | hwAddrFmt := "%0.2x:%0.2x:%0.2x:%0.2x:%0.2x:%0.2x" |
| 109 | |
| 110 | if d.EtherType != EtherTypeIEEE8021Q { |
| 111 | d.DstMAC = fmt.Sprintf(hwAddrFmt, b[0], b[1], b[2], b[3], b[4], b[5]) |
| 112 | d.SrcMAC = fmt.Sprintf(hwAddrFmt, b[6], b[7], b[8], b[9], b[10], b[11]) |
| 113 | } |
| 114 | |
| 115 | return d, nil |
| 116 | } |
no outgoing calls