2006-06-21 07:51:57 +04:00
|
|
|
/*
|
|
|
|
rdesktop: A Remote Desktop Protocol client.
|
|
|
|
Master include file
|
|
|
|
Copyright (C) Matthew Chapman 1999-2005
|
2006-06-26 04:16:09 +04:00
|
|
|
|
2006-06-21 07:51:57 +04:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
2006-06-26 04:16:09 +04:00
|
|
|
|
2006-06-21 07:51:57 +04:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2006-06-26 04:16:09 +04:00
|
|
|
|
2006-06-21 07:51:57 +04:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2006-06-26 04:16:09 +04:00
|
|
|
#include <string.h>
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <winsock2.h> /* winsock2.h first */
|
|
|
|
#include <windows.h>
|
|
|
|
#include <time.h>
|
|
|
|
#else /* WIN32 */
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/time.h>
|
2006-06-21 07:51:57 +04:00
|
|
|
#ifdef HAVE_SYS_SELECT_H
|
|
|
|
#include <sys/select.h>
|
2006-06-26 04:16:09 +04:00
|
|
|
#else /* HAVE_SYS_SELECT_H */
|
2006-06-21 07:51:57 +04:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
2006-06-26 04:16:09 +04:00
|
|
|
#endif /* HAVE_SYS_SELECT_H */
|
|
|
|
#endif /* WIN32 */
|
2006-06-21 07:51:57 +04:00
|
|
|
#include <limits.h> /* PATH_MAX */
|
|
|
|
|
|
|
|
#define VERSION "1.4.1"
|
|
|
|
|
|
|
|
#ifdef WITH_DEBUG
|
|
|
|
#define DEBUG(args) printf args;
|
|
|
|
#else
|
|
|
|
#define DEBUG(args)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef WITH_DEBUG_KBD
|
|
|
|
#define DEBUG_KBD(args) printf args;
|
|
|
|
#else
|
|
|
|
#define DEBUG_KBD(args)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef WITH_DEBUG_RDP5
|
|
|
|
#define DEBUG_RDP5(args) printf args;
|
|
|
|
#else
|
|
|
|
#define DEBUG_RDP5(args)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef WITH_DEBUG_CLIPBOARD
|
|
|
|
#define DEBUG_CLIPBOARD(args) printf args;
|
|
|
|
#else
|
|
|
|
#define DEBUG_CLIPBOARD(args)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef WITH_DEBUG_CHANNEL
|
|
|
|
#define DEBUG_CHANNEL(args) printf args;
|
|
|
|
#else
|
|
|
|
#define DEBUG_CHANNEL(args)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define STRNCPY(dst,src,n) { strncpy(dst,src,n-1); dst[n-1] = 0; }
|
|
|
|
|
|
|
|
#ifndef MIN
|
|
|
|
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MAX
|
|
|
|
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* timeval macros */
|
|
|
|
#ifndef timerisset
|
|
|
|
#define timerisset(tvp)\
|
|
|
|
((tvp)->tv_sec || (tvp)->tv_usec)
|
|
|
|
#endif
|
|
|
|
#ifndef timercmp
|
|
|
|
#define timercmp(tvp, uvp, cmp)\
|
|
|
|
((tvp)->tv_sec cmp (uvp)->tv_sec ||\
|
|
|
|
(tvp)->tv_sec == (uvp)->tv_sec &&\
|
|
|
|
(tvp)->tv_usec cmp (uvp)->tv_usec)
|
|
|
|
#endif
|
|
|
|
#ifndef timerclear
|
|
|
|
#define timerclear(tvp)\
|
|
|
|
((tvp)->tv_sec = (tvp)->tv_usec = 0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* If configure does not define the endianess, try
|
|
|
|
to find it out */
|
|
|
|
#if !defined(L_ENDIAN) && !defined(B_ENDIAN)
|
|
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
|
|
#define L_ENDIAN
|
|
|
|
#elif __BYTE_ORDER == __BIG_ENDIAN
|
|
|
|
#define B_ENDIAN
|
|
|
|
#else
|
|
|
|
#error Unknown endianness. Edit rdesktop.h.
|
|
|
|
#endif
|
|
|
|
#endif /* B_ENDIAN, L_ENDIAN from configure */
|
|
|
|
|
|
|
|
/* No need for alignment on x86 and amd64 */
|
|
|
|
#if !defined(NEED_ALIGN)
|
|
|
|
#if !(defined(__x86__) || defined(__x86_64__) || \
|
|
|
|
defined(__AMD64__) || defined(_M_IX86) || \
|
|
|
|
defined(__i386__))
|
|
|
|
#define NEED_ALIGN
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "parse.h"
|
|
|
|
#include "constants.h"
|
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
#ifndef MAKE_PROTO
|
|
|
|
#include "proto.h"
|
|
|
|
#endif
|