1#ifndef _S_FDHANDLER_H
2#define _S_FDHANDLER_H
3
4/*
5 * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
6 *
7 * @APPLE_LICENSE_HEADER_START@
8 *
9 * This file contains Original Code and/or Modifications of Original Code
10 * as defined in and that are subject to the Apple Public Source License
11 * Version 2.0 (the 'License'). You may not use this file except in
12 * compliance with the License. Please obtain a copy of the License at
13 * http://www.opensource.apple.com/apsl/ and read it before using this
14 * file.
15 *
16 * The Original Code and all software distributed under the License are
17 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
18 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
19 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
21 * Please see the License for the specific language governing rights and
22 * limitations under the License.
23 *
24 * @APPLE_LICENSE_HEADER_END@
25 */
26
27/*
28 * FDHandler.h
29 * - notification/callback services for a file descriptor
30 */
31
32/*
33 * Modification History
34 *
35 * October 26, 2001	Dieter Siegmund (dieter@apple.com)
36 * - created (based on bootp/IPConfiguration.tproj/FDSet.c)
37 */
38
39/*
40 * Type: FDHandler_func
41 * Purpose:
42 *   Function to call when the file descriptor is ready.
43 */
44
45typedef void (FDHandler_func)(void * arg1, void * arg2);
46
47typedef struct FDHandler_s FDHandler;
48
49FDHandler *
50FDHandler_create(int fd);
51
52void
53FDHandler_free(FDHandler * * handler_p);
54
55void
56FDHandler_enable(FDHandler * handler, FDHandler_func * func,
57		 void * arg1, void * arg2);
58void
59FDHandler_disable(FDHandler * handler);
60
61int
62FDHandler_fd(FDHandler * handler);
63
64#endif /* _S_FDHANDLER_H */
65