1/*
2 * Copyright (c) 1999-2009 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 _IOKIT_IOETHERNET_CONTROLLER_USER_H
25#define _IOKIT_IOETHERNET_CONTROLLER_USER_H
26
27#include <CoreFoundation/CoreFoundation.h>
28#include <IOKit/IOKitLib.h>
29
30__BEGIN_DECLS
31
32typedef struct __IOEthernetController * IOEthernetControllerRef;
33
34typedef void (*IOEthernetControllerCallback)(IOEthernetControllerRef controller, void * refcon);
35
36extern CFTypeRef kIOEthernetHardwareAddress;
37extern CFTypeRef kIOUserEthernetInterfaceRole;
38
39/*!
40 * @const kIOUserEthernetInterfaceMergeProperties
41 * @abstract
42 * The key for a dictionary of properties to merge into the property table
43 * of the Ethernet interface.
44 * @discussion
45 * The properties supplied to <code>IOEthernetControllerCreate</code> may
46 * contain a dictionary stored using this key. The contents of the dictionary
47 * are merged to the property table of the IOEthernetInterface when it is
48 * initialized, before the interface object is registered and attached as
49 * a child of the Ethernet controller.
50 */
51extern CFTypeRef kIOUserEthernetInterfaceMergeProperties;
52
53/*!
54	@function   IOEthernetControllerGetTypeID
55	@abstract   Returns the type identifier of all IOUserEthernet instances.
56*/
57CF_EXPORT
58CFTypeID IOEthernetControllerGetTypeID(void);
59
60CF_EXPORT
61IOEthernetControllerRef IOEthernetControllerCreate(
62                                CFAllocatorRef                  allocator,
63                                CFDictionaryRef                 properties);
64
65CF_EXPORT
66io_object_t IOEthernetControllerGetIONetworkInterfaceObject(
67                                IOEthernetControllerRef         controller);
68
69CF_EXPORT
70IOReturn    IOEthernetControllerSetLinkStatus(
71                                IOEthernetControllerRef         controller,
72                                Boolean                         state);
73
74CF_EXPORT
75IOReturn    IOEthernetControllerSetPowerSavings(
76								IOEthernetControllerRef			controller,
77								Boolean							state);
78
79CF_EXPORT
80CFIndex     IOEthernetControllerReadPacket(
81                                IOEthernetControllerRef         controller,
82                                uint8_t *                       buffer,
83                                CFIndex                         bufferLength);
84
85CF_EXPORT
86IOReturn    IOEthernetControllerWritePacket(
87                                IOEthernetControllerRef         controller,
88                                const uint8_t *                 buffer,
89                                CFIndex                         bufferLength);
90
91CF_EXPORT
92void        IOEthernetControllerScheduleWithRunLoop(
93                                IOEthernetControllerRef         controller,
94                                CFRunLoopRef                    runLoop,
95                                CFStringRef                     runLoopMode);
96
97CF_EXPORT
98void        IOEthernetControllerUnscheduleFromRunLoop(
99                                IOEthernetControllerRef         controller,
100                                CFRunLoopRef                    runLoop,
101                                CFStringRef                     runLoopMode);
102
103CF_EXPORT
104void        IOEthernetControllerSetDispatchQueue(
105                                IOEthernetControllerRef         controller,
106                                dispatch_queue_t                queue);
107
108CF_EXPORT
109void        IOEthernetControllerRegisterEnableCallback(
110                                IOEthernetControllerRef         controller,
111                                IOEthernetControllerCallback    callback,
112                                void *                          refcon);
113
114CF_EXPORT
115void        IOEthernetControllerRegisterDisableCallback(
116                                IOEthernetControllerRef         controller,
117                                IOEthernetControllerCallback    callback,
118                                void *                          refcon);
119
120CF_EXPORT
121void        IOEthernetControllerRegisterPacketAvailableCallback(
122                                IOEthernetControllerRef         controller,
123                                IOEthernetControllerCallback    callback,
124                                void *                          refcon);
125
126CF_EXPORT
127void        IOEthernetControllerRegisterBSDAttachCallback(
128                                IOEthernetControllerRef         controller,
129                                IOEthernetControllerCallback    callback,
130                                void *                          refcon);
131
132CF_EXPORT
133int         IOEthernetControllerGetBSDSocket(
134                                IOEthernetControllerRef         controller);
135
136__END_DECLS
137
138#endif /* _IOKIT_IOETHERNET_CONTROLLER_USER_H */
139