Re: Determine ppp assigned IP address via system configuration?
Re: Determine ppp assigned IP address via system configuration?
- Subject: Re: Determine ppp assigned IP address via system configuration?
- From: Julien Jalon <email@hidden>
- Date: Tue, 27 Nov 2001 07:55:16 +0100
Le mardi 27 novembre 2001, ` 05:24 AM, Josh Gilbert a icrit :
I have used the system configuration framework to rip hardware names,
ip addresses and device names from the "NetworkServices" dictionary in
the "/var/db/SystemConfiguration/preferences.xml" file.
Under the IPv4 dictionary for the ethernet connection it lists an IP
address for ethernet but under the IPv4 dictionary for the modem
connection it returns only the key-value of ConfigMethod=PPP.
Is is possible to determine a dynamically assigned PPP/IP address via
system configuration and the
/var/db/SystemConfiguration/preferences.xml database or?
any suggestions will be appreciated
Some example code for System Configuration framework:
#import <Cocoa/Cocoa.h>
#include <CoreFoundation/CoreFoundation.h>
#include <SystemConfiguration/SystemConfiguration.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
SCDynamicStoreRef
dynRef=SCDynamicStoreCreate(kCFAllocatorSystemDefault,
(CFStringRef)@"Whatever you want", NULL, NULL);
// Get all available keys in the Dynamic Store
NSArray *keyList=(NSArray
*)SCDynamicStoreCopyKeyList(dynRef,(CFStringRef)@".*");
// Get IP global configuration
NSDictionary *objects=(NSDictionary
*)SCDynamicStoreCopyValue(dynRef,(CFStringRef)@"State:/Network/Global/IPv4"
);
NSLog(@"%@",keyList);
NSLog(@"%@",objects);
[pool release];
return 0;
}
and take a look at this address:
<
http://developer.apple.com/techpubs/macosx/Networking/SysConfigOverview926/
index.html>
for what you can get with System Configuration.
--
Julien Jalon
<
http://mapage.noos.fr/jalon>