00001 /****************************************************************************** 00002 * Copyright (c) 1999-2008 ACCESS CO., LTD. All rights reserved. 00003 * Copyright (c) 2006 PalmSource, Inc (an ACCESS company). All rights reserved. 00004 *****************************************************************************/ 00010 #if PRAGMA_ONCE 00011 #pragma once 00012 #endif 00013 00014 #ifndef _HS_COMMON_H_ 00015 #define _HS_COMMON_H_ 00016 00017 00018 #ifdef WIN32 00019 #include <stdlib.h> 00020 #include <tchar.h> 00021 #define PATH_MAX _MAX_PATH 00022 #else 00023 #include <limits.h> 00024 #define _TCHAR char 00025 #define _T(x) x 00026 #endif 00027 #include <alp/hs_status.h> 00028 #include <alp/hs_id_mgr.h> 00029 00030 00031 #ifdef __cplusplus 00032 extern "C" { 00033 #endif 00034 00040 /***************************************************************************** 00041 * Defines 00042 *****************************************************************************/ 00043 #define ALP_HS_URI_SIZE 255 00044 #define ALP_HS_AGENT_ID_SIZE 127 00045 #define ALP_HS_MIME_TYPE_SIZE 255 00046 #define ALP_HS_MIME_VERSION_SIZE 127 00047 00048 #define ALP_HS_COMPARATOR_ID_SIZE 127 00049 00050 #define ALP_HS_COMPARATOR_NAME_SIZE 31 00051 00052 #define ALP_HS_NODE_NAME_SIZE 127 00053 00054 00063 #define ALP_HS_DEFAULT_NODE_NAME _T("local") 00064 #define ALP_HS_DEFAULT_DESKTOP_NODE_NAME _T("com.access-company.access desktop") 00065 00067 #define ALP_HS_EXT_COMPONENT_SIZE 4 00068 00069 // @} 00070 00076 /***************************************************************************** 00077 * Enums 00078 *****************************************************************************/ 00079 typedef enum _AlpHsObjectState { 00080 kObjectStateModified = 1, 00081 kObjectStateDeleted = 2, 00082 kObjectStateArchived = 3, 00083 kObjectStateNew = 4, 00084 kObjectStateEnumLimit = 5 00085 } AlpHsObjectState; 00086 00087 typedef enum _AlpHsSupportedDbType { 00088 kDbTypeUnsupported = 0, 00089 kDbTypeSQLite = 1, 00090 kDbTypeEnumLimit = 2 00091 } AlpHsSupportedDbType; 00092 00094 typedef enum _AlpHsChangeMgrType 00095 { 00096 kChMgrTypeInvalid = 0, 00098 kChMgrTypeHotsync = 1, 00100 kChMgrTypeExternal = 2, 00101 kChMgrTypeEnumLimit = 3, 00102 } AlpHsChangeMgrType; 00103 00105 typedef enum _AlpHsObjectComparatorType { 00107 kComparatorTypeInvalid = 0, 00109 kComparatorTypeExternal = 1, 00111 kComparatorTypeCanonical = 2, 00113 kComparatorTypeInternal = 3, 00114 kComparatorTypeEnumLimit = 4 00115 } AlpHsObjectComparatorType; 00116 00117 typedef enum _AlpHsDataStoreVersionType { 00118 kVersionTypeCapabilities = 1, 00119 kVersionTypeStringTable = 2, 00120 kVersionTypeEnumLimit = 3 00121 } AlpHsDataStoreVersionType; 00122 00123 /***************************************************************************** 00124 * Typedefs 00125 *****************************************************************************/ 00127 #ifdef WIN32 00128 #define ALP_HS_APPID_DATACHANGE_NOTIFICATION _T("/alp/datamodel") 00129 #else 00130 #define ALP_HS_APPID_DATACHANGE_NOTIFICATION "/alp/datamodel" 00131 #endif 00132 00133 // typedef AlpHsObjectState AlpDatamodelChangeType; 00135 typedef struct _AlpDatamodelChangeData AlpDatamodelChangeData; 00136 typedef AlpDatamodelChangeData* AlpDatamodelChangeDataPtr; 00137 struct _AlpDatamodelChangeData 00138 { 00139 int notificationId; 00140 00142 _TCHAR last32bytesOfLocURI [33]; 00147 AlpHsObjectState/*AlpDatamodelChangeType*/ changeType; 00148 00152 AlpLuid luid; 00153 }; 00154 00155 typedef void* AlpHsChangeMgrHandle; /* really a ChangeMgr ptr */ 00156 typedef void* AlpHsDbPtr; /* really a Database ptr */ 00157 typedef struct _AlpHsDataStoreRegistration AlpHsDataStoreRegistration; 00158 typedef AlpHsDataStoreRegistration* AlpHsDataStoreRegistrationPtr; 00159 struct _AlpHsDataStoreRegistration { 00160 _TCHAR locURI [ALP_HS_URI_SIZE]; 00161 _TCHAR tgtURI [ALP_HS_URI_SIZE]; 00162 _TCHAR agentId [ALP_HS_AGENT_ID_SIZE]; 00163 _TCHAR location[PATH_MAX]; 00164 AlpHsSupportedDbType dbType; 00165 AlpHsChangeMgrType chMgrType; 00167 int maxExtIDLen; 00168 00172 _TCHAR notifyType[ALP_HS_URI_SIZE]; 00173 00175 _TCHAR nodeName[ALP_HS_NODE_NAME_SIZE]; 00176 bool isPrimary; 00177 }; 00178 typedef struct _AlpHsObjectType AlpHsObjectType; 00179 typedef AlpHsObjectType* AlpHsObjectTypePtr; 00180 struct _AlpHsObjectType { 00181 uint32_t reserved; 00182 _TCHAR mimeType [ALP_HS_MIME_TYPE_SIZE]; 00183 _TCHAR mimeVersion[ALP_HS_MIME_VERSION_SIZE]; 00184 }; 00185 00186 typedef struct _AlpHsObjectComparatorInfo AlpHsObjectComparatorInfo; 00187 typedef AlpHsObjectComparatorInfo* AlpHsObjectComparatorInfoPtr; 00189 struct _AlpHsObjectComparatorInfo { 00190 _TCHAR id [ALP_HS_COMPARATOR_ID_SIZE]; 00191 uint32_t version; 00192 _TCHAR name [ALP_HS_COMPARATOR_NAME_SIZE]; 00193 AlpHsObjectComparatorType cmpType; 00194 AlpHsObjectType objType; 00195 _TCHAR tgtURI [ALP_HS_URI_SIZE]; 00196 uint32_t userId; 00197 }; 00198 00199 typedef alp_status_t (*AlpHsObjectComparatorFnPtr)(void* pContext, 00200 const _TCHAR* mimeType, 00201 const _TCHAR* mimeVersion, 00202 const _TCHAR* targetURI, 00203 uint16_t size1, 00204 const _TCHAR* buffer1, 00205 uint16_t size2, 00206 const _TCHAR* buffer2, 00207 int* result); 00208 00216 typedef struct _AlpHsExternalID 00217 { 00218 void* external_id; 00219 int16_t buff_size; 00220 int16_t id_size; 00221 } AlpHsExternalID; 00222 00236 typedef struct _AlpHsExternalObject AlpHsExternalObject; 00237 typedef AlpHsExternalObject* AlpHsExternalObjectPtr; 00238 struct _AlpHsExternalObject 00239 { 00240 AlpHsObjectState state; 00241 AlpHsExternalID externalId; 00242 int componentExtIdSize; 00243 AlpHsExternalID componentExtIds[ALP_HS_EXT_COMPONENT_SIZE]; 00244 }; 00245 00246 00247 typedef void* AlpHsDataStoreHandle; 00248 typedef void* AlpHsDbHandle; 00249 00251 00253 00254 #ifdef __cplusplus 00255 } 00256 #endif 00257 00258 #endif // _HS_COMMON_H_
Copyright © 1999-2008 ACCESS CO., LTD. All rights reserved.