telnet.h

Go to the documentation of this file.
00001 /* ES40 emulator.
00002  * Copyright (C) 2007-2008 by the ES40 Emulator Project
00003  *
00004  * WWW    : http://sourceforge.net/projects/es40
00005  * E-mail : camiel@camicom.com
00006  * 
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  * 
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00020  * 
00021  * Although this is not required, the author would appreciate being notified of, 
00022  * and receiving any modifications you may make to the source code that might serve
00023  * the general public.
00024  */
00025 
00073 #if !defined(INCLUDED_TELNET_H)
00074 #define INCLUDED_TELNET_H
00075 
00076 #if defined(HAVE_WINSOCK2_H)
00077 #include <winsock2.h>
00078 #endif
00079 
00080 #if defined(HAVE_WS2TCPIP_H)
00081 #include <ws2tcpip.h>
00082 #endif
00083 
00084 #if defined(HAVE_SYS_SOCKET_H)
00085 #include <sys/socket.h>
00086 #endif
00087 
00088 #if defined(HAVE_SOCKET_H)
00089 #include <socket.h>
00090 #endif
00091 
00092 #if defined(HAVE_IN_H)
00093 #include <in.h>
00094 #endif
00095 
00096 #if defined(HAVE_INET_H)
00097 #include <inet.h>
00098 #endif
00099 
00100 #if defined(HAVE_ARPA_INET_H)
00101 #include <arpa/inet.h>
00102 #endif
00103 
00104 #if defined(HAVE_ARPA_TELNET_H)
00105 #include <arpa/telnet.h>
00106 #endif
00107 
00108 #if defined(HAVE_NETINET_IN_H)
00109 #include <netinet/in.h>
00110 #endif
00111 
00112 #if defined(HAVE_SYS_SELECT_H)
00113 #include <sys/select.h>
00114 #endif
00115 
00116 #if defined(HAVE_ERRNO_H)
00117 #include <errno.h>
00118 #endif
00119 
00120 #if defined(HAVE_FCNTL_H)
00121 #include <fcntl.h>
00122 #endif
00123 
00124 #if defined(HAVE_SIGNAL_H)
00125 #include <signal.h>
00126 #endif
00127 
00128 #if defined(_WIN32) && !defined(__GNUWIN32__)
00129 typedef size_t        ssize_t;
00130 typedef int           socklen_t;
00131 #endif // _WIN32
00132 
00133 #if defined(__VMS)
00134 #define INVALID_SOCKET  - 1
00135 typedef unsigned int  socklen_t;
00136 #endif // __VMS
00137 
00138 #if defined(_WIN32) || defined(__VMS)
00139 #define IAC           255 /* interpret as command: */
00140 #define DONT          254 /* you are not to use option */
00141 #define DO            253 /* please, you use option */
00142 #define WONT          252 /* I won't use option */
00143 #define WILL          251 /* I will use option */
00144 #define SB            250 /* interpret as subnegotiation */
00145 #define GA            249 /* you may reverse the line */
00146 #define EL            248 /* erase the current line */
00147 #define EC            247 /* erase the current character */
00148 #define AYT           246 /* are you there */
00149 #define AO            245 /* abort output--but let prog finish */
00150 #define IP            244 /* interrupt process--permanently */
00151 #define BREAK         243 /* break */
00152 #define DM            242 /* data mark--for connect. cleaning */
00153 #define NOP           241 /* nop */
00154 #define SE            240 /* end sub negotiation */
00155 #define EOR           239 /* end of record (transparent mode) */
00156 #define ABORT         238 /* Abort process */
00157 #define SUSP          237 /* Suspend process */
00158 #define xEOF          236 /* End of file: EOF is already used... */
00159 
00160 #define SYNCH         242 /* for telfunc calls */
00161 #define TELOPT_ECHO   1   /* echo */
00162 #define TELOPT_SGA    3   /* suppress go ahead */
00163 #define TELOPT_NAWS   31  /* window size */
00164 #define TELOPT_LFLOW  33  /* remote flow control */
00165 
00166 #else // defined(_WIN32) || defined(__VMS)
00167 #define INVALID_SOCKET  1
00168 #endif // defined (_WIN32) || defined(__VMS)
00169 
00170 /* inet_aton -- Emulate BSD inet_aton via inet_addr.
00171    *
00172    * Useful on systems that don't have inet_aton, such as Solaris,
00173    * to let your code use the better inet_aton interface and use autoconf
00174    * and AC_REPLACE_FUNCS([inet_aton]).
00175    *
00176    * Copyright (C) 2003 Matthias Andree <matthias.andree@gmx.de>
00177    */
00178 #if !defined(HAVE_INET_ATON)
00179 inline int inet_aton(const char* name, struct in_addr* addr)
00180 {
00181   unsigned long a = inet_addr(name);
00182   addr->s_addr = a;
00183   return a != (unsigned int) -1;
00184 }
00185 #endif
00186 #endif // !defined(INCLUDED_TELNET_H)

SourceForge.net Logo
Project space on SourceForge.net