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