Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, October 16, 2026

Diff for libplaton/platon/net/Connection.h between version 1.6 and 1.7

version 1.6, 2002/09/19 15:29:45 version 1.7, 2002/09/20 16:22:25
Line 8 
Line 8 
  *  All rights reserved.                                                  *   *  All rights reserved.                                                  *
  *                                                                        *   *                                                                        *
  *  Updates: 1.4.2000, 5.10.2001                                          *   *  Updates: 1.4.2000, 5.10.2001                                          *
    *  20.9.2002 - Doxygen documentation                                     *
  *                                                                        *   *                                                                        *
  **************************************************************************/   **************************************************************************/
   
   /**
    * @file        telnet/telnet.h
    * @brief       Telnet protocol class
    * @author      Ondrej Jombik <nepto@pobox.sk>
    * @version     \$Id$
    * @date        2000-2002
    */
   
 /*  /*
  * Bez objektov uz ani krok. Ale nie vazne, toto vzniklo kvoli tomu,   * Bez objektov uz ani krok. Ale nie vazne, toto vzniklo kvoli tomu,
  * ze sa v buducnosti rata s niecim takym ako   * ze sa v buducnosti rata s niecim takym ako
Line 18 
Line 27 
  * Niezeby som chcel mat nejakom talkeri 200 dvojitych identit,   * Niezeby som chcel mat nejakom talkeri 200 dvojitych identit,
  * ale nikdy nevies kedy sa Ti nieco taketo zide...:)))   * ale nikdy nevies kedy sa Ti nieco taketo zide...:)))
  *   *
  * Nepto [1.4.2000]   * Nepto [1/4/2000]
  */   */
   
 #ifndef _PLATON_TELNET_TELNET_H  #ifndef _PLATON_TELNET_TELNET_H
 #define _PLATON_TELNET_TELNET_H  #define _PLATON_TELNET_TELNET_H
   
 /* Maximalna dlzka nazvu servera. */  /** Maximum hostname size */
 #ifndef MAX_HOST_SIZE  #ifndef TELNET_MAX_HOST_SIZE
 #define MAX_HOST_SIZE 100  #  define TELNET_MAX_HOST_SIZE 100
 #endif  #endif
   
 /* Standartny retazec ukoncenia riadku. Pouziva telnet_cnx::ReadLine(). */  /** End of line string; used by telnet_cnx::ReadLine() method. */
 #ifndef TELNET_EOL  #ifndef TELNET_EOL
 #define TELNET_EOL "\r\n"  #  define TELNET_EOL "\r\n"
 #endif  #endif
   
 /* Zakladny telnet port. */  /** Default telnet port */
 #ifndef TELNET_PORT  #ifndef TELNET_PORT
 #define TELNET_PORT 23  #  define TELNET_PORT 23
 #endif  #endif
   
 #ifdef __cplusplus  #ifdef __cplusplus
   
 class telnet_cnx{  
   /**
    * @class       telnet_cnx
    * @brief       Telnet protocol class
    * @author      Ondrej Jombik <nepto@pobox.sk>
    * @version     \$Id$
    * @date        2000-2002
    */
   class telnet_cnx
   {
   private:    private:
     int handle;      int handle;
     int port;      int port;
     char host[MAX_HOST_SIZE+1];      char host[TELNET_MAX_HOST_SIZE+1];
     char*__rbuf;      char*__rbuf;
   
   public:    public:
     /* Konstruktor. */      /**
     telnet_cnx(const char*newhost=NULL,const int newport=TELNET_PORT);           * Object constructor
     /* Destruktor. */           *
            * @param       host            hostname
            * @param       port            port
            */
       telnet_cnx(const char*host=NULL,const int port=TELNET_PORT);
   
       /**
            * Object destructor
            */
     ~telnet_cnx(void);      ~telnet_cnx(void);
   
     /* Is... metody. */          /**
     /* Ak je nadviazane spojenie, vracia nenulovu hodnotu, inak 0. */           * @name Property setting methods
     int IsConnected(void);//inline           */
           /**@{*/
     /* Set... metody. */  
     void SetPort(const int newport);//inline          /**
     void SetHost(const char*newhost,const int newport=0);           * Sets new port
            *
     /* Nadviazanie spojenia. Vysledok ako IsConnected(). */           * @param       newport         new port number
     int Connect(void);           * @note        inline method
     /* Ukoncenie spojenia. */           */
     void Disconnect(void);          inline void setPort(const int newport);
   
     /* Send... metody. */          /**
     int WriteLine(void);           * Sets new host
     int WriteLine(const char*s);           *
     int WriteStr(const char*s);           * @param       newhost         new hostname
     int WriteData(const void*p,int len);           * @param       newport         new port number
            */
     /* Read... metody, vracaju pocet precitanych bytov. 0 moze, ale nemusi */      void setHost(const char*newhost,const int newport=0);
     /* znamenat stratu spojenia. Na otestovanie pouzi IsConnected(). */  
     int ReadData(char*buffer,const int size);          /**@}*/
     int ReadLine(char*buffer,const int size);          /**
            * @name Connection manipulation methods
            */
           /**@{*/
   
       /**
            * Connects to remote host
            *
            * @return      non-zero value if connection is estabilished, 0 otherwise
            */
       int connect(void);
   
       /**
            * Disconnects from remote host
            */
       void disconnect(void);
   
           /**
            * Returns if connection is opened
            *
            * @return      non-zero value if connection is estabilished, 0 otherwise
            */
           int isConnected(void);//inline
   
           /**@}*/
           /**
            * @name Writting methods
            */
           /**@{*/
   
           /**
            * Writes newline character to connection
            *
            * @return      number of byttes written, -1 on error,
            *                      see write() syscall for more info
            */
       int writeLine(void);
   
           /**
            * Writes string and appends newline to connection
            *
            * @param       s               string to write
            * @return      number of byttes written, -1 on error,
            *                      see write() syscall for more info
            */
       int writeLine(const char*s);
   
           /**
            * Writes string to connection
            *
            * @param       s               string to write
            * @return      number of byttes written, -1 on error,
            *                      see write() syscall for more info
            */
       int writeStr(const char*s);
   
           /**
            * Writes data to connection
            *
            * @param       s               data to write
            * @param       len             length of data
            * @return      number of byttes written, -1 on error,
            *                      see write() syscall for more info
            */
       int writeData(const void*p,int len);
   
           /**@}*/
           /**
            * @name Reading methods
            */
           /**@{*/
   
           /**
            * Read data from connection
            *
            * @retval      buffer  pointer where to store read data
            * @param       size    buffer size
            * @return      count of read bytes
            *
            * Returned value of 0 may but must not indicate connection lost. If you
            * want to check your connection state, use isConnected() method for this
            * purpose.
            */
           int readData(char*buffer,const int size);
   
           /**
            * Read one line from connection
            *
            * @retval      buffer  pointer where to store read line
            * @param       size    buffer size
            * @return      count of read bytes, iow. line size
            * @see         readData for more info about returned value of 0 handling
            */
       int readLine(char*buffer,const int size);
   
           /**@}*/
   
 };  };
   

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top