blob: 41591068695dfe74d902dbe8243057e3167d009f [file] [log] [blame]
Damien Miller7b58e802005-12-13 19:33:19 +11001/* $OpenBSD: misc.h,v 1.28 2005/12/08 18:34:11 reyk Exp $ */
Ben Lindstrom36579d32001-01-29 07:39:26 +00002
Ben Lindstrom226cfa02001-01-22 05:34:40 +00003/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
5 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
6 * All rights reserved
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 */
Ben Lindstrom226cfa02001-01-22 05:34:40 +000014
Darren Tuckere608ca22004-05-13 16:15:47 +100015/* misc.c */
16
Kevin Stevesd009ae32001-07-04 17:25:54 +000017char *chop(char *);
18char *strdelim(char **);
Damien Miller232711f2004-06-15 10:35:30 +100019int set_nonblock(int);
20int unset_nonblock(int);
Damien Miller398e1cf2002-02-05 11:52:13 +110021void set_nodelay(int);
Kevin Stevesd009ae32001-07-04 17:25:54 +000022int a2port(const char *);
Damien Millerd27b9472005-12-13 19:29:02 +110023int a2tun(const char *, int *);
Damien Millerf91ee4c2005-03-01 21:24:33 +110024char *hpdelim(char **);
Kevin Stevesd009ae32001-07-04 17:25:54 +000025char *cleanhostname(char *);
26char *colon(char *);
27long convtime(const char *);
Damien Miller5fd38c02005-05-26 12:02:14 +100028char *tilde_expand_filename(const char *, uid_t);
Darren Tucker8e2eb302005-07-14 17:07:21 +100029char *percent_expand(const char *, ...) __attribute__((__sentinel__));
Damien Miller13390022005-07-06 09:44:19 +100030char *tohex(const u_char *, u_int);
Darren Tuckerce321d82005-10-03 18:11:24 +100031void sanitise_stdfd(void);
Kevin Stevesd009ae32001-07-04 17:25:54 +000032
33struct passwd *pwcopy(struct passwd *);
Ben Lindstrom226cfa02001-01-22 05:34:40 +000034
Ben Lindstrom387c4722001-05-08 20:27:25 +000035typedef struct arglist arglist;
36struct arglist {
Ben Lindstrom6328ab32002-03-22 02:54:23 +000037 char **list;
Darren Tuckerc7a6fc42004-08-13 21:18:00 +100038 u_int num;
39 u_int nalloc;
Ben Lindstrom387c4722001-05-08 20:27:25 +000040};
Kevin Stevesd009ae32001-07-04 17:25:54 +000041void addargs(arglist *, char *, ...) __attribute__((format(printf, 2, 3)));
Darren Tucker06f2bd82004-05-13 16:06:46 +100042
Darren Tuckere608ca22004-05-13 16:15:47 +100043/* readpass.c */
44
45#define RP_ECHO 0x0001
46#define RP_ALLOW_STDIN 0x0002
47#define RP_ALLOW_EOF 0x0004
Damien Miller23f07702004-06-18 01:19:03 +100048#define RP_USE_ASKPASS 0x0008
Darren Tuckere608ca22004-05-13 16:15:47 +100049
50char *read_passphrase(const char *, int);
Darren Tuckerce327b62004-11-05 20:38:03 +110051int ask_permission(const char *, ...) __attribute__((format(printf, 1, 2)));
Darren Tuckerf0f90982004-12-11 13:39:50 +110052int read_keyfile_line(FILE *, const char *, char *, size_t, u_long *);
Damien Miller7b58e802005-12-13 19:33:19 +110053
54int tun_open(int, int);
55
56/* Common definitions for ssh tunnel device forwarding */
57#define SSH_TUNMODE_NO 0x00
58#define SSH_TUNMODE_POINTOPOINT 0x01
59#define SSH_TUNMODE_ETHERNET 0x02
60#define SSH_TUNMODE_DEFAULT SSH_TUNMODE_POINTOPOINT
61#define SSH_TUNMODE_YES (SSH_TUNMODE_POINTOPOINT|SSH_TUNMODE_ETHERNET)
62
63#define SSH_TUNID_ANY 0x7fffffff
64#define SSH_TUNID_ERR (SSH_TUNID_ANY - 1)
65#define SSH_TUNID_MAX (SSH_TUNID_ANY - 2)