-
Notifications
You must be signed in to change notification settings - Fork 182
/
HACKING.html
120 lines (117 loc) · 2.61 KB
/
HACKING.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<html>
<head>
<title>ControlPlane Hacking Guide</title>
<style type="text/css">
table {
border: 1px solid black;
margin: 1em;
}
th {
font-size: smaller;
}
th, td {
border: 1px solid black;
text-align: center;
}
</style>
</head>
<body>
<h1>ControlPlane Hacking Guide</h1>
<h2>5 August 2007</h2>
<h3>Adding a new Evidence Source</h3>
<ol>
<li>Pick a <em>short name</em> for the evidence source; no spaces, starting with a letter (e.g. <tt>Foo</tt>)</li>
<li>Create an Objective-C class called <tt>FooEvidenceSource</tt> in the same style as the other sources. It should inherit from one of these:
<table>
<tr>
<td></td>
<th>EvidenceSource</th>
<th>GenericEvidenceSource</th>
<th>LoopingEvidenceSource</th>
<th>GenericLoopingEvidenceSource<br />(the simplest)</th>
</tr>
<tr>
<td>Use custom nib?</td>
<td>Yes</td>
<td>No</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td>Use simple loop?</td>
<td>No</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
</tr>
</table>
<dl>
<dt>If using custom nib:</dt>
<dd><ul>
<li>Create <em>FooRule.nib</em></li>
<li>From your <tt>-init</tt>, call:
<pre>
[super initWithNibNamed:@"FooRule"];
</pre>
</li>
<li>Extend:
<pre>
- (NSMutableDictionary *)readFromPanel;
- (void)writeToPanel:(NSDictionary *)dict usingType:(NSString *)type
</pre>
</li>
</ul></dd>
<dt>If <b>not</b> using custom nib:</dt>
<dd><ul><li>Override (implement):
<pre>
- (NSString *)getSuggestionLeadText:(NSString *)type
- (NSArray *)getSuggestions
</pre>
</li></ul></dd>
<dt>If using simple loop:</dt>
<dd><ul><li>Extend:
<pre>
- (void)doUpdate
- (void)clearCollectedData
</pre>
</li></ul></dd>
<dt>If <b>not</b> using simple loop:</dt>
<dd><ul><li>Override (implement):
<pre>
- (void)start
- (void)stop
</pre>
</li></ul></dd>
</dl>
</li>
<li>Add mention of it in MPController.m, around line 61:
<pre>
[appDefaults setValue:@"YES" forKey:@"EnableFooEvidenceSource"];
</pre>
</li>
<li>Add mention of it in the three places in EvidenceSource.m, from ~ line 268:
<pre>
#import "FooEvidenceSource.h"
...
[FooEvidenceSource class],
...
NSLocalizedString(@"Foo", @"Evidence source");
</pre>
</li>
</ol>
<h3>Adding a new Action</h3>
<ol>
<li>Pick a <em>short name</em> for the action; no spaces, starting with a letter (e.g. <tt>Foo</tt>)</li>
<li>Create an Objective-C class called <tt>FooAction</tt> in the same style as the other actions</li>
<li>Add mention of it in the three places in Action.m (from around line 146):
<pre>
#import "FooAction.h"
...
[FooAction class],
...
NSLocalizedString(@"Foo", @"Action type")
</pre>
</li>
</ol>
</body>
</html>