macmaskarg.go
func (d *Directive) UnmarshalBinary(b []byte) error {
	// Must be exactly 8 bytes
	if len(b) != directiveLen {
		return io.ErrUnexpectedEOF
	}

	// Byte 0 is reserved
	if b[0] != 0 {
		return ErrorBadArgumentParameter
	}

	// Copy command and MAC address into Directive
	d.Command = DirectiveCommand(b[1])
	mac := make(net.HardwareAddr, 6)
	copy(mac, b[2:])
	d.MAC = mac

	return nil
}
func (d *Directive) UnmarshalBinary(b []byte) error {
	// Must be exactly 8 bytes
	if len(b) != directiveLen {
		return io.ErrUnexpectedEOF
	}

	// Byte 0 is reserved
	if b[0] != 0 {
		return ErrorBadArgumentParameter
	}

	// Copy command and MAC address into Directive
	d.Command = DirectiveCommand(b[1])
	mac := make(net.HardwareAddr, 6)
	copy(mac, b[2:])
	d.MAC = mac

	return nil
}
func ( d * Directive ) UnmarshalBinary ( b [ ] byte ) error { // Must be exactly 8 bytes if len ( b ) != directiveLen { return io . ErrUnexpectedEOF } // Byte 0 is reserved if b [ 0 ] != 0 { return ErrorBadArgumentParameter } // Copy command and MAC address into Directive d . Command = DirectiveCommand ( b [ 1 ] ) mac := make ( net . HardwareAddr , 6 ) copy ( mac , b [ 2 : ] ) d . MAC = mac return nil }
// UnmarshalBinary unmarshals a raw byte slice into a Directive.
//
// If the byte slice does not contain exactly 8 bytes, io.ErrUnexpectedEOF
// is returned.
//
// If byte 0 (reserved byte) is not empty, ErrorBadArgumentParameter is
// returned.
UnmarshalBinary unmarshals a raw byte slice into a Directive . If the byte slice does not contain exactly 8 bytes io . ErrUnexpectedEOF is returned . If byte 0 ( reserved byte ) is not empty ErrorBadArgumentParameter is returned .