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