xref: /titanic_52/usr/src/lib/gss_mechs/mech_krb5/include/foreachaddr.h (revision 505d05c73a6e56769f263d4803b22eddd168ee24)
1 #pragma ident	"%Z%%M%	%I%	%E% SMI"
2 
3 /*
4  * include/foreachaddr.c
5  *
6  * Copyright 1990,1991,2000,2001,2002,2004 by the Massachusetts Institute of Technology.
7  * All Rights Reserved.
8  *
9  * Export of this software from the United States of America may
10  *   require a specific license from the United States Government.
11  *   It is the responsibility of any person or organization contemplating
12  *   export to obtain such a license before exporting.
13  *
14  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
15  * distribute this software and its documentation for any purpose and
16  * without fee is hereby granted, provided that the above copyright
17  * notice appear in all copies and that both that copyright notice and
18  * this permission notice appear in supporting documentation, and that
19  * the name of M.I.T. not be used in advertising or publicity pertaining
20  * to distribution of the software without specific, written prior
21  * permission.  Furthermore if you modify this software you must label
22  * your software as modified software and not distribute it in such a
23  * fashion that it might be confused with the original M.I.T. software.
24  * M.I.T. makes no representations about the suitability of
25  * this software for any purpose.  It is provided "as is" without express
26  * or implied warranty.
27  *
28  *
29  * Iterate over the protocol addresses supported by this host, invoking
30  * a callback function or three supplied by the caller.
31  *
32  * XNS support is untested, but "should just work".  (Hah!)
33  */
34 
35 /* This function iterates over all the addresses it can find for the
36    local system, in one or two passes.  In each pass, and between the
37    two, it can invoke callback functions supplied by the caller.  The
38    two passes should operate on the same information, though not
39    necessarily in the same order each time.  Duplicate and local
40    addresses should be eliminated.  Storage passed to callback
41    functions should not be assumed to be valid after foreach_localaddr
42    returns.
43 
44    The int return value is an errno value (XXX or krb5_error_code
45    returned for a socket error) if something internal to
46    foreach_localaddr fails.  If one of the callback functions wants to
47    indicate an error, it should store something via the 'data' handle.
48    If any callback function returns a non-zero value,
49    foreach_localaddr will clean up and return immediately.
50 
51    Multiple definitions are provided below, dependent on various
52    system facilities for extracting the necessary information.  */
53 
54 extern int
55 krb5int_foreach_localaddr (/*@null@*/ void *data,
56 			   int (*pass1fn) (/*@null@*/ void *,
57 					   struct sockaddr *) /*@*/,
58 			   /*@null@*/ int (*betweenfn) (/*@null@*/ void *) /*@*/,
59 			   /*@null@*/ int (*pass2fn) (/*@null@*/ void *,
60 						      struct sockaddr *) /*@*/)
61 #if defined(DEBUG) || defined(TEST)
62      /*@modifies fileSystem@*/
63 #endif
64     ;
65 
66 #define foreach_localaddr krb5int_foreach_localaddr
67