diff options
author | Pavel Roskin <plroskin@gmail.com> | 2017-03-12 09:35:00 -0700 |
---|---|---|
committer | jsorg71 <jay.sorg@gmail.com> | 2017-03-14 00:21:48 -0700 |
commit | 6ed4c969f4d646a7751fe2da29ba94eddd3d6477 (patch) | |
tree | 951c72b16a0be1a1cc8c77e6d2ecaa1f25f2bcd6 /common | |
parent | 8be83473b72c926d3c056fd8a81965dbce0a0e5e (diff) | |
download | xrdp-proprietary-6ed4c969f4d646a7751fe2da29ba94eddd3d6477.tar.gz xrdp-proprietary-6ed4c969f4d646a7751fe2da29ba94eddd3d6477.zip |
Eliminate APP_CC and DEFAULT_CC
Diffstat (limited to 'common')
-rw-r--r-- | common/arch.h | 8 | ||||
-rw-r--r-- | common/fifo.c | 10 | ||||
-rw-r--r-- | common/fifo.h | 10 | ||||
-rw-r--r-- | common/file.c | 20 | ||||
-rw-r--r-- | common/file.h | 8 | ||||
-rw-r--r-- | common/list.c | 20 | ||||
-rw-r--r-- | common/list.h | 20 | ||||
-rw-r--r-- | common/list16.c | 20 | ||||
-rw-r--r-- | common/list16.h | 20 | ||||
-rw-r--r-- | common/log.c | 28 | ||||
-rw-r--r-- | common/log.h | 20 | ||||
-rw-r--r-- | common/os_calls.c | 284 | ||||
-rw-r--r-- | common/os_calls.h | 270 | ||||
-rw-r--r-- | common/ssl_calls.c | 69 | ||||
-rw-r--r-- | common/ssl_calls.h | 66 | ||||
-rw-r--r-- | common/thread_calls.c | 24 | ||||
-rw-r--r-- | common/thread_calls.h | 22 | ||||
-rw-r--r-- | common/trans.c | 47 | ||||
-rw-r--r-- | common/trans.h | 50 |
19 files changed, 502 insertions, 514 deletions
diff --git a/common/arch.h b/common/arch.h index 873fd1d8..ce3137a7 100644 --- a/common/arch.h +++ b/common/arch.h @@ -96,14 +96,6 @@ typedef int bool_t; #define THREAD_CC #endif -#if defined(__BORLANDC__) || defined(_WIN32) -#define APP_CC __fastcall -#define DEFAULT_CC __cdecl -#else -#define APP_CC -#define DEFAULT_CC -#endif - #if defined(_WIN32) #if defined(__BORLANDC__) #define EXPORT_CC _export __cdecl diff --git a/common/fifo.c b/common/fifo.c index 61e30144..64e85f23 100644 --- a/common/fifo.c +++ b/common/fifo.c @@ -31,7 +31,7 @@ * @return pointer to new FIFO or NULL if system out of memory *****************************************************************************/ -FIFO * APP_CC +FIFO * fifo_create(void) { return (FIFO *) g_malloc(sizeof(FIFO), 1); @@ -41,7 +41,7 @@ fifo_create(void) * Delete specified FIFO *****************************************************************************/ -void APP_CC +void fifo_delete(FIFO *self) { USER_DATA *udp; @@ -91,7 +91,7 @@ fifo_delete(FIFO *self) * @return 0 on success, -1 on error *****************************************************************************/ -int APP_CC +int fifo_add_item(FIFO *self, void *item) { USER_DATA *udp; @@ -128,7 +128,7 @@ fifo_add_item(FIFO *self, void *item) * @return top item from FIFO or NULL if FIFO is empty *****************************************************************************/ -void * APP_CC +void * fifo_remove_item(FIFO *self) { void *item; @@ -163,7 +163,7 @@ fifo_remove_item(FIFO *self) * @return true if FIFO is empty, false otherwise *****************************************************************************/ -int APP_CC +int fifo_is_empty(FIFO *self) { if (!self) diff --git a/common/fifo.h b/common/fifo.h index 3d44c453..3a69e029 100644 --- a/common/fifo.h +++ b/common/fifo.h @@ -38,10 +38,10 @@ typedef struct fifo int auto_free; } FIFO; -FIFO * APP_CC fifo_create(void); -void APP_CC fifo_delete(FIFO *self); -int APP_CC fifo_add_item(FIFO *self, void *item); -void * APP_CC fifo_remove_item(FIFO *self); -int APP_CC fifo_is_empty(FIFO *self); +FIFO * fifo_create(void); +void fifo_delete(FIFO *self); +int fifo_add_item(FIFO *self, void *item); +void * fifo_remove_item(FIFO *self); +int fifo_is_empty(FIFO *self); #endif diff --git a/common/file.c b/common/file.c index 236ac3d8..16b8deee 100644 --- a/common/file.c +++ b/common/file.c @@ -30,14 +30,14 @@ #define FILE_MAX_LINE_BYTES 2048 -static int APP_CC +static int file_read_ini_line(struct stream *s, char *text, int text_bytes); /*****************************************************************************/ /* look up for a section name within str (i.e. pattern [section_name]) * if a section name is found, this function return 1 and copy the section * inplace of str. */ -static int APP_CC +static int line_lookup_for_section_name(char *str, int str_bytes) { int name_index_start; @@ -76,7 +76,7 @@ line_lookup_for_section_name(char *str, int str_bytes) /* returns error returns 0 if everything is ok returns 1 if problem reading file */ -static int APP_CC +static int l_file_read_sections(int fd, int max_file_size, struct list *names) { struct stream *s; @@ -117,7 +117,7 @@ l_file_read_sections(int fd, int max_file_size, struct list *names) * returns error * returns 0 if everything is ok * returns 1 if problem reading file */ -static int APP_CC +static int file_read_ini_line(struct stream *s, char *text, int text_bytes) { int i; @@ -195,7 +195,7 @@ file_read_ini_line(struct stream *s, char *text, int text_bytes) /*****************************************************************************/ /* returns error */ -static int APP_CC +static int file_split_name_value(char *text, char *name, char *value) { int len; @@ -238,7 +238,7 @@ file_split_name_value(char *text, char *name, char *value) /*****************************************************************************/ /* return error */ -static int APP_CC +static int l_file_read_section(int fd, int max_file_size, const char *section, struct list *names, struct list *values) { @@ -324,7 +324,7 @@ l_file_read_section(int fd, int max_file_size, const char *section, returns 0 if everything is ok returns 1 if problem reading file */ /* 32 K file size limit */ -int APP_CC +int file_read_sections(int fd, struct list *names) { return l_file_read_sections(fd, 32 * 1024, names); @@ -334,7 +334,7 @@ file_read_sections(int fd, struct list *names) /* return error */ /* this function should be preferred over file_read_sections because it can read any file size */ -int APP_CC +int file_by_name_read_sections(const char *file_name, struct list *names) { int fd; @@ -363,7 +363,7 @@ file_by_name_read_sections(const char *file_name, struct list *names) /*****************************************************************************/ /* return error */ /* 32 K file size limit */ -int APP_CC +int file_read_section(int fd, const char *section, struct list *names, struct list *values) { @@ -374,7 +374,7 @@ file_read_section(int fd, const char *section, /* return error */ /* this function should be preferred over file_read_section because it can read any file size */ -int APP_CC +int file_by_name_read_section(const char *file_name, const char *section, struct list *names, struct list *values) { diff --git a/common/file.h b/common/file.h index ec3bbcb1..8800e6a7 100644 --- a/common/file.h +++ b/common/file.h @@ -23,14 +23,14 @@ #include "arch.h" -int APP_CC +int file_read_sections(int fd, struct list* names); -int APP_CC +int file_by_name_read_sections(const char* file_name, struct list* names); -int APP_CC +int file_read_section(int fd, const char* section, struct list* names, struct list* values); -int APP_CC +int file_by_name_read_section(const char* file_name, const char* section, struct list* names, struct list* values); diff --git a/common/list.c b/common/list.c index 71f2d84a..8224c353 100644 --- a/common/list.c +++ b/common/list.c @@ -27,7 +27,7 @@ #include "list.h" /*****************************************************************************/ -struct list *APP_CC +struct list * list_create(void) { struct list *self; @@ -40,7 +40,7 @@ list_create(void) } /*****************************************************************************/ -void APP_CC +void list_delete(struct list *self) { int i; @@ -64,7 +64,7 @@ list_delete(struct list *self) } /*****************************************************************************/ -void APP_CC +void list_add_item(struct list *self, tbus item) { tbus *p; @@ -85,7 +85,7 @@ list_add_item(struct list *self, tbus item) } /*****************************************************************************/ -tbus APP_CC +tbus list_get_item(const struct list *self, int index) { if (index < 0 || index >= self->count) @@ -97,7 +97,7 @@ list_get_item(const struct list *self, int index) } /*****************************************************************************/ -void APP_CC +void list_clear(struct list *self) { int i; @@ -119,7 +119,7 @@ list_clear(struct list *self) } /*****************************************************************************/ -int APP_CC +int list_index_of(struct list *self, tbus item) { int i; @@ -136,7 +136,7 @@ list_index_of(struct list *self, tbus item) } /*****************************************************************************/ -void APP_CC +void list_remove_item(struct list *self, int index) { int i; @@ -159,7 +159,7 @@ list_remove_item(struct list *self, int index) } /*****************************************************************************/ -void APP_CC +void list_insert_item(struct list *self, int index, tbus item) { tbus *p; @@ -197,7 +197,7 @@ list_insert_item(struct list *self, int index, tbus item) /*****************************************************************************/ /* append one list to another using strdup for each item in the list */ /* begins copy at start_index, a zero based index on the source list */ -void APP_CC +void list_append_list_strdup(struct list *self, struct list *dest, int start_index) { int index; @@ -213,7 +213,7 @@ list_append_list_strdup(struct list *self, struct list *dest, int start_index) } /*****************************************************************************/ -void APP_CC +void list_dump_items(struct list *self) { int index; diff --git a/common/list.h b/common/list.h index 146aab11..b3c9ef13 100644 --- a/common/list.h +++ b/common/list.h @@ -33,25 +33,25 @@ struct list int auto_free; }; -struct list* APP_CC +struct list* list_create(void); -void APP_CC +void list_delete(struct list* self); -void APP_CC +void list_add_item(struct list* self, tintptr item); -tintptr APP_CC +tintptr list_get_item(const struct list *self, int index); -void APP_CC +void list_clear(struct list* self); -int APP_CC +int list_index_of(struct list* self, tintptr item); -void APP_CC +void list_remove_item(struct list* self, int index); -void APP_CC +void list_insert_item(struct list* self, int index, tintptr item); -void APP_CC +void list_append_list_strdup(struct list* self, struct list* dest, int start_index); -void APP_CC +void list_dump_items(struct list* self); #endif diff --git a/common/list16.c b/common/list16.c index 7ed4a169..8e548f71 100644 --- a/common/list16.c +++ b/common/list16.c @@ -27,7 +27,7 @@ #include "list16.h" /*****************************************************************************/ -struct list16 *APP_CC +struct list16 * list16_create(void) { struct list16 *self; @@ -38,7 +38,7 @@ list16_create(void) } /*****************************************************************************/ -void APP_CC +void list16_delete(struct list16 *self) { if (self == 0) @@ -51,7 +51,7 @@ list16_delete(struct list16 *self) } /*****************************************************************************/ -void APP_CC +void list16_init(struct list16* self) { g_memset(self, 0, sizeof(struct list16)); @@ -60,7 +60,7 @@ list16_init(struct list16* self) } /*****************************************************************************/ -void APP_CC +void list16_deinit(struct list16* self) { if (self->items != self->mitems) @@ -70,7 +70,7 @@ list16_deinit(struct list16* self) } /*****************************************************************************/ -void APP_CC +void list16_add_item(struct list16 *self, tui16 item) { tui16 *p; @@ -94,7 +94,7 @@ list16_add_item(struct list16 *self, tui16 item) } /*****************************************************************************/ -tui16 APP_CC +tui16 list16_get_item(struct list16 *self, int index) { if (index < 0 || index >= self->count) @@ -106,7 +106,7 @@ list16_get_item(struct list16 *self, int index) } /*****************************************************************************/ -void APP_CC +void list16_clear(struct list16 *self) { if (self->items != self->mitems) @@ -119,7 +119,7 @@ list16_clear(struct list16 *self) } /*****************************************************************************/ -int APP_CC +int list16_index_of(struct list16 *self, tui16 item) { int i; @@ -136,7 +136,7 @@ list16_index_of(struct list16 *self, tui16 item) } /*****************************************************************************/ -void APP_CC +void list16_remove_item(struct list16 *self, int index) { int i; @@ -153,7 +153,7 @@ list16_remove_item(struct list16 *self, int index) } /*****************************************************************************/ -void APP_CC +void list16_insert_item(struct list16 *self, int index, tui16 item) { tui16 *p; diff --git a/common/list16.h b/common/list16.h index 1a328ea7..fbe36e1d 100644 --- a/common/list16.h +++ b/common/list16.h @@ -32,25 +32,25 @@ struct list16 tui16 mitems[4]; }; -struct list16* APP_CC +struct list16* list16_create(void); -void APP_CC +void list16_delete(struct list16* self); -void APP_CC +void list16_init(struct list16* self); -void APP_CC +void list16_deinit(struct list16* self); -void APP_CC +void list16_add_item(struct list16* self, tui16 item); -tui16 APP_CC +tui16 list16_get_item(struct list16* self, int index); -void APP_CC +void list16_clear(struct list16* self); -int APP_CC +int list16_index_of(struct list16* self, tui16 item); -void APP_CC +void list16_remove_item(struct list16* self, int index); -void APP_CC +void list16_insert_item(struct list16* self, int index, tui16 item); #endif diff --git a/common/log.c b/common/log.c index e8e64f2f..29904fe5 100644 --- a/common/log.c +++ b/common/log.c @@ -52,7 +52,7 @@ static struct log_config *g_staticLogConfig = NULL; * @return see open(2) return values * */ -int DEFAULT_CC +int internal_log_file_open(const char *fname) { int ret = -1; @@ -80,7 +80,7 @@ internal_log_file_open(const char *fname) * @return syslog equivalent logging level * */ -int DEFAULT_CC +int internal_log_xrdp2syslog(const enum logLevels lvl) { switch (lvl) @@ -108,7 +108,7 @@ internal_log_xrdp2syslog(const enum logLevels lvl) * @return The log string in str pointer. * */ -void DEFAULT_CC +void internal_log_lvl2str(const enum logLevels lvl, char *str) { switch (lvl) @@ -135,7 +135,7 @@ internal_log_lvl2str(const enum logLevels lvl, char *str) } /******************************************************************************/ -enum logReturns DEFAULT_CC +enum logReturns internal_log_start(struct log_config *l_cfg) { enum logReturns ret = LOG_GENERAL_ERROR; @@ -183,7 +183,7 @@ internal_log_start(struct log_config *l_cfg) } /******************************************************************************/ -enum logReturns DEFAULT_CC +enum logReturns internal_log_end(struct log_config *l_cfg) { enum logReturns ret = LOG_GENERAL_ERROR; @@ -225,7 +225,7 @@ internal_log_end(struct log_config *l_cfg) * @param buf * @return */ -enum logLevels DEFAULT_CC +enum logLevels internal_log_text2level(const char *buf) { if (0 == g_strcasecmp(buf, "0") || @@ -259,7 +259,7 @@ internal_log_text2level(const char *buf) return LOG_LEVEL_DEBUG; } -enum logReturns DEFAULT_CC +enum logReturns internalReadConfiguration(const char *inFilename, const char *applicationName) { int fd; @@ -320,7 +320,7 @@ internalReadConfiguration(const char *inFilename, const char *applicationName) } /******************************************************************************/ -enum logReturns DEFAULT_CC +enum logReturns internal_config_read_logging(int file, struct log_config *lc, struct list *param_n, struct list *param_v, @@ -395,7 +395,7 @@ internal_config_read_logging(int file, struct log_config *lc, return LOG_STARTUP_OK; } -enum logReturns DEFAULT_CC +enum logReturns internalInitAndAllocStruct(void) { enum logReturns ret = LOG_GENERAL_ERROR; @@ -420,7 +420,7 @@ internalInitAndAllocStruct(void) * Here below the public functions */ -enum logReturns DEFAULT_CC +enum logReturns log_start_from_param(const struct log_config *iniParams) { enum logReturns ret = LOG_GENERAL_ERROR; @@ -479,7 +479,7 @@ log_start_from_param(const struct log_config *iniParams) * @param applicationName, the name that is used in the log for the running application * @return 0 on success */ -enum logReturns DEFAULT_CC +enum logReturns log_start(const char *iniFile, const char *applicationName) { enum logReturns ret = LOG_GENERAL_ERROR; @@ -520,7 +520,7 @@ log_start(const char *iniFile, const char *applicationName) * Function that terminates all logging * @return */ -enum logReturns DEFAULT_CC +enum logReturns log_end(void) { enum logReturns ret = LOG_GENERAL_ERROR; @@ -535,7 +535,7 @@ log_end(void) return ret; } -enum logReturns DEFAULT_CC +enum logReturns log_message(const enum logLevels lvl, const char *msg, ...) { char buff[LOG_BUFFER_SIZE + 31]; /* 19 (datetime) 4 (space+cr+lf+\0) */ @@ -631,7 +631,7 @@ log_message(const enum logLevels lvl, const char *msg, ...) * Return the configured log file name * @return */ -char *DEFAULT_CC +char * getLogFile(char *replybuf, int bufsize) { if (g_staticLogConfig) diff --git a/common/log.h b/common/log.h index d1552ccb..bd5852eb 100644 --- a/common/log.h +++ b/common/log.h @@ -85,7 +85,7 @@ struct log_config * @return * */ -enum logReturns DEFAULT_CC +enum logReturns internal_log_start(struct log_config *l_cfg); /** @@ -94,7 +94,7 @@ internal_log_start(struct log_config *l_cfg); * @param l_cfg pointer to the logging subsystem to stop * */ -enum logReturns DEFAULT_CC +enum logReturns internal_log_end(struct log_config *l_cfg); /** @@ -102,7 +102,7 @@ internal_log_end(struct log_config *l_cfg); * @param lvl, the loglevel * @param str pointer where the string will be stored. */ -void DEFAULT_CC +void internal_log_lvl2str(const enum logLevels lvl, char *str); /** @@ -112,7 +112,7 @@ internal_log_lvl2str(const enum logLevels lvl, char *str); * @return The corresponding level or LOG_LEVEL_DEBUG if error * */ -enum logLevels DEFAULT_CC +enum logLevels internal_log_text2level(const char *s); /** @@ -120,7 +120,7 @@ internal_log_text2level(const char *s); * also init its content. * @return LOG_STARTUP_OK or LOG_ERROR_MALLOC */ -enum logReturns DEFAULT_CC +enum logReturns internalInitAndAllocStruct(void); /** @@ -132,7 +132,7 @@ internalInitAndAllocStruct(void); * @param applicationName, the application name used in the log events. * @return */ -enum logReturns DEFAULT_CC +enum logReturns internal_config_read_logging(int file, struct log_config *lc, struct list *param_n, struct list *param_v, @@ -146,7 +146,7 @@ internal_config_read_logging(int file, struct log_config *lc, * @param applicationName, the name that is used in the log for the running application * @return LOG_STARTUP_OK on success */ -enum logReturns DEFAULT_CC +enum logReturns log_start(const char *iniFile, const char *applicationName); /** @@ -154,13 +154,13 @@ log_start(const char *iniFile, const char *applicationName); * @param iniParams * @return */ -enum logReturns DEFAULT_CC +enum logReturns log_start_from_param(const struct log_config *iniParams); /** * Function that terminates all logging * @return */ -enum logReturns DEFAULT_CC +enum logReturns log_end(void); /** @@ -170,7 +170,7 @@ log_end(void); * @param ... * @return */ -enum logReturns DEFAULT_CC +enum logReturns log_message(const enum logLevels lvl, const char *msg, ...) printflike(2, 3); /** diff --git a/common/os_calls.c b/common/os_calls.c index 76685a40..f85e5d2e 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -101,14 +101,14 @@ extern char **environ; #endif /*****************************************************************************/ -int APP_CC +int g_rm_temp_dir(void) { return 0; } /*****************************************************************************/ -int APP_CC +int g_mk_temp_dir(const char *app_name) { if (!g_directory_exist("/tmp/.xrdp")) @@ -128,7 +128,7 @@ g_mk_temp_dir(const char *app_name) } /*****************************************************************************/ -void APP_CC +void g_init(const char *app_name) { #if defined(_WIN32) @@ -155,7 +155,7 @@ g_init(const char *app_name) } /*****************************************************************************/ -void APP_CC +void g_deinit(void) { #if defined(_WIN32) @@ -167,7 +167,7 @@ g_deinit(void) /*****************************************************************************/ /* allocate memory, returns a pointer to it, size bytes are allocated, if zero is non zero, each byte will be set to zero */ -void *APP_CC +void * g_malloc(int size, int zero) { char *rv; @@ -187,7 +187,7 @@ g_malloc(int size, int zero) /*****************************************************************************/ /* free the memory pointed to by ptr, ptr can be zero */ -void APP_CC +void g_free(void *ptr) { if (ptr != 0) @@ -199,7 +199,7 @@ g_free(void *ptr) /*****************************************************************************/ /* output text to stdout, try to use g_write / g_writeln instead to avoid linux / windows EOL problems */ -void DEFAULT_CC +void g_printf(const char *format, ...) { va_list ap; @@ -210,7 +210,7 @@ g_printf(const char *format, ...) } /*****************************************************************************/ -void DEFAULT_CC +void g_sprintf(char *dest, const char *format, ...) { va_list ap; @@ -221,7 +221,7 @@ g_sprintf(char *dest, const char *format, ...) } /*****************************************************************************/ -int DEFAULT_CC +int g_snprintf(char *dest, int len, const char *format, ...) { int err; @@ -235,7 +235,7 @@ g_snprintf(char *dest, int len, const char *format, ...) } /*****************************************************************************/ -void DEFAULT_CC +void g_writeln(const char *format, ...) { va_list ap; @@ -251,7 +251,7 @@ g_writeln(const char *format, ...) } /*****************************************************************************/ -void DEFAULT_CC +void g_write(const char *format, ...) { va_list ap; @@ -263,7 +263,7 @@ g_write(const char *format, ...) /*****************************************************************************/ /* produce a hex dump */ -void APP_CC +void g_hexdump(const char *p, int len) { unsigned char *line; @@ -306,21 +306,21 @@ g_hexdump(const char *p, int len) } /*****************************************************************************/ -void APP_CC +void g_memset(void *ptr, int val, int size) { memset(ptr, val, size); } /*****************************************************************************/ -void APP_CC +void g_memcpy(void *d_ptr, const void *s_ptr, int size) { memcpy(d_ptr, s_ptr, size); } /*****************************************************************************/ -int APP_CC +int g_getchar(void) { return getchar(); @@ -328,7 +328,7 @@ g_getchar(void) /*****************************************************************************/ /*Returns 0 on success*/ -int APP_CC +int g_tcp_set_no_delay(int sck) { int ret = 1; /* error */ @@ -367,7 +367,7 @@ g_tcp_set_no_delay(int sck) /*****************************************************************************/ /*Returns 0 on success*/ -int APP_CC +int g_tcp_set_keepalive(int sck) { int ret = 1; /* error */ @@ -407,7 +407,7 @@ g_tcp_set_keepalive(int sck) /*****************************************************************************/ /* returns a newly created socket or -1 on error */ /* in win32 a socket is an unsigned int, in linux, it's an int */ -int APP_CC +int g_tcp_socket(void) { int rv; @@ -498,7 +498,7 @@ g_tcp_socket(void) /*****************************************************************************/ /* returns error */ -int APP_CC +int g_sck_set_send_buffer_bytes(int sck, int bytes) { int option_value; @@ -516,7 +516,7 @@ g_sck_set_send_buffer_bytes(int sck, int bytes) /*****************************************************************************/ /* returns error */ -int APP_CC +int g_sck_get_send_buffer_bytes(int sck, int *bytes) { int option_value; @@ -535,7 +535,7 @@ g_sck_get_send_buffer_bytes(int sck, int *bytes) /*****************************************************************************/ /* returns error */ -int APP_CC +int g_sck_set_recv_buffer_bytes(int sck, int bytes) { int option_value; @@ -553,7 +553,7 @@ g_sck_set_recv_buffer_bytes(int sck, int bytes) /*****************************************************************************/ /* returns error */ -int APP_CC +int g_sck_get_recv_buffer_bytes(int sck, int *bytes) { int option_value; @@ -571,7 +571,7 @@ g_sck_get_recv_buffer_bytes(int sck, int *bytes) } /*****************************************************************************/ -int APP_CC +int g_sck_local_socket(void) { #if defined(_WIN32) @@ -583,7 +583,7 @@ g_sck_local_socket(void) /*****************************************************************************/ /* returns error */ -int APP_CC +int g_sck_get_peer_cred(int sck, int *pid, int *uid, int *gid) { #if defined(SO_PEERCRED) @@ -641,7 +641,7 @@ g_sck_get_peer_cred(int sck, int *pid, int *uid, int *gid) } /*****************************************************************************/ -void APP_CC +void g_sck_close(int sck) { #if defined(_WIN32) @@ -729,7 +729,7 @@ g_sck_close(int sck) /*****************************************************************************/ /* returns error, zero is good */ #if defined(XRDP_ENABLE_IPV6) -int APP_CC +int g_tcp_connect(int sck, const char *address, const char *port) { int res = 0; @@ -789,7 +789,7 @@ g_tcp_connect(int sck, const char *address, const char *port) return res; } #else -int APP_CC +int g_tcp_connect(int sck, const char* address, const char* port) { struct sockaddr_in s; @@ -831,7 +831,7 @@ g_tcp_connect(int sck, const char* address, const char* port) /*****************************************************************************/ /* returns error, zero is good */ -int APP_CC +int g_sck_local_connect(int sck, const char *port) { #if defined(_WIN32) @@ -849,7 +849,7 @@ g_sck_local_connect(int sck, const char *port) } /*****************************************************************************/ -int APP_CC +int g_sck_set_non_blocking(int sck) { unsigned long i; @@ -871,7 +871,7 @@ g_sck_set_non_blocking(int sck) #if defined(XRDP_ENABLE_IPV6) /*****************************************************************************/ /* return boolean */ -static int APP_CC +static int address_match(const char *address, struct addrinfo *j) { struct sockaddr_in *ipv4_in; @@ -939,7 +939,7 @@ address_match(const char *address, struct addrinfo *j) #if defined(XRDP_ENABLE_IPV6) /*****************************************************************************/ /* returns error, zero is good */ -static int APP_CC +static int g_tcp_bind_flags(int sck, const char *port, const char *address, int flags) { int res; @@ -970,7 +970,7 @@ g_tcp_bind_flags(int sck, const char *port, const char *address, int flags) /*****************************************************************************/ /* returns error, zero is good */ -int APP_CC +int g_tcp_bind(int sck, const char *port) { int flags; @@ -979,7 +979,7 @@ g_tcp_bind(int sck, const char *port) return g_tcp_bind_flags(sck, port, 0, flags); } #else -int APP_CC +int g_tcp_bind(int sck, const char* port) { struct sockaddr_in s; @@ -993,7 +993,7 @@ g_tcp_bind(int sck, const char* port) #endif /*****************************************************************************/ -int APP_CC +int g_sck_local_bind(int sck, const char *port) { #if defined(_WIN32) @@ -1013,7 +1013,7 @@ g_sck_local_bind(int sck, const char *port) #if defined(XRDP_ENABLE_IPV6) /*****************************************************************************/ /* returns error, zero is good */ -int APP_CC +int g_tcp_bind_address(int sck, const char *port, const char *address) { int flags; @@ -1022,7 +1022,7 @@ g_tcp_bind_address(int sck, const char *port, const char *address) return g_tcp_bind_flags(sck, port, address, flags); } #else -int APP_CC +int g_tcp_bind_address(int sck, const char* port, const char* address) { struct sockaddr_in s; @@ -1041,14 +1041,14 @@ g_tcp_bind_address(int sck, const char* port, const char* address) /*****************************************************************************/ /* returns error, zero is good */ -int APP_CC +int g_sck_listen(int sck) { return listen(sck, 2); } /*****************************************************************************/ -int APP_CC +int g_tcp_accept(int sck) { int ret; @@ -1108,7 +1108,7 @@ g_tcp_accept(int sck) } /*****************************************************************************/ -int APP_CC +int g_sck_accept(int sck, char *addr, int addr_bytes, char *port, int port_bytes) { int ret; @@ -1175,7 +1175,7 @@ g_sck_accept(int sck, char *addr, int addr_bytes, char *port, int port_bytes) } /*****************************************************************************/ -void APP_CC +void g_write_ip_address(int rcv_sck, char *ip_address, int bytes) { struct sockaddr_in s; @@ -1209,7 +1209,7 @@ g_write_ip_address(int rcv_sck, char *ip_address, int bytes) } /*****************************************************************************/ -void APP_CC +void g_sleep(int msecs) { #if defined(_WIN32) @@ -1220,7 +1220,7 @@ g_sleep(int msecs) } /*****************************************************************************/ -int APP_CC +int g_sck_last_error_would_block(int sck) { #if defined(_WIN32) @@ -1231,7 +1231,7 @@ g_sck_last_error_would_block(int sck) } /*****************************************************************************/ -int APP_CC +int g_sck_recv(int sck, void *ptr, int len, int flags) { #if defined(_WIN32) @@ -1242,7 +1242,7 @@ g_sck_recv(int sck, void *ptr, int len, int flags) } /*****************************************************************************/ -int APP_CC +int g_sck_send(int sck, const void *ptr, int len, int flags) { #if defined(_WIN32) @@ -1254,7 +1254,7 @@ g_sck_send(int sck, const void *ptr, int len, int flags) /*****************************************************************************/ /* returns boolean */ -int APP_CC +int g_sck_socket_ok(int sck) { int opt; @@ -1276,7 +1276,7 @@ g_sck_socket_ok(int sck) /*****************************************************************************/ /* wait 'millis' milliseconds for the socket to be able to write */ /* returns boolean */ -int APP_CC +int g_sck_can_send(int sck, int millis) { fd_set wfds; @@ -1304,7 +1304,7 @@ g_sck_can_send(int sck, int millis) /*****************************************************************************/ /* wait 'millis' milliseconds for the socket to be able to receive */ /* returns boolean */ -int APP_CC +int g_sck_can_recv(int sck, int millis) { fd_set rfds; @@ -1331,7 +1331,7 @@ g_sck_can_recv(int sck, int millis) } /*****************************************************************************/ -int APP_CC +int g_sck_select(int sck1, int sck2) { fd_set rfds; @@ -1385,7 +1385,7 @@ g_sck_select(int sck1, int sck2) /*****************************************************************************/ /* returns boolean */ -static int APP_CC +static int g_fd_can_read(int fd) { fd_set rfds; @@ -1406,7 +1406,7 @@ g_fd_can_read(int fd) /*****************************************************************************/ /* returns error */ /* O_NONBLOCK = 0x00000800 */ -static int APP_CC +static int g_set_nonblock(int fd) { int error; @@ -1432,7 +1432,7 @@ g_set_nonblock(int fd) /*****************************************************************************/ /* returns 0 on error */ -tintptr APP_CC +tintptr g_create_wait_obj(const char *name) { #ifdef _WIN32 @@ -1467,7 +1467,7 @@ g_create_wait_obj(const char *name) /*****************************************************************************/ /* returns 0 on error */ -tintptr APP_CC +tintptr g_create_wait_obj_from_socket(tintptr socket, int write) { #ifdef _WIN32 @@ -1495,7 +1495,7 @@ g_create_wait_obj_from_socket(tintptr socket, int write) } /*****************************************************************************/ -void APP_CC +void g_delete_wait_obj_from_socket(tintptr wait_obj) { #ifdef _WIN32 @@ -1512,7 +1512,7 @@ g_delete_wait_obj_from_socket(tintptr wait_obj) /*****************************************************************************/ /* returns error */ -int APP_CC +int g_set_wait_obj(tintptr obj) { #ifdef _WIN32 @@ -1573,7 +1573,7 @@ g_set_wait_obj(tintptr obj) /*****************************************************************************/ /* returns error */ -int APP_CC +int g_reset_wait_obj(tintptr obj) { #ifdef _WIN32 @@ -1620,7 +1620,7 @@ g_reset_wait_obj(tintptr obj) /*****************************************************************************/ /* returns boolean */ -int APP_CC +int g_is_wait_obj_set(tintptr obj) { #ifdef _WIN32 @@ -1644,7 +1644,7 @@ g_is_wait_obj_set(tintptr obj) /*****************************************************************************/ /* returns error */ -int APP_CC +int g_delete_wait_obj(tintptr obj) { #ifdef _WIN32 @@ -1668,7 +1668,7 @@ g_delete_wait_obj(tintptr obj) /*****************************************************************************/ /* returns error */ -int APP_CC +int g_obj_wait(tintptr *read_objs, int rcount, tintptr *write_objs, int wcount, int mstimeout) { @@ -1799,7 +1799,7 @@ g_obj_wait(tintptr *read_objs, int rcount, tintptr *write_objs, int wcount, } /*****************************************************************************/ -void APP_CC +void g_random(char *data, int len) { #if defined(_WIN32) @@ -1837,14 +1837,14 @@ g_random(char *data, int len) } /*****************************************************************************/ -int APP_CC +int g_abs(int i) { return abs(i); } /*****************************************************************************/ -int APP_CC +int g_memcmp(const void *s1, const void *s2, int len) { return memcmp(s1, s2, len); @@ -1852,7 +1852,7 @@ g_memcmp(const void *s1, const void *s2, int len) /*****************************************************************************/ /* returns -1 on error, else return handle or file descriptor */ -int APP_CC +int g_file_open(const char *file_name) { #if defined(_WIN32) @@ -1876,7 +1876,7 @@ g_file_open(const char *file_name) /*****************************************************************************/ /* returns -1 on error, else return handle or file descriptor */ -int APP_CC +int g_file_open_ex(const char *file_name, int aread, int awrite, int acreate, int atrunc) { @@ -1914,7 +1914,7 @@ g_file_open_ex(const char *file_name, int aread, int awrite, /*****************************************************************************/ /* returns error, always 0 */ -int APP_CC +int g_file_close(int fd) { #if defined(_WIN32) @@ -1927,7 +1927,7 @@ g_file_close(int fd) /*****************************************************************************/ /* read from file, returns the number of bytes read or -1 on error */ -int APP_CC +int g_file_read(int fd, char *ptr, int len) { #if defined(_WIN32) @@ -1948,7 +1948,7 @@ g_file_read(int fd, char *ptr, int len) /*****************************************************************************/ /* write to file, returns the number of bytes written or -1 on error */ -int APP_CC +int g_file_write(int fd, const char *ptr, int len) { #if defined(_WIN32) @@ -1969,7 +1969,7 @@ g_file_write(int fd, const char *ptr, int len) /*****************************************************************************/ /* move file pointer, returns offset on success, -1 on failure */ -int APP_CC +int g_file_seek(int fd, int offset) { #if defined(_WIN32) @@ -1994,7 +1994,7 @@ g_file_seek(int fd, int offset) /*****************************************************************************/ /* do a write lock on a file */ /* return boolean */ -int APP_CC +int g_file_lock(int fd, int start, int len) { #if defined(_WIN32) @@ -2018,7 +2018,7 @@ g_file_lock(int fd, int start, int len) /*****************************************************************************/ /* returns error */ -int APP_CC +int g_chmod_hex(const char *filename, int flags) { #if defined(_WIN32) @@ -2045,7 +2045,7 @@ g_chmod_hex(const char *filename, int flags) /*****************************************************************************/ /* returns error, zero is ok */ -int APP_CC +int g_chown(const char *name, int uid, int gid) { return chown(name, uid, gid); @@ -2053,7 +2053,7 @@ g_chown(const char *name, int uid, int gid) /*****************************************************************************/ /* returns error, always zero */ -int APP_CC +int g_mkdir(const char *dirname) { #if defined(_WIN32) @@ -2067,7 +2067,7 @@ g_mkdir(const char *dirname) /* gets the current working directory and puts up to maxlen chars in dirname always returns 0 */ -char *APP_CC +char * g_get_current_dir(char *dirname, int maxlen) { #if defined(_WIN32) @@ -2085,7 +2085,7 @@ g_get_current_dir(char *dirname, int maxlen) /*****************************************************************************/ /* returns error, zero on success and -1 on failure */ -int APP_CC +int g_set_current_dir(const char *dirname) { #if defined(_WIN32) @@ -2106,7 +2106,7 @@ g_set_current_dir(const char *dirname) /*****************************************************************************/ /* returns boolean, non zero if the file exists */ -int APP_CC +int g_file_exist(const char *filename) { #if defined(_WIN32) @@ -2118,7 +2118,7 @@ g_file_exist(const char *filename) /*****************************************************************************/ /* returns boolean, non zero if the directory exists */ -int APP_CC +int g_directory_exist(const char *dirname) { #if defined(_WIN32) @@ -2141,7 +2141,7 @@ g_directory_exist(const char *dirname) /*****************************************************************************/ /* returns boolean */ -int APP_CC +int g_create_dir(const char *dirname) { #if defined(_WIN32) @@ -2155,7 +2155,7 @@ g_create_dir(const char *dirname) /* will try to create directories up to last / in name example /tmp/a/b/c/readme.txt will try to create /tmp/a/b/c returns boolean */ -int APP_CC +int g_create_path(const char *path) { char *pp; @@ -2196,7 +2196,7 @@ g_create_path(const char *path) /*****************************************************************************/ /* returns boolean */ -int APP_CC +int g_remove_dir(const char *dirname) { #if defined(_WIN32) @@ -2208,7 +2208,7 @@ g_remove_dir(const char *dirname) /*****************************************************************************/ /* returns non zero if the file was deleted */ -int APP_CC +int g_file_delete(const char *filename) { #if defined(_WIN32) @@ -2220,7 +2220,7 @@ g_file_delete(const char *filename) /*****************************************************************************/ /* returns file size, -1 on error */ -int APP_CC +int g_file_get_size(const char *filename) { #if defined(_WIN32) @@ -2242,7 +2242,7 @@ g_file_get_size(const char *filename) /*****************************************************************************/ /* returns length of text */ -int APP_CC +int g_strlen(const char *text) { if (text == NULL) @@ -2255,7 +2255,7 @@ g_strlen(const char *text) /*****************************************************************************/ /* locates char in text */ -const char *APP_CC +const char * g_strchr(const char* text, int c) { if (text == NULL) @@ -2268,7 +2268,7 @@ g_strchr(const char* text, int c) /*****************************************************************************/ /* returns dest */ -char *APP_CC +char * g_strcpy(char *dest, const char *src) { if (src == 0 && dest != 0) @@ -2287,7 +2287,7 @@ g_strcpy(char *dest, const char *src) /*****************************************************************************/ /* returns dest */ -char *APP_CC +char * g_strncpy(char *dest, const char *src, int len) { char *rv; @@ -2310,7 +2310,7 @@ g_strncpy(char *dest, const char *src, int len) /*****************************************************************************/ /* returns dest */ -char *APP_CC +char * g_strcat(char *dest, const char *src) { if (dest == 0 || src == 0) @@ -2323,7 +2323,7 @@ g_strcat(char *dest, const char *src) /*****************************************************************************/ /* if in = 0, return 0 else return newly alloced copy of in */ -char *APP_CC +char * g_strdup(const char *in) { int len; @@ -2349,7 +2349,7 @@ g_strdup(const char *in) /* if in = 0, return 0 else return newly alloced copy of input string * if the input string is larger than maxlen the returned string will be * truncated. All strings returned will include null termination*/ -char *APP_CC +char * g_strndup(const char *in, const unsigned int maxlen) { unsigned int len; @@ -2378,14 +2378,14 @@ g_strndup(const char *in, const unsigned int maxlen) } /*****************************************************************************/ -int APP_CC +int g_strcmp(const char *c1, const char *c2) { return strcmp(c1, c2); } /*****************************************************************************/ -int APP_CC +int g_strncmp(const char *c1, const char *c2, int len) { return strncmp(c1, c2, len); @@ -2393,7 +2393,7 @@ g_strncmp(const char *c1, const char *c2, int len) /*****************************************************************************/ /* compare up to delim */ -int APP_CC +int g_strncmp_d(const char *s1, const char *s2, const char delim, int n) { char c1; @@ -2415,7 +2415,7 @@ g_strncmp_d(const char *s1, const char *s2, const char delim, int n) } /*****************************************************************************/ -int APP_CC +int g_strcasecmp(const char *c1, const char *c2) { #if defined(_WIN32) @@ -2426,7 +2426,7 @@ g_strcasecmp(const char *c1, const char *c2) } /*****************************************************************************/ -int APP_CC +int g_strncasecmp(const char *c1, const char *c2, int len) { #if defined(_WIN32) @@ -2437,7 +2437,7 @@ g_strncasecmp(const char *c1, const char *c2, int len) } /*****************************************************************************/ -int APP_CC +int g_atoi(const char *str) { if (str == 0) @@ -2449,7 +2449,7 @@ g_atoi(const char *str) } /*****************************************************************************/ -int APP_CC +int g_htoi(char *str) { int len; @@ -2532,7 +2532,7 @@ g_htoi(char *str) /*****************************************************************************/ /* returns number of bytes copied into out_str */ -int APP_CC +int g_bytes_to_hexstr(const void *bytes, int num_bytes, char *out_str, int bytes_out_str) { @@ -2559,7 +2559,7 @@ g_bytes_to_hexstr(const void *bytes, int num_bytes, char *out_str, } /*****************************************************************************/ -int APP_CC +int g_pos(const char *str, const char *to_find) { const char *pp; @@ -2575,7 +2575,7 @@ g_pos(const char *str, const char *to_find) } /*****************************************************************************/ -int APP_CC +int g_mbstowcs(twchar *dest, const char *src, int n) { wchar_t *ldest; @@ -2587,7 +2587,7 @@ g_mbstowcs(twchar *dest, const char *src, int n) } /*****************************************************************************/ -int APP_CC +int g_wcstombs(char *dest, const twchar *src, int n) { const wchar_t *lsrc; @@ -2603,7 +2603,7 @@ g_wcstombs(char *dest, const twchar *src, int n) /* trim spaces and tabs, anything <= space */ /* trim_flags 1 trim left, 2 trim right, 3 trim both, 4 trim through */ /* this will always shorten the string or not change it */ -int APP_CC +int g_strtrim(char *str, int trim_flags) { int index; @@ -2734,7 +2734,7 @@ g_strtrim(char *str, int trim_flags) } /*****************************************************************************/ -long APP_CC +long g_load_library(char *in) { #if defined(_WIN32) @@ -2745,7 +2745,7 @@ g_load_library(char *in) } /*****************************************************************************/ -int APP_CC +int g_free_library(long lib) { if (lib == 0) @@ -2762,7 +2762,7 @@ g_free_library(long lib) /*****************************************************************************/ /* returns NULL if not found */ -void *APP_CC +void * g_get_proc_address(long lib, const char *name) { if (lib == 0) @@ -2779,7 +2779,7 @@ g_get_proc_address(long lib, const char *name) /*****************************************************************************/ /* does not work in win32 */ -int APP_CC +int g_system(char *aexec) { #if defined(_WIN32) @@ -2791,7 +2791,7 @@ g_system(char *aexec) /*****************************************************************************/ /* does not work in win32 */ -char *APP_CC +char * g_get_strerror(void) { #if defined(_WIN32) @@ -2802,7 +2802,7 @@ g_get_strerror(void) } /*****************************************************************************/ -int APP_CC +int g_get_errno(void) { #if defined(_WIN32) @@ -2814,7 +2814,7 @@ g_get_errno(void) /*****************************************************************************/ /* does not work in win32 */ -int APP_CC +int g_execvp(const char *p1, char *args[]) { #if defined(_WIN32) @@ -2831,7 +2831,7 @@ g_execvp(const char *p1, char *args[]) /*****************************************************************************/ /* does not work in win32 */ -int APP_CC +int g_execlp3(const char *a1, const char *a2, const char *a3) { #if defined(_WIN32) @@ -2848,7 +2848,7 @@ g_execlp3(const char *a1, const char *a2, const char *a3) /*****************************************************************************/ /* does not work in win32 */ -void APP_CC +void g_signal_child_stop(void (*func)(int)) { #if defined(_WIN32) @@ -2859,7 +2859,7 @@ g_signal_child_stop(void (*func)(int)) /*****************************************************************************/ -void APP_CC +void g_signal_segfault(void (*func)(int)) { #if defined(_WIN32) @@ -2870,7 +2870,7 @@ g_signal_segfault(void (*func)(int)) /*****************************************************************************/ /* does not work in win32 */ -void APP_CC +void g_signal_hang_up(void (*func)(int)) { #if defined(_WIN32) @@ -2881,7 +2881,7 @@ g_signal_hang_up(void (*func)(int)) /*****************************************************************************/ /* does not work in win32 */ -void APP_CC +void g_signal_user_interrupt(void (*func)(int)) { #if defined(_WIN32) @@ -2892,7 +2892,7 @@ g_signal_user_interrupt(void (*func)(int)) /*****************************************************************************/ /* does not work in win32 */ -void APP_CC +void g_signal_terminate(void (*func)(int)) { #if defined(_WIN32) @@ -2903,7 +2903,7 @@ g_signal_terminate(void (*func)(int)) /*****************************************************************************/ /* does not work in win32 */ -void APP_CC +void g_signal_pipe(void (*func)(int)) { #if defined(_WIN32) @@ -2914,7 +2914,7 @@ g_signal_pipe(void (*func)(int)) /*****************************************************************************/ /* does not work in win32 */ -void APP_CC +void g_signal_usr1(void (*func)(int)) { #if defined(_WIN32) @@ -2925,7 +2925,7 @@ g_signal_usr1(void (*func)(int)) /*****************************************************************************/ /* does not work in win32 */ -int APP_CC +int g_fork(void) { #if defined(_WIN32) @@ -2946,7 +2946,7 @@ g_fork(void) /*****************************************************************************/ /* does not work in win32 */ -int APP_CC +int g_setgid(int pid) { #if defined(_WIN32) @@ -2959,7 +2959,7 @@ g_setgid(int pid) /*****************************************************************************/ /* returns error, zero is success, non zero is error */ /* does not work in win32 */ -int APP_CC +int g_initgroups(const char *user, int gid) { #if defined(_WIN32) @@ -2972,7 +2972,7 @@ g_initgroups(const char *user, int gid) /*****************************************************************************/ /* does not work in win32 */ /* returns user id */ -int APP_CC +int g_getuid(void) { #if defined(_WIN32) @@ -2985,7 +2985,7 @@ g_getuid(void) /*****************************************************************************/ /* does not work in win32 */ /* returns user id */ -int APP_CC +int g_getgid(void) { #if defined(_WIN32) @@ -2998,7 +2998,7 @@ g_getgid(void) /*****************************************************************************/ /* does not work in win32 */ /* On success, zero is returned. On error, -1 is returned */ -int APP_CC +int g_setuid(int pid) { #if defined(_WIN32) @@ -3009,7 +3009,7 @@ g_setuid(int pid) } /*****************************************************************************/ -int APP_CC +int g_setsid(void) { #if defined(_WIN32) @@ -3020,7 +3020,7 @@ g_setsid(void) } /*****************************************************************************/ -int APP_CC +int g_setlogin(const char *name) { #ifdef BSD @@ -3033,7 +3033,7 @@ g_setlogin(const char *name) /*****************************************************************************/ /* does not work in win32 returns pid of process that exits or zero if signal occurred */ -int APP_CC +int g_waitchild(void) { #if defined(_WIN32) @@ -3059,7 +3059,7 @@ g_waitchild(void) /*****************************************************************************/ /* does not work in win32 returns pid of process that exits or zero if signal occurred */ -int APP_CC +int g_waitpid(int pid) { #if defined(_WIN32) @@ -3090,7 +3090,7 @@ g_waitpid(int pid) /*****************************************************************************/ /* does not work in win32 */ -void APP_CC +void g_clearenv(void) { #if defined(_WIN32) @@ -3105,7 +3105,7 @@ g_clearenv(void) /*****************************************************************************/ /* does not work in win32 */ -int APP_CC +int g_setenv(const char *name, const char *value, int rewrite) { #if defined(_WIN32) @@ -3117,7 +3117,7 @@ g_setenv(const char *name, const char *value, int rewrite) /*****************************************************************************/ /* does not work in win32 */ -char *APP_CC +char * g_getenv(const char *name) { #if defined(_WIN32) @@ -3128,7 +3128,7 @@ g_getenv(const char *name) } /*****************************************************************************/ -int APP_CC +int g_exit(int exit_code) { _exit(exit_code); @@ -3136,7 +3136,7 @@ g_exit(int exit_code) } /*****************************************************************************/ -int APP_CC +int g_getpid(void) { #if defined(_WIN32) @@ -3148,7 +3148,7 @@ g_getpid(void) /*****************************************************************************/ /* does not work in win32 */ -int APP_CC +int g_sigterm(int pid) { #if defined(_WIN32) @@ -3162,7 +3162,7 @@ g_sigterm(int pid) /* returns 0 if ok */ /* the caller is responsible to free the buffs */ /* does not work in win32 */ -int APP_CC +int g_getuser_info(const char *username, int *gid, int *uid, char **shell, char **dir, char **gecos) { @@ -3210,7 +3210,7 @@ g_getuser_info(const char *username, int *gid, int *uid, char **shell, /*****************************************************************************/ /* returns 0 if ok */ /* does not work in win32 */ -int APP_CC +int g_getgroup_info(const char *groupname, int *gid) { #if defined(_WIN32) @@ -3238,7 +3238,7 @@ g_getgroup_info(const char *groupname, int *gid) /* returns error */ /* if zero is returned, then ok is set */ /* does not work in win32 */ -int APP_CC +int g_check_user_in_group(const char *username, int gid, int *ok) { #if defined(_WIN32) @@ -3277,7 +3277,7 @@ g_check_user_in_group(const char *username, int gid, int *ok) measured in seconds. for windows, returns the number of seconds since the machine was started. */ -int APP_CC +int g_time1(void) { #if defined(_WIN32) @@ -3290,7 +3290,7 @@ g_time1(void) /*****************************************************************************/ /* returns the number of milliseconds since the machine was started. */ -int APP_CC +int g_time2(void) { #if defined(_WIN32) @@ -3307,7 +3307,7 @@ g_time2(void) /*****************************************************************************/ /* returns time in milliseconds, uses gettimeofday does not work in win32 */ -int APP_CC +int g_time3(void) { #if defined(_WIN32) @@ -3351,7 +3351,7 @@ struct dib_hdr }; /******************************************************************************/ -int APP_CC +int g_save_to_bmp(const char* filename, char* data, int stride_bytes, int width, int height, int depth, int bits_per_pixel) { @@ -3474,7 +3474,7 @@ g_save_to_bmp(const char* filename, char* data, int stride_bytes, /*****************************************************************************/ /* returns boolean */ -int APP_CC +int g_text2bool(const char *s) { if ( (g_atoi(s) != 0) || @@ -3489,7 +3489,7 @@ g_text2bool(const char *s) /*****************************************************************************/ /* returns pointer or nil on error */ -void * APP_CC +void * g_shmat(int shmid) { #if defined(_WIN32) @@ -3501,7 +3501,7 @@ g_shmat(int shmid) /*****************************************************************************/ /* returns -1 on error 0 on success */ -int APP_CC +int g_shmdt(const void *shmaddr) { #if defined(_WIN32) @@ -3513,7 +3513,7 @@ g_shmdt(const void *shmaddr) /*****************************************************************************/ /* returns -1 on error 0 on success */ -int APP_CC +int g_gethostname(char *name, int len) { return gethostname(name, len); @@ -3557,7 +3557,7 @@ static unsigned char g_reverse_byte[0x100] = /*****************************************************************************/ /* mirror each byte while copying */ -int APP_CC +int g_mirror_memcpy(void *dst, const void *src, int len) { tui8 *dst8; diff --git a/common/os_calls.h b/common/os_calls.h index 6232b63b..4e93558d 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -37,149 +37,149 @@ #define g_tcp_select g_sck_select #define g_close_wait_obj g_delete_wait_obj -int APP_CC g_rm_temp_dir(void); -int APP_CC g_mk_temp_dir(const char* app_name); -void APP_CC g_init(const char* app_name); -void APP_CC g_deinit(void); -void* APP_CC g_malloc(int size, int zero); -void APP_CC g_free(void* ptr); -void DEFAULT_CC g_printf(const char *format, ...) printflike(1, 2); -void DEFAULT_CC g_sprintf(char* dest, const char* format, ...) \ +int g_rm_temp_dir(void); +int g_mk_temp_dir(const char* app_name); +void g_init(const char* app_name); +void g_deinit(void); +void* g_malloc(int size, int zero); +void g_free(void* ptr); +void g_printf(const char *format, ...) printflike(1, 2); +void g_sprintf(char* dest, const char* format, ...) \ printflike(2, 3); -int DEFAULT_CC g_snprintf(char* dest, int len, const char* format, ...) \ +int g_snprintf(char* dest, int len, const char* format, ...) \ printflike(3, 4); -void DEFAULT_CC g_writeln(const char* format, ...) printflike(1, 2); -void DEFAULT_CC g_write(const char* format, ...) printflike(1, 2); -void APP_CC g_hexdump(const char *p, int len); -void APP_CC g_memset(void* ptr, int val, int size); -void APP_CC g_memcpy(void* d_ptr, const void* s_ptr, int size); -int APP_CC g_getchar(void); -int APP_CC g_tcp_set_no_delay(int sck); -int APP_CC g_tcp_set_keepalive(int sck); -int APP_CC g_tcp_socket(void); -int APP_CC g_sck_set_send_buffer_bytes(int sck, int bytes); -int APP_CC g_sck_get_send_buffer_bytes(int sck, int *bytes); -int APP_CC g_sck_set_recv_buffer_bytes(int sck, int bytes); -int APP_CC g_sck_get_recv_buffer_bytes(int sck, int *bytes); -int APP_CC g_sck_local_socket(void); -int APP_CC g_sck_get_peer_cred(int sck, int *pid, int *uid, int *gid); -void APP_CC g_sck_close(int sck); -int APP_CC g_tcp_connect(int sck, const char* address, const char* port); -int APP_CC g_sck_local_connect(int sck, const char* port); -int APP_CC g_sck_set_non_blocking(int sck); -int APP_CC g_tcp_bind(int sck, const char *port); -int APP_CC g_sck_local_bind(int sck, const char* port); -int APP_CC g_tcp_bind_address(int sck, const char* port, const char* address); -int APP_CC g_sck_listen(int sck); -int APP_CC g_tcp_accept(int sck); -int APP_CC g_sck_accept(int sck, char *addr, int addr_bytes, +void g_writeln(const char* format, ...) printflike(1, 2); +void g_write(const char* format, ...) printflike(1, 2); +void g_hexdump(const char *p, int len); +void g_memset(void* ptr, int val, int size); +void g_memcpy(void* d_ptr, const void* s_ptr, int size); +int g_getchar(void); +int g_tcp_set_no_delay(int sck); +int g_tcp_set_keepalive(int sck); +int g_tcp_socket(void); +int g_sck_set_send_buffer_bytes(int sck, int bytes); +int g_sck_get_send_buffer_bytes(int sck, int *bytes); +int g_sck_set_recv_buffer_bytes(int sck, int bytes); +int g_sck_get_recv_buffer_bytes(int sck, int *bytes); +int g_sck_local_socket(void); +int g_sck_get_peer_cred(int sck, int *pid, int *uid, int *gid); +void g_sck_close(int sck); +int g_tcp_connect(int sck, const char* address, const char* port); +int g_sck_local_connect(int sck, const char* port); +int g_sck_set_non_blocking(int sck); +int g_tcp_bind(int sck, const char *port); +int g_sck_local_bind(int sck, const char* port); +int g_tcp_bind_address(int sck, const char* port, const char* address); +int g_sck_listen(int sck); +int g_tcp_accept(int sck); +int g_sck_accept(int sck, char *addr, int addr_bytes, char *port, int port_bytes); -int APP_CC g_sck_recv(int sck, void* ptr, int len, int flags); -int APP_CC g_sck_send(int sck, const void* ptr, int len, int flags); -int APP_CC g_sck_last_error_would_block(int sck); -int APP_CC g_sck_socket_ok(int sck); -int APP_CC g_sck_can_send(int sck, int millis); -int APP_CC g_sck_can_recv(int sck, int millis); -int APP_CC g_sck_select(int sck1, int sck2); -void APP_CC g_write_ip_address(int rcv_sck, char* ip_address, int bytes); -void APP_CC g_sleep(int msecs); -tintptr APP_CC g_create_wait_obj(const char *name); -tintptr APP_CC g_create_wait_obj_from_socket(tintptr socket, int write); -void APP_CC g_delete_wait_obj_from_socket(tintptr wait_obj); -int APP_CC g_set_wait_obj(tintptr obj); -int APP_CC g_reset_wait_obj(tintptr obj); -int APP_CC g_is_wait_obj_set(tintptr obj); -int APP_CC g_delete_wait_obj(tintptr obj); -int APP_CC g_obj_wait(tintptr* read_objs, int rcount, tintptr* write_objs, +int g_sck_recv(int sck, void* ptr, int len, int flags); +int g_sck_send(int sck, const void* ptr, int len, int flags); +int g_sck_last_error_would_block(int sck); +int g_sck_socket_ok(int sck); +int g_sck_can_send(int sck, int millis); +int g_sck_can_recv(int sck, int millis); +int g_sck_select(int sck1, int sck2); +void g_write_ip_address(int rcv_sck, char* ip_address, int bytes); +void g_sleep(int msecs); +tintptr g_create_wait_obj(const char *name); +tintptr g_create_wait_obj_from_socket(tintptr socket, int write); +void g_delete_wait_obj_from_socket(tintptr wait_obj); +int g_set_wait_obj(tintptr obj); +int g_reset_wait_obj(tintptr obj); +int g_is_wait_obj_set(tintptr obj); +int g_delete_wait_obj(tintptr obj); +int g_obj_wait(tintptr* read_objs, int rcount, tintptr* write_objs, int wcount,int mstimeout); -void APP_CC g_random(char* data, int len); -int APP_CC g_abs(int i); -int APP_CC g_memcmp(const void* s1, const void* s2, int len); -int APP_CC g_file_open(const char* file_name); -int APP_CC g_file_open_ex(const char *file_name, int aread, int awrite, +void g_random(char* data, int len); +int g_abs(int i); +int g_memcmp(const void* s1, const void* s2, int len); +int g_file_open(const char* file_name); +int g_file_open_ex(const char *file_name, int aread, int awrite, int acreate, int atrunc); -int APP_CC g_file_close(int fd); -int APP_CC g_file_read(int fd, char* ptr, int len); -int APP_CC g_file_write(int fd, const char *ptr, int len); -int APP_CC g_file_seek(int fd, int offset); -int APP_CC g_file_lock(int fd, int start, int len); -int APP_CC g_chmod_hex(const char* filename, int flags); -int APP_CC g_chown(const char* name, int uid, int gid); -int APP_CC g_mkdir(const char* dirname); -char* APP_CC g_get_current_dir(char* dirname, int maxlen); -int APP_CC g_set_current_dir(const char *dirname); -int APP_CC g_file_exist(const char* filename); -int APP_CC g_directory_exist(const char* dirname); -int APP_CC g_create_dir(const char* dirname); -int APP_CC g_create_path(const char* path); -int APP_CC g_remove_dir(const char* dirname); -int APP_CC g_file_delete(const char* filename); -int APP_CC g_file_get_size(const char* filename); -int APP_CC g_strlen(const char* text); -const char *APP_CC g_strchr(const char *text, int c); -char* APP_CC g_strcpy(char* dest, const char* src); -char* APP_CC g_strncpy(char* dest, const char* src, int len); -char* APP_CC g_strcat(char* dest, const char* src); -char* APP_CC g_strdup(const char* in); -char* APP_CC g_strndup(const char* in, const unsigned int maxlen); -int APP_CC g_strcmp(const char* c1, const char* c2); -int APP_CC g_strncmp(const char* c1, const char* c2, int len); -int APP_CC g_strncmp_d(const char* c1, const char* c2, const char delim, int len); -int APP_CC g_strcasecmp(const char* c1, const char* c2); -int APP_CC g_strncasecmp(const char* c1, const char* c2, int len); -int APP_CC g_atoi(const char* str); -int APP_CC g_htoi(char* str); -int APP_CC g_bytes_to_hexstr(const void *bytes, int num_bytes, char *out_str, +int g_file_close(int fd); +int g_file_read(int fd, char* ptr, int len); +int g_file_write(int fd, const char *ptr, int len); +int g_file_seek(int fd, int offset); +int g_file_lock(int fd, int start, int len); +int g_chmod_hex(const char* filename, int flags); +int g_chown(const char* name, int uid, int gid); +int g_mkdir(const char* dirname); +char* g_get_current_dir(char* dirname, int maxlen); +int g_set_current_dir(const char *dirname); +int g_file_exist(const char* filename); +int g_directory_exist(const char* dirname); +int g_create_dir(const char* dirname); +int g_create_path(const char* path); +int g_remove_dir(const char* dirname); +int g_file_delete(const char* filename); +int g_file_get_size(const char* filename); +int g_strlen(const char* text); +const char *g_strchr(const char *text, int c); +char* g_strcpy(char* dest, const char* src); +char* g_strncpy(char* dest, const char* src, int len); +char* g_strcat(char* dest, const char* src); +char* g_strdup(const char* in); +char* g_strndup(const char* in, const unsigned int maxlen); +int g_strcmp(const char* c1, const char* c2); +int g_strncmp(const char* c1, const char* c2, int len); +int g_strncmp_d(const char* c1, const char* c2, const char delim, int len); +int g_strcasecmp(const char* c1, const char* c2); +int g_strncasecmp(const char* c1, const char* c2, int len); +int g_atoi(const char* str); +int g_htoi(char* str); +int g_bytes_to_hexstr(const void *bytes, int num_bytes, char *out_str, int bytes_out_str); -int APP_CC g_pos(const char* str, const char* to_find); -int APP_CC g_mbstowcs(twchar* dest, const char* src, int n); -int APP_CC g_wcstombs(char* dest, const twchar* src, int n); -int APP_CC g_strtrim(char* str, int trim_flags); -long APP_CC g_load_library(char* in); -int APP_CC g_free_library(long lib); -void* APP_CC g_get_proc_address(long lib, const char* name); -int APP_CC g_system(char* aexec); -char* APP_CC g_get_strerror(void); -int APP_CC g_get_errno(void); -int APP_CC g_execvp(const char* p1, char* args[]); -int APP_CC g_execlp3(const char* a1, const char* a2, const char* a3); -void APP_CC g_signal_child_stop(void (*func)(int)); -void APP_CC g_signal_segfault(void (*func)(int)); -void APP_CC g_signal_hang_up(void (*func)(int)); -void APP_CC g_signal_user_interrupt(void (*func)(int)); -void APP_CC g_signal_terminate(void (*func)(int)); -void APP_CC g_signal_pipe(void (*func)(int)); -void APP_CC g_signal_usr1(void (*func)(int)); -int APP_CC g_fork(void); -int APP_CC g_setgid(int pid); -int APP_CC g_initgroups(const char* user, int gid); -int APP_CC g_getuid(void); -int APP_CC g_getgid(void); -int APP_CC g_setuid(int pid); -int APP_CC g_setsid(void); -int APP_CC g_setlogin(const char *name); -int APP_CC g_waitchild(void); -int APP_CC g_waitpid(int pid); -void APP_CC g_clearenv(void); -int APP_CC g_setenv(const char* name, const char* value, int rewrite); -char* APP_CC g_getenv(const char* name); -int APP_CC g_exit(int exit_code); -int APP_CC g_getpid(void); -int APP_CC g_sigterm(int pid); -int APP_CC g_getuser_info(const char* username, int* gid, int* uid, char** shell, +int g_pos(const char* str, const char* to_find); +int g_mbstowcs(twchar* dest, const char* src, int n); +int g_wcstombs(char* dest, const twchar* src, int n); +int g_strtrim(char* str, int trim_flags); +long g_load_library(char* in); +int g_free_library(long lib); +void* g_get_proc_address(long lib, const char* name); +int g_system(char* aexec); +char* g_get_strerror(void); +int g_get_errno(void); +int g_execvp(const char* p1, char* args[]); +int g_execlp3(const char* a1, const char* a2, const char* a3); +void g_signal_child_stop(void (*func)(int)); +void g_signal_segfault(void (*func)(int)); +void g_signal_hang_up(void (*func)(int)); +void g_signal_user_interrupt(void (*func)(int)); +void g_signal_terminate(void (*func)(int)); +void g_signal_pipe(void (*func)(int)); +void g_signal_usr1(void (*func)(int)); +int g_fork(void); +int g_setgid(int pid); +int g_initgroups(const char* user, int gid); +int g_getuid(void); +int g_getgid(void); +int g_setuid(int pid); +int g_setsid(void); +int g_setlogin(const char *name); +int g_waitchild(void); +int g_waitpid(int pid); +void g_clearenv(void); +int g_setenv(const char* name, const char* value, int rewrite); +char* g_getenv(const char* name); +int g_exit(int exit_code); +int g_getpid(void); +int g_sigterm(int pid); +int g_getuser_info(const char* username, int* gid, int* uid, char** shell, char** dir, char** gecos); -int APP_CC g_getgroup_info(const char* groupname, int* gid); -int APP_CC g_check_user_in_group(const char* username, int gid, int* ok); -int APP_CC g_time1(void); -int APP_CC g_time2(void); -int APP_CC g_time3(void); -int APP_CC g_save_to_bmp(const char* filename, char* data, int stride_bytes, +int g_getgroup_info(const char* groupname, int* gid); +int g_check_user_in_group(const char* username, int gid, int* ok); +int g_time1(void); +int g_time2(void); +int g_time3(void); +int g_save_to_bmp(const char* filename, char* data, int stride_bytes, int width, int height, int depth, int bits_per_pixel); -int APP_CC g_text2bool(const char *s); -void * APP_CC g_shmat(int shmid); -int APP_CC g_shmdt(const void *shmaddr); -int APP_CC g_gethostname(char *name, int len); -int APP_CC g_mirror_memcpy(void *dst, const void *src, int len); +int g_text2bool(const char *s); +void * g_shmat(int shmid); +int g_shmdt(const void *shmaddr); +int g_gethostname(char *name, int len); +int g_mirror_memcpy(void *dst, const void *src, int len); /* glib-style wrappers */ #define g_new(struct_type, n_structs) \ diff --git a/common/ssl_calls.c b/common/ssl_calls.c index 1e50270b..f92cc972 100644 --- a/common/ssl_calls.c +++ b/common/ssl_calls.c @@ -85,28 +85,28 @@ ssl_finish(void) /* rc4 stuff */ /*****************************************************************************/ -void *APP_CC +void * ssl_rc4_info_create(void) { return g_malloc(sizeof(RC4_KEY), 1); } /*****************************************************************************/ -void APP_CC +void ssl_rc4_info_delete(void *rc4_info) { g_free(rc4_info); } /*****************************************************************************/ -void APP_CC +void ssl_rc4_set_key(void *rc4_info, char *key, int len) { RC4_set_key((RC4_KEY *)rc4_info, len, (tui8 *)key); } /*****************************************************************************/ -void APP_CC +void ssl_rc4_crypt(void *rc4_info, char *data, int len) { RC4((RC4_KEY *)rc4_info, len, (tui8 *)data, (tui8 *)data); @@ -115,35 +115,35 @@ ssl_rc4_crypt(void *rc4_info, char *data, int len) /* sha1 stuff */ /*****************************************************************************/ -void *APP_CC +void * ssl_sha1_info_create(void) { return g_malloc(sizeof(SHA_CTX), 1); } /*****************************************************************************/ -void APP_CC +void ssl_sha1_info_delete(void *sha1_info) { g_free(sha1_info); } /*****************************************************************************/ -void APP_CC +void ssl_sha1_clear(void *sha1_info) { SHA1_Init((SHA_CTX *)sha1_info); } /*****************************************************************************/ -void APP_CC +void ssl_sha1_transform(void *sha1_info, const char *data, int len) { SHA1_Update((SHA_CTX *)sha1_info, data, len); } /*****************************************************************************/ -void APP_CC +void ssl_sha1_complete(void *sha1_info, char *data) { SHA1_Final((tui8 *)data, (SHA_CTX *)sha1_info); @@ -152,35 +152,35 @@ ssl_sha1_complete(void *sha1_info, char *data) /* md5 stuff */ /*****************************************************************************/ -void *APP_CC +void * ssl_md5_info_create(void) { return g_malloc(sizeof(MD5_CTX), 1); } /*****************************************************************************/ -void APP_CC +void ssl_md5_info_delete(void *md5_info) { g_free(md5_info); } /*****************************************************************************/ -void APP_CC +void ssl_md5_clear(void *md5_info) { MD5_Init((MD5_CTX *)md5_info); } /*****************************************************************************/ -void APP_CC +void ssl_md5_transform(void *md5_info, char *data, int len) { MD5_Update((MD5_CTX *)md5_info, data, len); } /*****************************************************************************/ -void APP_CC +void ssl_md5_complete(void *md5_info, char *data) { MD5_Final((tui8 *)data, (MD5_CTX *)md5_info); @@ -189,7 +189,7 @@ ssl_md5_complete(void *md5_info, char *data) /* FIPS stuff */ /*****************************************************************************/ -void *APP_CC +void * ssl_des3_encrypt_info_create(const char *key, const char* ivec) { EVP_CIPHER_CTX *des3_ctx; @@ -205,7 +205,7 @@ ssl_des3_encrypt_info_create(const char *key, const char* ivec) } /*****************************************************************************/ -void *APP_CC +void * ssl_des3_decrypt_info_create(const char *key, const char* ivec) { EVP_CIPHER_CTX *des3_ctx; @@ -221,7 +221,7 @@ ssl_des3_decrypt_info_create(const char *key, const char* ivec) } /*****************************************************************************/ -void APP_CC +void ssl_des3_info_delete(void *des3) { EVP_CIPHER_CTX *des3_ctx; @@ -234,7 +234,7 @@ ssl_des3_info_delete(void *des3) } /*****************************************************************************/ -int APP_CC +int ssl_des3_encrypt(void *des3, int length, const char *in_data, char *out_data) { EVP_CIPHER_CTX *des3_ctx; @@ -251,7 +251,7 @@ ssl_des3_encrypt(void *des3, int length, const char *in_data, char *out_data) } /*****************************************************************************/ -int APP_CC +int ssl_des3_decrypt(void *des3, int length, const char *in_data, char *out_data) { EVP_CIPHER_CTX *des3_ctx; @@ -268,7 +268,7 @@ ssl_des3_decrypt(void *des3, int length, const char *in_data, char *out_data) } /*****************************************************************************/ -void * APP_CC +void * ssl_hmac_info_create(void) { HMAC_CTX *hmac_ctx; @@ -278,7 +278,7 @@ ssl_hmac_info_create(void) } /*****************************************************************************/ -void APP_CC +void ssl_hmac_info_delete(void *hmac) { HMAC_CTX *hmac_ctx; @@ -291,7 +291,7 @@ ssl_hmac_info_delete(void *hmac) } /*****************************************************************************/ -void APP_CC +void ssl_hmac_sha1_init(void *hmac, const char *data, int len) { HMAC_CTX *hmac_ctx; @@ -301,7 +301,7 @@ ssl_hmac_sha1_init(void *hmac, const char *data, int len) } /*****************************************************************************/ -void APP_CC +void ssl_hmac_transform(void *hmac, const char *data, int len) { HMAC_CTX *hmac_ctx; @@ -313,7 +313,7 @@ ssl_hmac_transform(void *hmac, const char *data, int len) } /*****************************************************************************/ -void APP_CC +void ssl_hmac_complete(void *hmac, char *data, int len) { HMAC_CTX *hmac_ctx; @@ -327,7 +327,7 @@ ssl_hmac_complete(void *hmac, char *data, int len) } /*****************************************************************************/ -static void APP_CC +static void ssl_reverse_it(char *p, int len) { int i; @@ -348,7 +348,7 @@ ssl_reverse_it(char *p, int len) } /*****************************************************************************/ -int APP_CC +int ssl_mod_exp(char *out, int out_len, const char *in, int in_len, const char *mod, int mod_len, const char *exp, int exp_len) { @@ -410,7 +410,7 @@ ssl_mod_exp(char *out, int out_len, const char *in, int in_len, /* returns error generates a new rsa key exp is passed in and mod and pri are passed out */ -int APP_CC +int ssl_gen_key_xrdp1(int key_size_in_bits, const char *exp, int exp_len, char *mod, int mod_len, char *pri, int pri_len) { @@ -486,7 +486,6 @@ ssl_gen_key_xrdp1(int key_size_in_bits, const char *exp, int exp_len, /*****************************************************************************/ struct ssl_tls * -APP_CC ssl_tls_create(struct trans *trans, const char *key, const char *cert) { struct ssl_tls *self; @@ -508,7 +507,7 @@ ssl_tls_create(struct trans *trans, const char *key, const char *cert) } /*****************************************************************************/ -int APP_CC +int ssl_tls_print_error(const char *func, SSL *connection, int value) { switch (SSL_get_error(connection, value)) @@ -538,7 +537,7 @@ ssl_tls_print_error(const char *func, SSL *connection, int value) } /*****************************************************************************/ -int APP_CC +int ssl_tls_accept(struct ssl_tls *self, long ssl_protocols, const char *tls_ciphers) { @@ -665,7 +664,7 @@ ssl_tls_accept(struct ssl_tls *self, long ssl_protocols, /*****************************************************************************/ /* returns error, */ -int APP_CC +int ssl_tls_disconnect(struct ssl_tls *self) { int status; @@ -699,7 +698,7 @@ ssl_tls_disconnect(struct ssl_tls *self) } /*****************************************************************************/ -void APP_CC +void ssl_tls_delete(struct ssl_tls *self) { if (self != NULL) @@ -717,7 +716,7 @@ ssl_tls_delete(struct ssl_tls *self) } /*****************************************************************************/ -int APP_CC +int ssl_tls_read(struct ssl_tls *tls, char *data, int length) { int status; @@ -766,7 +765,7 @@ ssl_tls_read(struct ssl_tls *tls, char *data, int length) } /*****************************************************************************/ -int APP_CC +int ssl_tls_write(struct ssl_tls *tls, const char *data, int length) { int status; @@ -811,7 +810,7 @@ ssl_tls_write(struct ssl_tls *tls, const char *data, int length) /*****************************************************************************/ /* returns boolean */ -int APP_CC +int ssl_tls_can_recv(struct ssl_tls *tls, int sck, int millis) { if (SSL_pending(tls->ssl) > 0) diff --git a/common/ssl_calls.h b/common/ssl_calls.h index c969ec43..4c069cb0 100644 --- a/common/ssl_calls.h +++ b/common/ssl_calls.h @@ -26,58 +26,58 @@ int ssl_init(void); int ssl_finish(void); -void* APP_CC +void* ssl_rc4_info_create(void); -void APP_CC +void ssl_rc4_info_delete(void* rc4_info); -void APP_CC +void ssl_rc4_set_key(void* rc4_info, char* key, int len); -void APP_CC +void ssl_rc4_crypt(void* rc4_info, char* data, int len); -void* APP_CC +void* ssl_sha1_info_create(void); -void APP_CC +void ssl_sha1_info_delete(void* sha1_info); -void APP_CC +void ssl_sha1_clear(void* sha1_info); -void APP_CC +void ssl_sha1_transform(void* sha1_info, const char *data, int len); -void APP_CC +void ssl_sha1_complete(void* sha1_info, char* data); -void* APP_CC +void* ssl_md5_info_create(void); -void APP_CC +void ssl_md5_info_delete(void* md5_info); -void APP_CC +void ssl_md5_clear(void* md5_info); -void APP_CC +void ssl_md5_transform(void* md5_info, char* data, int len); -void APP_CC +void ssl_md5_complete(void* md5_info, char* data); -void *APP_CC +void * ssl_des3_encrypt_info_create(const char *key, const char* ivec); -void *APP_CC +void * ssl_des3_decrypt_info_create(const char *key, const char* ivec); -void APP_CC +void ssl_des3_info_delete(void *des3); -int APP_CC +int ssl_des3_encrypt(void *des3, int length, const char *in_data, char *out_data); -int APP_CC +int ssl_des3_decrypt(void *des3, int length, const char *in_data, char *out_data); -void * APP_CC +void * ssl_hmac_info_create(void); -void APP_CC +void ssl_hmac_info_delete(void *hmac); -void APP_CC +void ssl_hmac_sha1_init(void *hmac, const char *data, int len); -void APP_CC +void ssl_hmac_transform(void *hmac, const char *data, int len); -void APP_CC +void ssl_hmac_complete(void *hmac, char *data, int len); -int APP_CC +int ssl_mod_exp(char *out, int out_len, const char *in, int in_len, const char *mod, int mod_len, const char *exp, int exp_len); -int APP_CC +int ssl_gen_key_xrdp1(int key_size_in_bits, const char* exp, int exp_len, char* mod, int mod_len, char* pri, int pri_len); @@ -93,20 +93,20 @@ struct ssl_tls }; /* xrdp_tls.c */ -struct ssl_tls *APP_CC +struct ssl_tls * ssl_tls_create(struct trans *trans, const char *key, const char *cert); -int APP_CC +int ssl_tls_accept(struct ssl_tls *self, long ssl_protocols, const char *tls_ciphers); -int APP_CC +int ssl_tls_disconnect(struct ssl_tls *self); -void APP_CC +void ssl_tls_delete(struct ssl_tls *self); -int APP_CC +int ssl_tls_read(struct ssl_tls *tls, char *data, int length); -int APP_CC +int ssl_tls_write(struct ssl_tls *tls, const char *data, int length); -int APP_CC +int ssl_tls_can_recv(struct ssl_tls *tls, int sck, int millis); const char *ssl_get_version(const struct ssl_st *ssl); diff --git a/common/thread_calls.c b/common/thread_calls.c index addad6fd..4ce25897 100644 --- a/common/thread_calls.c +++ b/common/thread_calls.c @@ -40,7 +40,7 @@ /*****************************************************************************/ /* returns error */ #if defined(_WIN32) -int APP_CC +int tc_thread_create(unsigned long (__stdcall *start_routine)(void *), void *arg) { int rv = 0; @@ -54,7 +54,7 @@ tc_thread_create(unsigned long (__stdcall *start_routine)(void *), void *arg) return rv; } #else -int APP_CC +int tc_thread_create(void * (* start_routine)(void *), void *arg) { int rv = 0; @@ -75,7 +75,7 @@ tc_thread_create(void * (* start_routine)(void *), void *arg) #endif /*****************************************************************************/ -tbus APP_CC +tbus tc_get_threadid(void) { #if defined(_WIN32) @@ -87,7 +87,7 @@ tc_get_threadid(void) /*****************************************************************************/ /* returns boolean */ -int APP_CC +int tc_threadid_equal(tbus tid1, tbus tid2) { #if defined(_WIN32) @@ -98,7 +98,7 @@ tc_threadid_equal(tbus tid1, tbus tid2) } /*****************************************************************************/ -tbus APP_CC +tbus tc_mutex_create(void) { #if defined(_WIN32) @@ -113,7 +113,7 @@ tc_mutex_create(void) } /*****************************************************************************/ -void APP_CC +void tc_mutex_delete(tbus mutex) { #if defined(_WIN32) @@ -128,7 +128,7 @@ tc_mutex_delete(tbus mutex) } /*****************************************************************************/ -int APP_CC +int tc_mutex_lock(tbus mutex) { #if defined(_WIN32) @@ -141,7 +141,7 @@ tc_mutex_lock(tbus mutex) } /*****************************************************************************/ -int APP_CC +int tc_mutex_unlock(tbus mutex) { int rv = 0; @@ -159,7 +159,7 @@ tc_mutex_unlock(tbus mutex) } /*****************************************************************************/ -tbus APP_CC +tbus tc_sem_create(int init_count) { #if defined(_WIN32) @@ -180,7 +180,7 @@ tc_sem_create(int init_count) } /*****************************************************************************/ -void APP_CC +void tc_sem_delete(tbus sem) { #if defined(_WIN32) @@ -197,7 +197,7 @@ tc_sem_delete(tbus sem) } /*****************************************************************************/ -int APP_CC +int tc_sem_dec(tbus sem) { #if defined(_WIN32) @@ -213,7 +213,7 @@ tc_sem_dec(tbus sem) } /*****************************************************************************/ -int APP_CC +int tc_sem_inc(tbus sem) { #if defined(_WIN32) diff --git a/common/thread_calls.h b/common/thread_calls.h index 2a3122fc..c8b6640a 100644 --- a/common/thread_calls.h +++ b/common/thread_calls.h @@ -23,27 +23,27 @@ #include "arch.h" -int APP_CC +int tc_thread_create(THREAD_RV (THREAD_CC * start_routine)(void*), void* arg); -tbus APP_CC +tbus tc_get_threadid(void); -int APP_CC +int tc_threadid_equal(tbus tid1, tbus tid2); -tbus APP_CC +tbus tc_mutex_create(void); -void APP_CC +void tc_mutex_delete(tbus mutex); -int APP_CC +int tc_mutex_lock(tbus mutex); -int APP_CC +int tc_mutex_unlock(tbus mutex); -tbus APP_CC +tbus tc_sem_create(int init_count); -void APP_CC +void tc_sem_delete(tbus sem); -int APP_CC +int tc_sem_dec(tbus sem); -int APP_CC +int tc_sem_inc(tbus sem); #endif diff --git a/common/trans.c b/common/trans.c index f77f959d..d73764de 100644 --- a/common/trans.c +++ b/common/trans.c @@ -31,7 +31,7 @@ #define MAX_SBYTES 0 /*****************************************************************************/ -int APP_CC +int trans_tls_recv(struct trans *self, char *ptr, int len) { if (self->tls == NULL) @@ -42,7 +42,7 @@ trans_tls_recv(struct trans *self, char *ptr, int len) } /*****************************************************************************/ -int APP_CC +int trans_tls_send(struct trans *self, const char *data, int len) { if (self->tls == NULL) @@ -53,7 +53,7 @@ trans_tls_send(struct trans *self, const char *data, int len) } /*****************************************************************************/ -int APP_CC +int trans_tls_can_recv(struct trans *self, int sck, int millis) { if (self->tls == NULL) @@ -64,21 +64,21 @@ trans_tls_can_recv(struct trans *self, int sck, int millis) } /*****************************************************************************/ -int APP_CC +int trans_tcp_recv(struct trans *self, char *ptr, int len) { return g_tcp_recv(self->sck, ptr, len, 0); } /*****************************************************************************/ -int APP_CC +int trans_tcp_send(struct trans *self, const char *data, int len) { return g_tcp_send(self->sck, data, len, 0); } /*****************************************************************************/ -int APP_CC +int trans_tcp_can_recv(struct trans *self, int sck, int millis) { return g_sck_can_recv(sck, millis); @@ -86,7 +86,6 @@ trans_tcp_can_recv(struct trans *self, int sck, int millis) /*****************************************************************************/ struct trans * -APP_CC trans_create(int mode, int in_size, int out_size) { struct trans *self = (struct trans *) NULL; @@ -111,7 +110,7 @@ trans_create(int mode, int in_size, int out_size) } /*****************************************************************************/ -void APP_CC +void trans_delete(struct trans *self) { if (self == 0) @@ -144,7 +143,7 @@ trans_delete(struct trans *self) } /*****************************************************************************/ -int APP_CC +int trans_get_wait_objs(struct trans *self, tbus *objs, int *count) { if (self == 0) @@ -173,7 +172,7 @@ trans_get_wait_objs(struct trans *self, tbus *objs, int *count) } /*****************************************************************************/ -int APP_CC +int trans_get_wait_objs_rw(struct trans *self, tbus *robjs, int *rcount, tbus *wobjs, int *wcount, int *timeout) { @@ -208,7 +207,7 @@ trans_get_wait_objs_rw(struct trans *self, tbus *robjs, int *rcount, } /*****************************************************************************/ -int APP_CC +int trans_send_waiting(struct trans *self, int block) { struct stream *temp_s; @@ -276,7 +275,7 @@ trans_send_waiting(struct trans *self, int block) } /*****************************************************************************/ -int APP_CC +int trans_check_wait_objs(struct trans *self) { tbus in_sck = (tbus) 0; @@ -430,7 +429,7 @@ trans_check_wait_objs(struct trans *self) } /*****************************************************************************/ -int APP_CC +int trans_force_read_s(struct trans *self, struct stream *in_s, int size) { int rcvd; @@ -488,14 +487,14 @@ trans_force_read_s(struct trans *self, struct stream *in_s, int size) } /*****************************************************************************/ -int APP_CC +int trans_force_read(struct trans *self, int size) { return trans_force_read_s(self, self->in_s, size); } /*****************************************************************************/ -int APP_CC +int trans_force_write_s(struct trans *self, struct stream *out_s) { int size; @@ -556,14 +555,14 @@ trans_force_write_s(struct trans *self, struct stream *out_s) } /*****************************************************************************/ -int APP_CC +int trans_force_write(struct trans *self) { return trans_force_write_s(self, self->out_s); } /*****************************************************************************/ -int APP_CC +int trans_write_copy_s(struct trans *self, struct stream *out_s) { int size; @@ -646,14 +645,14 @@ trans_write_copy_s(struct trans *self, struct stream *out_s) } /*****************************************************************************/ -int APP_CC +int trans_write_copy(struct trans* self) { return trans_write_copy_s(self, self->out_s); } /*****************************************************************************/ -int APP_CC +int trans_connect(struct trans *self, const char *server, const char *port, int timeout) { @@ -781,7 +780,7 @@ trans_connect(struct trans *self, const char *server, const char *port, /** * @return 0 on success, 1 on failure */ -int APP_CC +int trans_listen_address(struct trans *self, char *port, const char *address) { if (self->sck != 0) @@ -837,7 +836,7 @@ trans_listen_address(struct trans *self, char *port, const char *address) } /*****************************************************************************/ -int APP_CC +int trans_listen(struct trans *self, char *port) { return trans_listen_address(self, port, "0.0.0.0"); @@ -845,7 +844,6 @@ trans_listen(struct trans *self, char *port) /*****************************************************************************/ struct stream * -APP_CC trans_get_in_s(struct trans *self) { struct stream *rv = (struct stream *) NULL; @@ -864,7 +862,6 @@ trans_get_in_s(struct trans *self) /*****************************************************************************/ struct stream * -APP_CC trans_get_out_s(struct trans *self, int size) { struct stream *rv = (struct stream *) NULL; @@ -884,7 +881,7 @@ trans_get_out_s(struct trans *self, int size) /*****************************************************************************/ /* returns error */ -int APP_CC +int trans_set_tls_mode(struct trans *self, const char *key, const char *cert, long ssl_protocols, const char *tls_ciphers) { @@ -914,7 +911,7 @@ trans_set_tls_mode(struct trans *self, const char *key, const char *cert, /*****************************************************************************/ /* returns error */ -int APP_CC +int trans_shutdown_tls_mode(struct trans *self) { if (self->tls != NULL) diff --git a/common/trans.h b/common/trans.h index fac1fcab..77d1ed17 100644 --- a/common/trans.h +++ b/common/trans.h @@ -37,13 +37,13 @@ struct trans; /* forward declaration */ struct xrdp_tls; -typedef int (DEFAULT_CC *ttrans_data_in)(struct trans* self); -typedef int (DEFAULT_CC *ttrans_conn_in)(struct trans* self, +typedef int (*ttrans_data_in)(struct trans* self); +typedef int (*ttrans_conn_in)(struct trans* self, struct trans* new_self); -typedef int (DEFAULT_CC *tis_term)(void); -typedef int (APP_CC *trans_recv_proc) (struct trans *self, char *ptr, int len); -typedef int (APP_CC *trans_send_proc) (struct trans *self, const char *data, int len); -typedef int (APP_CC *trans_can_recv_proc) (struct trans *self, int sck, int millis); +typedef int (*tis_term)(void); +typedef int (*trans_recv_proc) (struct trans *self, char *ptr, int len); +typedef int (*trans_send_proc) (struct trans *self, const char *data, int len); +typedef int (*trans_can_recv_proc) (struct trans *self, int sck, int millis); /* optional source info */ @@ -88,47 +88,47 @@ struct trans int my_source; }; -struct trans* APP_CC +struct trans* trans_create(int mode, int in_size, int out_size); -void APP_CC +void trans_delete(struct trans* self); -int APP_CC +int trans_get_wait_objs(struct trans* self, tbus* objs, int* count); -int APP_CC +int trans_get_wait_objs_rw(struct trans *self, tbus *robjs, int *rcount, tbus *wobjs, int *wcount, int *timeout); -int APP_CC +int trans_check_wait_objs(struct trans* self); -int APP_CC +int trans_force_read_s(struct trans* self, struct stream* in_s, int size); -int APP_CC +int trans_force_write_s(struct trans* self, struct stream* out_s); -int APP_CC +int trans_force_read(struct trans* self, int size); -int APP_CC +int trans_force_write(struct trans* self); -int APP_CC +int trans_write_copy(struct trans* self); -int APP_CC +int trans_write_copy_s(struct trans* self, struct stream* out_s); -int APP_CC +int trans_connect(struct trans* self, const char* server, const char* port, int timeout); -int APP_CC +int trans_listen_address(struct trans* self, char* port, const char* address); -int APP_CC +int trans_listen(struct trans* self, char* port); -struct stream* APP_CC +struct stream* trans_get_in_s(struct trans* self); -struct stream* APP_CC +struct stream* trans_get_out_s(struct trans* self, int size); -int APP_CC +int trans_set_tls_mode(struct trans *self, const char *key, const char *cert, long ssl_protocols, const char *tls_ciphers); -int APP_CC +int trans_shutdown_tls_mode(struct trans *self); -int APP_CC +int trans_tcp_force_read_s(struct trans *self, struct stream *in_s, int size); #endif |