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