libfreerdp-utils: added include headers
This commit is contained in:
parent
f9d4453c40
commit
97cd5e7546
33
include/freerdp/utils/datablob.h
Normal file
33
include/freerdp/utils/datablob.h
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* DATABLOB Utils
|
||||
*
|
||||
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __DATABLOB_UTILS_H
|
||||
#define __DATABLOB_UTILS_H
|
||||
|
||||
struct _DATABLOB
|
||||
{
|
||||
void* data;
|
||||
int length;
|
||||
};
|
||||
typedef struct _DATABLOB DATABLOB;
|
||||
|
||||
void datablob_alloc(DATABLOB *datablob, int length);
|
||||
void datablob_free(DATABLOB *datablob);
|
||||
|
||||
#endif /* __DATABLOB_UTILS_H */
|
46
include/freerdp/utils/debug.h
Normal file
46
include/freerdp/utils/debug.h
Normal file
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* Debug Utils
|
||||
*
|
||||
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTILS_DEBUG_H
|
||||
#define __UTILS_DEBUG_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_DEBUG_ASSERT
|
||||
#include <assert.h>
|
||||
#define ASSERT(a) assert(a)
|
||||
#else
|
||||
#define ASSERT(a) do { } while (0)
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define DEBUG_NULL(fmt, ...) do { } while (0)
|
||||
#define DEBUG_PRINT(_dbg_str, fmt, ...) printf(_dbg_str fmt "\n" , __FUNCTION__, __LINE__, ## __VA_ARGS__)
|
||||
#define DEBUG_CLASS(_dbg_class, fmt, ...) DEBUG_PRINT("DBG_" #_dbg_class " %s (%d): ", fmt, ## __VA_ARGS__)
|
||||
|
||||
#ifdef WITH_DEBUG
|
||||
#define DEBUG(fmt, ...) DEBUG_PRINT("DBG %s (%d): ", fmt, ## __VA_ARGS__)
|
||||
#else
|
||||
#define DEBUG(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#endif /* __UTILS_DEBUG_H */
|
27
include/freerdp/utils/hexdump.h
Normal file
27
include/freerdp/utils/hexdump.h
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* Hex Dump Utils
|
||||
*
|
||||
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTILS_HEXDUMP_H
|
||||
#define __UTILS_HEXDUMP_H
|
||||
|
||||
#define FREERDP_HEXDUMP_LINE_LENGTH 16
|
||||
|
||||
void freerdp_hexdump(uint8* data, int length);
|
||||
|
||||
#endif /* __UTILS_HEXDUMP_H */
|
30
include/freerdp/utils/memory.h
Normal file
30
include/freerdp/utils/memory.h
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* Memory Utils
|
||||
*
|
||||
* Copyright 2009-2011 Jay Sorg
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __MEMORY_UTILS_H
|
||||
#define __MEMORY_UTILS_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
void* xmalloc(size_t size);
|
||||
void* xrealloc(void * oldmem, size_t size);
|
||||
void xfree(void * mem);
|
||||
char* xstrdup(const char * s);
|
||||
|
||||
#endif /* __MEMORY_UTILS_H */
|
27
include/freerdp/utils/semaphore.h
Normal file
27
include/freerdp/utils/semaphore.h
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* Semaphore Utils
|
||||
*
|
||||
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __SEMAPHORE_UTILS_H
|
||||
#define __SEMAPHORE_UTILS_H
|
||||
|
||||
void freerdp_sem_create(void * sem_struct, int iv);
|
||||
void freerdp_sem_signal(void * sem_struct);
|
||||
void freerdp_sem_wait(void * sem_struct);
|
||||
|
||||
#endif /* __SEMAPHORE_UTILS_H */
|
80
include/freerdp/utils/stream.h
Normal file
80
include/freerdp/utils/stream.h
Normal file
@ -0,0 +1,80 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* Stream Macro Utils
|
||||
*
|
||||
* Copyright 2009-2011 Jay Sorg
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __STREAM_UTILS_H
|
||||
#define __STREAM_UTILS_H
|
||||
|
||||
#define GET_UINT8(_p1, _offset) *(((uint8 *) _p1) + _offset)
|
||||
#define GET_UINT8A(_dest, _src, _offset, _len) ( \
|
||||
memcpy( \
|
||||
((void *) _dest), \
|
||||
((const void *) (_src + _offset)), \
|
||||
((size_t) _len) \
|
||||
))
|
||||
#define GET_UINT16(_p1, _offset) ( \
|
||||
(uint16) (*(((uint8 *) _p1) + _offset)) + \
|
||||
((uint16) (*(((uint8 *) _p1) + _offset + 1)) << 8))
|
||||
#define GET_UINT32(_p1, _offset) ( \
|
||||
(uint32) (*(((uint8 *) _p1) + _offset)) + \
|
||||
((uint32) (*(((uint8 *) _p1) + _offset + 1)) << 8) + \
|
||||
((uint32) (*(((uint8 *) _p1) + _offset + 2)) << 16) + \
|
||||
((uint32) (*(((uint8 *) _p1) + _offset + 3)) << 24))
|
||||
#define GET_UINT64(_p1, _offset) ( \
|
||||
(uint64) (*(((uint8 *) _p1) + _offset)) + \
|
||||
((uint64) (*(((uint8 *) _p1) + _offset + 1)) << 8) + \
|
||||
((uint64) (*(((uint8 *) _p1) + _offset + 2)) << 16) + \
|
||||
((uint64) (*(((uint8 *) _p1) + _offset + 3)) << 24) + \
|
||||
((uint64) (*(((uint8 *) _p1) + _offset + 4)) << 32) + \
|
||||
((uint64) (*(((uint8 *) _p1) + _offset + 5)) << 40) + \
|
||||
((uint64) (*(((uint8 *) _p1) + _offset + 6)) << 48) + \
|
||||
((uint64) (*(((uint8 *) _p1) + _offset + 7)) << 56))
|
||||
|
||||
#define SET_UINT8(_p1, _offset, _value) *(((uint8 *) _p1) + _offset) = (uint8) (_value)
|
||||
#define SET_UINT8A(_dest, _offset, _src, _len) ( \
|
||||
memcpy( \
|
||||
((void *) (_dest + _offset)), \
|
||||
((const void *) _src), \
|
||||
((size_t) _len) \
|
||||
))
|
||||
#define SET_UINT8V(_dest, _offset, _value, _len) ( \
|
||||
memset( \
|
||||
((void *) (_dest + _offset)), \
|
||||
((int) _value), \
|
||||
((size_t) _len) \
|
||||
))
|
||||
#define SET_UINT16(_p1, _offset, _value) \
|
||||
*(((uint8 *) _p1) + _offset) = (uint8) (((uint16) (_value)) & 0xff), \
|
||||
*(((uint8 *) _p1) + _offset + 1) = (uint8) ((((uint16) (_value)) >> 8) & 0xff)
|
||||
#define SET_UINT32(_p1, _offset, _value) \
|
||||
*(((uint8 *) _p1) + _offset) = (uint8) (((uint32) (_value)) & 0xff), \
|
||||
*(((uint8 *) _p1) + _offset + 1) = (uint8) ((((uint32) (_value)) >> 8) & 0xff), \
|
||||
*(((uint8 *) _p1) + _offset + 2) = (uint8) ((((uint32) (_value)) >> 16) & 0xff), \
|
||||
*(((uint8 *) _p1) + _offset + 3) = (uint8) ((((uint32) (_value)) >> 24) & 0xff)
|
||||
#define SET_UINT64(_p1, _offset, _value) \
|
||||
*(((uint8 *) _p1) + _offset) = (uint8) (((uint64) (_value)) & 0xff), \
|
||||
*(((uint8 *) _p1) + _offset + 1) = (uint8) ((((uint64) (_value)) >> 8) & 0xff), \
|
||||
*(((uint8 *) _p1) + _offset + 2) = (uint8) ((((uint64) (_value)) >> 16) & 0xff), \
|
||||
*(((uint8 *) _p1) + _offset + 3) = (uint8) ((((uint64) (_value)) >> 24) & 0xff), \
|
||||
*(((uint8 *) _p1) + _offset + 4) = (uint8) ((((uint64) (_value)) >> 32) & 0xff), \
|
||||
*(((uint8 *) _p1) + _offset + 5) = (uint8) ((((uint64) (_value)) >> 40) & 0xff), \
|
||||
*(((uint8 *) _p1) + _offset + 6) = (uint8) ((((uint64) (_value)) >> 48) & 0xff), \
|
||||
*(((uint8 *) _p1) + _offset + 7) = (uint8) ((((uint64) (_value)) >> 56) & 0xff)
|
||||
|
||||
#endif /* __STREAM_UTILS_H */
|
||||
|
53
include/freerdp/utils/unicode.h
Normal file
53
include/freerdp/utils/unicode.h
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* Unicode Utils
|
||||
*
|
||||
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UNICODE_UTILS_H
|
||||
#define __UNICODE_UTILS_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define DEFAULT_CODEPAGE "UTF-8"
|
||||
#define WINDOWS_CODEPAGE "UTF-16LE"
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
#include <iconv.h>
|
||||
#endif
|
||||
|
||||
#ifndef ICONV_CONST
|
||||
#define ICONV_CONST ""
|
||||
#endif
|
||||
|
||||
struct _UNICONV
|
||||
{
|
||||
int iconv;
|
||||
#ifdef HAVE_ICONV
|
||||
iconv_t* in_iconv_h;
|
||||
iconv_t* out_iconv_h;
|
||||
#endif
|
||||
};
|
||||
typedef struct _UNICONV UNICONV;
|
||||
|
||||
UNICONV* freerdp_uniconv_new();
|
||||
void freerdp_uniconv_free(UNICONV *uniconv);
|
||||
char* freerdp_uniconv_in(UNICONV *uniconv, unsigned char* pin, size_t in_len);
|
||||
char* freerdp_uniconv_out(UNICONV *uniconv, char *str, size_t *pout_len);
|
||||
void freerdp_uniconv_uppercase(UNICONV *uniconv, char *wstr, int length);
|
||||
|
||||
#endif /* __UNICODE_UTILS_H */
|
Loading…
Reference in New Issue
Block a user