plptools
Loading...
Searching...
No Matches
channel.h
Go to the documentation of this file.
1/*
2 * This file is part of plptools.
3 *
4 * Copyright (C) 1999 Philip Proudman <philip.proudman@btinternet.com>
5 * Copyright (C) 1999-2001 Fritz Elfert <felfert@to.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * along with this program; if not, see <https://www.gnu.org/licenses/>.
19 *
20 */
21#pragma once
22
23#include "config.h"
24#include <stdio.h>
25
26class NCP;
27class BufferStore;
28class PcServer;
29class TCPSocket;
30
31class Channel {
32public:
34 virtual ~Channel() = 0;
36
37 void setNcpChannel(int chan);
38 int getNcpChannel(void);
39 void ncpSend(BufferStore &a);
40 void setVerbose(short int _verbose);
41 short int getVerbose();
42 virtual void ncpDataCallback(BufferStore &a) = 0;
43 virtual const char *getNcpRegisterName() = 0;
44 void ncpConnect();
45 void ncpRegister();
46 void ncpDoRegisterAck(int ch, const char *name);
47 virtual void ncpConnectAck() = 0;
48 virtual void ncpConnectTerminate() = 0;
49 virtual void ncpConnectNak() = 0;
50 virtual void ncpRegisterAck() = 0;
51 void ncpDisconnect();
52 short int ncpProtocolVersion();
53 const char *getNcpConnectName();
54 void setNcpConnectName(const char *);
55
56 // The following two calls are used for destructing an instance
57
61 bool shouldTerminate() const; // Mainloop will terminate this class if true
62 void terminateWhenAsked();
63
64 PcServer *ncpFindPcServer(const char *name);
65 void ncpRegisterPcServer(TCPSocket *skt, const char *name);
66 void ncpUnregisterPcServer(PcServer *server);
67 int ncpGetSpeed();
68
69protected:
70 short int verbose;
71 const char *connectName;
72
73private:
77};
A generic container for an array of bytes.
Definition: bufferstore.h:36
NCP * ncpController
Definition: channel.h:74
void ncpUnregisterPcServer(PcServer *server)
Definition: channel.cc:84
void ncpDoRegisterAck(int ch, const char *name)
Definition: channel.cc:68
const char * getNcpConnectName()
Definition: channel.cc:116
void setVerbose(short int _verbose)
Definition: channel.cc:108
virtual void ncpDataCallback(BufferStore &a)=0
short int ncpProtocolVersion()
Definition: channel.cc:92
void newNcpController(NCP *ncpController)
Definition: channel.cc:104
void ncpRegisterPcServer(TCPSocket *skt, const char *name)
Definition: channel.cc:80
PcServer * ncpFindPcServer(const char *name)
Definition: channel.cc:76
virtual void ncpConnectAck()=0
void setNcpConnectName(const char *)
Definition: channel.cc:120
int ncpGetSpeed()
Definition: channel.cc:88
virtual const char * getNcpRegisterName()=0
virtual void ncpConnectNak()=0
void ncpDisconnect()
Definition: channel.cc:72
void setNcpChannel(int chan)
Definition: channel.cc:96
short int getVerbose()
Definition: channel.cc:112
short int verbose
Definition: channel.h:70
void ncpConnect()
Definition: channel.cc:60
virtual ~Channel()=0
Definition: channel.cc:38
void terminateWhenAsked()
Definition: channel.cc:55
bool _terminate
Definition: channel.h:76
void ncpRegister()
Definition: channel.cc:64
const char * connectName
Definition: channel.h:71
int getNcpChannel(void)
Definition: channel.cc:100
void ncpSend(BufferStore &a)
Definition: channel.cc:44
virtual void ncpConnectTerminate()=0
int ncpChannel
Definition: channel.h:75
virtual void ncpRegisterAck()=0
bool shouldTerminate() const
Indicates that the channel needs termination and should be cleaned-up.
Definition: channel.cc:49
Definition: ncp.h:55
Representation of a server process on the PC A dummy which does not allow connects for now.
Definition: ncp.h:44
A class for dealing with sockets.
Definition: tcpsocket.h:37
static RFSV * a
Definition: main.cc:55