xref: /freebsd/crypto/openssh/match.h (revision b66f2d16a0435b7e7f3edde6101797004ae8d3b9)
1b66f2d16SKris Kennaway /*
2b66f2d16SKris Kennaway  * Author: Tatu Ylonen <ylo@cs.hut.fi>
3b66f2d16SKris Kennaway  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4b66f2d16SKris Kennaway  *                    All rights reserved
5b66f2d16SKris Kennaway  * This file contains various auxiliary functions related to multiple
6b66f2d16SKris Kennaway  * precision integers.
7b66f2d16SKris Kennaway  *
8b66f2d16SKris Kennaway  * As far as I am concerned, the code I have written for this software
9b66f2d16SKris Kennaway  * can be used freely for any purpose.  Any derived versions of this
10b66f2d16SKris Kennaway  * software must be clearly marked as such, and if the derived work is
11b66f2d16SKris Kennaway  * incompatible with the protocol description in the RFC file, it must be
12b66f2d16SKris Kennaway  * called by a name other than "ssh" or "Secure Shell".
13b66f2d16SKris Kennaway  */
14a8f6863aSKris Kennaway #ifndef MATCH_H
15a8f6863aSKris Kennaway #define MATCH_H
16a8f6863aSKris Kennaway 
17a8f6863aSKris Kennaway /*
18a8f6863aSKris Kennaway  * Returns true if the given string matches the pattern (which may contain ?
19a8f6863aSKris Kennaway  * and * as wildcards), and zero if it does not match.
20a8f6863aSKris Kennaway  */
21a8f6863aSKris Kennaway int     match_pattern(const char *s, const char *pattern);
22a8f6863aSKris Kennaway 
23a8f6863aSKris Kennaway /*
24a8f6863aSKris Kennaway  * Tries to match the host name (which must be in all lowercase) against the
25a8f6863aSKris Kennaway  * comma-separated sequence of subpatterns (each possibly preceded by ! to
26b66f2d16SKris Kennaway  * indicate negation).  Returns -1 if negation matches, 1 if there is
27b66f2d16SKris Kennaway  * a positive match, 0 if there is no match at all.
28a8f6863aSKris Kennaway  */
29a8f6863aSKris Kennaway int     match_hostname(const char *host, const char *pattern, unsigned int len);
30a8f6863aSKris Kennaway 
31a8f6863aSKris Kennaway #endif
32