| version 1.7, 2002/09/20 16:22:25 |
version 1.8, 2002/09/29 03:55:02 |
|
|
| /************************************************************************** |
/************************************************************************** |
| * * |
* * |
| * No objects telnet protocol header file * |
* Net connection non-object routines * |
| * * |
* * |
| * Programmed by Ondrej Jombik <nepto@pobox.sk> * |
* Programmed by Ondrej Jombik <nepto@pobox.sk> * |
| * Copyright (c) 2000 Condy software inc. * |
* Copyright (c) 2000 Condy software inc. * |
|
|
| **************************************************************************/ |
**************************************************************************/ |
| |
|
| /** |
/** |
| * @file telnet/tn_noobj.h |
* Net connection non-object routines |
| * @brief Telnet protocol non-object routines |
* |
| |
* @file platon/net/connection.h |
| * @author Ondrej Jombik <nepto@pobox.sk> |
* @author Ondrej Jombik <nepto@pobox.sk> |
| * @version \$Id$ |
* @version \$Id$ |
| * @date 2001-2002 |
* @date 2001-2002 |
| */ |
*/ |
| |
|
| #ifndef _PLATON_TELNET_TN_NOOBJ_H |
#ifndef _PLATON_NET_CONNECTION_H |
| #define _PLATON_TELNET_TN_NOOBJ_H |
#define _PLATON_NET_CONNECTION_H |
| |
|
| /** End of line string. */ |
/** End of line string. */ |
| #ifndef TELNET_EOL |
#ifndef NET_CONNECTION_EOL |
| # define TELNET_EOL "\r\n" |
# define NET_CONNECTION_EOL "\r\n" |
| #endif |
#endif |
| |
|
| /** Default telnet port */ |
/** Default telnet port */ |
| #ifndef TELNET_PORT |
#ifndef NET_CONNECTION_PORT |
| # define TELNET_PORT 23 |
# define NET_CONNECTION_PORT 23 |
| #endif |
#endif |
| |
|
| /** Telnet stream mode */ |
/** Telnet stream mode */ |
| #ifndef TELNET_FMODE |
#ifndef NET_CONNECTION_FMODE |
| # define TELNET_FMODE "rt+" |
# define NET_CONNECTION_FMODE "rt+" |
| #endif |
#endif |
| |
|
| /** |
/** |
|
|
| * |
* |
| * Note that ouput stream will be buffered. |
* Note that ouput stream will be buffered. |
| */ |
*/ |
| #define telnet_fconnect(host,port) fdopen(telnet_connect(host,port), TELNET_FMODE) |
#define net_connection_fconnect(host,port) \ |
| |
fdopen(net_connection_connect(host,port), NET_CONNECTION_FMODE) |
| |
|
| #ifdef __cplusplus |
#ifdef __cplusplus |
| extern "C" { |
extern "C" { |
|
|
| * @param port port |
* @param port port |
| * @return telnet connection handle or -1 on error |
* @return telnet connection handle or -1 on error |
| */ |
*/ |
| int telnet_connect(const char*host,int port); |
int net_connection_connect(const char*host,int port); |
| |
|
| /** |
/** |
| * Read data from connection |
* Read data from connection |
|
|
| * @param size buffer size |
* @param size buffer size |
| * @return count of read bytes or negative value on connection lost |
* @return count of read bytes or negative value on connection lost |
| */ |
*/ |
| int telnet_read(int handle,char*buffer,int size); |
int net_connection_read(int handle,char*buffer,int size); |
| |
|
| /** |
/** |
| * Read one line from connection |
* Read one line from connection |
|
|
| * @param size buffer size |
* @param size buffer size |
| * @return count of read bytes or negative value on connection lost |
* @return count of read bytes or negative value on connection lost |
| * |
* |
| * One line is character set terminated with @ref TELNET_EOL. |
* One line is character set terminated with @ref NET_CONNECTION_EOL. |
| */ |
*/ |
| int telnet_gets(int handle,char*buffer,int size); |
int net_connection_gets(int handle,char*buffer,int size); |
| |
|
| #ifdef __cplusplus |
#ifdef __cplusplus |
| } |
} |
| #endif |
#endif |
| |
|
| #endif /* #ifndef _PLATON_TELNET_TN_NOOBJ_H */ |
#endif /* #ifndef _PLATON_NET_CONNECTION_H */ |
| |
|