Import additional CMS headers and update docs
[firmware_extractor.git] / os_defs.h
1 /***********************************************************************
2  *
3  *  Copyright (c) 2006-2007  Broadcom Corporation
4  *  All Rights Reserved
5  *
6
7
8 # This program is free software; you can redistribute it and/or modify 
9 # it under the terms of the GNU General Public License, version 2, as published by  
10 # the Free Software Foundation (the "GPL"). 
11
12 #
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 #   
22
23 # A copy of the GPL is available at http://www.broadcom.com/licenses/GPLv2.php, or by 
24 # writing to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
25 # Boston, MA 02111-1307, USA. 
26 #
27  *
28  ************************************************************************/
29
30 #ifndef __OS_DEFS_H__
31 #define __OS_DEFS_H__
32
33 #include <unistd.h>  /* for getopt */
34 #include <stdio.h>   /* for snprintf */
35 #include <stdint.h>  /* for the various integer types */
36 #include <stdlib.h>  /* for NULL */
37 #include <string.h>  /* for strlen, strncpy */
38 #include <ctype.h>   /* for isdigit */
39 #include <syslog.h>  /* for syslog */
40 #include <stdarg.h>  /* for va_list */
41 #include "cms_params.h"
42
43 /*!\file os_defs.h
44  * \brief Various commonly used, but OS dependent definitions are defined here.
45  *
46  *  This file is for Linux.
47  */
48
49 #ifndef NUMBER_TYPES_ALREADY_DEFINED
50 #define NUMBER_TYPES_ALREADY_DEFINED
51
52 /** Unsigned 64 bit integer.
53  * This data type was introduced in TR-106 Issue 1, Admendment 2, Sept. 2008
54  */
55 typedef uint64_t   UINT64;
56
57 /** Signed 64 bit integer.
58  * This data type was introduced in TR-106 Issue 1, Admendment 2, Sept. 2008
59  */
60 typedef int64_t    SINT64;
61
62 /** Unsigned 32 bit integer. */
63 typedef uint32_t   UINT32;
64
65 /** Signed 32 bit integer. */
66 typedef int32_t    SINT32;
67
68 /** Unsigned 16 bit integer. */
69 typedef uint16_t   UINT16;
70
71 /** Signed 16 bit integer. */
72 typedef int16_t    SINT16;
73
74 /** Unsigned 8 bit integer. */
75 typedef uint8_t    UINT8;
76
77 /** Signed 8 bit integer. */
78 typedef int8_t     SINT8;
79
80 #endif /* NUMBER_TYPES_ALREADY_DEFINED */
81
82
83 #ifndef BOOL_TYPE_ALREADY_DEFINED
84 #define BOOL_TYPE_ALREADY_DEFINED
85
86 /**Boolean type; use 1 byte only, possible values are TRUE(1) or FALSE(0) only.
87  *
88  * TRUE/FALSE defined in cms.h
89  */
90 typedef uint8_t    UBOOL8;
91
92 #endif /* BOOL_TYPE_ALREADY_DEFINED */
93
94
95 /** Base64 encoded string representation of binary data.
96  *
97  * This is to support TR69 data types.
98  */
99 typedef char *     BASE64;
100
101
102 /** Hex encoded string representation of binary data.
103  * This data type was introduced in TR-106 Issue 1, Admendment 2, Sept. 2008
104  *
105  * This is to support TR69 data types.
106  */
107 typedef char *     HEXBINARY;
108
109
110 /** String representation of date and time.
111  *
112  * This is to support TR69 data types.
113  */
114 typedef char *     DATETIME;
115
116
117 /** Invalid file descriptor number */
118 #define CMS_INVALID_FD  (-1)
119
120
121 /** Invalid process id.
122  *
123  * Management entities should not need to use this constant.  It is used
124  * by OS dependent code in the OAL layer.  But I put this constant here
125  * to make it easier to find.
126  */
127 #define CMS_INVALID_PID   0
128
129
130 /** A number to identify a MdmObject (but not the specific instance of
131  *  the object).
132  *
133  * MdmObjectId's are defined in mdm_oid.h.
134  */
135 typedef UINT16 MdmObjectId;
136
137
138 /** A structure to keep track of instance information.
139  *
140  * External callers can treat this as an opaque handle.
141  * Note the instance array must be of type UINT32 because
142  * the instance id's are constantly increasing, so we
143  * cannot save space by defining instance to be
144  * an array of UINT8's.
145  */
146 typedef struct
147 {
148    UINT8 currentDepth;                     /**< next index in the instance array 
149                                             *   to fill.  0 means empty. */
150    UINT32 instance[MAX_MDM_INSTANCE_DEPTH];/**< Array of instance id's. */
151 } InstanceIdStack;
152
153
154
155 #endif /* __OS_DEFS_H__ */
156