edu.wisc.cs.stego.lib
Class GenericEditor
java.lang.Object
|
+--edu.wisc.cs.stego.CodeEditor
|
+--edu.wisc.cs.stego.modules.Unprofile
|
+--edu.wisc.cs.stego.lib.GenericEditor
- public class GenericEditor
- extends Unprofile
This class is a general purpose CodeEditor
which can
embed any watermark representable with the WatermarkGraph
class. This is the default CodeEditor for the WM program.
- See Also:
WatermarkGraph
,
CodeEditor
,
WM
Constructor Summary |
protected |
GenericEditor()
Just a simple, protected default constructor. |
Method Summary |
static CodeEditor |
buildCodeEditor(java.lang.String[] params)
Returns a new instance of a GenericEditor object. |
protected void |
insertWatermarkCode(ClassFile cls,
CodeAttribute code,
int where)
Given a class, the code of one of it's methods, and an index into that
code, insert a portion of the watermark building code. |
void |
instrumentClasses(WatermarkGraph graph,
ProfilePoint[] profile,
java.util.Map classes,
java.lang.String nodec)
This method preforms the work of modifying the target program's classes. |
protected void |
instrumentNodeClass(ClassFile node,
WatermarkGraph graph)
Adds the necessary fields and methods to the class that is being used as the
node class in the watermark graph. |
protected void |
setSignature(int nparams)
Sets the member variable which is the signature of the wm$connect method
for this watermark. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
GenericEditor
protected GenericEditor()
- Just a simple, protected default constructor. No arguments are required.
buildCodeEditor
public static CodeEditor buildCodeEditor(java.lang.String[] params)
- Returns a new instance of a GenericEditor object. Parameters are ignored.
This method is a factory method for instantiating GenericEditor instances.
- Parameters:
params
- is ignored.- Returns:
- a new instance of a GenericEditor object.
- See Also:
CodeEditor.buildCodeEditor(java.lang.String[])
instrumentClasses
public void instrumentClasses(WatermarkGraph graph,
ProfilePoint[] profile,
java.util.Map classes,
java.lang.String nodec)
- This method preforms the work of modifying the target program's classes.
It performs some initialization, then calls the identical method in the
Unprofile
class to take advantage of that classes ability
to locate and remove calls to the profiling methods.
- Overrides:
- instrumentClasses in class Unprofile
- Parameters:
graph
- the adjacency matrix of the watermark graph.profile
- the array of profile points.classes
- a map containing the classfiles, keyed on the classnames.nodec
- the name of the class to be used as the nodes in the graph.- See Also:
Unprofile
setSignature
protected void setSignature(int nparams)
- Sets the member variable which is the signature of the wm$connect method
for this watermark.
- Parameters:
nparams
- the number of integer parameters to wm$connect
instrumentNodeClass
protected void instrumentNodeClass(ClassFile node,
WatermarkGraph graph)
- Adds the necessary fields and methods to the class that is being used as the
node class in the watermark graph. Field names are added with a prefix of
wm$
to avoid symbol scope conflicts.
- Overrides:
- instrumentNodeClass in class Unprofile
- Parameters:
node
- the classfile representing the node class.fields
- the names of the pointer fields to add to the class.
insertWatermarkCode
protected void insertWatermarkCode(ClassFile cls,
CodeAttribute code,
int where)
- Given a class, the code of one of it's methods, and an index into that
code, insert a portion of the watermark building code.
- Overrides:
- insertWatermarkCode in class Unprofile
- Parameters:
code
- the code attribute in which to insert code.where
- the index at which to insert the code.