1/*
2 * Copyright (c) 2000-2014 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
24#ifndef _S_IPCONFIG_TYPES_H
25#define _S_IPCONFIG_TYPES_H
26
27#include <sys/types.h>
28#include <netinet/in.h>
29
30#ifdef mig_external
31#undef mig_external
32#endif
33#define mig_external __private_extern__
34
35#define IPCONFIG_IF_ANY		""
36#define MAX_IF_NAMELEN 		32
37#define MAX_INLINE_DATA 	2048
38
39typedef char if_name_t[MAX_IF_NAMELEN];
40typedef char inline_data_t[MAX_INLINE_DATA];
41typedef uint8_t * xmlData_t;
42typedef u_int32_t ip_address_t;
43
44typedef enum {
45    ipconfig_status_success_e = 0,
46    ipconfig_status_permission_denied_e = 1,
47    ipconfig_status_interface_does_not_exist_e = 2,
48    ipconfig_status_invalid_parameter_e = 3,
49    ipconfig_status_invalid_operation_e = 4,
50    ipconfig_status_allocation_failed_e = 5,
51    ipconfig_status_internal_error_e = 6,
52    ipconfig_status_operation_not_supported_e = 7,
53    ipconfig_status_address_in_use_e = 8,
54    ipconfig_status_no_server_e = 9,
55    ipconfig_status_server_not_responding_e = 10,
56    ipconfig_status_lease_terminated_e = 11,
57    ipconfig_status_media_inactive_e = 12,
58    ipconfig_status_server_error_e = 13,
59    ipconfig_status_no_such_service_e = 14,
60    ipconfig_status_duplicate_service_e = 15,
61    ipconfig_status_address_timed_out_e = 16,
62    ipconfig_status_not_found_e = 17,
63    ipconfig_status_resource_unavailable_e = 18,
64    ipconfig_status_network_changed_e = 19,
65    ipconfig_status_last_e,
66} ipconfig_status_t;
67
68static __inline__ const char *
69ipconfig_status_string(ipconfig_status_t status)
70{
71    static const char * str[] = {
72	"success",
73	"permission denied",
74	"interface doesn't exist",
75	"invalid parameter",
76	"invalid operation",
77	"allocation failed",
78	"internal error",
79	"operation not supported",
80	"address in use",
81	"no server",
82	"server not responding",
83	"lease terminated",
84	"media inactive",
85	"server error",
86	"no such service",
87	"duplicate service",
88	"address timed out",
89	"not found",
90	"resource unavailable",
91	"network changed"
92    };
93    if (status >= ipconfig_status_last_e)
94	return ("<unknown>");
95    return (str[status]);
96}
97
98#endif /* _S_IPCONFIG_TYPES_H */
99