root/trunk/PmpMyApp/source/XzibitController.m

Revision 54, 1.0 KB (checked in by tyler, 4 years ago)
  • Finish implementing the little GUI app
Line 
1//
2//  XzibitController.m
3//  PmpMyApp
4//
5//  Created by R. Tyler Ballance on 2/9/07.
6//  Copyright 2007 bleep. LLC. All rights reserved.
7//
8
9#import "XzibitController.h"
10#include "pmpmapper.h"
11
12@implementation XzibitController
13
14- (IBAction)createMapping:(id)sender
15{
16        int privateport = [localCreatePort intValue];
17        int publicport = [natCreatePort intValue];
18        int duration = [mappingDuration intValue];
19       
20        if (pmp_create_map(PMP_MAP_TCP,privateport,publicport,(duration * 60)) != NULL)
21        {
22                [statusField setStringValue:[NSString stringWithFormat:@"Mapping for port %d created with external port %d", privateport, publicport]];
23        }
24        else
25        {
26                [statusField setStringValue:@"Failed to properly create the mapping"];
27        }
28}
29
30- (IBAction)destroyMapping:(id)sender
31{
32        int privateport = [localDestroyPort intValue];
33       
34        if (pmp_destroy_map(PMP_MAP_TCP,privateport) != NULL)
35        {
36                [statusField setStringValue:[NSString stringWithFormat:@"Mapping for port %d destroyed", privateport]];
37        }
38        else
39        {
40                [statusField setStringValue:@"Failed to properly destroy the mapping"];
41        }
42}
43
44@end
Note: See TracBrowser for help on using the browser.