hostfile.h revision 221420
133965Sjdp/* $OpenBSD: hostfile.h,v 1.19 2010/11/29 23:45:51 djm Exp $ */
233965Sjdp
333965Sjdp/*
433965Sjdp * Author: Tatu Ylonen <ylo@cs.hut.fi>
533965Sjdp * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
633965Sjdp *                    All rights reserved
733965Sjdp *
833965Sjdp * As far as I am concerned, the code I have written for this software
933965Sjdp * can be used freely for any purpose.  Any derived versions of this
1033965Sjdp * software must be clearly marked as such, and if the derived work is
1133965Sjdp * incompatible with the protocol description in the RFC file, it must be
1233965Sjdp * called by a name other than "ssh" or "Secure Shell".
1333965Sjdp */
1433965Sjdp#ifndef HOSTFILE_H
1533965Sjdp#define HOSTFILE_H
1633965Sjdp
1733965Sjdptypedef enum {
1838889Sjdp	HOST_OK, HOST_NEW, HOST_CHANGED, HOST_REVOKED, HOST_FOUND
1933965Sjdp}       HostStatus;
2033965Sjdp
2133965Sjdptypedef enum {
22218822Sdim	MRK_ERROR, MRK_NONE, MRK_REVOKE, MRK_CA
23130561Sobrien}	HostkeyMarker;
24130561Sobrien
25130561Sobrienstruct hostkey_entry {
26218822Sdim	char *host;
27218822Sdim	char *file;
28218822Sdim	u_long line;
2933965Sjdp	Key *key;
3060484Sobrien	HostkeyMarker marker;
3133965Sjdp};
3233965Sjdpstruct hostkeys;
3333965Sjdp
34218822Sdimstruct hostkeys *init_hostkeys(void);
35218822Sdimvoid	 load_hostkeys(struct hostkeys *, const char *, const char *);
36130561Sobrienvoid	 free_hostkeys(struct hostkeys *);
3777298Sobrien
38130561SobrienHostStatus check_key_in_hostkeys(struct hostkeys *, Key *,
39130561Sobrien    const struct hostkey_entry **);
40130561Sobrienint	 lookup_key_in_hostkeys_by_type(struct hostkeys *, int,
4133965Sjdp    const struct hostkey_entry **);
42130561Sobrien
43130561Sobrienint	 hostfile_read_key(char **, u_int *, Key *);
44130561Sobrienint	 add_host_to_hostfile(const char *, const char *, const Key *, int);
45130561Sobrien
4689857Sobrien#define HASH_MAGIC	"|1|"
4733965Sjdp#define HASH_DELIM	'|'
4833965Sjdp
4933965Sjdp#define CA_MARKER	"@cert-authority"
5033965Sjdp#define REVOKE_MARKER	"@revoked"
51130561Sobrien
52130561Sobrienchar	*host_hash(const char *, const char *, u_int);
5333965Sjdp
5433965Sjdp#endif
5533965Sjdp