summaryrefslogtreecommitdiff
path: root/src/tests/telnetsrv.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-03-30 22:33:41 +0000
committerMike Buland <eichlan@xagasoft.com>2011-03-30 22:33:41 +0000
commit4b9289cfb260f4bcecaf23a810584ef6ef8e8501 (patch)
tree79136af08c7e42ba3322f0d73e9779e4354b318a /src/tests/telnetsrv.cpp
parentc7636dc954eddfe58f7959392602fbc9072d77e7 (diff)
downloadlibbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.gz
libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.bz2
libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.xz
libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.zip
Ok, string stuff is working much, much better, a load of new unit tests have
been added, and I deleted a whole slew of stupid old tests that I don't need.
Diffstat (limited to 'src/tests/telnetsrv.cpp')
-rw-r--r--src/tests/telnetsrv.cpp92
1 files changed, 0 insertions, 92 deletions
diff --git a/src/tests/telnetsrv.cpp b/src/tests/telnetsrv.cpp
deleted file mode 100644
index aac6b39..0000000
--- a/src/tests/telnetsrv.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
1/*
2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
8#include "bu/server.h"
9#include "bu/protocoltelnet.h"
10#include "bu/client.h"
11
12class MyTelnet : public Bu::ProtocolTelnet
13{
14public:
15 MyTelnet()
16 {
17 }
18
19 virtual ~MyTelnet()
20 {
21 }
22
23 virtual void onNewConnection( Bu::Client *pClient )
24 {
25 Bu::ProtocolTelnet::onNewConnection( pClient );
26
27 //oNAWS.remoteSet();
28 oEcho.localSet();
29 oSuppressGA.remoteSet( true );
30 oSuppressGA.localSet( true );
31 setCanonical();
32 }
33
34 virtual void onSubNAWS( uint16_t iWidth, uint16_t iHeight )
35 {
36 printf("New dim = (%dx%d)\n", iWidth, iHeight );
37 }
38
39 virtual void gotLine( Bu::String &sLine )
40 {
41 printf("Line: \"%s\"\n", sLine.getStr() );
42 write("\n\r", 2 );
43 }
44
45private:
46
47};
48
49class TelServer : public Bu::Server
50{
51public:
52 TelServer()
53 {
54 }
55
56 virtual ~TelServer()
57 {
58 }
59
60 virtual void onNewConnection( Bu::Client *pClient, int )
61 {
62 printf("New connection.\n");
63
64 pClient->setProtocol( new MyTelnet() );
65 }
66
67 virtual void onClosedConnection( Bu::Client *pClient )
68 {
69 printf("Lost connection.\n");
70
71 delete pClient->getProtocol();
72 }
73
74private:
75
76};
77
78int main()
79{
80 TelServer ts;
81
82 ts.addPort( 4000 );
83 ts.setTimeout( 0, 5000 );
84
85 printf("Initializing server on port: 4000\n");
86
87 for(;;)
88 {
89 ts.scan();
90 }
91}
92