]>
Commit | Line | Data |
---|---|---|
dbf6a266 | 1 | /* |
78403150 | 2 | * Copyright (c) 2004, 2006, 2011, 2014 Apple Inc. All rights reserved. |
dbf6a266 A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
78403150 | 5 | * |
dbf6a266 A |
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. | |
78403150 | 12 | * |
dbf6a266 A |
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. | |
78403150 | 20 | * |
dbf6a266 A |
21 | * @APPLE_LICENSE_HEADER_END@ |
22 | */ | |
23 | ||
24 | /* | |
25 | * Modification History | |
26 | * | |
27 | * August 5, 2004 Allan Nathanson <ajn@apple.com> | |
28 | * - initial revision | |
29 | */ | |
30 | ||
31 | #ifndef _NET_H | |
32 | #define _NET_H | |
33 | ||
34 | #include <sys/cdefs.h> | |
35 | ||
36 | #include <CoreFoundation/CoreFoundation.h> | |
37 | #include <SystemConfiguration/SystemConfiguration.h> | |
38 | ||
39 | ||
40 | typedef int (*optionHandler) (CFStringRef key, | |
41 | const char *description, | |
42 | void *info, | |
43 | int argc, | |
44 | char **argv, | |
45 | CFMutableDictionaryRef newConfiguration); | |
46 | ||
47 | typedef enum { | |
48 | isOther, // use "only" handler function for processing | |
49 | isHelp, | |
50 | isChooseOne, | |
51 | isChooseMultiple, | |
52 | isBoolean, | |
53 | isNumber, | |
54 | isString, | |
55 | isStringArray | |
56 | } optionType; | |
57 | ||
58 | typedef const struct { | |
59 | const CFStringRef selection; | |
60 | const CFStringRef *key; | |
61 | const unsigned int flags; | |
62 | } selections; | |
63 | #define selectionNotAvailable 1<<0 // if you can't "choose" this selection | |
64 | ||
65 | typedef const struct { | |
66 | const char *option; | |
67 | const char *description; | |
68 | optionType type; | |
69 | const CFStringRef *key; | |
70 | optionHandler handler; | |
71 | void *info; | |
72 | } options, *optionsRef; | |
73 | ||
74 | ||
dbf6a266 A |
75 | extern CFMutableArrayRef new_interfaces; |
76 | ||
77 | extern CFArrayRef interfaces; | |
78 | extern CFArrayRef services; | |
79 | extern CFArrayRef protocols; | |
80 | extern CFArrayRef sets; | |
81 | ||
82 | extern SCNetworkInterfaceRef net_interface; | |
83 | extern SCNetworkServiceRef net_service; | |
84 | extern SCNetworkProtocolRef net_protocol; | |
85 | extern SCNetworkSetRef net_set; | |
86 | ||
87 | extern CFNumberRef CFNumberRef_0; | |
88 | extern CFNumberRef CFNumberRef_1; | |
89 | ||
90 | ||
91 | __BEGIN_DECLS | |
92 | ||
93 | Boolean _process_options(optionsRef options, | |
94 | int nOptions, | |
95 | int argc, | |
96 | char **argv, | |
97 | CFMutableDictionaryRef newConfiguration); | |
98 | ||
17d3ee29 | 99 | CF_RETURNS_RETAINED |
dbf6a266 A |
100 | CFNumberRef _copy_number (const char *arg); |
101 | ||
102 | CFIndex _find_option (const char *option, | |
103 | optionsRef options, | |
104 | const int nOptions); | |
105 | ||
106 | CFIndex _find_selection (CFStringRef choice, | |
107 | selections choises[], | |
108 | unsigned int *flags); | |
109 | ||
110 | void _show_entity (CFDictionaryRef entity, CFStringRef prefix); | |
111 | ||
17d3ee29 A |
112 | void do_net_init (void); |
113 | void do_net_quit (int argc, char **argv); | |
dbf6a266 | 114 | |
17d3ee29 A |
115 | void do_net_open (int argc, char **argv); |
116 | void do_net_commit (int argc, char **argv); | |
117 | void do_net_apply (int argc, char **argv); | |
118 | void do_net_close (int argc, char **argv); | |
dbf6a266 | 119 | |
17d3ee29 A |
120 | void do_net_create (int argc, char **argv); |
121 | void do_net_disable (int argc, char **argv); | |
122 | void do_net_enable (int argc, char **argv); | |
78403150 | 123 | void do_net_migrate (int argc, char **argv); |
17d3ee29 A |
124 | void do_net_remove (int argc, char **argv); |
125 | void do_net_select (int argc, char **argv); | |
126 | void do_net_set (int argc, char **argv); | |
127 | void do_net_show (int argc, char **argv); | |
128 | void do_net_update (int argc, char **argv); | |
dbf6a266 | 129 | |
17d3ee29 | 130 | void do_net_snapshot (int argc, char **argv); |
dbf6a266 A |
131 | |
132 | __END_DECLS | |
133 | ||
134 | #endif /* !_NET_H */ |