makefile and header changes

This commit is contained in:
jsorg71 2005-03-11 02:23:30 +00:00
parent 777893bdd6
commit 5140dac0f5
5 changed files with 125 additions and 112 deletions

View File

@ -310,10 +310,11 @@ int g_tcp_socket(void)
/*****************************************************************************/
int g_tcp_local_socket(void)
{
int rv;
rv = socket(PF_LOCAL, SOCK_STREAM, 0);
return rv;
#if defined(_WIN32)
return 0;
#else
return socket(PF_LOCAL, SOCK_STREAM, 0);
#endif
}
/*****************************************************************************/
@ -391,12 +392,16 @@ int g_tcp_bind(int sck, char* port)
/*****************************************************************************/
int g_tcp_local_bind(int sck, char* port)
{
#if defined(_WIN32)
return -1;
#else
struct sockaddr_un s;
memset(&s, 0, sizeof(struct sockaddr_un));
s.sun_family = AF_UNIX;
strcpy(s.sun_path, port);
return bind(sck, (struct sockaddr*)&s, sizeof(struct sockaddr_un));
#endif
}
/*****************************************************************************/

View File

@ -82,8 +82,8 @@ char* g_strncpy(char* dest, char* src, int len);
char* g_strcat(char* dest, char* src);
char* g_strdup(char* in);
int g_strcmp(char* c1, char* c2);
int g_load_library(char* in);
int g_free_library(int lib);
void* g_get_proc_address(int lib, char* name);
long g_load_library(char* in);
int g_free_library(long lib);
void* g_get_proc_address(long lib, char* name);
int g_system(char* aexec);
void g_signal(int sig_num, void (*func)(int));

View File

@ -44,86 +44,86 @@ struct stream
};
/******************************************************************************/
#define s_check(s) (s->p <= s->end)
#define s_check(s) ((s)->p <= (s)->end)
/******************************************************************************/
#define s_check_rem(s, n) (s->p + n <= s->end)
#define s_check_rem(s, n) ((s)->p + (n) <= (s)->end)
/******************************************************************************/
#define s_check_end(s) (s->p == s->end)
#define s_check_end(s) ((s)->p == (s)->end)
/******************************************************************************/
#define make_stream(s) \
{ \
s = (struct stream*)g_malloc(sizeof(struct stream), 1); \
(s) = (struct stream*)g_malloc(sizeof(struct stream), 1); \
}
/******************************************************************************/
#define init_stream(s, v) \
{ \
if (v > s->size) \
if ((v) > (s)->size) \
{ \
g_free(s->data); \
s->data = (char*)g_malloc(v, 0); \
s->size = v; \
g_free((s)->data); \
(s)->data = (char*)g_malloc((v), 0); \
(s)->size = (v); \
} \
s->p = s->data; \
s->end = s->data; \
s->next_packet = 0; \
(s)->p = (s)->data; \
(s)->end = (s)->data; \
(s)->next_packet = 0; \
}
/******************************************************************************/
#define free_stream(s) \
{ \
if (s != 0) \
if ((s) != 0) \
{ \
g_free(s->data); \
g_free((s)->data); \
} \
g_free(s); \
g_free((s)); \
} \
/******************************************************************************/
#define s_push_layer(s, h, n) \
{ \
s->h = s->p; \
s->p += n; \
(s)->h = (s)->p; \
(s)->p += (n); \
}
/******************************************************************************/
#define s_pop_layer(s, h) \
{ \
s->p = s->h; \
(s)->p = (s)->h; \
}
/******************************************************************************/
#define s_mark_end(s) \
{ \
s->end = s->p; \
(s)->end = (s)->p; \
}
/******************************************************************************/
#define in_uint8(s, v) \
{ \
v = *((unsigned char*)(s->p)); \
s->p++; \
(v) = *((unsigned char*)((s)->p)); \
(s)->p++; \
}
/******************************************************************************/
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
#define in_sint16_le(s, v) \
{ \
v = (signed short) \
(v) = (signed short) \
( \
(*((unsigned char*)(s->p + 0)) << 0) | \
(*((unsigned char*)(s->p + 1)) << 8) \
(*((unsigned char*)((s)->p + 0)) << 0) | \
(*((unsigned char*)((s)->p + 1)) << 8) \
); \
s->p += 2; \
(s)->p += 2; \
}
#else
#define in_sint16_le(s, v) \
{ \
v = *((signed short*)(s->p)); \
s->p += 2; \
(v) = *((signed short*)((s)->p)); \
(s)->p += 2; \
}
#endif
@ -131,171 +131,171 @@ struct stream
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
#define in_uint16_le(s, v) \
{ \
v = (unsigned short) \
(v) = (unsigned short) \
( \
(*((unsigned char*)(s->p + 0)) << 0) | \
(*((unsigned char*)(s->p + 1)) << 8) \
(*((unsigned char*)((s)->p + 0)) << 0) | \
(*((unsigned char*)((s)->p + 1)) << 8) \
); \
s->p += 2; \
(s)->p += 2; \
}
#else
#define in_uint16_le(s, v) \
{ \
v = *((unsigned short*)(s->p)); \
s->p += 2; \
(v) = *((unsigned short*)((s)->p)); \
(s)->p += 2; \
}
#endif
/******************************************************************************/
#define in_uint16_be(s, v) \
{ \
v = *((unsigned char*)(s->p)); \
s->p++; \
v = v << 8; \
v = v | *((unsigned char*)(s->p)); \
s->p++; \
(v) = *((unsigned char*)((s)->p)); \
(s)->p++; \
(v) <<= 8; \
(v) |= *((unsigned char*)((s)->p)); \
(s)->p++; \
}
/******************************************************************************/
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
#define in_uint32_le(s, v) \
{ \
v = (unsigned int) \
(v) = (unsigned int) \
( \
(*((unsigned char*)(s->p + 0)) << 0) | \
(*((unsigned char*)(s->p + 1)) << 8) | \
(*((unsigned char*)(s->p + 2)) << 16) | \
(*((unsigned char*)(s->p + 3)) << 24) \
(*((unsigned char*)((s)->p + 0)) << 0) | \
(*((unsigned char*)((s)->p + 1)) << 8) | \
(*((unsigned char*)((s)->p + 2)) << 16) | \
(*((unsigned char*)((s)->p + 3)) << 24) \
); \
s->p += 4; \
(s)->p += 4; \
}
#else
#define in_uint32_le(s, v) \
{ \
v = *((unsigned int*)(s->p)); \
s->p += 4; \
(v) = *((unsigned int*)((s)->p)); \
(s)->p += 4; \
}
#endif
/******************************************************************************/
#define in_uint32_be(s, v) \
{ \
v = *((unsigned char*)(s->p)); \
s->p++; \
v = v << 8; \
v = v | *((unsigned char*)(s->p)); \
s->p++; \
v = v << 8; \
v = v | *((unsigned char*)(s->p)); \
s->p++; \
v = v << 8; \
v = v | *((unsigned char*)(s->p)); \
s->p++; \
(v) = *((unsigned char*)((s)->p)); \
(s)->p++; \
(v) <<= 8; \
(v) |= *((unsigned char*)((s)->p)); \
(s)->p++; \
(v) <<= 8; \
(v) |= *((unsigned char*)((s)->p)); \
(s)->p++; \
(v) <<= 8; \
(v) |= *((unsigned char*)((s)->p)); \
(s)->p++; \
}
/******************************************************************************/
#define out_uint8(s, v) \
{ \
*(s->p) = (unsigned char)(v); \
s->p++; \
*((s)->p) = (unsigned char)(v); \
(s)->p++; \
}
/******************************************************************************/
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
#define out_uint16_le(s, v) \
{ \
*(s->p) = (unsigned char)(v); \
s->p++; \
*(s->p) = (unsigned char)((v) >> 8); \
s->p++; \
*((s)->p) = (unsigned char)((v) >> 0); \
(s)->p++; \
*((s)->p) = (unsigned char)((v) >> 8); \
(s)->p++; \
}
#else
#define out_uint16_le(s, v) \
{ \
*((unsigned short*)(s->p)) = (unsigned short)(v); \
s->p += 2; \
*((unsigned short*)((s)->p)) = (unsigned short)(v); \
(s)->p += 2; \
}
#endif
/******************************************************************************/
#define out_uint16_be(s, v) \
{ \
*(s->p) = (unsigned char)((v) >> 8); \
s->p++; \
*(s->p) = (unsigned char)(v); \
s->p++; \
*((s)->p) = (unsigned char)((v) >> 8); \
(s)->p++; \
*((s)->p) = (unsigned char)((v) >> 0); \
(s)->p++; \
}
/******************************************************************************/
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
#define out_uint32_le(s, v) \
{ \
*(s->p) = (unsigned char)(v); \
s->p++; \
*(s->p) = (unsigned char)((v) >> 8); \
s->p++; \
*(s->p) = (unsigned char)((v) >> 16); \
s->p++; \
*(s->p) = (unsigned char)((v) >> 24); \
s->p++; \
*((s)->p) = (unsigned char)((v) >> 0); \
(s)->p++; \
*((s)->p) = (unsigned char)((v) >> 8); \
(s)->p++; \
*((s)->p) = (unsigned char)((v) >> 16); \
(s)->p++; \
*((s)->p) = (unsigned char)((v) >> 24); \
(s)->p++; \
}
#else
#define out_uint32_le(s, v) \
{ \
*((unsigned int*)(s->p)) = (v); \
s->p += 4; \
*((unsigned int*)((s)->p)) = (v); \
(s)->p += 4; \
}
#endif
/******************************************************************************/
#define out_uint32_be(s, v) \
{ \
*(s->p) = (unsigned char)((v) >> 24); \
*((s)->p) = (unsigned char)((v) >> 24); \
s->p++; \
*(s->p) = (unsigned char)((v) >> 16); \
*((s)->p) = (unsigned char)((v) >> 16); \
s->p++; \
*(s->p) = (unsigned char)((v) >> 8); \
s->p++; \
*(s->p) = (unsigned char)(v); \
*((s)->p) = (unsigned char)((v) >> 8); \
s->p++; \
*((s)->p) = (unsigned char)(v); \
(s)->p++; \
}
/******************************************************************************/
#define in_uint8p(s, v, n) \
{ \
v = s->p; \
s->p += n; \
(v) = (s)->p; \
(s)->p += (n); \
}
/******************************************************************************/
#define in_uint8a(s, v, n) \
{ \
g_memcpy(v, s->p, n); \
s->p += n; \
g_memcpy((v), (s)->p, (n)); \
(s)->p += (n); \
}
/******************************************************************************/
#define in_uint8s(s, n) \
{ \
s->p += n; \
(s)->p += (n); \
}
/******************************************************************************/
#define out_uint8p(s, v, n) \
{ \
g_memcpy(s->p, v, n); \
s->p += n; \
g_memcpy((s)->p, (v), (n)); \
(s)->p += (n); \
}
/******************************************************************************/
#define out_uint8a(s, v, n) \
{ \
out_uint8p(s, v, n); \
out_uint8p((s), (v), (n)); \
}
/******************************************************************************/
#define out_uint8s(s, n) \
{ \
g_memset(s->p, 0, n); \
s->p += n; \
g_memset((s)->p, 0, (n)); \
(s)->p += (n); \
}

View File

@ -1,14 +1,14 @@
XRDPOBJ = ../common/os_calls.o \
xrdp.o xrdp_tcp.o xrdp_iso.o xrdp_mcs.o xrdp_sec.o \
XRDPOBJ = xrdp.o xrdp_tcp.o xrdp_iso.o xrdp_mcs.o xrdp_sec.o \
xrdp_rdp.o xrdp_process.o xrdp_listen.o xrdp_orders.o \
xrdp_bitmap.o xrdp_wm.o xrdp_painter.o xrdp_list.o \
xrdp_region.o xrdp_cache.o xrdp_font.o funcs.o \
xrdp_login_wnd.o xrdp_file.o xrdp_bitmap_compress.o \
xrdp_interface.o
xrdp_interface.o \
os_calls.o
#CFLAGS = -Wall -O2 -I../common -DXRDP_DEBUG -DUSE_OPENSSL -DUSE_PTHREAD
CFLAGS = -Wall -O2 -I../common -DUSE_OPENSSL -DUSE_PTHREAD
CFLAGS = -Wall -O2 -I../common
C_OS_FLAGS = $(CFLAGS) -DUSE_OPENSSL -DUSE_PTHREAD -c
LDFLAGS = -L /usr/gnu/lib
LIBS = -lpthread -lcrypto
#CC = g++
@ -21,3 +21,6 @@ xrdp: $(XRDPOBJ)
clean:
rm -f $(XRDPOBJ) xrdp
os_calls.o:
$(CC) $(C_OS_FLAGS) ../common/os_calls.c

View File

@ -3,17 +3,20 @@
# this assumes openssl and borland free command line tools are installed
# this assumes c:\windows is windows directory
#
# run 'set PATH=c:\borland\bcc55\bin' and run 'make all'
# run 'set PATH=c:\borland\bcc55\bin' and run 'make -f makefile_win32 all'
#
XRDPOBJ = xrdp.obj os_calls.obj xrdp_tcp.obj xrdp_iso.obj xrdp_mcs.obj \
XRDPOBJ = xrdp.obj xrdp_tcp.obj xrdp_iso.obj xrdp_mcs.obj \
xrdp_sec.obj xrdp_rdp.obj xrdp_process.obj xrdp_listen.obj \
xrdp_orders.obj xrdp_bitmap.obj xrdp_wm.obj xrdp_painter.obj \
xrdp_list.obj xrdp_region.obj xrdp_cache.obj xrdp_font.obj \
funcs.obj xrdp_login_wnd.obj xrdp_file.obj
funcs.obj xrdp_login_wnd.obj xrdp_file.obj xrdp_interface.obj \
xrdp_bitmap_compress.obj \
os_calls.obj
CFLAGS = -w- -O2 -Ic:\borland\bcc55\include -Ic:\openssl\include
LDFLAGS = -Lc:\borland\bcc55\lib
CFLAGS = -w- -O2 -I../common
C_OS_FLAGS = -w- -O2 -Ic:/borland/bcc55/include -Ic:/openssl/include -DUSE_OPENSSL -c
LDFLAGS = -Lc:/borland/bcc55/lib
xrdp: $(XRDPOBJ)
$(CC) $(LDFLAGS) libeay32.lib $(XRDPOBJ)
@ -21,8 +24,10 @@ xrdp: $(XRDPOBJ)
all: lib xrdp
clean:
del *.obj *.o xrdp.exe
del $(XRDPOBJ) xrdp.exe
lib:
implib -a -w libeay32.lib c:\windows\system32\libeay32.dll
implib -a -w libeay32.lib c:/windows/system32/libeay32.dll
os_calls.obj:
$(CC) $(C_OS_FLAGS) ../common/os_calls.c