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#ifndef _channel_h_
22#define _channel_h_
23
24#include "config.h"
25#include <stdio.h>
26
27class NCP;
28class bufferStore;
29class PcServer;
30class TCPSocket;
31
32class channel {
33public:
35 virtual ~channel() = 0;
37
38 void setNcpChannel(int chan);
39 int getNcpChannel(void);
40 void ncpSend(bufferStore &a);
41 void setVerbose(short int _verbose);
42 short int getVerbose();
43 virtual void ncpDataCallback(bufferStore &a) = 0;
44 virtual const char *getNcpRegisterName() = 0;
45 void ncpConnect();
46 void ncpRegister();
47 void ncpDoRegisterAck(int ch, const char *name);
48 virtual void ncpConnectAck() = 0;
49 virtual void ncpConnectTerminate() = 0;
50 virtual void ncpConnectNak() = 0;
51 virtual void ncpRegisterAck() = 0;
52 void ncpDisconnect();
53 short int ncpProtocolVersion();
54 const char *getNcpConnectName();
55 void setNcpConnectName(const char *);
56
57 // The following two calls are used for destructing an instance
58
62 bool shouldTerminate() const; // Mainloop will terminate this class if true
63 void terminateWhenAsked();
64
65 PcServer *ncpFindPcServer(const char *name);
66 void ncpRegisterPcServer(TCPSocket *skt, const char *name);
67 void ncpUnregisterPcServer(PcServer *server);
68 int ncpGetSpeed();
69
70protected:
71 short int verbose;
72 const char *connectName;
73
74private:
78};
79
80#endif
Definition: ncp.h:54
Representation of a server process on the PC A dummy which does not allow connects for now.
Definition: ncp.h:43
A class for dealing with sockets.
Definition: tcpsocket.h:38
A generic container for an array of bytes.
Definition: bufferstore.h:37
void ncpSend(bufferStore &a)
Definition: channel.cc:46
virtual const char * getNcpRegisterName()=0
short int getVerbose()
Definition: channel.cc:142
void ncpDoRegisterAck(int ch, const char *name)
Definition: channel.cc:76
int ncpChannel
Definition: channel.h:76
bool shouldTerminate() const
Indicates that the channel needs termination and should be cleaned-up.
Definition: channel.cc:52
void ncpRegisterPcServer(TCPSocket *skt, const char *name)
Definition: channel.cc:94
virtual void ncpConnectTerminate()=0
void ncpDisconnect()
Definition: channel.cc:82
void setNcpChannel(int chan)
Definition: channel.cc:118
virtual void ncpConnectAck()=0
void ncpConnect()
Definition: channel.cc:64
const char * connectName
Definition: channel.h:72
virtual ~channel()=0
Definition: channel.cc:39
virtual void ncpConnectNak()=0
PcServer * ncpFindPcServer(const char *name)
Definition: channel.cc:88
void terminateWhenAsked()
Definition: channel.cc:58
virtual void ncpRegisterAck()=0
short int ncpProtocolVersion()
Definition: channel.cc:112
virtual void ncpDataCallback(bufferStore &a)=0
int ncpGetSpeed()
Definition: channel.cc:106
NCP * ncpController
Definition: channel.h:75
int getNcpChannel(void)
Definition: channel.cc:124
const char * getNcpConnectName()
Definition: channel.cc:148
void ncpRegister()
Definition: channel.cc:70
void ncpUnregisterPcServer(PcServer *server)
Definition: channel.cc:100
short int verbose
Definition: channel.h:71
void setNcpConnectName(const char *)
Definition: channel.cc:154
bool _terminate
Definition: channel.h:77
void setVerbose(short int _verbose)
Definition: channel.cc:136
void newNcpController(NCP *ncpController)
Definition: channel.cc:130
static rfsv * a
Definition: main.cc:53