| version 1.6, 2002/09/19 15:29:45 |
version 1.7, 2002/09/20 16:22:25 |
|
|
| * All rights reserved. * |
* All rights reserved. * |
| * * |
* * |
| * Updates: 29.1.2000, 9.2.2000, 21.3.2000, 5.10.2001 * |
* Updates: 29.1.2000, 9.2.2000, 21.3.2000, 5.10.2001 * |
| |
* 20.9.2002 - Doxygen documentation * |
| * * |
* * |
| **************************************************************************/ |
**************************************************************************/ |
| |
|
| |
/** |
| |
* @file telnet/tn_noobj.h |
| |
* @brief Telnet protocol non-object routines |
| |
* @author Ondrej Jombik <nepto@pobox.sk> |
| |
* @version \$Id$ |
| |
* @date 2001-2002 |
| |
*/ |
| |
|
| #ifndef _PLATON_TELNET_TN_NOOBJ_H |
#ifndef _PLATON_TELNET_TN_NOOBJ_H |
| #define _PLATON_TELNET_TN_NOOBJ_H |
#define _PLATON_TELNET_TN_NOOBJ_H |
| |
|
| |
/** End of line string. */ |
| /* Standartny retazec ukoncenia riadku. Pouziva telnet_gets(). */ |
|
| #ifndef TELNET_EOL |
#ifndef TELNET_EOL |
| #define TELNET_EOL "\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 |
| |
|
| /* Mod telnet prudu otvoreneho ftelnet_connect-om. */ |
/** Telnet stream mode */ |
| #ifndef TELNET_FMODE |
#ifndef TELNET_FMODE |
| #define TELNET_FMODE "rt+" |
# define TELNET_FMODE "rt+" |
| #endif |
#endif |
| |
|
| /* Vracia FILE*, alebo NULL pri chybe. */ |
/** |
| /* Pozor na to, ze vystupny stream bude bufferovany! */ |
* Performs stream-oriented connection to remote host |
| |
* |
| |
* @param host hostname |
| |
* @param port port |
| |
* @return telnet connection stream (FILE *) |
| |
* |
| |
* Note that ouput stream will be buffered. |
| |
*/ |
| #define telnet_fconnect(host,port) fdopen(telnet_connect(host,port), TELNET_FMODE) |
#define telnet_fconnect(host,port) fdopen(telnet_connect(host,port), TELNET_FMODE) |
| |
|
| #ifdef __cplusplus |
#ifdef __cplusplus |
| extern "C" { |
extern "C" { |
| #endif |
#endif |
| |
|
| /* Vracia handle, alebo -1 pri chybe. */ |
/** |
| int telnet_connect(const char*host,int port); |
* Connects to remote host |
| |
* |
| /* Precita data z portu. */ |
* @param host hostname |
| /* Vracia pocet precitanych bytov, prip. <0 pri strate spojenia. */ |
* @param port port |
| int telnet_read(int handle,char*buffer,int size); |
* @return telnet connection handle or -1 on error |
| |
*/ |
| /* Precita riadok z portu. (riadok je postupnost znakov ukoncena TELNET_EOL) */ |
int telnet_connect(const char*host,int port); |
| /* Vracia pocet precitanych bytov, prip. <0 pri strate spojenia. */ |
|
| int telnet_gets(int handle,char*buffer,int size); |
/** |
| |
* Read data from connection |
| |
* |
| |
* @param handle telnet connection handle |
| |
* @retval buffer pointer where to store read data |
| |
* @param size buffer size |
| |
* @return count of read bytes or negative value on connection lost |
| |
*/ |
| |
int telnet_read(int handle,char*buffer,int size); |
| |
|
| |
/** |
| |
* Read one line from connection |
| |
* |
| |
* @param handle telnet connection handle |
| |
* @retval buffer pointer where to store read data |
| |
* @param size buffer size |
| |
* @return count of read bytes or negative value on connection lost |
| |
* |
| |
* One line is character set terminated with @ref TELNET_EOL. |
| |
*/ |
| |
int telnet_gets(int handle,char*buffer,int size); |
| |
|
| #ifdef __cplusplus |
#ifdef __cplusplus |
| } |
} |