monitor.h revision 98675
198675Sdes/*	$OpenBSD: monitor.h,v 1.6 2002/06/11 05:46:20 mpech Exp $	*/
298675Sdes
398675Sdes/*
498675Sdes * Copyright 2002 Niels Provos <provos@citi.umich.edu>
598675Sdes * All rights reserved.
698675Sdes *
798675Sdes * Redistribution and use in source and binary forms, with or without
898675Sdes * modification, are permitted provided that the following conditions
998675Sdes * are met:
1098675Sdes * 1. Redistributions of source code must retain the above copyright
1198675Sdes *    notice, this list of conditions and the following disclaimer.
1298675Sdes * 2. Redistributions in binary form must reproduce the above copyright
1398675Sdes *    notice, this list of conditions and the following disclaimer in the
1498675Sdes *    documentation and/or other materials provided with the distribution.
1598675Sdes *
1698675Sdes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1798675Sdes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1898675Sdes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1998675Sdes * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2098675Sdes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2198675Sdes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2298675Sdes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2398675Sdes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2498675Sdes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2598675Sdes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2698675Sdes */
2798675Sdes
2898675Sdes#ifndef _MONITOR_H_
2998675Sdes#define _MONITOR_H_
3098675Sdes
3198675Sdesenum monitor_reqtype {
3298675Sdes	MONITOR_REQ_MODULI, MONITOR_ANS_MODULI,
3398675Sdes	MONITOR_REQ_FREE, MONITOR_REQ_AUTHSERV,
3498675Sdes	MONITOR_REQ_SIGN, MONITOR_ANS_SIGN,
3598675Sdes	MONITOR_REQ_PWNAM, MONITOR_ANS_PWNAM,
3698675Sdes	MONITOR_REQ_AUTH2_READ_BANNER, MONITOR_ANS_AUTH2_READ_BANNER,
3798675Sdes	MONITOR_REQ_AUTHPASSWORD, MONITOR_ANS_AUTHPASSWORD,
3898675Sdes	MONITOR_REQ_BSDAUTHQUERY, MONITOR_ANS_BSDAUTHQUERY,
3998675Sdes	MONITOR_REQ_BSDAUTHRESPOND, MONITOR_ANS_BSDAUTHRESPOND,
4098675Sdes	MONITOR_REQ_SKEYQUERY, MONITOR_ANS_SKEYQUERY,
4198675Sdes	MONITOR_REQ_SKEYRESPOND, MONITOR_ANS_SKEYRESPOND,
4298675Sdes	MONITOR_REQ_KEYALLOWED, MONITOR_ANS_KEYALLOWED,
4398675Sdes	MONITOR_REQ_KEYVERIFY, MONITOR_ANS_KEYVERIFY,
4498675Sdes	MONITOR_REQ_KEYEXPORT,
4598675Sdes	MONITOR_REQ_PTY, MONITOR_ANS_PTY,
4698675Sdes	MONITOR_REQ_PTYCLEANUP,
4798675Sdes	MONITOR_REQ_SESSKEY, MONITOR_ANS_SESSKEY,
4898675Sdes	MONITOR_REQ_SESSID,
4998675Sdes	MONITOR_REQ_RSAKEYALLOWED, MONITOR_ANS_RSAKEYALLOWED,
5098675Sdes	MONITOR_REQ_RSACHALLENGE, MONITOR_ANS_RSACHALLENGE,
5198675Sdes	MONITOR_REQ_RSARESPONSE, MONITOR_ANS_RSARESPONSE,
5298675Sdes	MONITOR_REQ_TERM
5398675Sdes};
5498675Sdes
5598675Sdesstruct mm_master;
5698675Sdesstruct monitor {
5798675Sdes	int			 m_recvfd;
5898675Sdes	int			 m_sendfd;
5998675Sdes	struct mm_master	*m_zback;
6098675Sdes	struct mm_master	*m_zlib;
6198675Sdes	struct Kex		**m_pkex;
6298675Sdes	pid_t			 m_pid;
6398675Sdes};
6498675Sdes
6598675Sdesstruct monitor *monitor_init(void);
6698675Sdesvoid monitor_reinit(struct monitor *);
6798675Sdesvoid monitor_sync(struct monitor *);
6898675Sdes
6998675Sdesstruct Authctxt;
7098675Sdesstruct Authctxt *monitor_child_preauth(struct monitor *);
7198675Sdesvoid monitor_child_postauth(struct monitor *);
7298675Sdes
7398675Sdesstruct mon_table;
7498675Sdesint monitor_read(struct monitor*, struct mon_table *, struct mon_table **);
7598675Sdes
7698675Sdes/* Prototypes for request sending and receiving */
7798675Sdesvoid mm_request_send(int, enum monitor_reqtype, Buffer *);
7898675Sdesvoid mm_request_receive(int, Buffer *);
7998675Sdesvoid mm_request_receive_expect(int, enum monitor_reqtype, Buffer *);
8098675Sdes
8198675Sdes#endif /* _MONITOR_H_ */
82