Created
July 1, 2014 13:48
-
-
Save georgik/75c1974af9aa0ccfd1d3 to your computer and use it in GitHub Desktop.
DHCP LPR detection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import <SystemConfiguration/SCDynamicStoreCopyDHCPInfo.h> | |
int main(int argc, const char * argv[]) { | |
@autoreleasepool { | |
CFDictionaryRef info = SCDynamicStoreCopyDHCPInfo(NULL, NULL); | |
if (info != NULL) { | |
// code RFC 2132 - http://www.ietf.org/rfc/rfc2132.txt | |
// 1 - netmask | |
// 2 - time offset | |
// 3 - router | |
// 4 - time server | |
// 5 - nameserver | |
// 6 - DNS | |
// 7 - Log server | |
// 8 - Cookie server | |
// 9 - LPR server | |
// 15 - domain name | |
CFDataRef data = DHCPInfoGetOptionData(info, 9); | |
NSData *my_nsdata = (__bridge NSData*)data; | |
NSLog(@"Hello, World!"); | |
NSLog(@"%@\n", my_nsdata); | |
} else { | |
NSLog(@"No DHCP information\n"); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment