1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
|
/* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mobile Application Link.
*
* The Initial Developer of the Original Code is AvantGo, Inc.
* Portions created by AvantGo, Inc. are Copyright (C) 1997-1999
* AvantGo, Inc. All Rights Reserved.
*
* Contributor(s):
*/
#ifndef __AGCOMMANDPROCESSOR_H__
#define __AGCOMMANDPROCESSOR_H__
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#include <AGTypes.h>
#include <AGReader.h>
#include <AGServerConfig.h>
#include <AGDeviceInfo.h>
#include <AGDBConfig.h>
#include <AGRecord.h>
#include <AGClientProcessor.h>
#include <AGLocationConfig.h>
#include <AGUserConfig.h>
#include <AGProtocol.h>
typedef struct AGPlatformCommands {
void *out;
AGPerformTaskFunc performTaskFunc;
AGPerformItemFunc performItemFunc;
AGPerformDeleteDatabaseFunc performDeleteDatabaseFunc;
AGPerformOpenDatabaseFunc performOpenDatabaseFunc;
AGPerformCloseDatabaseFunc performCloseDatabaseFunc;
AGPerformClearModsFunc performClearModsFunc;
AGPerformGoodbyeFunc performGoodbyeFunc;
AGPerformRecordFunc performRecordFunc;
AGPerformExpansionFunc performExpansionFunc;
AGPerformExpansionResourceFunc performExpansionResourceFunc;
AGPerformExpansionChSCFunc performExpansionChSCFunc;
AGPerformEndFunc performEndFunc;
// AGPerformSendDeviceInfoFunc performSendDeviceInfoFunc;
// AGPerformDatabaseConfigFunc performDatabaseConfigFunc;
// AGPerformServerConfigFunc performServerConfigFunc;
// AGPerformCookieFunc performCookieFunc;
// AGPerformNonceFunc performNonceFunc;
} AGPlatformCommands;
typedef struct AGCommandProcessor {
AGPlatformCommands commands;
AGServerConfig *serverConfig;
AGDBConfig *currentDb;
AGBool syncAgain;
} AGCommandProcessor;
ExportFunc AGCommandProcessor *AGCommandProcessorNew(AGServerConfig *server);
ExportFunc AGCommandProcessor *AGCommandProcessorInit(
AGCommandProcessor *processor,
AGServerConfig *server);
ExportFunc void AGCommandProcessorFinalize(AGCommandProcessor *processor);
ExportFunc void AGCommandProcessorFree(AGCommandProcessor *processor);
ExportFunc int32 AGCommandProcessorStart(AGCommandProcessor *processor);
ExportFunc AGBool AGCommandProcessorShouldSyncAgain(
AGCommandProcessor *processor);
ExportFunc AGPerformCommandFunc AGCommandProcessorGetPerformFunc(
AGCommandProcessor *processor);
ExportFunc int32 AGCPPerformCommand(AGCommandProcessor *processor,
int32 *errCode,
AGReader *reader);
ExportFunc int32 AGCPEnd(AGCommandProcessor *out,
int32 *returnErrorCode);
ExportFunc int32 AGCPSendDeviceInfo(AGCommandProcessor *out,
int32 *returnErrorCode,
AGBool send);
ExportFunc int32 AGCPDatabaseConfig(AGCommandProcessor *out,
int32 *returnErrorCode,
char *dbname,
AGDBConfigType config,
AGBool sendRecordPlatformData,
int32 platformDataLength,
void *platformData);
ExportFunc int32 AGCPServerConfig(AGCommandProcessor *out,
int32 *returnErrorCode,
char *friendlyName,
char *userUrl,
char *message,
char *serverUri,
AGBool clientShouldHashPasswords,
AGBool allowSecureClientConnect,
uint32 connectTimeout,
uint32 writeTimeout,
uint32 readTimeout);
ExportFunc int32 AGCPCookie(AGCommandProcessor *out,
int32 *returnErrorCode,
int32 cookieLength,
void *cookie);
ExportFunc int32 AGCPNonce(AGCommandProcessor *out,
int32 *returnErrorCode,
uint8 nonce[16]);
ExportFunc int32 AGCPTask(AGCommandProcessor *out,
int32 *returnErrorCode,
char *currentTask,
AGBool bufferable);
ExportFunc int32 AGCPItem(AGCommandProcessor *out,
int32 *returnErrorCode,
int32 currentItemNumber,
int32 totalItemCount,
char *currentItem);
ExportFunc int32 AGCPDeleteDatabase(AGCommandProcessor *out,
int32 *returnErrorCode,
char *dbname);
ExportFunc int32 AGCPOpenDatabase(AGCommandProcessor *out,
int32 *returnErrorCode,
char *dbname);
ExportFunc int32 AGCPCloseDatabase(AGCommandProcessor *out,
int32 *returnErrorCode);
ExportFunc int32 AGCPClearMods(AGCommandProcessor *out,
int32 *returnErrorCode);
ExportFunc int32 AGCPGoodbye(AGCommandProcessor *out,
int32 *returnErrorCode,
AGSyncStatus syncStatus,
int32 errorCode,
char *errorMessage);
ExportFunc int32 AGCPRecord(AGCommandProcessor *out,
int32 *returnErrorCode,
int32 *newUID,
int32 uid,
AGRecordStatus mod,
int32 recordDataLength,
void *recordData,
int32 platformDataLength,
void *platformData);
ExportFunc int32 AGCPExpansion(AGCommandProcessor *out, int32 *returnErrorCode,
int32 expansionCommand,
int32 commandLength,
void *commandBytes);
ExportFunc int32 AGCPExpansionResource(AGCommandProcessor *out,
int32 *returnErrorCode,
int32 type,
int32 resourceLen,
void *resource);
ExportFunc int32 AGCPExpansionChangeServerConfig(AGCommandProcessor *out,
int32 *returnErrorCode,
AGBool disableServer,
int32 flags,
char *serverName,
int16 serverPort,
char *userName,
int32 passwordLen,
uint8 *password,
AGBool connectSecurely,
AGBool notRemovable);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif /* __AGCOMMANDPROCESSOR_H__ */
|