11e8db6e2SBrian Feldman /* $OpenBSD: match.h,v 1.7 2001/03/10 17:51:04 markus Exp $ */ 21e8db6e2SBrian Feldman 3b66f2d16SKris Kennaway /* 4b66f2d16SKris Kennaway * Author: Tatu Ylonen <ylo@cs.hut.fi> 5b66f2d16SKris Kennaway * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 6b66f2d16SKris Kennaway * All rights reserved 7b66f2d16SKris Kennaway * This file contains various auxiliary functions related to multiple 8b66f2d16SKris Kennaway * precision integers. 9b66f2d16SKris Kennaway * 10b66f2d16SKris Kennaway * As far as I am concerned, the code I have written for this software 11b66f2d16SKris Kennaway * can be used freely for any purpose. Any derived versions of this 12b66f2d16SKris Kennaway * software must be clearly marked as such, and if the derived work is 13b66f2d16SKris Kennaway * incompatible with the protocol description in the RFC file, it must be 14b66f2d16SKris Kennaway * called by a name other than "ssh" or "Secure Shell". 15b66f2d16SKris Kennaway */ 16a8f6863aSKris Kennaway #ifndef MATCH_H 17a8f6863aSKris Kennaway #define MATCH_H 18a8f6863aSKris Kennaway 19a8f6863aSKris Kennaway /* 20a8f6863aSKris Kennaway * Returns true if the given string matches the pattern (which may contain ? 21a8f6863aSKris Kennaway * and * as wildcards), and zero if it does not match. 22a8f6863aSKris Kennaway */ 23a8f6863aSKris Kennaway int match_pattern(const char *s, const char *pattern); 24a8f6863aSKris Kennaway 25a8f6863aSKris Kennaway /* 26a8f6863aSKris Kennaway * Tries to match the host name (which must be in all lowercase) against the 27a8f6863aSKris Kennaway * comma-separated sequence of subpatterns (each possibly preceded by ! to 28b66f2d16SKris Kennaway * indicate negation). Returns -1 if negation matches, 1 if there is 29b66f2d16SKris Kennaway * a positive match, 0 if there is no match at all. 30a8f6863aSKris Kennaway */ 311e8db6e2SBrian Feldman int match_hostname(const char *host, const char *pattern, u_int len); 321e8db6e2SBrian Feldman 331e8db6e2SBrian Feldman /* 341e8db6e2SBrian Feldman * Returns first item from client-list that is also supported by server-list, 351e8db6e2SBrian Feldman * caller must xfree() returned string. 361e8db6e2SBrian Feldman */ 371e8db6e2SBrian Feldman char *match_list(const char *client, const char *server, u_int *next); 38a8f6863aSKris Kennaway 39a8f6863aSKris Kennaway #endif 40