Home | History | Annotate | Download | only in common
      1 /*
      2  * Copyright (C) 2014 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef DMT_DEFS_H
     18 #define DMT_DEFS_H
     19 
     20 /**
     21  \file dmtDefs.h
     22 
     23  \brief   The dmtDefs.h header file contains constants and datatype definitions exported
     24           from the DM engine.
     25 */
     26 
     27 #include "dmtError.h"
     28 
     29 /**
     30  * The enumeration defines lock types for the access device management tree
     31  */
     32 enum {
     33     /**
     34      * Shared lock allows read-only access to the tree, but can be shared between multiple readers.
     35      */
     36     SYNCML_DM_LOCK_TYPE_SHARED = 0,
     37 
     38     /**
     39      * Exclusive lock allows full access to the tree, but can not be shared with any other locks.
     40      */
     41     SYNCML_DM_LOCK_TYPE_EXCLUSIVE = 1,
     42 
     43     /**
     44      * Automatic lock is treated as "shared" by engine until first "set" operation.
     45      * During first "set" operation lock is upgraded to exclusive with potential wait operation.
     46      * Note: upgrade operation is performed via unlock, which makes it possible for the tree to change,
     47      * so after first "read" but before next "write" operations, this field potentially can be changed.
     48      * If this is crucial, explicit "Exclusive" lock should be specified.
     49      * Note: in case of any lock, if tree object is held for more than 10 sec without accessing,
     50      * lock is released automatically to prevent blocking other processes by misbehaving app.
     51      */
     52     SYNCML_DM_LOCK_TYPE_AUTOMATIC = 2
     53 };
     54 
     55 /**
     56  * Lock types definition for the accessing device management tree
     57  */
     58 typedef INT32 SYNCML_DM_TREE_LOCK_TYPE_T;
     59 
     60 /**
     61  * The enumeration defines data types for the device management tree
     62  */
     63 enum {
     64      /** Undefined data type  */
     65     SYNCML_DM_DATAFORMAT_UNDEFINED = -1,
     66     /** Null data type  */
     67     SYNCML_DM_DATAFORMAT_NULL      = 0,
     68     /** String data type  */
     69     SYNCML_DM_DATAFORMAT_STRING    = 1,
     70     /** Integer data type  */
     71     SYNCML_DM_DATAFORMAT_INT       = 2,
     72     /** Boolean data type  */
     73     SYNCML_DM_DATAFORMAT_BOOL      = 3,
     74     /** Binary data type  */
     75     SYNCML_DM_DATAFORMAT_BIN       = 4,
     76     /** Node data type  */
     77     SYNCML_DM_DATAFORMAT_NODE      = 5,
     78     /** Base 64 data encoding type  */
     79     SYNCML_DM_DATAFORMAT_B64       = 6,
     80     /** XML data type  */
     81     SYNCML_DM_DATAFORMAT_XML       = 7,
     82     /** Date data type  */
     83     SYNCML_DM_DATAFORMAT_DATE      = 8,
     84     /** Time data type  */
     85     SYNCML_DM_DATAFORMAT_TIME      = 10,
     86     /** Float data type  */
     87     SYNCML_DM_DATAFORMAT_FLOAT     = 11
     88 };
     89 
     90 /**
     91  * Definition data types for the device management tree.
     92  */
     93 typedef INT8 SYNCML_DM_DATAFORMAT_T;
     94 
     95 /**
     96  * The enumeration defines operation types that can be performed on a plugin sub tree for
     97  * the device management tree
     98  */
     99 enum
    100 {
    101     /** No command */
    102     SYNCML_DM_PLUGIN_NO_COMMAND,
    103     /** Command "Add" */
    104     SYNCML_DM_PLUGIN_ADD,
    105     /** Command "Delete" */
    106     SYNCML_DM_PLUGIN_DELETE,
    107     /** Command "Replace" */
    108     SYNCML_DM_PLUGIN_REPLACE,
    109     /** Command "Add Child" */
    110     SYNCML_DM_PLUGIN_ADD_CHILD,
    111     /** Command "Get" */
    112     SYNCML_DM_PLUGIN_GET,
    113     /** Command "Rename" */
    114     SYNCML_DM_PLUGIN_RENAME
    115 };
    116 
    117 /**
    118  * Definition operation types that can be performed on a plugin sub tree for
    119  * the device management tree.
    120  */
    121 typedef UINT8 SYNCML_DM_PLUGIN_COMMAND_T;
    122 
    123 /**
    124  * The enumeration defines command properties for the  device management tree operations
    125  */
    126 enum
    127 {
    128     /** Execute command on node */
    129     SYNCML_DM_PLUGIN_COMMAND_ON_NODE,
    130     /** Execute command on property name  */
    131     SYNCML_DM_PLUGIN_COMMAND_ON_NAME_PROPERTY,
    132     /** Execute command on property titles */
    133     SYNCML_DM_PLUGIN_COMMAND_ON_TITLE_PROPERTY,
    134     /** Execute command on property LOB */
    135     SYNCML_DM_PLUGIN_COMMAND_ON_LOB_PROPERTY
    136 };
    137 
    138 /**
    139  * Definition command properties for the  device management tree operations
    140  */
    141 typedef UINT8 SYNCML_DM_PLUGIN_COMMAND_ATTRIBUTE_T;
    142 
    143 /**
    144  * Access Control List (ACL) permissions - int "or'ed" of the following values
    145  */
    146 enum {
    147     /** Grants "Add" permissions */
    148     SYNCML_DM_ACL_ADD  = 0x01,
    149     /** Grants "Delete" permissions */
    150     SYNCML_DM_ACL_DELETE = 0x02,
    151     /** Grants "Get" permissions */
    152     SYNCML_DM_ACL_GET  = 0x04,
    153     /** Grants "Replace" permissions */
    154     SYNCML_DM_ACL_REPLACE = 0x08,
    155     /** Grants "Execute" permissions */
    156     SYNCML_DM_ACL_EXEC  = 0x10
    157 };
    158 
    159 /**
    160  * Definition Access Control List (ACL) permissions.
    161  */
    162 typedef UINT8 SYNCML_DM_ACL_PERMISSIONS_T;
    163 
    164 enum {
    165     /** No updates */
    166     SYNCML_DM_EVENT_NONE = 0,
    167     /** Node added */
    168     SYNCML_DM_EVENT_ADD = 0x01,
    169     /** Leaf node replaced */
    170     SYNCML_DM_EVENT_REPLACE = 0x02,
    171     /** Node deleteds */
    172     SYNCML_DM_EVENT_DELETE = 0x04,
    173     /** Interior node renamed */
    174     SYNCML_DM_EVENT_RENAME = 0x08,
    175     /** Inderect update */
    176     SYNCML_DM_EVENT_INDIRECT = 0x10,
    177 };
    178 
    179 /**
    180  * Definition of action performed on DM node.
    181  */
    182 typedef UINT8 SYNCML_DM_EVENT_ACTION_T;
    183 
    184 enum {
    185     /** Event constructed only for updates on specific node */
    186     SYNCML_DM_EVENT_NODE = 0,
    187     /** Cumulative event constructed for sub tree */
    188     SYNCML_DM_EVENT_CUMULATIVE = 1,
    189     /** Detail event constracted for node or sub tree */
    190     SYNCML_DM_EVENT_DETAIL = 2
    191 };
    192 
    193 /**
    194  * Definition of depth of DM event.
    195  */
    196 typedef UINT8 SYNCML_DM_EVENT_TYPE_T;
    197 
    198 /**
    199  * The enumeration defines types for SyncML DM server session
    200  */
    201 enum
    202 {
    203     /** "Server Initiated" session type */
    204     SYNCML_DM_SERVER_INITIATED_SESSION = 1200,
    205     /** "Clien Initiated" session type */
    206     SYNCML_DM_CLIENT_INITIATED_SESSION = 1201
    207 };
    208 
    209 /**
    210  * Definition types for SyncML DM server session
    211  */
    212 typedef UINT16 SYNCML_DM_SESSION_DIRECTION_T;
    213 
    214 #endif
    215