PageRenderTime 18ms CodeModel.GetById 11ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 0ms

/packages/univint/src/SCNetworkConnection.pas

https://github.com/slibre/freepascal
Pascal | 714 lines | 55 code | 60 blank | 599 comment | 0 complexity | c72ef1785b3caa11159e7516a5904de0 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
  1{
  2 * Copyright (c) 2003-2006, 2008-2010 Apple Inc. All rights reserved.
  3 *
  4 * @APPLE_LICENSE_HEADER_START@
  5 * 
  6 * This file contains Original Code and/or Modifications of Original Code
  7 * as defined in and that are subject to the Apple Public Source License
  8 * Version 2.0 (the 'License'). You may not use this file except in
  9 * compliance with the License. Please obtain a copy of the License at
 10 * http://www.opensource.apple.com/apsl/ and read it before using this
 11 * file.
 12 * 
 13 * The Original Code and all software distributed under the License are
 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
 18 * Please see the License for the specific language governing rights and
 19 * limitations under the License.
 20 * 
 21 * @APPLE_LICENSE_HEADER_END@
 22 }
 23{  Pascal Translation:  Peter N Lewis, <peter@stairways.com.au>, 2004 }
 24{  Pascal Translation Updated:  Jonas Maebe, <jonas@freepascal.org>, October 2009 }
 25{  Pascal Translation Updated:  Jonas Maebe, <jonas@freepascal.org>, October 2012 }
 26{
 27    Modified for use with Free Pascal
 28    Version 308
 29    Please report any bugs to <gpc@microbizz.nl>
 30}
 31
 32{$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
 33{$mode macpas}
 34{$packenum 1}
 35{$macro on}
 36{$inline on}
 37{$calling mwpascal}
 38
 39unit SCNetworkConnection;
 40interface
 41{$setc UNIVERSAL_INTERFACES_VERSION := $0400}
 42{$setc GAP_INTERFACES_VERSION := $0308}
 43
 44{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
 45    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
 46{$endc}
 47
 48{$ifc defined CPUPOWERPC and defined CPUI386}
 49	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
 50{$endc}
 51{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
 52	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
 53{$endc}
 54
 55{$ifc not defined __ppc__ and defined CPUPOWERPC32}
 56	{$setc __ppc__ := 1}
 57{$elsec}
 58	{$setc __ppc__ := 0}
 59{$endc}
 60{$ifc not defined __ppc64__ and defined CPUPOWERPC64}
 61	{$setc __ppc64__ := 1}
 62{$elsec}
 63	{$setc __ppc64__ := 0}
 64{$endc}
 65{$ifc not defined __i386__ and defined CPUI386}
 66	{$setc __i386__ := 1}
 67{$elsec}
 68	{$setc __i386__ := 0}
 69{$endc}
 70{$ifc not defined __x86_64__ and defined CPUX86_64}
 71	{$setc __x86_64__ := 1}
 72{$elsec}
 73	{$setc __x86_64__ := 0}
 74{$endc}
 75{$ifc not defined __arm__ and defined CPUARM}
 76	{$setc __arm__ := 1}
 77{$elsec}
 78	{$setc __arm__ := 0}
 79{$endc}
 80
 81{$ifc defined cpu64}
 82  {$setc __LP64__ := 1}
 83{$elsec}
 84  {$setc __LP64__ := 0}
 85{$endc}
 86
 87
 88{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
 89	{$error Conflicting definitions for __ppc__ and __i386__}
 90{$endc}
 91
 92{$ifc defined __ppc__ and __ppc__}
 93	{$setc TARGET_CPU_PPC := TRUE}
 94	{$setc TARGET_CPU_PPC64 := FALSE}
 95	{$setc TARGET_CPU_X86 := FALSE}
 96	{$setc TARGET_CPU_X86_64 := FALSE}
 97	{$setc TARGET_CPU_ARM := FALSE}
 98	{$setc TARGET_OS_MAC := TRUE}
 99	{$setc TARGET_OS_IPHONE := FALSE}
100	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
101	{$setc TARGET_OS_EMBEDDED := FALSE}
102{$elifc defined __ppc64__ and __ppc64__}
103	{$setc TARGET_CPU_PPC := FALSE}
104	{$setc TARGET_CPU_PPC64 := TRUE}
105	{$setc TARGET_CPU_X86 := FALSE}
106	{$setc TARGET_CPU_X86_64 := FALSE}
107	{$setc TARGET_CPU_ARM := FALSE}
108	{$setc TARGET_OS_MAC := TRUE}
109	{$setc TARGET_OS_IPHONE := FALSE}
110	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
111	{$setc TARGET_OS_EMBEDDED := FALSE}
112{$elifc defined __i386__ and __i386__}
113	{$setc TARGET_CPU_PPC := FALSE}
114	{$setc TARGET_CPU_PPC64 := FALSE}
115	{$setc TARGET_CPU_X86 := TRUE}
116	{$setc TARGET_CPU_X86_64 := FALSE}
117	{$setc TARGET_CPU_ARM := FALSE}
118{$ifc defined(iphonesim)}
119 	{$setc TARGET_OS_MAC := FALSE}
120	{$setc TARGET_OS_IPHONE := TRUE}
121	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
122{$elsec}
123	{$setc TARGET_OS_MAC := TRUE}
124	{$setc TARGET_OS_IPHONE := FALSE}
125	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
126{$endc}
127	{$setc TARGET_OS_EMBEDDED := FALSE}
128{$elifc defined __x86_64__ and __x86_64__}
129	{$setc TARGET_CPU_PPC := FALSE}
130	{$setc TARGET_CPU_PPC64 := FALSE}
131	{$setc TARGET_CPU_X86 := FALSE}
132	{$setc TARGET_CPU_X86_64 := TRUE}
133	{$setc TARGET_CPU_ARM := FALSE}
134	{$setc TARGET_OS_MAC := TRUE}
135	{$setc TARGET_OS_IPHONE := FALSE}
136	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
137	{$setc TARGET_OS_EMBEDDED := FALSE}
138{$elifc defined __arm__ and __arm__}
139	{$setc TARGET_CPU_PPC := FALSE}
140	{$setc TARGET_CPU_PPC64 := FALSE}
141	{$setc TARGET_CPU_X86 := FALSE}
142	{$setc TARGET_CPU_X86_64 := FALSE}
143	{$setc TARGET_CPU_ARM := TRUE}
144	{ will require compiler define when/if other Apple devices with ARM cpus ship }
145	{$setc TARGET_OS_MAC := FALSE}
146	{$setc TARGET_OS_IPHONE := TRUE}
147	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
148	{$setc TARGET_OS_EMBEDDED := TRUE}
149{$elsec}
150	{$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ is defined.}
151{$endc}
152
153{$ifc defined __LP64__ and __LP64__ }
154  {$setc TARGET_CPU_64 := TRUE}
155{$elsec}
156  {$setc TARGET_CPU_64 := FALSE}
157{$endc}
158
159{$ifc defined FPC_BIG_ENDIAN}
160	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
161	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
162{$elifc defined FPC_LITTLE_ENDIAN}
163	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
164	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
165{$elsec}
166	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
167{$endc}
168{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
169{$setc CALL_NOT_IN_CARBON := FALSE}
170{$setc OLDROUTINENAMES := FALSE}
171{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
172{$setc OPAQUE_UPP_TYPES := TRUE}
173{$setc OTCARBONAPPLICATION := TRUE}
174{$setc OTKERNEL := FALSE}
175{$setc PM_USE_SESSION_APIS := TRUE}
176{$setc TARGET_API_MAC_CARBON := TRUE}
177{$setc TARGET_API_MAC_OS8 := FALSE}
178{$setc TARGET_API_MAC_OSX := TRUE}
179{$setc TARGET_CARBON := TRUE}
180{$setc TARGET_CPU_68K := FALSE}
181{$setc TARGET_CPU_MIPS := FALSE}
182{$setc TARGET_CPU_SPARC := FALSE}
183{$setc TARGET_OS_UNIX := FALSE}
184{$setc TARGET_OS_WIN32 := FALSE}
185{$setc TARGET_RT_MAC_68881 := FALSE}
186{$setc TARGET_RT_MAC_CFM := FALSE}
187{$setc TARGET_RT_MAC_MACHO := TRUE}
188{$setc TYPED_FUNCTION_POINTERS := TRUE}
189{$setc TYPE_BOOL := FALSE}
190{$setc TYPE_EXTENDED := FALSE}
191{$setc TYPE_LONGLONG := TRUE}
192uses MacTypes,MacOSXPosix,CFBase,CFDictionary,CFRunLoop;
193{$endc} {not MACOSALLINCLUDE}
194
195{$ALIGN POWER}
196
197{!
198	@header SCNetworkConnection
199	@discussion The SCNetworkConnection API contains functions that allow
200		an application to control connection-oriented services defined
201		in the system and get connection-status information.
202
203		The functions in the SCNetworkConnection API allow you to
204		control and get information about existing services only.
205		If you need to create, change, or remove services, you
206		should use the SCNetworkConfiguration API instead.
207
208		Note: Currently, only PPP services can be controlled.
209 }
210
211
212{!
213	@typedef SCNetworkConnectionRef
214	@discussion This is the handle to manage a connection-oriented service.
215 }
216type
217	SCNetworkConnectionRef = ^__SCNetworkConnection; { an opaque type }
218	__SCNetworkConnection = record end;
219
220
221{!
222	@typedef SCNetworkConnectionContext
223	@discussion Structure containing user-specified data and callbacks
224		for a SCNetworkConnection.
225	@field version The version number of the structure type being passed
226		in as a parameter to the SCNetworkConnectionCreateWithServiceID
227		function.  This structure is version 0.
228	@field info A C pointer to a user-specified block of data.
229	@field retain The callback used to add a retain for the info field.
230		If this parameter is not a pointer to a function of the correct
231		prototype, the behavior is undefined.  The value may be NULL.
232	@field release The calllback used to remove a retain previously added
233		for the info field.  If this parameter is not a pointer to a
234		function of the correct prototype, the behavior is undefined.
235		The value may be NULL.
236	@field copyDescription The callback used to provide a description of
237		the info field.
238 }
239// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
240type SCNetworkConnectionContext = record
241		version: CFIndex;
242		info: Ptr;
243		retain: function( info: UnivPtr ): UnivPtr;
244		release: procedure( info: UnivPtr );
245		copyDescription: function( info: UnivPtr ): CFStringRef;
246	end;
247	SCNetworkConnectionContextPtr = ^SCNetworkConnectionContext;
248
249
250{!
251	@enum SCNetworkConnectionStatus
252	@discussion Status of the network connection.
253		This status is intended to be generic and high level.
254		An extended status, specific to the type of network
255		connection is also available for applications that
256		need additonal information.
257	@constant kSCNetworkConnectionInvalid
258		The network connection refers to an invalid service.
259	@constant kSCNetworkConnectionDisconnected
260		The network connection is disconnected.
261	@constant kSCNetworkConnectionConnecting
262		The network connection is connecting.
263	@constant kSCNetworkConnectionConnected
264		The network connection is connected.
265	@constant kSCNetworkConnectionDisconnecting
266		The network connection is disconnecting.
267 }
268// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
269const
270	kSCNetworkConnectionInvalid = -1;
271	kSCNetworkConnectionDisconnected = 0;
272	kSCNetworkConnectionConnecting = 1;
273	kSCNetworkConnectionConnected = 2;
274	kSCNetworkConnectionDisconnecting = 3;
275type
276	SCNetworkConnectionStatus = SInt32;
277
278
279{!
280	@enum SCNetworkConnectionPPPStatus
281	@discussion PPP-specific status of the network connection.
282		This status is returned as part of the extended information
283		for a PPP service.
284		Note: additional status might be returned in the future.
285		Your application should be prepared to receive an unknown value.
286	@constant kSCNetworkConnectionPPPDisconnected
287		PPP is disconnected.
288	@constant kSCNetworkConnectionPPPInitializing
289		PPP is initializing.
290	@constant kSCNetworkConnectionPPPConnectingLink
291		PPP is connecting the lower connection layer (for example,
292		the modem is dialing out).
293	@constant kSCNetworkConnectionPPPDialOnTraffic
294		PPP is waiting for networking traffic to automatically
295		establish the connection.
296	@constant kSCNetworkConnectionPPPNegotiatingLink
297		The PPP lower layer is connected and PPP is negotiating the
298		link layer (LCP protocol).
299	@constant kSCNetworkConnectionPPPAuthenticating
300		PPP is authenticating to the server (PAP, CHAP, MS-CHAP or
301		EAP protocols).
302	@constant kSCNetworkConnectionPPPWaitingForCallBack
303		PPP is waiting for the server to call back.
304	@constant kSCNetworkConnectionPPPNegotiatingNetwork
305		PPP is now authenticated and negotiating the networking
306		layer (IPCP or IPv6CP protocols)
307	@constant kSCNetworkConnectionPPPConnected
308		PPP is now fully connected for at least one networking layer.
309		Additional networking protocol might still be negotiating.
310	@constant kSCNetworkConnectionPPPTerminating
311		PPP networking and link protocols are terminating.
312	@constant kSCNetworkConnectionPPPDisconnectingLink
313		PPP is disconnecting the lower level (for example, the modem
314		is hanging up).
315	@constant kSCNetworkConnectionPPPHoldingLinkOff
316		PPP is disconnected and maintaining the link temporarily off.
317	@constant kSCNetworkConnectionPPPSuspended
318		PPP is suspended as a result of the suspend command (for
319		example, when a V.92 Modem is On Hold).
320	@constant kSCNetworkConnectionPPPWaitingForRedial
321		PPP has found a busy server and is waiting for redial.
322 }
323// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
324const
325	kSCNetworkConnectionPPPDisconnected = 0;
326	kSCNetworkConnectionPPPInitializing = 1;
327	kSCNetworkConnectionPPPConnectingLink = 2;
328	kSCNetworkConnectionPPPDialOnTraffic = 3;
329	kSCNetworkConnectionPPPNegotiatingLink = 4;
330	kSCNetworkConnectionPPPAuthenticating = 5;
331	kSCNetworkConnectionPPPWaitingForCallBack = 6;
332	kSCNetworkConnectionPPPNegotiatingNetwork = 7;
333	kSCNetworkConnectionPPPConnected = 8;
334	kSCNetworkConnectionPPPTerminating = 9;
335	kSCNetworkConnectionPPPDisconnectingLink = 10;
336	kSCNetworkConnectionPPPHoldingLinkOff = 11;
337	kSCNetworkConnectionPPPSuspended = 12;
338	kSCNetworkConnectionPPPWaitingForRedial = 13;
339type
340	SCNetworkConnectionPPPStatus = SInt32;
341
342
343{!
344	@typedef SCNetworkConnectionCallBack
345	@discussion Type of the callback function used when a
346		status event is delivered.
347	@param status The connection status.
348	@param connection The connection reference.
349	@param info Application-specific information.
350 }
351type
352  // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
353	SCNetworkConnectionCallBack = procedure( connection: SCNetworkConnectionRef; status: SCNetworkConnectionStatus; info: UnivPtr );
354
355
356{
357    Keys for the statistics dictionary
358}
359
360{$ifc USE_CFSTR_CONSTANT_MACROS}
361{$definec kSCNetworkConnectionBytesIn CFSTRP('BytesIn')}
362{$endc}		{ CFNumber }
363{$ifc USE_CFSTR_CONSTANT_MACROS}
364{$definec kSCNetworkConnectionBytesOut CFSTRP('BytesOut')}
365{$endc}		{ CFNumber }
366{$ifc USE_CFSTR_CONSTANT_MACROS}
367{$definec kSCNetworkConnectionPacketsIn CFSTRP('PacketsIn')}
368{$endc}		{ CFNumber }
369{$ifc USE_CFSTR_CONSTANT_MACROS}
370{$definec kSCNetworkConnectionPacketsOut CFSTRP('PacketsOut')}
371{$endc}		{ CFNumber }
372{$ifc USE_CFSTR_CONSTANT_MACROS}
373{$definec kSCNetworkConnectionErrorsIn CFSTRP('ErrorsIn')}
374{$endc}		{ CFNumber }
375{$ifc USE_CFSTR_CONSTANT_MACROS}
376{$definec kSCNetworkConnectionErrorsOut CFSTRP('ErrorsOut')}
377{$endc}		{ CFNumber }
378
379
380{
381 Keys for the SCNetworkConnectionCopyUserPreferences() "selectionOptions"
382 dictionary
383 }
384
385{!
386	@define kSCNetworkConnectionSelectionOptionOnDemandHostName
387	@discussion A host name that will be used to select the
388		"best" SCNetworkConnection.
389 }
390// #if	(__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000) || TARGET_IPHONE_SIMULATOR
391// Only on  Mac OS X 10.6+, iPhoneOS 3.0+, iPhoneSimulator
392{$ifc USE_CFSTR_CONSTANT_MACROS}
393{$definec kSCNetworkConnectionSelectionOptionOnDemandHostName CFSTRP('OnDemandHostName')}
394{$endc}	{ CFString }
395
396// #endif
397
398{!
399	@define kSCNetworkConnectionSelectionOptionOnDemandRetry
400	@discussion A boolean value used to indicate whether a DNS query has
401		already been issued for the specified OnDemand host name.
402 }
403// #if	(__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) || (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000) || TARGET_IPHONE_SIMULATOR
404// Only on  Mac OS X 10.6+, iPhoneOS 3.0+, iPhoneSimulator
405{$ifc USE_CFSTR_CONSTANT_MACROS}
406{$definec kSCNetworkConnectionSelectionOptionOnDemandRetry CFSTRP('OnDemandRetry')}
407{$endc}		{ CFBoolean }
408// #endif
409
410
411{ until __IPHONE_NA is automatically translated }
412{$ifc TARGET_OS_MAC}
413
414{!
415	@function SCNetworkConnectionGetTypeID
416	@discussion Returns the type identifier of all SCNetworkConnection
417		instances.
418 }
419function SCNetworkConnectionGetTypeID: CFTypeID; external name '_SCNetworkConnectionGetTypeID';
420(* __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA) *)
421
422
423{!
424	@function SCNetworkConnectionCopyUserPreferences
425	@discussion Provides the default service ID and a dictionary of user
426		options for the connection.  Applications can use the
427		returned serviceID and userOptions values to open a
428		connection on the fly.
429	@param selectionOptions Currently unimplemented. Pass NULL for this
430		version.
431	@param serviceID Reference to the default serviceID for starting
432		connections, this value will be returned by the function.
433	@param userOptions Reference to default userOptions for starting
434		connections, this will be returned by the function.
435	@result Returns TRUE if there is a valid service to dial;
436		FALSE if the function was unable to retrieve a service to dial.
437 }
438function SCNetworkConnectionCopyUserPreferences( selectionOptions: CFDictionaryRef; var serviceID: CFStringRef; var userOptions: CFDictionaryRef ): Boolean; external name '_SCNetworkConnectionCopyUserPreferences';
439(* __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA) *)
440
441
442{!
443	@function SCNetworkConnectionCreateWithServiceID
444	@discussion Creates a new connection reference to use for getting
445		the status or for connecting or disconnecting the associated
446		service.
447	@param allocator The CFAllocator that should be used to allocate
448		memory for the connection structure.  This parameter may be
449		NULL in which case the current default CFAllocator is used.
450		If this reference is not a valid CFAllocator, the behavior
451		is undefined.
452	@param serviceID A string that defines the service identifier
453		of the connection.  Service identifiers uniquely identify
454		services in the system configuration database.
455	@param callout The function to be called when the status
456		of the connection changes.  If this parameter is NULL, the
457		application will not receive notifications of status change
458		and will need to poll for updates.
459	@param context The SCNetworkConnectionContext associated with the
460		callout.
461	@result Returns a reference to the new SCNetworkConnection.
462 }
463function SCNetworkConnectionCreateWithServiceID( allocator: CFAllocatorRef; serviceID: CFStringRef; callout: SCNetworkConnectionCallBack; var context: SCNetworkConnectionContext ): SCNetworkConnectionRef; external name '_SCNetworkConnectionCreateWithServiceID';
464(* __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA) *)
465
466
467{!
468	@function SCNetworkConnectionCopyServiceID
469	@discussion Returns the service ID associated with the SCNetworkConnection.
470	@param connection The SCNetworkConnection to obtain status from.
471	@result Returns the service ID associated with the SCNetworkConnection.
472 }
473function SCNetworkConnectionCopyServiceID( connection: SCNetworkConnectionRef ): CFStringRef; external name '_SCNetworkConnectionCopyServiceID';
474(* __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA) *)
475
476
477{!
478	@function SCNetworkConnectionGetStatus
479	@discussion Returns the status of the SCNetworkConnection.
480		A status is one of the following values:
481<pre>
482@textblock
483&#32
484	kSCNetworkConnectionInvalid
485	kSCNetworkConnectionDisconnected
486	kSCNetworkConnectionConnecting
487	kSCNetworkConnectionDisconnecting
488	kSCNetworkConnectionConnected
489@/textblock
490</pre>
491	@param connection The SCNetworkConnection to obtain status from.
492	@result Returns the status value.
493}
494function SCNetworkConnectionGetStatus( connection: SCNetworkConnectionRef ): SCNetworkConnectionStatus; external name '_SCNetworkConnectionGetStatus';
495(* __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA) *)
496
497
498{!
499	@function SCNetworkConnectionCopyExtendedStatus
500	@discussion Returns the extended status of the connection.
501		An extended status dictionary contains specific dictionaries
502		describing the status for each subcomponent of the service.
503
504		For example, a status dictionary will contain the following
505		sub-dictionaries, keys, and values:
506<pre>
507@textblock
508&#32
509	IPv4  : Addresses      : the assigned IP address.
510&#32
511	PPP   : Status         : the PPP-specific status of type
512				 SCNetworkConnectionPPPStatus.
513&#32
514		LastCause      : Available when the status is "Disconnected"
515				 and contains the last error associated with
516				 connecting or disconnecting.
517&#32
518		ConnectTime    : the time when the connection was
519				 established.
520&#32
521	Modem : ConnectSpeed   : the speed of the modem connection
522				 in bits/second.
523&#32
524	IPSec : Status         : the IPSec-specific status of type
525				 SCNetworkConnectionIPSecStatus
526&#32
527		ConnectTime    : the time when the connection was
528				 established.
529
530@/textblock
531</pre>
532		Other dictionaries could be present for PPPoE, PPTP, and L2TP.
533
534		The status dictionary may be extended in the future to contain
535		additional information.
536	@param connection The SCNetworkConnection to obtain status from.
537	@result Returns the status dictionary.
538		If NULL is returned, the error can be retrieved using the SCError function.
539 }
540function SCNetworkConnectionCopyExtendedStatus( connection: SCNetworkConnectionRef ): CFDictionaryRef; external name '_SCNetworkConnectionCopyExtendedStatus';
541(* __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA) *)
542
543
544{!
545	@function SCNetworkConnectionCopyStatistics
546	@discussion Returns the statistics of the SCNetworkConnection.
547		A statistic dictionary contains specific dictionaries
548		with statistics for each subcomponent of the service.
549
550		For example, a statistics dictionary will contain the following
551		sub-dictionaries, keys, and values:
552<pre>
553@textblock
554&#32
555	PPP : BytesIn    :
556	PPP : BytesOut   : Contains the number of bytes going up into
557			   (or coming out of) the network stack for
558			   any networking protocol without the PPP
559			   headers and trailers.
560&#32
561	PPP : PacketsIn  :
562	PPP : PacketsOut : Contains the number of packets going up into
563			   (or coming out of) the network stack for
564			   any networking protocol without the PPP
565			   headers and trailers.
566&#32
567	PPP : ErrorsIn   :
568	PPP : ErrorsOut  : Contains the number of errors going up into
569			   (or coming out of) the network stack for
570			   any networking protocol without the PPP
571			   headers and trailers.
572@/textblock
573</pre>
574		The statistics dictionary may be extended in the future to
575		contain additional information.
576	@param connection The SCNetworkConnection to obtained statistics from.
577	@result Returns the statistics dictionary.
578		If NULL is returned, the error can be retrieved using the SCError function.
579 }
580function SCNetworkConnectionCopyStatistics( connection: SCNetworkConnectionRef ): CFDictionaryRef; external name '_SCNetworkConnectionCopyStatistics';
581(* __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA) *)
582
583
584{!
585	@function SCNetworkConnectionStart
586	@discussion Starts the connection for the SCNetworkConnection.
587		The connection process is asynchronous and the function will
588		return immediately.  The connection status can be obtained
589		by polling or by callback.  The connection is made with the
590		default settings from the administrator.  Some of the settings
591		can be overridden for the duration of the connection.  These
592		are specified in an options dictionary.  The options dictionary
593		uses the same format as a network service defined in the system
594		configuration preferences schema.
595
596		Note: Starting and stopping of connections is implicitly
597		arbitrated.  Calling SCNetworkConnectionStart on a connection
598		already started will indicate that the application has
599		interest in the connection and it shouldn't be stopped by
600		anyone else.
601	@param connection The SCNetworkConnection to start.
602	@param userOptions The options dictionary to start the connection with.
603		If userOptions is NULL, the default settings will be used.
604		If userOptions are specified, they must be in the same format
605		as network services stored in the system configuration
606		preferences schema.  The options will override the default
607		settings defined for the service.
608
609		For security reasons, not all options can be overridden; the
610		appropriate merging of all settings will be done before the
611		connection is established, and inappropriate options will be
612		ignored.
613	@param linger This parameter indicates whether or not the connection
614		can stay around when the application no longer has interest
615		in it.  A typical application should pass FALSE, and the
616		connection will be automatically stopped when the reference
617		is released or if the application quits.  If the application
618		passes TRUE, the application can release the reference or
619		exit and the connection will be maintained until a timeout
620		event, until a specific stop request occurs, or until an
621		error is encountered.
622	@result Returns TRUE if the connection was correctly started (the
623		actual connection is not established yet, and the connection
624		status needs to be periodically checked); FALSE if the
625		connection request was not started.  The error must be
626		retrieved from the SCError function.
627 }
628function SCNetworkConnectionStart( connection: SCNetworkConnectionRef; userOptions: CFDictionaryRef; linger: Boolean ): Boolean; external name '_SCNetworkConnectionStart';
629(* __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA) *)
630
631
632{!
633	@function SCNetworkConnectionStop
634	@discussion Stops the connection for the SCNetworkConnection.
635		The disconnection process is asynchronous and the function
636		will return immediately.  The connection status can be
637		obtained by polling or by callback.  This function performs
638		an arbitrated stop of the connection.  If several applications
639		have marked their interest in the connection, by calling
640		SCNetworkConnectionStart, the call will succeed but the
641		actual connection will be maintained until the last interested
642		application calls SCNetworkConnectionStop.
643
644		In certain cases, you might want to stop the connection anyway.
645		In these cases, you set the forceDisconnect argument to TRUE.
646	@param connection The SCNetworkConnection to stop.
647	@result Returns TRUE if the disconnection request succeeded;
648		FALSE if the disconnection request failed.
649		The error must be retrieved from the SCError function.
650 }
651function SCNetworkConnectionStop( connection: SCNetworkConnectionRef; forceDisconnect: Boolean ): Boolean; external name '_SCNetworkConnectionStop';
652(* __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA) *)
653
654
655{!
656	@function SCNetworkConnectionCopyUserOptions
657	@discussion Copies the user options used to start the connection.
658		This is a mechanism a client can use to retrieve the user options
659		previously passed to the SCNetworkConnectionStart function.
660	@param connection The SCNetworkConnection to obtain options from.
661	@result Returns the service dictionary containing the connection options.
662		The dictionary can be empty if no user options were used.
663		If NULL is returned, the error can be retrieved using the SCError function.
664 }
665function SCNetworkConnectionCopyUserOptions( connection: SCNetworkConnectionRef ): CFDictionaryRef; external name '_SCNetworkConnectionCopyUserOptions';
666(* __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA) *)
667
668
669{!
670	@function SCNetworkConnectionScheduleWithRunLoop
671	@discussion Schedules a connection with the run loop.
672	@param connection The SCNetworkConnection to schedule.
673	@param runLoop The run loop to schedule with.
674	@param runLoopMode The run loop mode.
675	@result Returns TRUE if the connection is scheduled successfully;
676		FALSE if the scheduling failed.
677		The error can be retrieved using the SCError function.
678 }
679function SCNetworkConnectionScheduleWithRunLoop( connection: SCNetworkConnectionRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ): Boolean; external name '_SCNetworkConnectionScheduleWithRunLoop';
680(* __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA) *)
681
682
683{!
684	@function SCNetworkConnectionUnscheduleFromRunLoop
685	@discussion Unschedules a connection from the run loop.
686	@param connection The SCNetworkConnection to unschedule.
687	@param runLoop The run loop to unschedule from.
688	@param runLoopMode The run loop mode.
689	@result Returns TRUE if the connection is unscheduled successfully;
690		FALSE if the unscheduling failed.
691		The error can be retrieved using the SCError function.
692 }
693function SCNetworkConnectionUnscheduleFromRunLoop( connection: SCNetworkConnectionRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ): Boolean; external name '_SCNetworkConnectionUnscheduleFromRunLoop';
694(* __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA) *)
695
696
697{!
698	 @function SCNetworkConnectionSetDispatchQueue
699	 @discussion Caller provides a dispatch queue on which the callback contained in connection will run.
700	 @param connection The SCNetworkConnection to notify.
701	 @param queue The libdispatch queue to run the callback on.
702		Pass NULL to disable notifications, and release queue.
703	 @result Returns TRUE if the notifications have been enabled/disabled as desired;
704		 FALSE if not.
705		 The error can be retrieved using the SCError function.
706 }
707function SCNetworkConnectionSetDispatchQueue( connection: SCNetworkConnectionRef; queue: dispatch_queue_t ): Boolean; external name '_SCNetworkConnectionSetDispatchQueue';
708(* __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA) *)
709
710{$endc} {TARGET_OS_MAC}
711{$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
712
713end.
714{$endc} {not MACOSALLINCLUDE}