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