~ubuntu-branches/ubuntu/saucy/resiprocate/saucy-proposed

« back to all changes in this revision

Viewing changes to tfm/TelnetClient.hxx

  • Committer: Package Import Robot
  • Author(s): Daniel Pocock
  • Date: 2012-05-17 19:29:59 UTC
  • Revision ID: package-import@ubuntu.com-20120517192959-vv00m77isztdy64q
Tags: upstream-1.8.2
ImportĀ upstreamĀ versionĀ 1.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#if !defined(Dragon_Telnet_Client_hxx)
 
2
#define Dragon_Telnet_Client_hxx
 
3
 
 
4
#include <Netxx/Stream.h>
 
5
#include <Netxx/Timeout.h>
 
6
 
 
7
#include "rutil/Data.hxx"
 
8
 
 
9
class TelnetClient
 
10
{
 
11
   public:
 
12
      TelnetClient(const resip::Data& server);
 
13
      virtual ~TelnetClient();
 
14
 
 
15
   protected:
 
16
      void read();
 
17
      void expect(const resip::Data& expects);
 
18
      void expect();
 
19
      void send(const resip::Data& data, bool newline=true);
 
20
      
 
21
   private:
 
22
      Netxx::Stream mClient;
 
23
      resip::Data mBuffer;
 
24
};
 
25
 
 
26
class Cisco7960Client : public TelnetClient
 
27
{
 
28
   public:
 
29
      // login, open a test session
 
30
      Cisco7960Client(const resip::Data& server, const resip::Data& password);
 
31
      
 
32
      void onhook();
 
33
      void offhook();
 
34
      void selectLine(int lineNumber);
 
35
      void soft(int key, int repeat = 1);
 
36
      void provisionLine(int lineNumber, 
 
37
                         const resip::Data& name, 
 
38
                         const resip::Data& authName, 
 
39
                         const resip::Data& authPass, 
 
40
                         const resip::Data& proxy, 
 
41
                         int proxyPort=5060);
 
42
      void dial(const resip::Data& number);
 
43
      void selectAndDial(int lineNumber, const resip::Data& number);
 
44
      void registerLine(int lineNumber);
 
45
      void unregisterLine(int lineNumber);
 
46
      void reset();  // reboots
 
47
      void reload(); // reloads configuration
 
48
};
 
49
 
 
50
#endif
 
51
 
 
52
// Copyright 2005 Purplecomm, Inc.
 
53
/*
 
54
  Copyright (c) 2005, PurpleComm, Inc. 
 
55
  All rights reserved.
 
56
 
 
57
  Redistribution and use in source and binary forms, with or without modification,
 
58
  are permitted provided that the following conditions are met:
 
59
 
 
60
  * Redistributions of source code must retain the above copyright notice, this
 
61
    list of conditions and the following disclaimer.
 
62
  * Redistributions in binary form must reproduce the above copyright notice,
 
63
    this list of conditions and the following disclaimer in the documentation
 
64
    and/or other materials provided with the distribution.
 
65
  * Neither the name of PurpleComm, Inc. nor the names of its contributors may
 
66
    be used to endorse or promote products derived from this software without
 
67
    specific prior written permission.
 
68
 
 
69
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 
70
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
71
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
72
  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
 
73
  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
74
  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 
75
  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
76
  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 
77
  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
78
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
79
*/