Skip to content

ControlPlane Hacking

dustinrue edited this page Nov 6, 2011 · 8 revisions

##ControlPlane Hacking Guide

###Adding a new Evidence Source

  1. Pick a short name for the evidence source; no spaces, starting with a letter
  2. Create an Objective-C class called FooEvidenceSource in the same style as the other sources. It should inherit from one of these:
    EvidenceSource GenericEvidenceSource LoopingEvidenceSource GenericLoopingEvidenceSource
    (the simplest)
    Use custom nib? Yes No Yes No
    Use simple loop? No No Yes Yes
    If using custom nib:* Create FooRule.nib * From your -init, call:

    [super initWithNibNamed:@"FooRule"];

    Extend: - (NSMutableDictionary *)readFromPanel; - (void)writeToPanel:(NSDictionary *)dict usingType:(NSString *)type

    If not using custom nib: Override (implement): - (NSString *)getSuggestionLeadText:(NSString *)type - (NSArray *)getSuggestions

    If using simple loop: Extend: - (void)doUpdate - (void)clearCollectedData

    If not using simple loop: Override (implement): - (void)start - (void)stop

    Add mention of it in MPController.m, around line 61: [appDefaults setValue:@"YES" forKey:@"EnableFooEvidenceSource"]; Add mention of it in the three places in EvidenceSource.m, from ~ line 268: #import "FooEvidenceSource.h" ... [FooEvidenceSource class], ... NSLocalizedString(@"Foo", @"Evidence source"); Adding a new Action

    Pick a short name for the action; no spaces, starting with a letter (e.g. Foo) Create an Objective-C class called FooAction in the same style as the other actions Add mention of it in the three places in Action.m (from around line 146): #import "FooAction.h" ... [FooAction class], ... NSLocalizedString(@"Foo", @"Action type")