]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/network/IONetworkLib.h
375c5693c3de195c2d7ffbf838cae443050da18c
[apple/xnu.git] / iokit / IOKit / network / IONetworkLib.h
1 /*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
24 *
25 * HISTORY
26 *
27 */
28
29 #ifndef _IONETWORKLIB_H
30 #define _IONETWORKLIB_H
31
32 #include <IOKit/IOKitLib.h>
33 #include <IOKit/network/IONetworkData.h>
34 #include <IOKit/network/IONetworkMedium.h>
35 #include <IOKit/network/IONetworkStats.h>
36 #include <IOKit/network/IOEthernetStats.h>
37 #include <IOKit/network/IONetworkUserClient.h>
38
39 typedef UInt32 IONDHandle;
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 /*! @function IONetworkOpen
46 @abstract Open a connection to an IONetworkInterface object.
47 An IONetworkUserClient object is created to manage the connection. */
48
49 IOReturn IONetworkOpen(io_object_t obj, io_connect_t * con);
50
51 /*! @function IONetworkClose
52 @abstract Close the connection to an IONetworkInterface object. */
53
54 IOReturn IONetworkClose(io_connect_t con);
55
56 /*! @function IONetworkWriteData
57 @abstract Write to the buffer of a network data object.
58 @param conObject The connection object.
59 @param dataHandle The handle of a network data object.
60 @param srcBuf The data to write is taken from this buffer.
61 @param inSize The size of the source buffer.
62 @result kIOReturnSuccess on success, or an error code otherwise. */
63
64 IOReturn IONetworkWriteData(io_connect_t conObj,
65 IONDHandle dataHandle,
66 UInt8 * srcBuf,
67 UInt32 inSize);
68
69 /*! @function IONetworkReadData
70 @abstract Read the buffer of a network data object.
71 @param conObject The connection object.
72 @param dataHandle The handle of a network data object.
73 @param destBuf The buffer where the data read shall be written to.
74 @param inOutSizeP Pointer to an integer that the caller must initialize
75 to contain the size of the buffer. This function will overwrite
76 it with the actual number of bytes written to the buffer.
77 @result kIOReturnSuccess on success, or an error code otherwise. */
78
79 IOReturn IONetworkReadData(io_connect_t conObj,
80 IONDHandle dataHandle,
81 UInt8 * destBuf,
82 UInt32 * inOutSizeP);
83
84 /*! @function IONetworkResetData
85 @abstract Fill the buffer of a network data object with zeroes.
86 @param conObject The connection object.
87 @param dataHandle The handle of a network data object.
88 @result kIOReturnSuccess on success, or an error code otherwise. */
89
90 IOReturn IONetworkResetData(io_connect_t conObject, IONDHandle dataHandle);
91
92 /*! @function IONetworkGetDataCapacity
93 @abstract Get the capacity (in bytes) of a network data object.
94 @param con The connection object.
95 @param dataHandle The handle of a network data object.
96 @param capacityP Upon success, the capacity is written to this address.
97 @result kIOReturnSuccess on success, or an error code otherwise. */
98
99 IOReturn IONetworkGetDataCapacity(io_connect_t conObject,
100 IONDHandle dataHandle,
101 UInt32 * capacityP);
102
103 /*! @function IONetworkGetDataHandle
104 @abstract Get the handle of a network data object with the given name.
105 @param con The connection object.
106 @param dataName The name of the network data object.
107 @param dataHandleP Upon success, the handle is written to this address.
108 @result kIOReturnSuccess on success, or an error code otherwise. */
109
110 IOReturn IONetworkGetDataHandle(io_connect_t conObject,
111 const char * dataName,
112 IONDHandle * dataHandleP);
113
114 #ifdef __cplusplus
115 }
116 #endif
117
118 #endif /* !_IONETWORKLIB_H */