Read Me About MoreSCF
=====================
1.1
System Configuration framework (SCF) allows you to programmatically configure network settings. SCF provides a nice, abstract, extensible API for manipulating persistent preferences. However, older versions of the framework do not provide a high-level API. Thus, prior to Mac OS X 10.4, if you want to do common operations, like creating a new set (known as a "location" in the user interface), you have to combine a number of diverse APIs from I/O Kit, System Configuration, and Core Foundation.
MoreSCF is an attempt to make this easier. It includes a library of code to do all of the things that the user might do in the Network preferences panel. For example, you can create a new location, duplicate a location, activate and inactivate services (known as "ports" in the user interface), and so on. MoreSCF also provides high-level APIs to do common operations, such as creating a new set that contains a single PPP dialup service.
System Configuration framework was introduced in Mac OS X 10.1. In theory, MoreSCF could work on that system or later. In practice, I have tested it back to Mac OS X 10.3.
IMPORTANT: If your product requires Mac OS X 10.4 or later, you should use the new, high-level System Configuration framework API instead of MoreSCF. This API, defined in the "SCNetworkConfiguration.h" header file, includes routines for doing all of things that MoreSCF does. By using this API you make your code simpler and more future-proof.
Packing List
------------
The sample contains the following items:
o Read Me.txt -- A document that redirects you to this document.
o MoreSCF -- A folder containing MoreSCF and various support files.
- Read Me About MoreSCF.txt -- This document.
- MoreSCFHelpers.h -- Interface to the following.
- MoreSCFHelpers.c -- A high-level module that provides commonly
used System Configuration framework functions, such as creating
a new set that contains a single PPP dialup service.
- MoreSCF.h -- Interface to the following.
- MoreSCF.c -- A mid-level module layered on top of the SCPreferences
component of System Configuration framework. This module recasts
the SCPreferences API in terms that you would recognize from
looking at the Network preferences panel.
- MoreSCFDigest.h -- Interface to the following.
- MoreSCFDigest.c -- Code to create SCPreferences entities from
simple C structures.
- MoreSCFPortScanner.h -- Interface to the following.
- MoreSCFPortScanner.c -- Code to scan the I/O Registry for
network-capable ports.
- MoreSCFCCLScanner.h -- Interface to the following.
- MoreSCFCCLScanner.c -- Code to scan the system for modem scripts (CCLs).
- MoreSCFTest -- A program that both tests MoreSCF and gives an example
of its use.
o MoreCFQ -- MoreIsBetter Core Foundation utilities.
Using the Sample
----------------
The sample includes a compiled version of the MoreSCFTest command line tool. This tool modifies the SCF preferences, which means you must run it as root. The following example assumes that you've downloaded the sample to your desktop:
$ sudo Desktop/MoreSCF/MoreSCF/MoreSCFTest/build/Debug/MoreSCFTest -lq
Password: ********
MoreSCFTest
Running all tests
LeakTest(TestPortScanner)
LeakTest(TestPortScannerOld)
MoreSCFPortScanner.c: You should install a port name callback.
LeakTest(TestCCLScanner)
LeakTest(TestCopySetsDict)
LeakTest(TestSetEnumerationAndSwitch)
LeakTest(TestDuplicateAndDeleteSet)
LeakTest(TestRenameSet)
LeakTest(TestServiceEnumerate)
LeakTest(TestDuplicateAndDeleteService)
LeakTest(TestRenameService)
LeakTest(TestEnumerateEntities)
LeakTest(TestCreateSet)
LeakTest(TestISP)
LeakTest(TestAppleTalk)
LeakTest(TestTrivialCreate)
You can also run an individual test by naming it as an argument:
$ Desktop/MoreSCF/MoreSCF/MoreSCFTest/build/Debug/MoreSCFTest TestCCLScanner
MoreSCFTest
TestCCLScanner
3Com Impact Analog 14.4
3Com Impact ISDN 56K
3Com Impact ISDN 56K MLPPP
3Com Impact ISDN 64K
3Com Impact ISDN 64K MLPPP
Apple External 56K Modem (v.32)
Apple External 56K Modem (v.34)
Apple External 56K Modem (v.90)
Apple External 56K Modem (v.92)
Apple Internal 56K Modem (v.32)
Apple Internal 56K Modem (v.34)
* Apple Internal 56K Modem (v.90)
Apple Internal 56K Modem (v.92)
[...]
When running all tests the tool takes quite some time to run (up to a few minutes on my ancient test machine). As long as it runs to completion it should leave your network preferences how it found them. However, if you stop it halfway through you may need to manually restore your preferences.
Some of the tests requires that you have a location called "DefaultLocationForMoreSCFTest". You should create this location using the Network panel of System Preferences. Just create the location and leave its settings unmodified. The test uses this location to verify that a new set created by MoreSCF exactly matches a default set created by the control panel.
Note: Under some circumstances the TestCreateSet test will fail because the newly created set doesn't exactly match the contents of "DefaultLocationForMoreSCFTest". There are a few common reasons for this.
o Your "DefaultLocationForMoreSCFTest" set might be is out of date; to rectify this simply open the control panel, deleting the existing "DefaultLocationForMoreSCFTest" location and create a new one.
o You might have NetInfo enabled; to rectify this, turn off NetInfo using the "Directory Setup" application, then update your "DefaultLocationForMoreSCFTest" set as described previously.
o The "DefaultLocationForMoreSCFTest" might be set to use non-DHCP address acquisition (in the "Configure" popup menu). This can happen if you create the new set when your current set is not using DHCP. In that case the Network preferences panel creates a set with the same address acquisition mode as your current set. This anomalous behavior is not replicated by MoreSCF. To make TestCreateSet run without error, open the Network preferences panel and modify the services within the "DefaultLocationForMoreSCFTest" set to acquire address via PPP.
Building the Sample
-------------------
The sample was built using Xcode 2.4.1 on Mac OS X 10.4.8. To build the sample, open the MoreSCFTest project file (MoreSCF/MoreSCFTest/MoreSCFTest.xcodeproj) and choose Build from the Build menu. By default this builds the Debug build configuration, resulting in a new executable tool (MoreSCF/MoreSCFTest/build/Debug/MoreSCFTest).
Note: When you build the Intel side of the universal binary, you'll see warnings of the form:
#warning MoreSCF is deprecated if you are building for 10.4 or later.
This is because MoreSCF is not recommended for use on Mac OS X 10.4 and later (you should instead use the nice high-level API from "SCNetworkConfiguration.h"), and all Intel-based Macintosh computers 10.4 or later. If you get this warning, you should consider removing MoreSCF from your product and using the System Configuration framework directly. If that's not feasible, you can quieten the warning by setting the MORE_SCF_NO_DEPRECATION_WARNINGS compile-time variable.
SCF Hints and Tips
------------------
This section describes a number of things to keep in mind while working with SCF, or indeed MoreSCF.
o Documentation -- You can find System Configuration framework documentation in the Darwin > Networking section of the ADC Reference Library. The current URLs on the Apple developer web site are:
<http://developer.apple.com/documentation/Networking/Conceptual/SystemConfigFrameworks/index.html>
<http://developer.apple.com/documentation/Networking/Reference/SysConfig/index.html>
o Running with Privileges -- Code that modifies the System Configuration framework preferences must run as root (with effective user ID of 0). There are simple ways to work around this during development (described below). However, your final product will need to be smarter abou
qq_40265942
- 粉丝: 1
- 资源: 1
最新资源
- (源码)基于C++的RucBase数据库管理系统.zip
- 美国华盛顿州电动汽车保有量数据集(21W+记录)CSV+XML+JSON+RDF格式
- (源码)基于PyTorch框架的图像识别系统.zip
- Java项目:图书管理系统(基于Java+Springboot+Maven+MyBatisPlus+Vue+Mysql)
- 使用C语言实现字符串逆序输出实现方式.docx
- (源码)基于C++和OpenGL的简易太阳系行星系统.zip
- JAVAspringboot客户管理系统源码数据库 MySQL源码类型 WebForm
- NodeJS旅游景点分享网站[编号:CS_03796](1).zip
- (源码)基于Spring Boot和Vue的药品进销存管理系统.zip
- C语言字符串逆序.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈