• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Setting Network Preferences Programatically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting Network Preferences Programatically


  • Subject: Re: Setting Network Preferences Programatically
  • From: James Masasaki <email@hidden>
  • Date: Thu, 23 Oct 2003 23:04:20 -0700

Actually, why wouldn't this hack work:

prefs = MoreSCGetSCPreferencesRef(); // Get prefs ref from MoreSCF


proxyPrefsDictionaryRef =
SCDynamicStoreCopyProxies( NULL ); // Ask
dynamic store to get a copy of the proxies
dictionary


////////////////////////////////////////////////////////////////
// Munge the proxy dictionary data namely setting proxy server,
// and port

////////////////////////////////////////////////////////////////

.
.
.

// Blast the dictionary back to the prefs via SCF

result = SCPreferencesPathSetValue( prefs,
<CFStringRef path>, // ?
proxyPrefs );

James

At 1:49 PM -0700 10/21/03, Quinn wrote:

>Let's look at each of the pieces in turn.
>
>1. MoreSCF -- This provides a high-level API on
>top of the basic System Configuration framework
>API. There is no specific MoreSCF function for
>setting proxies, but you can combine the
>existing functions to do what you need. I'll
>talk about this more below.
>
><http://developer.apple.com/samplecode/Sample_Code/Networking/MoreSCF.htm>
>
>2. MoreAuthSample -- This shows the standard
>"setuid root helper tool" technique for doing
>privileged operations. This involves using a
>setuid root helper tool to do the privileged
>operation that can't be done directly by your
>application. You use Authorization Services to
>prompt the user to enter their password to
>execute the tool the first time. It's possible
>to bypass the authorization dialog if you have
>an installer that installs the setuid root
>helper tool, but the installer will probably
>want to display a dialog of its own.
>
><http://developer.apple.com/samplecode/Sample_Code/Security/MoreAuthSample.h
tm>
>
>3. QISA -- This high-level sample that shows how
>to integrate MoreSCF and MoreAuthSample.
>
><http://developer.apple.com/samplecode/Sample_Code/Networking/QISA.htm>
>
> * * *
>
>The MoreSCF functions that you want to use are:
>
>o MoreSCCreateProxiesEntity -- This creates a
>proxy entity dictionary from a parameter block.
>
>o MoreSCSetEntity -- You can use this to store
>the proxy entity dictionary into a particular
>service of a particular set. You can pass NULL
>to the setID parameter, because you want to
>affect the current set. The protocol parameter
>should be kSCEntNetProxies. The serviceID
>parameter should be the service ID of the active
>service within the set. This is somewhat
>complicated because the active service is the
>first service whose link is active. To work
>this out you really need to go digging in the
>SCF dynamic store. However, you can probably
>use the expedient solution of iterating through
>all of the services in the set, and setting the
>proxy entity in each service.
>
>o MoreSCCopyEntity -- Use this to get the old
>value of the proxy entity before you overwrite
>it.
>
>o MoreSCCopyServiceIDs -- Will return a list of
>service IDs for a set. Pass NULL to the setID
>parameter to work with the current set.
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

References: 
 >Setting Network Preferences Programatically (From: James Masasaki <email@hidden>)
 >Re: Setting Network Preferences Programatically (From: Quinn <email@hidden>)

  • Prev by Date: Re: Passing Around AuthorizationRefs
  • Next by Date: Re: Setting Network Preferences Programatically
  • Previous by thread: Re: Setting Network Preferences Programatically
  • Next by thread: OT: iChatAV
  • Index(es):
    • Date
    • Thread