1 /*
2  * lftp - file transfer program
3  *
4  * Copyright (c) 1996-2012 by Alexander V. Lukyanov (lav@yars.free.net)
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 /* $Id: DummyProto.cc,v 1.12 2009/03/20 12:28:04 lav Exp $ */
21 
22 #include <config.h>
23 
24 #include "DummyProto.h"
25 #include <stddef.h>
26 
DummyProto()27 DummyProto::DummyProto() {}
~DummyProto()28 DummyProto::~DummyProto() {}
Do()29 int DummyProto::Do() { return STALL; }
Done()30 int DummyProto::Done() { return NO_HOST; }
GetProto() const31 const char *DummyProto::GetProto() const { return ""; }
Clone() const32 FileAccess *DummyProto::Clone() const { return new DummyProto; }
Read(Buffer * buf,int size)33 int DummyProto::Read(Buffer *buf,int size) { return NO_HOST; };
Write(const void * buf,int size)34 int DummyProto::Write(const void *buf,int size) { return NO_HOST; };
StoreStatus()35 int DummyProto::StoreStatus() { return NO_HOST; }
36 
37 class DummyDirList : public DirList
38 {
39 public:
DummyDirList(FA * p1,ArgV * a)40    DummyDirList(FA *p1,ArgV *a) : DirList(p1,a) {}
Do()41    int Do() { SetError(session->StrError(FA::NO_HOST)); return STALL; }
Status()42    const char *Status() { return ""; }
43 };
44 class DummyListInfo : public ListInfo
45 {
46 public:
DummyListInfo(FA * p1)47    DummyListInfo(FA *p1) : ListInfo(p1,0) {}
Do()48    int Do() { SetError(session->StrError(FA::NO_HOST)); return STALL; }
Status()49    const char *Status() { return ""; }
50 };
MakeDirList(ArgV * a)51 DirList *DummyProto::MakeDirList(ArgV *a)
52 {
53    return new DummyDirList(this,a);
54 }
MakeListInfo(const char * path)55 ListInfo *DummyProto::MakeListInfo(const char *path)
56 {
57    return new DummyListInfo(this);
58 }
59 
GetProto() const60 const char *DummyNoProto::GetProto() const { return proto; }
Clone() const61 FileAccess *DummyNoProto::Clone() const { return new DummyNoProto(proto); }
StrError(int)62 const char *DummyNoProto::StrError(int)
63 {
64    static xstring str;
65    str.vset(proto.get(),_(" - not supported protocol"),NULL);
66    return str;
67 }
68