annotate th_types.h @ 354:c01e42fc9adb

More work on SOCKS proxy support, should work now.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 23 Jun 2011 08:26:48 +0300
parents 7eaf065f7a65
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 * Type definations
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 * Programmed and designed by Matti 'ccr' Hamalainen
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 * (C) Copyright 2002-2008 Tecnic Software productions (TNSP)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 *
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 * Please read file 'COPYING' for information on license and distribution.
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 */
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 /* If your code uses "config.h", you need to #include
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 * it before including this header.
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 */
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 #ifndef _TH_TYPES_H
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 #define _TH_TYPES_H
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 #ifdef HAVE_STDINT_H
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 #include <stdint.h>
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 #ifndef HAVE_INT_TYPES
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 #define HAVE_INT_TYPES 1
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 #ifdef HAVE_SYS_TYPES_H
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 #include <sys/types.h>
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 #ifndef HAVE_INT_TYPES
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 #define HAVE_INT_TYPES 1
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 /* Shorthand types */
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 typedef unsigned long int ulint_t;
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 typedef signed long int lint_t;
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 #ifndef HAVE_UINT_T
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 typedef unsigned int uint_t;
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 /* Default assumptions for these types should be ok for most 32bit platforms...
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 * feel free to define TH_TYPE_* if necessary to remedy
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 */
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 #ifdef TH_TYPE_I8
81
69aed051f84d Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
39 typedef unsigned TH_TYPE_I8 uint8_t; /* 8 bits, unsigned */
69aed051f84d Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
40 typedef signed TH_TYPE_I8 int8_t; /* 8 bits, signed */
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 #else
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 #ifndef HAVE_INT_TYPES
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 typedef unsigned char uint8_t;
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 typedef signed char int8_t;
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 #ifdef TH_TYPE_I16
81
69aed051f84d Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
50 typedef unsigned TH_TYPE_I16 uint16_t; /* 16 bits, unsigned == 2 BYTEs */
69aed051f84d Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
51 typedef signed TH_TYPE_I16 int16_t; /* 16 bits, signed */
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 #else
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 #ifndef HAVE_INT_TYPES
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 typedef unsigned short int uint16_t;
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 typedef signed short int int16_t;
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 #ifdef TH_TYPE_I32
81
69aed051f84d Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
60 typedef unsigned TH_TYPE_I32 uint32_t; /* 32 bits, unsigned == 4 BYTES == 2 WORDs */
69aed051f84d Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
61 typedef signed TH_TYPE_I32 int32_t; /* 32 bits, signed */
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 #else
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 #ifndef HAVE_INT_TYPES
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 typedef unsigned int uint32_t;
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 typedef signed int int32_t;
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 #ifdef TH_TYPE_I64
81
69aed051f84d Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
70 typedef unsigned TH_TYPE_I64 uint64_t; /* 64 bits, unsigned == 8 BYTES == 2 DWORDs */
69aed051f84d Synced th-libs.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
71 typedef signed TH_TYPE_I64 int64_t; /* 64 bits, signed */
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 #else
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 #ifndef HAVE_INT_TYPES
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 typedef unsigned long long uint64_t;
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 typedef signed long long int64_t;
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 /* This is the character type used in all string-related routines of
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 * th_libs. Currently it is set to be equivalent of basetype "char",
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 * but under some platforms it may be necessary to use
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 * "unsigned char" instead.
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 *
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 * Also in future this type may be changed to hold 32-bit UNICODE
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 */
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 typedef char char_t;
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 /* Define a boolean type
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 */
101
7eaf065f7a65 Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
92 #if !defined(FALSE) && !defined(TRUE) && !defined(BOOL)
7eaf065f7a65 Updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
93 typedef enum { FALSE = 0, TRUE = 1 } BOOL;
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 #ifndef BOOL
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 #ifdef bool
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 #define BOOL bool
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 #else
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 #define BOOL int
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 #endif
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 #endif /* _TH_TYPES_H */