// -*-c++-*- /* $Id: sfsserv.h,v 1.8 2001/04/15 23:22:54 dm Exp $ */ /* * * Copyright (C) 2000 David Mazieres (dm@uun.org) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * */ #include "sfsmisc.h" #include "arpc.h" #include "crypt.h" #include "seqno.h" class sfsserv { struct condat { sfs_connectinfo ci; sfs_connectres cr; }; ptr sk; public: const ref xc; const ref x; const ref destroyed; private: vec authfreelist; rpc_ptr cd; sfs_hashcharge charge; protected: ref sfssrv; void dispatch (svccb *sbp); virtual ptr doconnect (const sfs_connectarg *, sfs_servinfo *) = 0; public: seqcheck seqstate; bool authid_valid; sfs_hash sessid; sfs_hash authid; vec authtab; vec credtab; explicit sfsserv (ref xc, ptr x = NULL); virtual ~sfsserv (); u_int32_t authalloc (); void authfree (size_t n); AUTH *getauth (size_t n) { return n < authtab.size () ? implicit_cast (authtab[n]) : (AUTH *) NULL; } virtual void sfs_connect (svccb *sbp); virtual void sfs_encrypt (svccb *sbp); virtual void sfs_getfsinfo (svccb *sbp) { sbp->reject (PROC_UNAVAIL); } virtual void sfs_login (svccb *sbp); virtual void sfs_logout (svccb *sbp); virtual void sfs_idnames (svccb *sbp); virtual void sfs_idnums (svccb *sbp); virtual void sfs_getcred (svccb *sbp); virtual void sfs_badproc (svccb *sbp) { sbp->reject (PROC_UNAVAIL); } }; typedef callback >::ref sfsserv_cb; void sfssd_slave (sfsserv_cb cb); ptr getauthclnt ();