plptools
Loading...
Searching...
No Matches
channel.cc
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#include "config.h"
22#include <cstdlib>
23#include <iostream>
24#include <string>
25#include <cstring>
26
27#include "channel.h"
28#include "ncp.h"
29
30channel::channel(NCP * _ncpController)
31{
32 verbose = 0;
33 ncpChannel = 0;
34 connectName = 0;
35 ncpController = _ncpController;
36 _terminate = false;
37}
38
40{
41 if (connectName)
42 free((void *)connectName);
43}
44
47{
49}
50
52shouldTerminate() const
53{
54 return _terminate;
55}
56
59{
60 _terminate = true;
61}
62
65{
67}
68
71{
73}
74
76ncpDoRegisterAck(int ch, const char *name)
77{
78 ncpController->RegisterAck(ch, name);
79}
80
83{
85}
86
88ncpFindPcServer(const char *name)
89{
90 return ncpController->findPcServer(name);
91}
92
94ncpRegisterPcServer(TCPSocket *skt, const char *name)
95{
97}
98
101{
103}
104
107{
108 return ncpController->getSpeed();
109}
110
111short int channel::
113{
115}
116
118setNcpChannel(int chan)
119{
120 ncpChannel = chan;
121}
122
125{
126 return ncpChannel;
127}
128
130newNcpController(NCP * _ncpController)
131{
132 ncpController = _ncpController;
133}
134
136setVerbose(short int _verbose)
137{
138 verbose = _verbose;
139}
140
141short int channel::
143{
144 return verbose;
145}
146
147const char * channel::
149{
150 return connectName;
151}
152
154setNcpConnectName(const char *name)
155{
156 if (name) {
157 if (connectName)
158 free((void *)connectName);
159 connectName = strdup(name);
160 }
161}
Definition: ncp.h:54
void registerPcServer(TCPSocket *skt, const char *name)
Definition: ncp.cc:175
PcServer * findPcServer(const char *name)
Definition: ncp.cc:163
void unregisterPcServer(PcServer *server)
Definition: ncp.cc:180
int connect(channel *c)
Definition: ncp.cc:413
void Register(channel *c)
Definition: ncp.cc:396
int getSpeed()
Definition: ncp.cc:512
short int getProtocolVersion()
Definition: ncp.cc:112
void disconnect(int channel)
Definition: ncp.cc:465
void send(int channel, bufferStore &a)
Definition: ncp.cc:438
void RegisterAck(int, const char *)
Definition: ncp.cc:380
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
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
void ncpDisconnect()
Definition: channel.cc:82
void setNcpChannel(int chan)
Definition: channel.cc:118
void ncpConnect()
Definition: channel.cc:64
const char * connectName
Definition: channel.h:72
virtual ~channel()=0
Definition: channel.cc:39
PcServer * ncpFindPcServer(const char *name)
Definition: channel.cc:88
void terminateWhenAsked()
Definition: channel.cc:58
short int ncpProtocolVersion()
Definition: channel.cc:112
int ncpGetSpeed()
Definition: channel.cc:106
NCP * ncpController
Definition: channel.h:75
int getNcpChannel(void)
Definition: channel.cc:124
channel(NCP *ncpController)
Definition: channel.cc:30
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