- Import PmpMyApp source for bonjour-dev

git-svn-id: svn://svn.geekisp.com/bleep/trunk/PmpMyApp@48 a256dd88-e320-0410-9161-d397f098afaa
This commit is contained in:
R. Tyler Ballance 2007-02-08 21:43:32 +00:00
commit 9b259565bb
14 changed files with 2654 additions and 0 deletions

Binary file not shown.

4
English.lproj/MainMenu.nib/classes.nib generated Normal file
View File

@ -0,0 +1,4 @@
{
IBClasses = ({CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; });
IBVersion = 1;
}

22
English.lproj/MainMenu.nib/info.nib generated Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>135 107 356 240 0 0 1680 1028 </string>
<key>IBEditorPositions</key>
<dict>
<key>29</key>
<string>131 352 306 44 0 0 1680 1028 </string>
</dict>
<key>IBFramework Version</key>
<string>446.1</string>
<key>IBOpenObjects</key>
<array>
<integer>21</integer>
<integer>29</integer>
</array>
<key>IBSystem Version</key>
<string>8L2127</string>
</dict>
</plist>

Binary file not shown.

28
Info.plist Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.bleepsoft.PmpMyApp</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View File

@ -0,0 +1,369 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
2F5A48720B75598F0052B0C1 /* pmpmapper.c in Sources */ = {isa = PBXBuildFile; fileRef = 2F5A48710B75598F0052B0C1 /* pmpmapper.c */; };
2F5A48900B75658F0052B0C1 /* pmpmapper.c in Sources */ = {isa = PBXBuildFile; fileRef = 2F5A48710B75598F0052B0C1 /* pmpmapper.c */; };
2F901ED00B7AEDB5004FF42C /* route.c in Sources */ = {isa = PBXBuildFile; fileRef = 2F901ECF0B7AEDB5004FF42C /* route.c */; };
2F901ED30B7AEDBA004FF42C /* route.c in Sources */ = {isa = PBXBuildFile; fileRef = 2F901ECF0B7AEDB5004FF42C /* route.c */; };
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = "<group>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
2F5A48700B75598F0052B0C1 /* pmpmapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pmpmapper.h; path = source/pmpmapper.h; sourceTree = "<group>"; };
2F5A48710B75598F0052B0C1 /* pmpmapper.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pmpmapper.c; path = source/pmpmapper.c; sourceTree = "<group>"; };
2F5A488A0B7565810052B0C1 /* PMPMapper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = PMPMapper; sourceTree = BUILT_PRODUCTS_DIR; };
2F901ECE0B7AEDB5004FF42C /* route.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = route.h; path = source/route.h; sourceTree = "<group>"; };
2F901ECF0B7AEDB5004FF42C /* route.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = route.c; path = source/route.c; sourceTree = "<group>"; };
32CA4F630368D1EE00C91783 /* PmpMyApp_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PmpMyApp_Prefix.pch; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* PmpMyApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PmpMyApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
2F5A48880B7565810052B0C1 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
8D11072E0486CEB800E47090 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
2F5A486C0B7559600052B0C1 /* NAT-PMP */,
);
name = Classes;
sourceTree = "<group>";
};
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
);
name = "Linked Frameworks";
sourceTree = "<group>";
};
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
isa = PBXGroup;
children = (
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */,
29B97325FDCFA39411CA2CEA /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8D1107320486CEB800E47090 /* PmpMyApp.app */,
2F5A488A0B7565810052B0C1 /* PMPMapper */,
);
name = Products;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* PmpMyApp */ = {
isa = PBXGroup;
children = (
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
name = PmpMyApp;
sourceTree = "<group>";
};
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
isa = PBXGroup;
children = (
32CA4F630368D1EE00C91783 /* PmpMyApp_Prefix.pch */,
29B97316FDCFA39411CA2CEA /* main.m */,
);
name = "Other Sources";
sourceTree = "<group>";
};
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
8D1107310486CEB800E47090 /* Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
);
name = Resources;
sourceTree = "<group>";
};
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
2F5A486C0B7559600052B0C1 /* NAT-PMP */ = {
isa = PBXGroup;
children = (
2F5A48700B75598F0052B0C1 /* pmpmapper.h */,
2F5A48710B75598F0052B0C1 /* pmpmapper.c */,
2F901ECE0B7AEDB5004FF42C /* route.h */,
2F901ECF0B7AEDB5004FF42C /* route.c */,
);
name = "NAT-PMP";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
2F5A48890B7565810052B0C1 /* PMPMapper */ = {
isa = PBXNativeTarget;
buildConfigurationList = 2F5A48A90B7565AE0052B0C1 /* Build configuration list for PBXNativeTarget "PMPMapper" */;
buildPhases = (
2F5A48870B7565810052B0C1 /* Sources */,
2F5A48880B7565810052B0C1 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = PMPMapper;
productName = PMPMapper;
productReference = 2F5A488A0B7565810052B0C1 /* PMPMapper */;
productType = "com.apple.product-type.tool";
};
8D1107260486CEB800E47090 /* PmpMyApp */ = {
isa = PBXNativeTarget;
buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "PmpMyApp" */;
buildPhases = (
8D1107290486CEB800E47090 /* Resources */,
8D11072C0486CEB800E47090 /* Sources */,
8D11072E0486CEB800E47090 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = PmpMyApp;
productInstallPath = "$(HOME)/Applications";
productName = PmpMyApp;
productReference = 8D1107320486CEB800E47090 /* PmpMyApp.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "PmpMyApp" */;
hasScannedForEncodings = 1;
mainGroup = 29B97314FDCFA39411CA2CEA /* PmpMyApp */;
projectDirPath = "";
targets = (
8D1107260486CEB800E47090 /* PmpMyApp */,
2F5A48890B7565810052B0C1 /* PMPMapper */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8D1107290486CEB800E47090 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
2F5A48870B7565810052B0C1 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2F5A48900B75658F0052B0C1 /* pmpmapper.c in Sources */,
2F901ED30B7AEDBA004FF42C /* route.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
8D11072C0486CEB800E47090 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072D0486CEB800E47090 /* main.m in Sources */,
2F5A48720B75598F0052B0C1 /* pmpmapper.c in Sources */,
2F901ED00B7AEDB5004FF42C /* route.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
089C165DFE840E0CC02AAC07 /* English */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = {
isa = PBXVariantGroup;
children = (
29B97319FDCFA39411CA2CEA /* English */,
);
name = MainMenu.nib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
2F5A48AA0B7565AE0052B0C1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
INSTALL_PATH = "$(HOME)/bin";
PREBINDING = NO;
PRODUCT_NAME = PMPMapper;
ZERO_LINK = YES;
};
name = Debug;
};
2F5A48AB0B7565AE0052B0C1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
ppc,
i386,
);
COPY_PHASE_STRIP = YES;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
INSTALL_PATH = "$(HOME)/bin";
PREBINDING = NO;
PRODUCT_NAME = PMPMapper;
ZERO_LINK = NO;
};
name = Release;
};
C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = PmpMyApp;
WRAPPER_EXTENSION = app;
ZERO_LINK = YES;
};
name = Debug;
};
C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
ppc,
i386,
);
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = PmpMyApp;
WRAPPER_EXTENSION = app;
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
2F5A48A90B7565AE0052B0C1 /* Build configuration list for PBXNativeTarget "PMPMapper" */ = {
isa = XCConfigurationList;
buildConfigurations = (
2F5A48AA0B7565AE0052B0C1 /* Debug */,
2F5A48AB0B7565AE0052B0C1 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "PmpMyApp" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4B08A954540054247B /* Debug */,
C01FCF4C08A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "PmpMyApp" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,452 @@
// !$*UTF8*$!
{
089C165DFE840E0CC02AAC07 /* English */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {915, 843}}";
sepNavSelRange = "{93, 0}";
sepNavVisRect = "{{0, 0}, {915, 843}}";
};
};
29B97313FDCFA39411CA2CEA /* Project object */ = {
activeBuildConfigurationName = Debug;
activeExecutable = 2F5A488B0B7565810052B0C1 /* PMPMapper */;
activeTarget = 2F5A48890B7565810052B0C1 /* PMPMapper */;
addToTargets = (
8D1107260486CEB800E47090 /* PmpMyApp */,
);
breakpoints = (
);
breakpointsGroup = 2F5A48AC0B7565AE0052B0C1 /* XCBreakpointsBucket */;
codeSenseManager = 2F5A485A0B75586F0052B0C1 /* Code sense */;
executables = (
2F5A484B0B7558670052B0C1 /* PmpMyApp */,
2F5A488B0B7565810052B0C1 /* PMPMapper */,
);
perUserDictionary = {
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
625,
20,
48,
43,
43,
20,
);
PBXFileTableDataSourceColumnsKey = (
PBXFileDataSource_FiletypeID,
PBXFileDataSource_Filename_ColumnID,
PBXFileDataSource_Built_ColumnID,
PBXFileDataSource_ObjectSize_ColumnID,
PBXFileDataSource_Errors_ColumnID,
PBXFileDataSource_Warnings_ColumnID,
PBXFileDataSource_Target_ColumnID,
);
};
PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
200,
350,
20,
48.1626,
43,
43,
);
PBXFileTableDataSourceColumnsKey = (
PBXFileDataSource_FiletypeID,
PBXFileDataSource_Filename_ColumnID,
PBXTargetDataSource_PrimaryAttribute,
PBXFileDataSource_Built_ColumnID,
PBXFileDataSource_ObjectSize_ColumnID,
PBXFileDataSource_Errors_ColumnID,
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 192659396;
PBXWorkspaceStateSaveDate = 192659396;
};
perUserProjectItems = {
2F5A489C0B7565AE0052B0C1 /* PBXTextBookmark */ = 2F5A489C0B7565AE0052B0C1 /* PBXTextBookmark */;
2F5A489D0B7565AE0052B0C1 /* PBXTextBookmark */ = 2F5A489D0B7565AE0052B0C1 /* PBXTextBookmark */;
2F5A48A00B7565AE0052B0C1 /* PBXTextBookmark */ = 2F5A48A00B7565AE0052B0C1 /* PBXTextBookmark */;
2F5A48A10B7565AE0052B0C1 /* PBXTextBookmark */ = 2F5A48A10B7565AE0052B0C1 /* PBXTextBookmark */;
2F5A48A20B7565AE0052B0C1 /* PBXTextBookmark */ = 2F5A48A20B7565AE0052B0C1 /* PBXTextBookmark */;
2F5A49370B7575010052B0C1 /* PBXTextBookmark */ = 2F5A49370B7575010052B0C1 /* PBXTextBookmark */;
2F901EC10B7AED84004FF42C /* PBXTextBookmark */ = 2F901EC10B7AED84004FF42C /* PBXTextBookmark */;
2F901EC50B7AED84004FF42C /* PBXTextBookmark */ = 2F901EC50B7AED84004FF42C /* PBXTextBookmark */;
2F901ED80B7AEDBC004FF42C /* PBXTextBookmark */ = 2F901ED80B7AEDBC004FF42C /* PBXTextBookmark */;
2F901EE10B7AEE09004FF42C /* PBXTextBookmark */ = 2F901EE10B7AEE09004FF42C /* PBXTextBookmark */;
2F901EF70B7AEED5004FF42C /* PBXTextBookmark */ = 2F901EF70B7AEED5004FF42C /* PBXTextBookmark */;
2F9020F40B7BC77F004FF42C /* PBXTextBookmark */ = 2F9020F40B7BC77F004FF42C /* PBXTextBookmark */;
2F9020F50B7BC77F004FF42C /* PBXTextBookmark */ = 2F9020F50B7BC77F004FF42C /* PBXTextBookmark */;
2F9020F60B7BC77F004FF42C /* PBXTextBookmark */ = 2F9020F60B7BC77F004FF42C /* PBXTextBookmark */;
2F9021260B7BCD94004FF42C /* PBXTextBookmark */ = 2F9021260B7BCD94004FF42C /* PBXTextBookmark */;
2F9021280B7BCD94004FF42C /* PBXTextBookmark */ = 2F9021280B7BCD94004FF42C /* PBXTextBookmark */;
2F9021290B7BCD94004FF42C /* PBXTextBookmark */ = 2F9021290B7BCD94004FF42C /* PBXTextBookmark */;
2F90213A0B7BCF9E004FF42C /* PBXTextBookmark */ = 2F90213A0B7BCF9E004FF42C /* PBXTextBookmark */;
2F90213B0B7BCF9E004FF42C /* PBXTextBookmark */ = 2F90213B0B7BCF9E004FF42C /* PBXTextBookmark */;
2F90213C0B7BCF9E004FF42C /* PBXTextBookmark */ = 2F90213C0B7BCF9E004FF42C /* PBXTextBookmark */;
2F90213D0B7BCF9E004FF42C /* PBXTextBookmark */ = 2F90213D0B7BCF9E004FF42C /* PBXTextBookmark */;
2F9021410B7BD05A004FF42C /* PBXTextBookmark */ = 2F9021410B7BD05A004FF42C /* PBXTextBookmark */;
};
sourceControlManager = 2F5A48590B75586F0052B0C1 /* Source Control */;
userBuildSettings = {
};
};
2F5A484B0B7558670052B0C1 /* PmpMyApp */ = {
isa = PBXExecutable;
activeArgIndex = 2147483647;
activeArgIndices = (
);
argumentStrings = (
);
autoAttachOnCrash = 1;
configStateDict = {
};
customDataFormattersEnabled = 1;
debuggerPlugin = GDBDebugging;
disassemblyDisplayState = 0;
enableDebugStr = 1;
environmentEntries = (
);
executableSystemSymbolLevel = 0;
executableUserSymbolLevel = 0;
libgmallocEnabled = 0;
name = PmpMyApp;
sourceDirectories = (
);
};
2F5A48590B75586F0052B0C1 /* Source Control */ = {
isa = PBXSourceControlManager;
fallbackIsa = XCSourceControlManager;
isSCMEnabled = 0;
scmConfiguration = {
};
scmType = "";
};
2F5A485A0B75586F0052B0C1 /* Code sense */ = {
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
2F5A48700B75598F0052B0C1 /* pmpmapper.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {817, 846}}";
sepNavSelRange = "{529, 0}";
sepNavVisRect = "{{0, 0}, {817, 846}}";
sepNavWindowFrame = "{{1954, -14}, {939, 979}}";
};
};
2F5A48710B75598F0052B0C1 /* pmpmapper.c */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {817, 2212}}";
sepNavSelRange = "{4316, 0}";
sepNavVisRect = "{{0, 0}, {817, 846}}";
};
};
2F5A48890B7565810052B0C1 /* PMPMapper */ = {
activeExec = 0;
executables = (
2F5A488B0B7565810052B0C1 /* PMPMapper */,
);
};
2F5A488B0B7565810052B0C1 /* PMPMapper */ = {
isa = PBXExecutable;
activeArgIndex = 2147483647;
activeArgIndices = (
);
argumentStrings = (
);
autoAttachOnCrash = 1;
configStateDict = {
};
customDataFormattersEnabled = 1;
debuggerPlugin = GDBDebugging;
disassemblyDisplayState = 0;
dylibVariantSuffix = "";
enableDebugStr = 1;
environmentEntries = (
);
executableSystemSymbolLevel = 0;
executableUserSymbolLevel = 0;
libgmallocEnabled = 0;
name = PMPMapper;
savedGlobals = {
};
sourceDirectories = (
);
variableFormatDictionary = {
};
};
2F5A489C0B7565AE0052B0C1 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 089C165DFE840E0CC02AAC07 /* English */;
name = "English: 3";
rLen = 0;
rLoc = 93;
rType = 0;
vrLen = 93;
vrLoc = 0;
};
2F5A489D0B7565AE0052B0C1 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8D1107310486CEB800E47090 /* Info.plist */;
name = "Info.plist: 23";
rLen = 0;
rLoc = 738;
rType = 0;
vrLen = 844;
vrLoc = 0;
};
2F5A48A00B7565AE0052B0C1 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 089C165DFE840E0CC02AAC07 /* English */;
name = "English: 3";
rLen = 0;
rLoc = 93;
rType = 0;
vrLen = 93;
vrLoc = 0;
};
2F5A48A10B7565AE0052B0C1 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8D1107310486CEB800E47090 /* Info.plist */;
name = "Info.plist: 23";
rLen = 0;
rLoc = 738;
rType = 0;
vrLen = 844;
vrLoc = 0;
};
2F5A48A20B7565AE0052B0C1 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F5A48700B75598F0052B0C1 /* pmpmapper.h */;
name = "PMPMapper.h: 1";
rLen = 0;
rLoc = 0;
rType = 0;
vrLen = 139;
vrLoc = 0;
};
2F5A48AC0B7565AE0052B0C1 /* XCBreakpointsBucket */ = {
isa = XCBreakpointsBucket;
name = "Project Breakpoints";
objects = (
);
};
2F5A49370B7575010052B0C1 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F5A48710B75598F0052B0C1 /* pmpmapper.c */;
name = "PMPMapper.c: 29";
rLen = 0;
rLoc = 4002;
rType = 0;
vrLen = 951;
vrLoc = 0;
};
2F901EC10B7AED84004FF42C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F901EC20B7AED84004FF42C /* defroute.c */;
name = "(null): 12";
rLen = 0;
rLoc = 201;
rType = 0;
vrLen = 1280;
vrLoc = 0;
};
2F901EC20B7AED84004FF42C /* defroute.c */ = {
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.c;
name = defroute.c;
path = "/Users/tyler/Library/Mail Downloads/defroute.c";
sourceTree = "<absolute>";
};
2F901EC50B7AED84004FF42C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F901EC60B7AED84004FF42C /* defroute.c */;
name = "(null): 12";
rLen = 0;
rLoc = 201;
rType = 0;
vrLen = 1280;
vrLoc = 0;
};
2F901EC60B7AED84004FF42C /* defroute.c */ = {
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.c;
name = defroute.c;
path = "/Users/tyler/Library/Mail Downloads/defroute.c";
sourceTree = "<absolute>";
};
2F901ECE0B7AEDB5004FF42C /* route.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {722, 844}}";
sepNavSelRange = "{408, 0}";
sepNavVisRect = "{{0, 0}, {722, 844}}";
};
};
2F901ECF0B7AEDB5004FF42C /* route.c */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {817, 1764}}";
sepNavSelRange = "{157, 0}";
sepNavVisRect = "{{0, 918}, {817, 846}}";
};
};
2F901ED80B7AEDBC004FF42C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F901ECE0B7AEDB5004FF42C /* route.h */;
name = "route.h: 1";
rLen = 0;
rLoc = 0;
rType = 0;
vrLen = 135;
vrLoc = 0;
};
2F901EE10B7AEE09004FF42C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F901ECF0B7AEDB5004FF42C /* route.c */;
name = "struct sockaddr_in *default_gw()";
rLen = 32;
rLoc = 1055;
rType = 0;
vrLen = 1288;
vrLoc = 0;
};
2F901EF70B7AEED5004FF42C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F901ECE0B7AEDB5004FF42C /* route.h */;
name = "route.h: 26";
rLen = 0;
rLoc = 408;
rType = 0;
vrLen = 452;
vrLoc = 0;
};
2F9020F40B7BC77F004FF42C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F901ECF0B7AEDB5004FF42C /* route.c */;
name = "route.c: 12";
rLen = 0;
rLoc = 157;
rType = 0;
vrLen = 1279;
vrLoc = 1019;
};
2F9020F50B7BC77F004FF42C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F5A48710B75598F0052B0C1 /* pmpmapper.c */;
name = "pmpmapper.c: 35";
rLen = 0;
rLoc = 1382;
rType = 0;
vrLen = 1851;
vrLoc = 0;
};
2F9020F60B7BC77F004FF42C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F5A48700B75598F0052B0C1 /* pmpmapper.h */;
name = "pmpmapper.h: 30";
rLen = 0;
rLoc = 529;
rType = 0;
vrLen = 867;
vrLoc = 0;
};
2F9021260B7BCD94004FF42C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F5A48700B75598F0052B0C1 /* pmpmapper.h */;
name = "pmpmapper.h: PMP_TIMEOUT";
rLen = 0;
rLoc = 529;
rType = 0;
vrLen = 867;
vrLoc = 0;
};
2F9021280B7BCD94004FF42C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F5A48710B75598F0052B0C1 /* pmpmapper.c */;
name = "pmpmapper.c: 53";
rLen = 0;
rLoc = 1477;
rType = 0;
vrLen = 2132;
vrLoc = 929;
};
2F9021290B7BCD94004FF42C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F5A48700B75598F0052B0C1 /* pmpmapper.h */;
name = "pmpmapper.h: PMP_TIMEOUT";
rLen = 0;
rLoc = 529;
rType = 0;
vrLen = 867;
vrLoc = 0;
};
2F90213A0B7BCF9E004FF42C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F901ECF0B7AEDB5004FF42C /* route.c */;
name = "route.c: 12";
rLen = 0;
rLoc = 157;
rType = 0;
vrLen = 1228;
vrLoc = 1272;
};
2F90213B0B7BCF9E004FF42C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F5A48710B75598F0052B0C1 /* pmpmapper.c */;
name = "pmpmapper.c: 50";
rLen = 0;
rLoc = 1384;
rType = 0;
vrLen = 1337;
vrLoc = 3052;
};
2F90213C0B7BCF9E004FF42C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F5A48710B75598F0052B0C1 /* pmpmapper.c */;
name = "pmpmapper.c: 50";
rLen = 0;
rLoc = 1384;
rType = 0;
vrLen = 1337;
vrLoc = 3052;
};
2F90213D0B7BCF9E004FF42C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F901ECF0B7AEDB5004FF42C /* route.c */;
name = "route.c: 12";
rLen = 0;
rLoc = 157;
rType = 0;
vrLen = 1228;
vrLoc = 1272;
};
2F9021410B7BD05A004FF42C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2F5A48710B75598F0052B0C1 /* pmpmapper.c */;
name = "pmpmapper.c: printf";
rLen = 0;
rLoc = 4316;
rType = 0;
vrLen = 1766;
vrLoc = 0;
};
8D1107260486CEB800E47090 /* PmpMyApp */ = {
activeExec = 0;
executables = (
2F5A484B0B7558670052B0C1 /* PmpMyApp */,
);
};
8D1107310486CEB800E47090 /* Info.plist */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {915, 843}}";
sepNavSelRange = "{413, 0}";
sepNavVisRect = "{{0, 0}, {915, 843}}";
};
};
}

7
PmpMyApp_Prefix.pch Normal file
View File

@ -0,0 +1,7 @@
//
// Prefix header for all source files of the 'PmpMyApp' target in the 'PmpMyApp' project
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif

14
main.m Normal file
View File

@ -0,0 +1,14 @@
//
// main.m
// PmpMyApp
//
// Created by R. Tyler Ballance on 2/3/07.
// Copyright bleep. LLC 2007. All rights reserved.
//
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **) argv);
}

158
source/pmpmapper.c Normal file
View File

@ -0,0 +1,158 @@
/*
* PMPMapper.c
* PmpMyApp
*
* Created by R. Tyler Ballance on 2/3/07.
* Copyright 2007 bleep. LLC. All rights reserved.
*
*/
#include "pmpmapper.h"
//! double_timeout(struct timeval *) will handle doubling a timeout for backoffs required by NAT-PMP
static void double_timeout(struct timeval *to)
{
int second = 1000000; // number of useconds
to->tv_sec = (to->tv_sec * 2);
to->tv_usec = (to->tv_usec * 2);
// Overflow useconds if necessary
if (to->tv_usec >= second)
{
int overflow = (to->tv_usec / second);
to->tv_usec = (to->tv_usec - (overflow * second));
to->tv_sec = (to->tv_sec + overflow);
}
}
/*!
* pmp_get_public(struct sockaddr_in *) will return a sockaddr_in
* structure representing the publicly facing IP address of the
* default NAT gateway. The function will return NULL if:
* - The gateway doesn't support NAT-PMP
* - The gateway errors in some other spectacular fashion
*/
struct sockaddr_in *pmp_get_public(struct sockaddr_in *gateway)
{
int recvfd, sendfd;
int req_attempts = 1;
struct timeval req_timeout;
pmp_ip_request_t req;
pmp_ip_response_t resp;
struct sockaddr_in *recvsockaddr = (struct sockaddr_in *)(malloc(sizeof(struct sockaddr)));
struct sockaddr_in *publicsockaddr = NULL;
req_timeout.tv_sec = 0;
req_timeout.tv_usec = PMP_TIMEOUT;
recvsockaddr->sin_family = AF_INET;
recvsockaddr->sin_port = PMP_PORT;
recvsockaddr->sin_addr.s_addr = htonl(INADDR_ANY);
gateway->sin_port = PMP_PORT; // Default port for NAT-PMP is 5351
sendfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
recvfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
// Clean out both req and resp structures
bzero(&req, sizeof(pmp_ip_request_t));
bzero(&resp, sizeof(pmp_ip_response_t));
req.version = 0;
req.opcode = 0;
if (bind(recvfd, (struct sockaddr *)(recvsockaddr), sizeof(struct sockaddr_in)) < 0)
{
fprintf(stderr, "Failed to bind properly to UDP:%d (%s)\n", PMP_PORT, strerror(errno));
return NULL;
}
// Attempt to contact NAT-PMP device 9 times as per: draft-cheshire-nat-pmp-02.txt
while (req_attempts < 10)
{
#ifdef PMP_DEBUG
fprintf(stderr, "Attempting to retrieve the public ip address for the NAT device at: %s\n", inet_ntoa(gateway->sin_addr));
fprintf(stderr, "\tTimeout: %ds %dus, Request #: %d\n", req_timeout.tv_sec, req_timeout.tv_usec, req_attempts);
#endif
struct sockaddr_in addr;
socklen_t len = sizeof(struct sockaddr_in);
if (sendto(sendfd, &req, sizeof(req), 0, (struct sockaddr *)(gateway), sizeof(struct sockaddr)) < 0)
{
fprintf(stderr, "There was an error sending the NAT-PMP public IP request! (%s)\n", strerror(errno));
return NULL;
}
if (setsockopt(recvfd, SOL_SOCKET, SO_RCVTIMEO, &req_timeout, sizeof(req_timeout)) < 0)
{
fprintf(stderr, "There was an error setting the socket's options! (%s)\n", strerror(errno));
return NULL;
}
if (recvfrom(recvfd, &resp, sizeof(pmp_ip_response_t), 0, (struct sockaddr *)(&addr), &len) < 0)
{
if ( (errno != EAGAIN) || (req_attempts == 9) )
{
fprintf(stderr, "There was an error receiving the response from the NAT-PMP device! (%s)\n", strerror(errno));
return NULL;
}
else
{
goto iterate;
}
}
if (addr.sin_addr.s_addr != gateway->sin_addr.s_addr)
{
fprintf(stderr, "Response was not received from our gateway! Instead from: %s\n", inet_ntoa(addr.sin_addr));
}
else
{
break;
}
iterate:
++req_attempts;
double_timeout(&req_timeout);
}
if (publicsockaddr == NULL)
return NULL;
#ifdef PMP_DEBUG
fprintf(stderr, "Response received from NAT-PMP device:\n");
fprintf(stderr, "version: %d\n", resp.version);
fprintf(stderr, "opcode: %d\n", resp.opcode);
fprintf(stderr, "resultcode: %d\n", resp.resultcode);
fprintf(stderr, "epoch: %d\n", resp.epoch);
struct in_addr in;
in.s_addr = resp.address;
fprintf(stderr, "address: %s\n", inet_ntoa(in));
#endif
publicsockaddr->sin_addr.s_addr = resp.address;
return publicsockaddr;
}
#ifdef PMP_DEBUG
int main(int argc, char **argv)
{
struct sockaddr_in *gw = NULL;
struct sockaddr_in *pub = NULL;
printf("Acquiring the default gateway: ");
if ((gw = default_gw()) == NULL)
{
printf("Failed to acquire the default gateway address!\n");
return EXIT_FAILURE;
}
printf("%s\n", inet_ntoa(gw->sin_addr));
pub = pmp_get_public(gw);
return EXIT_SUCCESS;
}
#endif

51
source/pmpmapper.h Normal file
View File

@ -0,0 +1,51 @@
/*
* PMPMapper.h
* PmpMyApp
*
* Created by R. Tyler Ballance on 2/3/07.
* Copyright 2007 bleep. LLC. All rights reserved.
*
*/
#ifndef _PMPMAPPER_H
#define _PMPMAPPER_H
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <assert.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/types.h>
#include <net/if.h>
#include <net/route.h>
#include "route.h"
// Comment out to disable building main()
#define PMP_DEBUG
#define PMP_VERSION 0
#define PMP_PORT 5351
#define PMP_TIMEOUT 250000
/*
* uint8_t: version, opcodes
* uint16_t: resultcode
* unint32_t: epoch (seconds since mappings reset)
*/
typedef struct {
uint8_t version;
uint8_t opcode;
} pmp_ip_request_t;
typedef struct {
uint8_t version;
uint8_t opcode; // 128 + n
uint16_t resultcode;
uint32_t epoch;
uint32_t address;
} pmp_ip_response_t;
#endif

126
source/route.c Normal file
View File

@ -0,0 +1,126 @@
/*
* route.c
* PmpMyApp
*
* Created by R. Tyler Ballance on 2/7/07.
* Copyright 2007 bleep. LLC. All rights reserved.
*
*/
#include "route.h"
/*
* Thanks to R. Matthew Emerson for the fixes on this
*/
/* alignment constraint for routing socket */
#define ROUNDUP(a) \
((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
void get_rtaddrs(int bitmask, struct sockaddr *sa, struct sockaddr *addrs[])
{
int i;
for (i = 0; i < RTAX_MAX; i++)
{
if (bitmask & (1 << i))
{
addrs[i] = sa;
sa = (struct sockaddr *)(ROUNDUP(sa->sa_len) + (char *)sa);
}
else
{
addrs[i] = NULL;
}
}
}
int is_default_route (struct sockaddr *sa, struct sockaddr *mask)
{
struct sockaddr_in *sin;
if (sa->sa_family != AF_INET)
return 0;
sin = (struct sockaddr_in *)sa;
if ((sin->sin_addr.s_addr == INADDR_ANY) &&
mask &&
(ntohl(((struct sockaddr_in *)mask)->sin_addr.s_addr) == 0L ||
mask->sa_len == 0))
return 1;
else
return 0;
}
struct sockaddr_in *default_gw()
{
int mib[6];
size_t needed;
char *buf, *next, *lim;
struct rt_msghdr2 *rtm;
struct sockaddr *sa;
struct sockaddr *rti_info[RTAX_MAX];
struct sockaddr_in *sin;
mib[0] = CTL_NET;
mib[1] = PF_ROUTE;
mib[2] = 0;
mib[3] = 0;
mib[4] = NET_RT_DUMP2;
mib[5] = 0;
if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
{
err(1, "sysctl: net.route.0.0.dump estimate");
}
buf = malloc(needed);
if (buf == 0)
{
err(2, "malloc");
}
if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0)
{
err(1, "sysctl: net.route.0.0.dump");
}
lim = buf + needed;
for (next = buf; next < lim; next += rtm->rtm_msglen)
{
rtm = (struct rt_msghdr2 *)next;
sa = (struct sockaddr *)(rtm + 1);
if (sa->sa_family == AF_INET)
{
sin = (struct sockaddr_in *)sa;
struct sockaddr addr, mask;
get_rtaddrs(rtm->rtm_addrs, sa, rti_info);
bzero(&addr, sizeof(addr));
if (rtm->rtm_addrs & RTA_DST)
bcopy(rti_info[RTAX_DST], &addr, rti_info[RTAX_DST]->sa_len);
bzero(&mask, sizeof(mask));
if (rtm->rtm_addrs & RTA_NETMASK)
bcopy(rti_info[RTAX_NETMASK], &mask, rti_info[RTAX_NETMASK]->sa_len);
if (is_default_route(&addr, &mask))
{
sin = (struct sockaddr_in *)rti_info[RTAX_GATEWAY];
break;
}
}
rtm = (struct rt_msghdr2 *)next;
}
free(buf);
return sin;
}

31
source/route.h Normal file
View File

@ -0,0 +1,31 @@
/*
* route.h
* PmpMyApp
*
* Created by R. Tyler Ballance on 2/7/07.
* Copyright 2007 bleep. LLC. All rights reserved.
*
*/
#ifndef _ROUTE_H
#define _ROUTE_H
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <net/route.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <err.h>
struct sockaddr_in *default_gw();
#endif