Telnet.h

Go to the documentation of this file.
00001 #ifndef __TELNET_H__
00002 #define __TELNET_H__
00003 
00004 /*
00005 
00006 $Header$
00007 
00008 */
00009 
00010 #include <arpa/telnet.h>
00011 
00012 #include "Connection.h"
00013 #include "GetLine.h"
00014 
00015 // Maximal terminal name size.
00016 static const unsigned int TELNET_LIMIT_TERM_NAME_SIZE = 32;
00017 
00018 // Errors.
00019 static const char *const ERROR_TELNET_INVALID_COMMAND = "Invalid telnet command %d (0x%x).";
00020 static const char *const ERROR_TELNET_INVALID_OPTION  = "Invalid telnet option %d (0x%x).";
00021 
00022 class Telnet : public Object
00023 {
00024 
00025   PYLON_OBJECT
00026 
00027 public:
00028 
00029   Telnet(Connection *conn, GetLine *gl);
00030   virtual ~Telnet();
00031 
00032   int iac(unsigned char command, unsigned char option1,
00033           unsigned char option2 = 0, unsigned char option3 = 0,
00034           unsigned char option4 = 0, unsigned char option5 = 0);
00035 
00036   static int iac(Connection *conn, unsigned char command, unsigned char option1,
00037                  unsigned char option2 = 0, unsigned char option3 = 0,
00038                  unsigned char option4 = 0, unsigned char option5 = 0);
00039 
00040   int parse(int *readCnt);
00041 
00042   static int setEcho(Connection *conn, const bool on = true);
00043 
00044 private:
00045 
00046   int negotiateOptions(const uint8_t cmd, const uint8_t opt);
00047 
00048   bool _isTelnet;
00049 
00050   bool _echo;
00051   int _echoCount;
00052 
00053   bool _sga;
00054   int _sgaCount;
00055 
00056   Connection *_connection;
00057   GetLine *_gl;
00058   unsigned int _screenWidth, _screenHeight;
00059   char _termName[TELNET_LIMIT_TERM_NAME_SIZE];
00060 };
00061 
00062 #endif

Generated on Thu Sep 6 20:11:25 2007 for Pylon Application Platform by  doxygen 1.5.1