]> rtime.felk.cvut.cz Git - orte.git/blob - orte/include/defines.h
ec19f9b5b56abdd88ddd9c40309ccbe8f6b66035
[orte.git] / orte / include / defines.h
1 /*
2  *  $Id: defines.h,v 0.0.0.1            2003/08/21 
3  *
4  *  AUTHOR: Petr Smolik                 petr.smolik@wo.cz
5  *
6  *  ORTE - OCERA Real-Time Ethernet     http://www.ocera.org/
7  *  --------------------------------------------------------------------
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (at your option) any later version.
13  *  
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *  
19  */
20
21 #ifndef _DEFINES_H
22 #define _DEFINES_H
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #define RTPS_DEFAULT_PORT           7400
29
30 #define MAX_PARAMETER_LOCAL_LENGTH  8     //min 8 bytes !!!
31
32 #define MAX_STRING_IPADDRESS_LENGTH 4*3+3+1
33
34 //#define ENABLE_MEM_CHECK
35
36 //////////////////////////////////////////////////////////////////////////////
37 // Debug
38 #define MAX_DEBUG_SECTIONS          100
39 #define MAX_DEBUG_LEVEL             10
40 #define debug(SECTION, LEVEL) \
41         ((LEVEL) > MAX_DEBUG_LEVEL) ? (void) 0 : \
42         ((db_level = (LEVEL)) > debugLevels[SECTION]) ? (void) 0 : db_print
43 #ifndef ENABLE_MEM_CHECK
44   #define MALLOC malloc
45   #define FREE   free
46 #else
47   #define MALLOC mem_check_malloc
48   #define FREE   mem_check_free
49 #endif        
50         
51 //////////////////////////////////////////////////////////////////////////////
52 // fnmatch
53 // We #undef these before defining them because some losing systems
54 // (HP-UX A.08.07 for example) define these in <unistd.h>.
55 #undef  FNM_PATHNAME
56 #undef  FNM_NOESCAPE
57 #undef  FNM_PERIOD
58 /* Bits set in the FLAGS argument to `fnmatch'.  */
59 #define FNM_PATHNAME    (1 << 0) /* No wildcard can ever match `/'.  */
60 #define FNM_NOESCAPE    (1 << 1) /* Backslashes don't quote special chars.  */
61 #define FNM_PERIOD  (1 << 2) /* Leading `.' is matched only explicitly.  */
62 #define FNM_FILE_NAME   FNM_PATHNAME /* Preferred GNU name.  */
63 #define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match.  */
64 #define FNM_CASEFOLD    (1 << 4) /* Compare without regard to case.  */
65 /* Value returned by `fnmatch' if STRING does not match PATTERN.  */
66 #define FNM_NOMATCH 1
67
68 //////////////////////////////////////////////////////////////////////////////
69 // Hash
70 #define HASH_LOADFACTOR  0.8
71 // Deleted entry indicator
72 #define HASH_EMPTY       0x00000000
73 #define HASH_INUSE       0x11111111
74 #define HASH_DELETED     0xffffffff
75
76 //////////////////////////////////////////////////////////////////////////////
77 // conv
78 #ifdef _WIN32
79 /* Swap bytes in 16 bit value.  */
80 #define bswap_16(x) \
81      ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) 
82
83 /* Swap bytes in 32 bit value.  */
84 #define bswap_32(x) \
85      ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) |           \
86       (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24)) 
87 #endif
88
89 #ifdef __cplusplus
90 } /* extern "C"*/
91 #endif
92
93 #endif /* _DEFINES_H */