#include <stdio.h>
#include <stdarg.h>
#include <sys/types.h>
#include <netinet/in.h>
#include "pi-debug.h"
#include "pi-source.h"
#include "pi-dlp.h"
#include "pi-syspkt.h"
Include dependency graph for dlp.c:

Go to the source code of this file.
Defines | |
| #define | DLP_REQUEST_DATA(req, arg, offset) &req->argv[arg]->data[offset] |
| #define | DLP_RESPONSE_DATA(res, arg, offset) &res->argv[arg]->data[offset] |
| #define | get_date(ptr) (dlp_ptohdate((ptr))) |
| #define | set_date(ptr, val) (dlp_htopdate((val),(ptr))) |
| #define | RequireDLPVersion(sd, major, minor) |
| #define | RECORD_READ_SAFEGUARD_SIZE 100 |
| #define | Trace(name) |
| #define | TraceX(name, format,...) |
Functions | |
| void | dlp_set_protocol_version (int major, int minor) |
| Set the version of the DLP protocol we report to the device. | |
| char * | dlp_strerror (int error) |
| dlpArg * | dlp_arg_new (int argID, size_t len) |
| void | dlp_arg_free (struct dlpArg *arg) |
| int | dlp_arg_len (int argc, struct dlpArg **argv) |
| dlpRequest * | dlp_request_new (enum dlpFunctions cmd, int argc,...) |
| dlpRequest * | dlp_request_new_with_argid (enum dlpFunctions cmd, int argid, int argc,...) |
| dlpResponse * | dlp_response_new (enum dlpFunctions cmd, int argc) |
| ssize_t | dlp_response_read (struct dlpResponse **res, int sd) |
| ssize_t | dlp_request_write (struct dlpRequest *req, int sd) |
| void | dlp_request_free (struct dlpRequest *req) |
| void | dlp_response_free (struct dlpResponse *res) |
| int | dlp_exec (int sd, struct dlpRequest *req, struct dlpResponse **res) |
| time_t | dlp_ptohdate (const unsigned char *data) |
| void | dlp_htopdate (time_t time_interval, unsigned char *data) |
| Convert a date to Palm OS date. | |
| int | dlp_GetSysDateTime (int sd, time_t *t) |
| Get the time from the device and return it as a local time_t value. | |
| int | dlp_SetSysDateTime (int sd, time_t t) |
| Set the time on the Palm using a local time_t value. | |
| int | dlp_ReadStorageInfo (int sd, int cardno, struct CardInfo *c) |
| Read information about internal handheld memory. | |
| int | dlp_ReadSysInfo (int sd, struct SysInfo *s) |
| Read the system information block. | |
| int | dlp_ReadDBList (int sd, int cardno, int flags, int start, pi_buffer_t *info) |
| Read the database list from the device. | |
| int | dlp_FindDBInfo (int sd, int cardno, int start, const char *dbname, unsigned long type, unsigned long creator, struct DBInfo *info) |
| static void | dlp_decode_finddb_response (struct dlpResponse *res, int *cardno, unsigned long *localid, int *dbhandle, struct DBInfo *info, struct DBSizeInfo *size) |
| int | dlp_FindDBByName (int sd, int cardno, PI_CONST char *name, unsigned long *localid, int *dbhandle, struct DBInfo *info, struct DBSizeInfo *size) |
| int | dlp_FindDBByOpenHandle (int sd, int dbhandle, int *cardno, unsigned long *localid, struct DBInfo *info, struct DBSizeInfo *size) |
| Get information about an open database. | |
| int | dlp_FindDBByTypeCreator (int sd, unsigned long type, unsigned long creator, int start, int latest, int *cardno, unsigned long *localid, int *dbhandle, struct DBInfo *info, struct DBSizeInfo *size) |
| Find databases by type and/or creator. | |
| int | dlp_OpenDB (int sd, int cardno, int mode, PI_CONST char *name, int *dbhandle) |
| int | dlp_DeleteDB (int sd, int card, const char *name) |
| int | dlp_CreateDB (int sd, unsigned long creator, unsigned long type, int cardno, int flags, unsigned int version, const char *name, int *dbhandle) |
| int | dlp_CloseDB (int sd, int dbhandle) |
| Close an opened database. | |
| int | dlp_CloseDB_All (int sd) |
| Close all opened databases. | |
| int | dlp_CallApplication (int sd, unsigned long creator, unsigned long type, int action, size_t length, const void *data, unsigned long *retcode, pi_buffer_t *retbuf) |
| int | dlp_ResetSystem (int sd) |
| Require reboot of device after HotSync terminates. | |
| int | dlp_AddSyncLogEntry (int sd, char *entry) |
| Add an entry into the HotSync log on the device. | |
| int | dlp_ReadOpenDBInfo (int sd, int dbhandle, int *records) |
| Return the number of records in an opened database. | |
| int | dlp_SetDBInfo (int sd, int dbhandle, int flags, int clearFlags, unsigned int version, time_t createDate, time_t modifyDate, time_t backupDate, unsigned long type, unsigned long creator) |
| Change information for an open database. | |
| int | dlp_MoveCategory (int sd, int handle, int fromcat, int tocat) |
| Move all records from a category to another category. | |
| int | dlp_OpenConduit (int sd) |
| State that a conduit has started running on the desktop. | |
| int | dlp_EndOfSync (int sd, int status) |
| Terminate connection with the device. | |
| int | dlp_AbortSync (int sd) |
| Terminate HotSync _without_ notifying Palm. | |
| int | dlp_WriteUserInfo (int sd, const struct PilotUser *User) |
| int | dlp_ReadUserInfo (int sd, struct PilotUser *User) |
| Read the device user information. | |
| int | dlp_ReadNetSyncInfo (int sd, struct NetSyncInfo *i) |
| Read Network HotSync information. | |
| int | dlp_WriteNetSyncInfo (int sd, const struct NetSyncInfo *i) |
| int | dlp_GetROMToken (int sd, unsigned long token, void *buffer, size_t *size) |
| Emulation of the SysGetROMToken function on the device. | |
| int | dlp_ResetLastSyncPC (int sd) |
| Convenience function to reset lastSyncPC in the UserInfo to 0. | |
| int | dlp_ResetDBIndex (int sd, int dbhandle) |
| Reset the nextRecord position used in dlp_ReadNextRecInCategory(). | |
| int | dlp_ReadRecordIDList (int sd, int dbhandle, int sort, int start, int max, recordid_t *IDs, int *count) |
| Read the list of record IDs from an open database. | |
| int | dlp_WriteRecord (int sd, int dbhandle, int flags, recordid_t recID, int catID, const void *data, size_t length, recordid_t *pNewRecID) |
| int | dlp_DeleteRecord (int sd, int dbhandle, int all, recordid_t recID) |
| Delete an existing record from a database. | |
| int | dlp_DeleteCategory (int sd, int dbhandle, int category) |
| Delete a category from a database. | |
| int | dlp_ReadResourceByType (int sd, int dbhandle, unsigned long type, int resID, pi_buffer_t *buffer, int *resindex) |
| Read a resource identified by its type and ID. | |
| int | dlp_ReadResourceByIndex (int sd, int dbhandle, unsigned int resindex, pi_buffer_t *buffer, unsigned long *type, int *resID) |
| Read a resource identified by its resource index. | |
| int | dlp_WriteResource (int sd, int dbhandle, unsigned long type, int resID, const void *data, size_t length) |
| int | dlp_DeleteResource (int sd, int dbhandle, int all, unsigned long restype, int resID) |
| Delete a resource or all resources from a resource file. | |
| int | dlp_ReadAppBlock (int sd, int dbhandle, int offset, int reqbytes, pi_buffer_t *retbuf) |
| Read a database's AppInfo block. | |
| int | dlp_WriteAppBlock (int sd, int dbhandle, const void *data, size_t length) |
| int | dlp_ReadSortBlock (int sd, int dbhandle, int offset, int reqbytes, pi_buffer_t *retbuf) |
| Read a database's SortInfo block. | |
| int | dlp_WriteSortBlock (int sd, int dbhandle, const void *data, size_t length) |
| int | dlp_CleanUpDatabase (int sd, int dbhandle) |
| Clean up a database by removing deleted/archived records. | |
| int | dlp_ResetSyncFlags (int sd, int dbhandle) |
| Reset dirty record flags, update sync time. | |
| int | dlp_ReadNextRecInCategory (int sd, int dbhandle, int category, pi_buffer_t *buffer, recordid_t *recuid, int *recindex, int *attr) |
| Iterate through records in category. | |
| int | dlp_ReadAppPreference (int sd, unsigned long creator, int prefID, int backup, int maxsize, void *buffer, size_t *size, int *version) |
| Convenience function to ead an app preference data block. | |
| int | dlp_WriteAppPreference (int sd, unsigned long creator, int prefID, int backup, int version, const void *buffer, size_t size) |
| int | dlp_ReadNextModifiedRecInCategory (int sd, int dbhandle, int category, pi_buffer_t *buffer, recordid_t *recID, int *recindex, int *attr) |
| Iterate through modified records in category. | |
| int | dlp_ReadNextModifiedRec (int sd, int dbhandle, pi_buffer_t *buffer, recordid_t *recID, int *recindex, int *attr, int *category) |
| Iterate through modified records in database. | |
| int | dlp_ReadRecordById (int sd, int dbhandle, recordid_t recuid, pi_buffer_t *buffer, int *recindex, int *attr, int *category) |
| Read a record using its unique ID. | |
| int | dlp_ReadRecordByIndex (int sd, int dbhandle, int recindex, pi_buffer_t *buffer, recordid_t *recuid, int *attr, int *category) |
| Read a record using its index. | |
| int | dlp_ExpSlotEnumerate (int sd, int *numSlots, int *slotRefs) |
| Enumerate expansion slots. | |
| int | dlp_ExpCardPresent (int sd, int slotRef) |
| Checks whether a card is inserted in a slot. | |
| int | dlp_ExpCardInfo (int sd, int slotRef, unsigned long *flags, int *numStrings, char **strings) |
| Get information about a removable card inserted in an expansion slot. | |
| int | dlp_VFSGetDefaultDir (int sd, int volRefNum, const char *type, char *dir, int *len) |
| int | dlp_VFSImportDatabaseFromFile (int sd, int volRefNum, const char *path, int *cardno, unsigned long *localid) |
| int | dlp_VFSExportDatabaseToFile (int sd, int volRefNum, const char *path, int cardno, unsigned int localid) |
| int | dlp_VFSFileCreate (int sd, int volRefNum, const char *name) |
| int | dlp_VFSFileOpen (int sd, int volRefNum, const char *path, int openMode, FileRef *fileRef) |
| int | dlp_VFSFileClose (int sd, FileRef fileRef) |
| Close an open VFS file. | |
| int | dlp_VFSFileWrite (int sd, FileRef fileRef, const void *data, size_t len) |
| int | dlp_VFSFileRead (int sd, FileRef fileRef, pi_buffer_t *data, size_t len) |
| Read data from an open file. | |
| int | dlp_VFSFileDelete (int sd, int volRefNum, const char *path) |
| int | dlp_VFSFileRename (int sd, int volRefNum, const char *path, const char *newname) |
| int | dlp_VFSFileEOF (int sd, FileRef fileRef) |
| Checks whether the current position is at the end of file. | |
| int | dlp_VFSFileTell (int sd, FileRef fileRef, int *position) |
| Return the current seek position in an open file. | |
| int | dlp_VFSFileGetAttributes (int sd, FileRef fileRef, unsigned long *attributes) |
| Return the attributes of an open file. | |
| int | dlp_VFSFileSetAttributes (int sd, FileRef fileRef, unsigned long attributes) |
| Change the attributes of an open file. | |
| int | dlp_VFSFileGetDate (int sd, FileRef fileRef, int which, time_t *date) |
| Return one of the dates associated with an open file or directory. | |
| int | dlp_VFSFileSetDate (int sd, FileRef fileRef, int which, time_t date) |
| Change one of the dates for an open file or directory. | |
| int | dlp_VFSDirCreate (int sd, int volRefNum, const char *path) |
| int | dlp_VFSDirEntryEnumerate (int sd, FileRef dirRefNum, unsigned long *dirIterator, int *maxDirItems, struct VFSDirInfo *data) |
| Iterate through the entries in a directory. | |
| int | dlp_VFSVolumeFormat (int sd, unsigned char flags, int fsLibRef, struct VFSSlotMountParam *param) |
| Format a VFS volume. | |
| int | dlp_VFSVolumeEnumerate (int sd, int *numVols, int *volRefs) |
| Returns a list of connected VFS volumes. | |
| int | dlp_VFSVolumeInfo (int sd, int volRefNum, struct VFSInfo *volInfo) |
| Returns information about a VFS volume. | |
| int | dlp_VFSVolumeGetLabel (int sd, int volRefNum, int *len, char *name) |
| Return the label (name) of a VFS volume. | |
| int | dlp_VFSVolumeSetLabel (int sd, int volRefNum, const char *name) |
| int | dlp_VFSVolumeSize (int sd, int volRefNum, long *volSizeUsed, long *volSizeTotal) |
| Return the total and used size of a VFS volume. | |
| int | dlp_VFSFileSeek (int sd, FileRef fileRef, int origin, int offset) |
| Change the current seek position in an open file. | |
| int | dlp_VFSFileResize (int sd, FileRef fileRef, int newSize) |
| Resize an open file. | |
| int | dlp_VFSFileSize (int sd, FileRef fileRef, int *size) |
| Return the size of an open file. | |
| int | dlp_ExpSlotMediaType (int sd, int slotNum, unsigned long *mediaType) |
| Return the type of media supported by an expansion slot. | |
Variables | |
| char * | dlp_errorlist [] |
| char * | vfs_errorlist [] |
| char * | exp_errorlist [] |
| static int | dlp_version_major = PI_DLP_VERSION_MAJOR |
| static int | dlp_version_minor = PI_DLP_VERSION_MINOR |
| #define DLP_REQUEST_DATA | ( | req, | |||
| arg, | |||||
| offset | ) | &req->argv[arg]->data[offset] |
Definition at line 44 of file dlp.c.
Referenced by dlp_AddSyncLogEntry(), dlp_CallApplication(), dlp_CleanUpDatabase(), dlp_CloseDB(), dlp_CreateDB(), dlp_DeleteCategory(), dlp_DeleteDB(), dlp_DeleteRecord(), dlp_DeleteResource(), dlp_EndOfSync(), dlp_ExpCardInfo(), dlp_ExpCardPresent(), dlp_ExpSlotMediaType(), dlp_FindDBByName(), dlp_FindDBByOpenHandle(), dlp_FindDBByTypeCreator(), dlp_MoveCategory(), dlp_OpenDB(), dlp_ReadAppBlock(), dlp_ReadAppPreference(), dlp_ReadDBList(), dlp_ReadNextModifiedRec(), dlp_ReadNextModifiedRecInCategory(), dlp_ReadNextRecInCategory(), dlp_ReadOpenDBInfo(), dlp_ReadRecordById(), dlp_ReadRecordByIndex(), dlp_ReadRecordIDList(), dlp_ReadResourceByIndex(), dlp_ReadResourceByType(), dlp_ReadSortBlock(), dlp_ReadStorageInfo(), dlp_ReadSysInfo(), dlp_ResetDBIndex(), dlp_ResetSyncFlags(), dlp_SetDBInfo(), dlp_SetSysDateTime(), dlp_VFSDirCreate(), dlp_VFSDirEntryEnumerate(), dlp_VFSExportDatabaseToFile(), dlp_VFSFileClose(), dlp_VFSFileCreate(), dlp_VFSFileDelete(), dlp_VFSFileEOF(), dlp_VFSFileGetAttributes(), dlp_VFSFileGetDate(), dlp_VFSFileOpen(), dlp_VFSFileRead(), dlp_VFSFileRename(), dlp_VFSFileResize(), dlp_VFSFileSeek(), dlp_VFSFileSetAttributes(), dlp_VFSFileSetDate(), dlp_VFSFileSize(), dlp_VFSFileTell(), dlp_VFSFileWrite(), dlp_VFSGetDefaultDir(), dlp_VFSImportDatabaseFromFile(), dlp_VFSVolumeFormat(), dlp_VFSVolumeGetLabel(), dlp_VFSVolumeInfo(), dlp_VFSVolumeSetLabel(), dlp_VFSVolumeSize(), dlp_WriteAppBlock(), dlp_WriteAppPreference(), dlp_WriteNetSyncInfo(), dlp_WriteRecord(), dlp_WriteResource(), dlp_WriteSortBlock(), and dlp_WriteUserInfo().
| #define DLP_RESPONSE_DATA | ( | res, | |||
| arg, | |||||
| offset | ) | &res->argv[arg]->data[offset] |
Definition at line 45 of file dlp.c.
Referenced by dlp_CallApplication(), dlp_CreateDB(), dlp_decode_finddb_response(), dlp_ExpCardInfo(), dlp_ExpSlotEnumerate(), dlp_ExpSlotMediaType(), dlp_GetSysDateTime(), dlp_OpenDB(), dlp_ReadAppBlock(), dlp_ReadAppPreference(), dlp_ReadDBList(), dlp_ReadNetSyncInfo(), dlp_ReadNextModifiedRec(), dlp_ReadNextModifiedRecInCategory(), dlp_ReadNextRecInCategory(), dlp_ReadOpenDBInfo(), dlp_ReadRecordById(), dlp_ReadRecordByIndex(), dlp_ReadRecordIDList(), dlp_ReadResourceByIndex(), dlp_ReadResourceByType(), dlp_ReadSortBlock(), dlp_ReadStorageInfo(), dlp_ReadSysInfo(), dlp_ReadUserInfo(), dlp_VFSDirEntryEnumerate(), dlp_VFSFileGetAttributes(), dlp_VFSFileGetDate(), dlp_VFSFileOpen(), dlp_VFSFileSize(), dlp_VFSFileTell(), dlp_VFSFileWrite(), dlp_VFSGetDefaultDir(), dlp_VFSImportDatabaseFromFile(), dlp_VFSVolumeEnumerate(), dlp_VFSVolumeGetLabel(), dlp_VFSVolumeInfo(), dlp_VFSVolumeSize(), and dlp_WriteRecord().
| #define get_date | ( | ptr | ) | (dlp_ptohdate((ptr))) |
Definition at line 47 of file dlp.c.
Referenced by dlp_decode_finddb_response(), dlp_ReadDBList(), dlp_ReadStorageInfo(), and dlp_ReadUserInfo().
| #define RECORD_READ_SAFEGUARD_SIZE 100 |
Definition at line 59 of file dlp.c.
Referenced by dlp_ReadRecordById(), dlp_ReadRecordByIndex(), dlp_ReadResourceByIndex(), and dlp_ReadResourceByType().
| #define RequireDLPVersion | ( | sd, | |||
| major, | |||||
| minor | ) |
Value:
if (pi_version(sd) < (((major)<<8) | (minor))) \ return dlpErrNotSupp
Definition at line 50 of file dlp.c.
Referenced by dlp_ExpCardInfo(), dlp_ExpCardPresent(), dlp_ExpSlotEnumerate(), dlp_ExpSlotMediaType(), dlp_VFSDirCreate(), dlp_VFSDirEntryEnumerate(), dlp_VFSExportDatabaseToFile(), dlp_VFSFileClose(), dlp_VFSFileCreate(), dlp_VFSFileDelete(), dlp_VFSFileEOF(), dlp_VFSFileGetAttributes(), dlp_VFSFileGetDate(), dlp_VFSFileOpen(), dlp_VFSFileRead(), dlp_VFSFileRename(), dlp_VFSFileResize(), dlp_VFSFileSeek(), dlp_VFSFileSetAttributes(), dlp_VFSFileSetDate(), dlp_VFSFileSize(), dlp_VFSFileTell(), dlp_VFSFileWrite(), dlp_VFSGetDefaultDir(), dlp_VFSImportDatabaseFromFile(), dlp_VFSVolumeEnumerate(), dlp_VFSVolumeFormat(), dlp_VFSVolumeGetLabel(), dlp_VFSVolumeInfo(), dlp_VFSVolumeSetLabel(), and dlp_VFSVolumeSize().
| #define set_date | ( | ptr, | |||
| val | ) | (dlp_htopdate((val),(ptr))) |
| #define Trace | ( | name | ) |
Definition at line 155 of file dlp.c.
Referenced by dlp_AbortSync(), dlp_CleanUpDatabase(), dlp_CloseDB(), dlp_CloseDB_All(), dlp_DeleteRecord(), dlp_EndOfSync(), dlp_ExpSlotEnumerate(), dlp_FindDBByOpenHandle(), dlp_GetROMToken(), dlp_GetSysDateTime(), dlp_OpenConduit(), dlp_ReadNetSyncInfo(), dlp_ReadNextModifiedRec(), dlp_ReadOpenDBInfo(), dlp_ReadSysInfo(), dlp_ReadUserInfo(), dlp_ResetDBIndex(), dlp_ResetLastSyncPC(), dlp_ResetSyncFlags(), dlp_ResetSystem(), dlp_SetDBInfo(), dlp_VFSVolumeEnumerate(), dlp_VFSVolumeFormat(), dlp_WriteNetSyncInfo(), dlp_WriteRecord(), and dlp_WriteUserInfo().
| #define TraceX | ( | name, | |||
| format, | |||||
| ... | ) |
Definition at line 156 of file dlp.c.
Referenced by dlp_AddSyncLogEntry(), dlp_CallApplication(), dlp_CreateDB(), dlp_DeleteCategory(), dlp_DeleteDB(), dlp_DeleteResource(), dlp_ExpCardInfo(), dlp_ExpCardPresent(), dlp_ExpSlotMediaType(), dlp_FindDBByName(), dlp_FindDBByTypeCreator(), dlp_FindDBInfo(), dlp_MoveCategory(), dlp_OpenDB(), dlp_ReadAppBlock(), dlp_ReadAppPreference(), dlp_ReadDBList(), dlp_ReadNextModifiedRecInCategory(), dlp_ReadNextRecInCategory(), dlp_ReadRecordById(), dlp_ReadRecordByIndex(), dlp_ReadRecordIDList(), dlp_ReadResourceByIndex(), dlp_ReadResourceByType(), dlp_ReadSortBlock(), dlp_ReadStorageInfo(), dlp_SetSysDateTime(), dlp_VFSDirCreate(), dlp_VFSDirEntryEnumerate(), dlp_VFSExportDatabaseToFile(), dlp_VFSFileClose(), dlp_VFSFileCreate(), dlp_VFSFileDelete(), dlp_VFSFileEOF(), dlp_VFSFileGetAttributes(), dlp_VFSFileGetDate(), dlp_VFSFileOpen(), dlp_VFSFileRead(), dlp_VFSFileRename(), dlp_VFSFileResize(), dlp_VFSFileSeek(), dlp_VFSFileSetAttributes(), dlp_VFSFileSetDate(), dlp_VFSFileSize(), dlp_VFSFileTell(), dlp_VFSFileWrite(), dlp_VFSGetDefaultDir(), dlp_VFSImportDatabaseFromFile(), dlp_VFSVolumeGetLabel(), dlp_VFSVolumeInfo(), dlp_VFSVolumeSetLabel(), dlp_VFSVolumeSize(), dlp_WriteAppBlock(), dlp_WriteAppPreference(), dlp_WriteResource(), and dlp_WriteSortBlock().
| int dlp_AbortSync | ( | int | sd | ) |
Terminate HotSync _without_ notifying Palm.
This will cause the Palm to time out, and should (if I remember right) lose any changes to unclosed databases. _Never_ use under ordinary circumstances. If the sync needs to be aborted in a reasonable manner, use EndOfSync with a non-zero status.
| sd | Socket number |
Definition at line 1944 of file dlp.c.
References dlp_AbortSync(), find_pi_socket(), PI_ERR_SOCK_INVALID, pi_reset_errors(), PI_SOCK_CONN_END, pi_socket::state, and Trace.
Referenced by _wrap_dlp_AbortSync(), and dlp_AbortSync().
01945 { 01946 pi_socket_t *ps; 01947 01948 Trace(dlp_AbortSync); 01949 pi_reset_errors(sd); 01950 01951 /* Pretend we sent the sync end */ 01952 if ((ps = find_pi_socket(sd)) == NULL) { 01953 errno = ESRCH; 01954 return PI_ERR_SOCK_INVALID; 01955 } 01956 01957 ps->state = PI_SOCK_CONN_END; 01958 01959 return 0; 01960 }
Here is the call graph for this function:

| int dlp_AddSyncLogEntry | ( | int | sd, | |
| char * | string | |||
| ) |
Add an entry into the HotSync log on the device.
Move to the next line with \n, as usual. You may invoke this command once or more before calling dlp_EndOfSync(), but it is not required.
| sd | Socket number | |
| string | Nul-terminated string with the text to insert in the log |
Definition at line 1746 of file dlp.c.
References dlp_AddSyncLogEntry(), dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlpFuncAddSyncLogEntry, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), and TraceX.
Referenced by _wrap_dlp_AddSyncLogEntry(), AddSyncLogEntryCmd(), DeDupe(), dlp_AddSyncLogEntry(), do_delete(), do_get_ram(), do_get_rom(), do_install(), exit_fn(), main(), palm_backup(), palm_fetch_internal(), palm_list_internal(), and reopen_fn().
01747 { 01748 int result; 01749 struct dlpRequest *req; 01750 struct dlpResponse *res; 01751 01752 TraceX(dlp_AddSyncLogEntry,"%s",entry); 01753 pi_reset_errors(sd); 01754 01755 req = dlp_request_new(dlpFuncAddSyncLogEntry, 1, strlen(entry) + 1); 01756 if (req == NULL) 01757 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01758 01759 strcpy(DLP_REQUEST_DATA(req, 0, 0), entry); 01760 01761 result = dlp_exec(sd, req, &res); 01762 01763 dlp_request_free(req); 01764 dlp_response_free(res); 01765 01766 if (result > 0) { 01767 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01768 "DLP AddSyncLogEntry Entry: \n %s\n", entry)); 01769 } 01770 01771 return result; 01772 }
Here is the call graph for this function:

| void dlp_arg_free | ( | struct dlpArg * | arg | ) |
Definition at line 258 of file dlp.c.
References dlpArg::data.
Referenced by dlp_request_free(), dlp_request_new(), dlp_request_new_with_argid(), and dlp_response_free().
00259 { 00260 if (arg != NULL) { 00261 if (arg->data != NULL) 00262 free (arg->data); 00263 free (arg); 00264 } 00265 }
| int dlp_arg_len | ( | int | argc, | |
| struct dlpArg ** | argv | |||
| ) |
Definition at line 281 of file dlp.c.
References dlpArg::len, PI_DLP_ARG_FLAG_LONG, PI_DLP_ARG_FLAG_SHORT, PI_DLP_ARG_SHORT_LEN, and PI_DLP_ARG_TINY_LEN.
Referenced by dlp_request_write().
00282 { 00283 int i, len = 0; 00284 00285 for (i = 0; i < argc; i++) { 00286 struct dlpArg *arg = argv[i]; 00287 00288 /* FIXME: shapiro: should these be < or <= ??? */ 00289 if (arg->len < PI_DLP_ARG_TINY_LEN && 00290 (arg->id_ & (PI_DLP_ARG_FLAG_SHORT | PI_DLP_ARG_FLAG_LONG)) == 0) 00291 len += 2; 00292 else if (arg->len < PI_DLP_ARG_SHORT_LEN && 00293 (arg->id_ & PI_DLP_ARG_FLAG_LONG) == 0) 00294 len += 4; 00295 else 00296 len += 6; 00297 00298 len += arg->len; 00299 } 00300 00301 return len; 00302 }
| struct dlpArg* dlp_arg_new | ( | int | argID, | |
| size_t | len | |||
| ) |
Definition at line 223 of file dlp.c.
References dlpArg::data, dlpArg::id_, and dlpArg::len.
Referenced by dlp_request_new(), dlp_request_new_with_argid(), and dlp_response_read().
00224 { 00225 struct dlpArg *arg; 00226 00227 arg = (struct dlpArg *)malloc(sizeof (struct dlpArg)); 00228 00229 if (arg != NULL) { 00230 arg->id_ = argID; 00231 arg->len = len; 00232 arg->data = NULL; 00233 if (len > 0) { 00234 arg->data = (char *)malloc (len); 00235 if (arg->data == NULL) { 00236 free(arg); 00237 arg = NULL; 00238 } 00239 } 00240 } 00241 00242 return arg; 00243 }
| int dlp_CallApplication | ( | int | sd, | |
| unsigned long | creator, | |||
| unsigned long | type, | |||
| int | action, | |||
| size_t | length, | |||
| const void * | data, | |||
| unsigned long * | retcode, | |||
| pi_buffer_t * | retbuf | |||
| ) |
Definition at line 1591 of file dlp.c.
References dlpResponse::argv, CHECK, DLP_BUF_SIZE, dlp_CallApplication(), dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_request_new_with_argid(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncCallApplication, get_long, get_short, dlpArg::len, LOG, pi_buffer_append(), pi_buffer_clear(), PI_DBG_DLP, PI_DBG_LVL_DEBUG, PI_DBG_LVL_ERR, PI_DBG_LVL_INFO, pi_dumpdata(), PI_ERR_DLP_DATASIZE, PI_ERR_GENERIC_MEMORY, pi_getsockopt(), PI_LEVEL_SOCK, pi_reset_errors(), pi_set_error(), pi_setsockopt(), PI_SOCK_HONOR_RX_TIMEOUT, pi_version(), set_long, set_short, and TraceX.
01594 { 01595 int result, 01596 version = pi_version(sd), 01597 previous_honor_rx_timeout, 01598 no_rx_timeout = 0; 01599 size_t data_len; 01600 struct dlpRequest *req; 01601 struct dlpResponse *res; 01602 01603 TraceX(dlp_CallApplication,"type='%4.4s' creator='%4.4s' action=0x%04x dataLength=%d", 01604 (const char *)&type,(const char *)&creator,action,(int)length); 01605 pi_reset_errors(sd); 01606 if (retbuf) 01607 pi_buffer_clear(retbuf); 01608 01609 /* we are going to temporarily disable PI_SOCK_HONOR_RX_TIMEOUT 01610 * so that lengthy tasks on the device side don't cause a 01611 * connection timeout 01612 */ 01613 data_len = sizeof(previous_honor_rx_timeout); 01614 pi_getsockopt(sd, PI_LEVEL_SOCK, PI_SOCK_HONOR_RX_TIMEOUT, 01615 &previous_honor_rx_timeout, &data_len); 01616 01617 if (version >= 0x0101) { /* PalmOS 2.0 call encoding */ 01618 01619 if (length + 22 > DLP_BUF_SIZE) { 01620 LOG((PI_DBG_DLP, PI_DBG_LVL_ERR, 01621 "DLP CallApplication: data too large (>64k)")); 01622 pi_set_error(sd, PI_ERR_DLP_DATASIZE); 01623 return -131; 01624 } 01625 01626 req = dlp_request_new_with_argid( 01627 dlpFuncCallApplication, 0x21, 1, 22 + length); 01628 if (req == NULL) 01629 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01630 01631 set_long(DLP_REQUEST_DATA(req, 0, 0), creator); 01632 set_long(DLP_REQUEST_DATA(req, 0, 4), type); 01633 set_short(DLP_REQUEST_DATA(req, 0, 8), action); 01634 set_long(DLP_REQUEST_DATA(req, 0, 10), length); 01635 set_long(DLP_REQUEST_DATA(req, 0, 14), 0); 01636 set_long(DLP_REQUEST_DATA(req, 0, 18), 0); 01637 if (length) 01638 memcpy(DLP_REQUEST_DATA(req, 0, 22), data, length); 01639 01640 data_len = sizeof(no_rx_timeout); 01641 pi_setsockopt(sd, PI_LEVEL_SOCK, PI_SOCK_HONOR_RX_TIMEOUT, 01642 &no_rx_timeout, &data_len); 01643 01644 result = dlp_exec(sd, req, &res); 01645 01646 pi_setsockopt(sd, PI_LEVEL_SOCK, PI_SOCK_HONOR_RX_TIMEOUT, 01647 &previous_honor_rx_timeout, &data_len); 01648 01649 dlp_request_free(req); 01650 01651 if (result > 0) { 01652 data_len = res->argv[0]->len - 16; 01653 01654 if (retcode) 01655 *retcode = get_long(DLP_RESPONSE_DATA(res, 0, 0)); 01656 if (retbuf) 01657 pi_buffer_append(retbuf, DLP_RESPONSE_DATA(res, 0, 16), data_len); 01658 01659 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01660 "DLP CallApplication Result: %lu (0x%08lx), " 01661 "and %d bytes:\n", 01662 get_long(DLP_RESPONSE_DATA(res, 0, 0)), 01663 get_long(DLP_RESPONSE_DATA(res, 0, 0)), 01664 data_len)); 01665 CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG, 01666 pi_dumpdata(DLP_RESPONSE_DATA(res, 0, 16), 01667 (size_t)data_len)); 01668 } 01669 01670 } else { /* PalmOS 1.0 call encoding */ 01671 01672 if (length + 8 > DLP_BUF_SIZE) { 01673 LOG((PI_DBG_DLP, PI_DBG_LVL_ERR, 01674 "DLP CallApplication: data too large (>64k)")); 01675 pi_set_error(sd, PI_ERR_DLP_DATASIZE); 01676 return -131; 01677 } 01678 01679 req = dlp_request_new (dlpFuncCallApplication, 1, 8 + length); 01680 if (req == NULL) 01681 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01682 01683 set_long(DLP_REQUEST_DATA(req, 0, 0), creator); 01684 set_short(DLP_REQUEST_DATA(req, 0, 4), action); 01685 set_short(DLP_REQUEST_DATA(req, 0, 6), length); 01686 memcpy(DLP_REQUEST_DATA(req, 0, 8), data, length); 01687 01688 data_len = sizeof(no_rx_timeout); 01689 pi_setsockopt(sd, PI_LEVEL_SOCK, PI_SOCK_HONOR_RX_TIMEOUT, 01690 &no_rx_timeout, &data_len); 01691 01692 result = dlp_exec(sd, req, &res); 01693 01694 pi_setsockopt(sd, PI_LEVEL_SOCK, PI_SOCK_HONOR_RX_TIMEOUT, 01695 &previous_honor_rx_timeout, &data_len); 01696 01697 dlp_request_free(req); 01698 01699 if (result > 0) { 01700 data_len = res->argv[0]->len - 6; 01701 if (retcode) 01702 *retcode = get_short(DLP_RESPONSE_DATA(res, 0, 2)); 01703 if (retbuf) 01704 pi_buffer_append(retbuf, DLP_RESPONSE_DATA(res, 0, 6), data_len); 01705 01706 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01707 "DLP CallApplication Action: %d Result:" 01708 " %u (0x%04x), and %d bytes:\n", 01709 (int)get_short(DLP_RESPONSE_DATA(res, 0, 0)), 01710 (unsigned int)get_short(DLP_RESPONSE_DATA(res, 0, 2)), 01711 (unsigned int)get_short(DLP_RESPONSE_DATA(res, 0, 2)), 01712 data_len)); 01713 CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG, 01714 pi_dumpdata(DLP_RESPONSE_DATA(res, 0, 6), 01715 (size_t)data_len)); 01716 } 01717 } 01718 01719 dlp_response_free(res); 01720 return result; 01721 }
Here is the call graph for this function:

| int dlp_CleanUpDatabase | ( | int | sd, | |
| int | dbhandle | |||
| ) |
Clean up a database by removing deleted/archived records.
Delete all records in the opened database which are marked as archived or deleted.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() |
Definition at line 3099 of file dlp.c.
References dlp_CleanUpDatabase(), dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlpFuncCleanUpDatabase, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, and Trace.
Referenced by _wrap_dlp_CleanUpDatabase(), close_db(), dlp_CleanUpDatabase(), do_delete(), install_tux_with_name(), Java_org_gnu_pilotlink_PilotLink_closeDB(), main(), and palm_purge().
03100 { 03101 int result; 03102 struct dlpRequest *req; 03103 struct dlpResponse *res; 03104 03105 Trace(dlp_CleanUpDatabase); 03106 pi_reset_errors(sd); 03107 03108 req = dlp_request_new(dlpFuncCleanUpDatabase, 1, 1); 03109 if (req == NULL) 03110 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03111 03112 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 03113 03114 result = dlp_exec(sd, req, &res); 03115 03116 dlp_request_free(req); 03117 dlp_response_free(res); 03118 03119 return result; 03120 }
Here is the call graph for this function:

| int dlp_CloseDB | ( | int | sd, | |
| int | dbhandle | |||
| ) |
Close an opened database.
| sd | Socket number | |
| dbhandle | The DB handle returned by dlp_OpenDB() |
Definition at line 1545 of file dlp.c.
References dlp_CloseDB(), dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlpFuncCloseDB, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, and Trace.
Referenced by _wrap_dlp_CloseDB(), close_db(), DeDupe(), dlp_CloseDB(), dlp_ReadAppPreference(), dlp_WriteAppPreference(), do_delete(), do_fetch(), do_list(), fetch_wavs(), Install(), install_tux_with_name(), Java_org_gnu_pilotlink_PilotLink_closeDB(), Java_org_gnu_pilotlink_PilotLink_getAppInfoBlock(), main(), palm_purge(), pi_file_install(), and pi_file_merge().
01546 { 01547 int result; 01548 struct dlpRequest *req; 01549 struct dlpResponse *res; 01550 01551 Trace(dlp_CloseDB); 01552 pi_reset_errors(sd); 01553 01554 req = dlp_request_new(dlpFuncCloseDB, 1, 1); 01555 if (req == NULL) 01556 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01557 01558 set_byte(DLP_REQUEST_DATA(req, 0, 0), (unsigned char) dbhandle); 01559 01560 result = dlp_exec(sd, req, &res); 01561 01562 dlp_request_free(req); 01563 dlp_response_free(res); 01564 01565 return result; 01566 }
Here is the call graph for this function:

| int dlp_CloseDB_All | ( | int | sd | ) |
Close all opened databases.
| sd | Socket number |
Definition at line 1569 of file dlp.c.
References dlp_CloseDB_All(), dlp_exec(), dlp_request_free(), dlp_request_new_with_argid(), dlp_response_free(), dlpFuncCloseDB, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), and Trace.
Referenced by _wrap_dlp_CloseDB_All(), and dlp_CloseDB_All().
01570 { 01571 int result; 01572 struct dlpRequest *req; 01573 struct dlpResponse *res; 01574 01575 Trace(dlp_CloseDB_All); 01576 pi_reset_errors(sd); 01577 01578 req = dlp_request_new_with_argid(dlpFuncCloseDB, 0x21, 0); 01579 if (req == NULL) 01580 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01581 01582 result = dlp_exec(sd, req, &res); 01583 01584 dlp_request_free(req); 01585 dlp_response_free(res); 01586 01587 return result; 01588 }
Here is the call graph for this function:

| int dlp_CreateDB | ( | int | sd, | |
| unsigned long | creator, | |||
| unsigned long | type, | |||
| int | cardno, | |||
| int | flags, | |||
| unsigned int | version, | |||
| const char * | name, | |||
| int * | dbhandle | |||
| ) |
Definition at line 1505 of file dlp.c.
References dlp_CreateDB(), dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncCreateDB, get_byte, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, set_long, set_short, and TraceX.
01507 { 01508 int result; 01509 struct dlpRequest *req; 01510 struct dlpResponse *res; 01511 01512 TraceX(dlp_CreateDB,"'%s' type='%4.4s' creator='%4.4s' flags=0x%04x version=%d", 01513 name,(const char *)&type,(const char *)&creator,flags,version); 01514 pi_reset_errors(sd); 01515 01516 req = dlp_request_new(dlpFuncCreateDB, 1, 14 + (strlen(name) + 1)); 01517 if (req == NULL) 01518 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01519 01520 set_long(DLP_REQUEST_DATA(req, 0, 0), creator); 01521 set_long(DLP_REQUEST_DATA(req, 0, 4), type); 01522 set_byte(DLP_REQUEST_DATA(req, 0, 8), cardno); 01523 set_byte(DLP_REQUEST_DATA(req, 0, 9), 0); 01524 set_short(DLP_REQUEST_DATA(req, 0, 10), flags); 01525 set_short(DLP_REQUEST_DATA(req, 0, 12), version); 01526 strcpy(DLP_REQUEST_DATA(req, 0, 14), name); 01527 01528 result = dlp_exec(sd, req, &res); 01529 01530 dlp_request_free(req); 01531 01532 if (result > 0 && dbhandle) { 01533 *dbhandle = get_byte(DLP_RESPONSE_DATA(res, 0, 0)); 01534 01535 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01536 "DLP CreateDB Handle=%d\n", *dbhandle)); 01537 } 01538 01539 dlp_response_free(res); 01540 01541 return result; 01542 }
Here is the call graph for this function:

| static void dlp_decode_finddb_response | ( | struct dlpResponse * | res, | |
| int * | cardno, | |||
| unsigned long * | localid, | |||
| int * | dbhandle, | |||
| struct DBInfo * | info, | |||
| struct DBSizeInfo * | size | |||
| ) | [static] |
Definition at line 1208 of file dlp.c.
References dlpResponse::argc, dlpResponse::argv, DBInfo::backupDate, DBInfo::createDate, DBInfo::creator, DLP_RESPONSE_DATA, dlpDBFlagAppInfoDirty, dlpDBFlagBackup, dlpDBFlagCopyPrevention, dlpDBFlagNewer, dlpDBFlagOpen, dlpDBFlagReadOnly, dlpDBFlagReset, dlpDBFlagResource, dlpDBFlagStream, DBInfo::flags, get_byte, get_date, get_long, get_short, dlpArg::id_, DBInfo::index, LOG, DBInfo::miscFlags, DBInfo::modifyDate, DBInfo::modnum, DBInfo::more, DBInfo::name, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_DLP_ARG_FIRST_ID, printlong(), size, DBInfo::type, and DBInfo::version.
Referenced by dlp_FindDBByName(), dlp_FindDBByOpenHandle(), and dlp_FindDBByTypeCreator().
01210 { 01211 int arg, argid; 01212 for (arg = 0; arg < res->argc; arg++) { 01213 argid = (res->argv[arg]->id_ & 0x7f) - PI_DLP_ARG_FIRST_ID; 01214 if (argid == 0) { 01215 if (cardno) 01216 *cardno = get_byte(DLP_RESPONSE_DATA(res, arg, 0)); 01217 if (localid) 01218 *localid = get_long(DLP_RESPONSE_DATA(res, arg, 2)); 01219 if (dbhandle) 01220 *dbhandle = get_long(DLP_RESPONSE_DATA(res, arg, 6)); 01221 01222 if (info) { 01223 info->more = 0; 01224 info->miscFlags = 01225 get_byte(DLP_RESPONSE_DATA(res, arg, 11)); 01226 info->flags = 01227 get_short(DLP_RESPONSE_DATA(res, arg, 12)); 01228 info->type = 01229 get_long(DLP_RESPONSE_DATA(res, arg, 14)); 01230 info->creator = 01231 get_long(DLP_RESPONSE_DATA(res, arg, 18)); 01232 info->version = 01233 get_short(DLP_RESPONSE_DATA(res, arg, 22)); 01234 info->modnum = 01235 get_long(DLP_RESPONSE_DATA(res, arg, 24)); 01236 info->createDate = 01237 get_date((const unsigned char *)DLP_RESPONSE_DATA(res, arg, 28)); 01238 info->modifyDate = 01239 get_date((const unsigned char *)DLP_RESPONSE_DATA(res, arg, 36)); 01240 info->backupDate = 01241 get_date((const unsigned char *)DLP_RESPONSE_DATA(res, arg, 44)); 01242 info->index = 01243 get_short(DLP_RESPONSE_DATA(res, arg, 52)); 01244 01245 strncpy(info->name, DLP_RESPONSE_DATA(res, arg, 54), 32); 01246 info->name[32] = '\0'; 01247 01248 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01249 "DLP FindDB Name: '%s', " 01250 "Version: %d, More: %s\n", 01251 info->name, info->version, 01252 info->more ? "Yes" : "No")); 01253 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01254 " Creator: '%s'", printlong(info->creator))); 01255 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01256 " Type: '%s' Flags: %s%s%s%s%s%s%s%s%s%s", 01257 printlong(info->type), 01258 (info->flags & dlpDBFlagResource) ? 01259 "Resource " : "", 01260 (info->flags & dlpDBFlagReadOnly) ? 01261 "ReadOnly " : "", 01262 (info->flags & dlpDBFlagAppInfoDirty) ? 01263 "AppInfoDirty " : "", 01264 (info->flags & dlpDBFlagBackup) ? 01265 "Backup " : "", 01266 (info->flags & dlpDBFlagReset) ? 01267 "Reset " : "", 01268 (info->flags & dlpDBFlagNewer) ? 01269 "Newer " : "", 01270 (info->flags & dlpDBFlagCopyPrevention) ? 01271 "CopyPrevention " : "", 01272 (info->flags & dlpDBFlagStream) ? 01273 "Stream " : "", 01274 (info->flags & dlpDBFlagOpen) ? 01275 "Open " : "", 01276 (!info->flags) ? "None" : "")); 01277 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01278 " (0x%2.2X)\n", info->flags)); 01279 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01280 " Modnum: %ld, Index: %d, " 01281 "Creation date: %s", 01282 info->modnum, info->index, 01283 ctime(&info->createDate))); 01284 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01285 " Modification date: %s", 01286 ctime(&info->modifyDate))); 01287 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01288 " Backup date: %s", 01289 ctime(&info->backupDate))); 01290 } 01291 } 01292 else if (argid == 1) { 01293 if (size) { 01294 size->numRecords = 01295 get_long(DLP_RESPONSE_DATA(res, arg, 0)); 01296 size->totalBytes = 01297 get_long(DLP_RESPONSE_DATA(res, arg, 4)); 01298 size->dataBytes = 01299 get_long(DLP_RESPONSE_DATA(res, arg, 8)); 01300 size->appBlockSize = 01301 get_long(DLP_RESPONSE_DATA(res, arg, 12)); 01302 size->sortBlockSize = 01303 get_long(DLP_RESPONSE_DATA(res, arg, 16)); 01304 size->maxRecSize = 01305 get_long(DLP_RESPONSE_DATA(res, arg, 20)); 01306 } 01307 } 01308 } 01309 }
Here is the call graph for this function:

| int dlp_DeleteCategory | ( | int | sd, | |
| int | dbhandle, | |||
| int | category | |||
| ) |
Delete a category from a database.
Any record in that category will be moved to the Unfiled category.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() | |
| category | Category to delete |
Definition at line 2610 of file dlp.c.
References dlp_DeleteCategory(), dlp_DeleteRecord(), dlp_exec(), dlp_ReadRecordByIndex(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlpFuncDeleteRecord, dlpRecAttrArchived, dlpRecAttrDeleted, flags, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), pi_version(), set_byte, set_long, and TraceX.
Referenced by _wrap_dlp_DeleteCategory(), dlp_DeleteCategory(), and main().
02611 { 02612 int result; 02613 struct dlpRequest *req; 02614 struct dlpResponse *res; 02615 02616 TraceX(dlp_DeleteCategory,"category=%d",category); 02617 pi_reset_errors(sd); 02618 02619 if (pi_version(sd) < 0x0101) { 02620 /* Emulate if not connected to PalmOS 2.0 */ 02621 int i, cat, attr; 02622 recordid_t id_; 02623 02624 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 02625 "DLP DeleteCategory Emulating with: Handle: %d, " 02626 "Category: %d\n", 02627 dbhandle, category & 0xff)); 02628 02629 for (i = 0; 02630 (result = dlp_ReadRecordByIndex(sd, dbhandle, i, NULL, &id_, 02631 &attr, &cat)) >= 0; i++) { 02632 if (cat != category 02633 || (attr & dlpRecAttrDeleted) 02634 || (attr & dlpRecAttrArchived)) 02635 continue; 02636 result = dlp_DeleteRecord(sd, dbhandle, 0, id_); 02637 if (result < 0) 02638 break; 02639 i--; /* Sigh, deleting record moves it to the end. */ 02640 } 02641 02642 return result; 02643 } else { 02644 int flags = 0x40; 02645 02646 req = dlp_request_new(dlpFuncDeleteRecord, 1, 6); 02647 if (req == NULL) 02648 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 02649 02650 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 02651 set_byte(DLP_REQUEST_DATA(req, 0, 1), flags); 02652 set_long(DLP_REQUEST_DATA(req, 0, 2), category & 0xff); 02653 02654 result = dlp_exec(sd, req, &res); 02655 02656 dlp_request_free(req); 02657 dlp_response_free(res); 02658 02659 return result; 02660 } 02661 }
Here is the call graph for this function:

| int dlp_DeleteDB | ( | int | sd, | |
| int | card, | |||
| const char * | name | |||
| ) |
Definition at line 1479 of file dlp.c.
References dlp_DeleteDB(), dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlpFuncDeleteDB, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, and TraceX.
01480 { 01481 int result; 01482 struct dlpRequest *req; 01483 struct dlpResponse *res; 01484 01485 TraceX(dlp_DeleteDB,"%s",name); 01486 pi_reset_errors(sd); 01487 01488 req = dlp_request_new(dlpFuncDeleteDB, 1, 2 + (strlen(name) + 1)); 01489 if (req == NULL) 01490 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01491 01492 set_byte(DLP_REQUEST_DATA(req, 0, 0), card); 01493 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0); 01494 strcpy(DLP_REQUEST_DATA(req, 0, 2), name); 01495 01496 result = dlp_exec(sd, req, &res); 01497 01498 dlp_request_free(req); 01499 dlp_response_free(res); 01500 01501 return result; 01502 }
Here is the call graph for this function:

| int dlp_DeleteRecord | ( | int | sd, | |
| int | dbhandle, | |||
| int | all, | |||
| recordid_t | recuid | |||
| ) |
Delete an existing record from a database.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() | |
| all | If set, ALL records are deleted from the database. | |
| recuid | Record ID of record to delete if all == 0. |
Definition at line 2583 of file dlp.c.
References dlp_DeleteRecord(), dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlpFuncDeleteRecord, flags, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, set_long, and Trace.
Referenced by _wrap_dlp_DeleteRecord(), DeDupe(), delete_both(), dlp_DeleteCategory(), dlp_DeleteRecord(), do_delete(), Java_org_gnu_pilotlink_PilotLink_deleteRecordById(), main(), sync_CopyToPilot(), and sync_record().
02584 { 02585 int result, 02586 flags = all ? 0x80 : 0; 02587 struct dlpRequest *req; 02588 struct dlpResponse *res; 02589 02590 Trace(dlp_DeleteRecord); 02591 pi_reset_errors(sd); 02592 02593 req = dlp_request_new(dlpFuncDeleteRecord, 1, 6); 02594 if (req == NULL) 02595 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 02596 02597 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 02598 set_byte(DLP_REQUEST_DATA(req, 0, 1), flags); 02599 set_long(DLP_REQUEST_DATA(req, 0, 2), recID); 02600 02601 result = dlp_exec(sd, req, &res); 02602 02603 dlp_request_free(req); 02604 dlp_response_free(res); 02605 02606 return result; 02607 }
Here is the call graph for this function:

| int dlp_DeleteResource | ( | int | sd, | |
| int | dbhandle, | |||
| int | all, | |||
| unsigned long | restype, | |||
| int | resid | |||
| ) |
Delete a resource or all resources from a resource file.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() | |
| all | If set, all resources are removed from this database (restype and resid are ignored) | |
| restype | Resource type (four-char code) | |
| resid | Resource ID |
Definition at line 2896 of file dlp.c.
References dlp_DeleteResource(), dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlpFuncDeleteResource, flags, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, set_long, set_short, and TraceX.
Referenced by _wrap_dlp_DeleteResource(), dlp_DeleteResource(), and main().
02898 { 02899 int result, 02900 flags = all ? 0x80 : 0; 02901 struct dlpRequest *req; 02902 struct dlpResponse *res; 02903 02904 TraceX(dlp_DeleteResource,"restype='%4.4s' resID=%d all=%d", 02905 (const char *)&restype,resID,all); 02906 pi_reset_errors(sd); 02907 02908 req = dlp_request_new(dlpFuncDeleteResource, 1, 8); 02909 if (req == NULL) 02910 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 02911 02912 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 02913 set_byte(DLP_REQUEST_DATA(req, 0, 1), flags); 02914 set_long(DLP_REQUEST_DATA(req, 0, 2), restype); 02915 set_short(DLP_REQUEST_DATA(req, 0, 6), resID); 02916 02917 result = dlp_exec(sd, req, &res); 02918 02919 dlp_request_free(req); 02920 dlp_response_free(res); 02921 02922 return result; 02923 }
Here is the call graph for this function:

| int dlp_EndOfSync | ( | int | sd, | |
| int | status | |||
| ) |
Terminate connection with the device.
Required at the end of a session. The pi_socket layer will call this for you if you don't. After the device receives this command, it will terminate the connection.
| sd | Socket number | |
| status | End of sync status (see dlpEndStatus enum) |
Definition at line 1908 of file dlp.c.
References dlp_EndOfSync(), dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlpFuncEndOfSync, find_pi_socket(), PI_ERR_GENERIC_MEMORY, PI_ERR_SOCK_INVALID, pi_reset_errors(), pi_set_error(), PI_SOCK_CONN_END, set_short, pi_socket::state, and Trace.
Referenced by _wrap_dlp_EndOfSync(), dlp_EndOfSync(), do_fetch(), do_install(), exit_fn(), handle_single_command(), Java_org_gnu_pilotlink_PilotLink_endSync(), main(), pi_close(), and reopen_fn().
01909 { 01910 int result; 01911 pi_socket_t *ps; 01912 struct dlpRequest *req; 01913 struct dlpResponse *res; 01914 01915 Trace(dlp_EndOfSync); 01916 pi_reset_errors(sd); 01917 01918 ps = find_pi_socket(sd); 01919 if (ps == NULL) { 01920 errno = ESRCH; 01921 return PI_ERR_SOCK_INVALID; 01922 } 01923 01924 req = dlp_request_new(dlpFuncEndOfSync, 1, 2); 01925 if (req == NULL) 01926 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01927 01928 set_short(DLP_REQUEST_DATA(req, 0, 0), status); 01929 01930 result = dlp_exec(sd, req, &res); 01931 01932 dlp_request_free(req); 01933 dlp_response_free(res); 01934 01935 /* Messy code to set end-of-sync flag on socket 01936 so pi_close won't do it for us */ 01937 if (result == 0) 01938 ps->state = PI_SOCK_CONN_END; 01939 01940 return result; 01941 }
Here is the call graph for this function:

| int dlp_exec | ( | int | sd, | |
| struct dlpRequest * | req, | |||
| struct dlpResponse ** | res | |||
| ) |
Definition at line 706 of file dlp.c.
References dlp_request_write(), dlp_response_read(), dlpErrNoError, dlpFuncReadRecord, dlpFuncReadRecordEx, dlpFuncVFSVolumeInfo, dlpFuncVFSVolumeSize, dlpFuncWriteResource, LOG, PI_DBG_DLP, PI_DBG_LVL_DEBUG, PI_DBG_LVL_ERR, PI_ERR_DLP_COMMAND, PI_ERR_DLP_PALMOS, pi_set_error(), and pi_set_palmos_error().
Referenced by dlp_AddSyncLogEntry(), dlp_CallApplication(), dlp_CleanUpDatabase(), dlp_CloseDB(), dlp_CloseDB_All(), dlp_CreateDB(), dlp_DeleteCategory(), dlp_DeleteDB(), dlp_DeleteRecord(), dlp_DeleteResource(), dlp_EndOfSync(), dlp_ExpCardInfo(), dlp_ExpCardPresent(), dlp_ExpSlotEnumerate(), dlp_ExpSlotMediaType(), dlp_FindDBByName(), dlp_FindDBByOpenHandle(), dlp_FindDBByTypeCreator(), dlp_GetSysDateTime(), dlp_MoveCategory(), dlp_OpenConduit(), dlp_OpenDB(), dlp_ReadAppBlock(), dlp_ReadAppPreference(), dlp_ReadDBList(), dlp_ReadNetSyncInfo(), dlp_ReadNextModifiedRec(), dlp_ReadNextModifiedRecInCategory(), dlp_ReadNextRecInCategory(), dlp_ReadOpenDBInfo(), dlp_ReadRecordById(), dlp_ReadRecordByIndex(), dlp_ReadRecordIDList(), dlp_ReadResourceByIndex(), dlp_ReadResourceByType(), dlp_ReadSortBlock(), dlp_ReadStorageInfo(), dlp_ReadSysInfo(), dlp_ReadUserInfo(), dlp_ResetDBIndex(), dlp_ResetSyncFlags(), dlp_ResetSystem(), dlp_SetDBInfo(), dlp_SetSysDateTime(), dlp_VFSDirCreate(), dlp_VFSDirEntryEnumerate(), dlp_VFSExportDatabaseToFile(), dlp_VFSFileClose(), dlp_VFSFileCreate(), dlp_VFSFileDelete(), dlp_VFSFileEOF(), dlp_VFSFileGetAttributes(), dlp_VFSFileGetDate(), dlp_VFSFileOpen(), dlp_VFSFileRead(), dlp_VFSFileRename(), dlp_VFSFileResize(), dlp_VFSFileSeek(), dlp_VFSFileSetAttributes(), dlp_VFSFileSetDate(), dlp_VFSFileSize(), dlp_VFSFileTell(), dlp_VFSFileWrite(), dlp_VFSGetDefaultDir(), dlp_VFSImportDatabaseFromFile(), dlp_VFSVolumeEnumerate(), dlp_VFSVolumeFormat(), dlp_VFSVolumeGetLabel(), dlp_VFSVolumeInfo(), dlp_VFSVolumeSetLabel(), dlp_VFSVolumeSize(), dlp_WriteAppBlock(), dlp_WriteAppPreference(), dlp_WriteNetSyncInfo(), dlp_WriteRecord(), dlp_WriteResource(), dlp_WriteSortBlock(), and dlp_WriteUserInfo().
00707 { 00708 int bytes, result; 00709 *res = NULL; 00710 00711 if ((result = dlp_request_write (req, sd)) < req->argc) { 00712 LOG((PI_DBG_DLP, PI_DBG_LVL_ERR, 00713 "DLP sd:%i dlp_request_write returned %i\n", 00714 sd, result)); 00715 errno = -EIO; 00716 return result; 00717 } 00718 00719 if ((bytes = dlp_response_read (res, sd)) < 0) { 00720 LOG((PI_DBG_DLP, PI_DBG_LVL_ERR, 00721 "DLP sd:%i dlp_response_read returned %i\n", 00722 sd, bytes)); 00723 errno = -EIO; 00724 return bytes; 00725 } 00726 00727 /* Check to make sure the response is for this command */ 00728 if ((*res)->cmd != req->cmd) { 00729 /* The Palm m130 and Tungsten T return the wrong code for VFSVolumeInfo */ 00730 /* Tungsten T5 (and maybe Treo 650) return dlpFuncEndOfSync for dlpFuncWriteResource */ 00731 /* In some cases, the Tapwave Zodiac returns dlpFuncReadRecord instead of dlpFuncReadRecordEx */ 00732 if ((req->cmd != dlpFuncVFSVolumeInfo || (*res)->cmd != dlpFuncVFSVolumeSize) 00733 && req->cmd != dlpFuncWriteResource /* T5 */ 00734 && req->cmd != dlpFuncReadRecord /* Zodiac */ 00735 && req->cmd != dlpFuncReadRecordEx) /* Zodiac */ 00736 { 00737 errno = -ENOMSG; 00738 00739 LOG((PI_DBG_DLP, PI_DBG_LVL_DEBUG, 00740 "dlp_exec: result CMD 0x%02x doesn't match requested cmd 0x%02x\n", 00741 (unsigned)((*res)->cmd), (unsigned)req->cmd)); 00742 00743 return pi_set_error(sd, PI_ERR_DLP_COMMAND); 00744 } 00745 } 00746 00747 /* Check to make sure there was no error */ 00748 if ((*res)->err != dlpErrNoError) { 00749 errno = -ENOMSG; 00750 pi_set_palmos_error(sd, (int)((*res)->err)); 00751 return pi_set_error(sd, PI_ERR_DLP_PALMOS); 00752 } 00753 00754 return bytes; 00755 }
Here is the call graph for this function:

| int dlp_ExpCardInfo | ( | int | sd, | |
| int | slotref, | |||
| unsigned long * | expflags, | |||
| int * | numstrings, | |||
| char ** | strings | |||
| ) |
Get information about a removable card inserted in an expansion slot.
Supported on Palm OS 4.0 and later. The info strings are returned in a single malloc()'ed buffer as a suite of nul-terminated string, one after the other.
| sd | Socket number | |
| slotref | The slot reference as returned by dlp_ExpSlotEnumerate(). | |
| expflags | If not NULL, the card flags (see dlpExpCardCapabilities enum) | |
| numstrings | On return, the number of strings found in the strings array | |
| strings | If not NULL, ptr to a char*. If there are strings to return, this function allocates a buffer to hold the strings. You are responsible for free()'ing the buffer once you're done with it. |
Definition at line 3839 of file dlp.c.
References dlp_exec(), dlp_ExpCardInfo(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncExpCardInfo, get_byte, get_long, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_short, and TraceX.
Referenced by _wrap_dlp_ExpCardInfo(), dlp_ExpCardInfo(), and main().
03841 { 03842 int result; 03843 struct dlpRequest* req; 03844 struct dlpResponse* res; 03845 03846 RequireDLPVersion(sd,1,2); 03847 TraceX(dlp_ExpCardInfo,"slotRef=%d",slotRef); 03848 pi_reset_errors(sd); 03849 03850 req = dlp_request_new (dlpFuncExpCardInfo, 1, 2); 03851 if (req == NULL) 03852 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03853 03854 set_short(DLP_REQUEST_DATA(req, 0, 0), slotRef); 03855 03856 result = dlp_exec(sd, req, &res); 03857 03858 dlp_request_free(req); 03859 03860 if (result > 0) { 03861 *flags = get_long(DLP_RESPONSE_DATA (res, 0, 0)); 03862 *numStrings = get_byte(DLP_RESPONSE_DATA (res, 0, 4)); 03863 03864 if (strings && *numStrings) { 03865 int i, len, sz = 0; 03866 char *p = DLP_RESPONSE_DATA (res, 0, 8); 03867 03868 for (i=0; i < *numStrings; i++, sz+=len, p+=len) 03869 len = strlen (p) + 1; 03870 03871 *strings = (char *) malloc ((size_t)sz); 03872 if (*strings) 03873 memcpy (*strings, DLP_RESPONSE_DATA (res, 0, 8), (size_t)sz); 03874 else 03875 result = pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03876 } 03877 03878 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 03879 "DLP ExpCardInfo flags: 0x%08lx numStrings: %d\n", 03880 *flags, *numStrings)); 03881 } 03882 03883 dlp_response_free(res); 03884 03885 return result; 03886 }
Here is the call graph for this function:

| int dlp_ExpCardPresent | ( | int | sd, | |
| int | slotref | |||
| ) |
Checks whether a card is inserted in a slot.
Supported on Palm OS 4.0 and later. Returns >=0 if a card is inserted in the slot.
| sd | Socket number | |
| slotref | The slot reference as returned by dlp_ExpSlotEnumerate(). |
Definition at line 3814 of file dlp.c.
References dlp_exec(), dlp_ExpCardPresent(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlpFuncExpCardPresent, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_short, and TraceX.
Referenced by _wrap_dlp_ExpCardPresent(), dlp_ExpCardPresent(), and main().
03815 { 03816 int result; 03817 struct dlpRequest *req; 03818 struct dlpResponse *res; 03819 03820 RequireDLPVersion(sd,1,2); 03821 TraceX(dlp_ExpCardPresent,"slotRef=%d",slotRef); 03822 pi_reset_errors(sd); 03823 03824 req = dlp_request_new (dlpFuncExpCardPresent, 1, 2); 03825 if (req == NULL) 03826 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03827 03828 set_short(DLP_REQUEST_DATA(req, 0, 0), slotRef); 03829 03830 result = dlp_exec (sd, req, &res); 03831 03832 dlp_request_free(req); 03833 dlp_response_free(res); 03834 03835 return result; 03836 }
Here is the call graph for this function:

| int dlp_ExpSlotEnumerate | ( | int | sd, | |
| int * | numslots, | |||
| int * | slotrefs | |||
| ) |
Enumerate expansion slots.
Supported on Palm OS 4.0 and later. Expansion slots are physical slots present on the device. To check whether a card is inserted in a slot, use dlp_ExpCardPresent().
| sd | Socket number | |
| numslots | On input, maximum number of slots that can be returned in the slotRefs array. On return, the actual number of slot references returned in slotRefs. | |
| slotrefs | On return, numSlots slot references |
Definition at line 3768 of file dlp.c.
References dlp_exec(), dlp_ExpSlotEnumerate(), dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncExpSlotEnumerate, get_short, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, and Trace.
Referenced by _wrap_dlp_ExpSlotEnumerate(), dlp_ExpSlotEnumerate(), and main().
03769 { 03770 int result; 03771 struct dlpRequest *req; 03772 struct dlpResponse *res; 03773 03774 RequireDLPVersion(sd,1,2); 03775 Trace(dlp_ExpSlotEnumerate); 03776 pi_reset_errors(sd); 03777 03778 req = dlp_request_new(dlpFuncExpSlotEnumerate, 0); 03779 if (req == NULL) 03780 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03781 03782 result = dlp_exec(sd, req, &res); 03783 03784 dlp_request_free(req); 03785 03786 if (result > 0) { 03787 int slots, i; 03788 03789 slots = get_short(DLP_RESPONSE_DATA (res, 0, 0)); 03790 03791 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 03792 "DLP ExpSlotEnumerate %d\n", slots)); 03793 03794 if (slots) { 03795 for (i = 0; i < slots && i < *numSlots; i++) { 03796 slotRefs[i] = 03797 get_short(DLP_RESPONSE_DATA (res, 0, 03798 2 + (2 * i))); 03799 03800 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 03801 " %d Slot-Refnum %d\n", i, slotRefs[i])); 03802 } 03803 } 03804 03805 *numSlots = slots; 03806 } 03807 03808 dlp_response_free(res); 03809 03810 return result; 03811 }
Here is the call graph for this function:

| int dlp_ExpSlotMediaType | ( | int | sd, | |
| int | slotref, | |||
| unsigned long * | mediatype | |||
| ) |
Return the type of media supported by an expansion slot.
Supported on Palm OS 5.2 and later (DLP 1.4 and later).
| sd | Socket number | |
| slotref | The slot reference as returned by dlp_ExpSlotEnumerate(). | |
| mediatype | On return, the media type |
Definition at line 4873 of file dlp.c.
References dlp_exec(), dlp_ExpSlotMediaType(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncExpSlotMediaType, get_long, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_short, and TraceX.
Referenced by _wrap_dlp_ExpSlotMediaType(), and dlp_ExpSlotMediaType().
04874 { 04875 int result; 04876 struct dlpRequest *req; 04877 struct dlpResponse *res; 04878 04879 RequireDLPVersion(sd,1, 4); 04880 TraceX(dlp_ExpSlotMediaType,"slotNum=%d",slotNum); 04881 pi_reset_errors(sd); 04882 04883 req = dlp_request_new (dlpFuncExpSlotMediaType, 1, 2); 04884 if (req == NULL) 04885 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04886 04887 set_short (DLP_REQUEST_DATA (req, 0, 0), slotNum); 04888 04889 result = dlp_exec (sd, req, &res); 04890 04891 dlp_request_free (req); 04892 04893 if (result > 0) { 04894 *mediaType = get_long (DLP_RESPONSE_DATA (res, 0, 0)); 04895 04896 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04897 "DLP Media Type for slot %d: %4.4s\n", 04898 slotNum, mediaType)); 04899 } 04900 04901 dlp_response_free (res); 04902 04903 return result; 04904 }
Here is the call graph for this function:

| int dlp_FindDBByName | ( | int | sd, | |
| int | cardno, | |||
| PI_CONST char * | name, | |||
| unsigned long * | localid, | |||
| int * | dbhandle, | |||
| struct DBInfo * | info, | |||
| struct DBSizeInfo * | size | |||
| ) |
Definition at line 1312 of file dlp.c.
References dlp_decode_finddb_response(), dlp_exec(), dlp_FindDBByName(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlpFindDBOptFlagGetAttributes, dlpFindDBOptFlagGetSize, dlpFuncFindDB, flags, PI_ERR_DLP_UNSUPPORTED, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), pi_version(), set_byte, size, and TraceX.
01314 { 01315 int result; 01316 struct dlpRequest *req; 01317 struct dlpResponse *res; 01318 int flags = 0; 01319 01320 TraceX(dlp_FindDBByName,"cardno=%d name='%s'",cardno,name); 01321 pi_reset_errors(sd); 01322 01323 if (pi_version(sd) < 0x0102) 01324 return pi_set_error(sd, PI_ERR_DLP_UNSUPPORTED); 01325 01326 req = dlp_request_new(dlpFuncFindDB, 1, 2 + (strlen(name) + 1)); 01327 if (req == NULL) 01328 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01329 01330 if (localid || dbhandle || info) 01331 flags |= dlpFindDBOptFlagGetAttributes; 01332 if (size) 01333 flags |= dlpFindDBOptFlagGetSize; 01334 01335 set_byte(DLP_REQUEST_DATA(req, 0, 0), flags); 01336 set_byte(DLP_REQUEST_DATA(req, 0, 1), cardno); 01337 strcpy(DLP_REQUEST_DATA(req, 0, 2), name); 01338 01339 result = dlp_exec(sd, req, &res); 01340 01341 dlp_request_free(req); 01342 01343 if (result > 0) 01344 dlp_decode_finddb_response(res, NULL, localid, dbhandle, info, size); 01345 01346 dlp_response_free(res); 01347 01348 return result; 01349 }
Here is the call graph for this function:

| int dlp_FindDBByOpenHandle | ( | int | sd, | |
| int | dbhandle, | |||
| int * | cardno, | |||
| unsigned long * | localid, | |||
| struct DBInfo * | dbInfo, | |||
| struct DBSizeInfo * | dbSize | |||
| ) |
Get information about an open database.
Supported on Palm OS 3.0 (DLP 1.2) and later.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() | |
| cardno | If not NULL, on return contains the cardno of the memory card the database resides on | |
| localid | If not NULL, on return contains the LocalID of the database | |
| dbInfo | If not NULL, on return contains information about the database | |
| dbSize | If not NULL, on return contains information about the database size |
Definition at line 1352 of file dlp.c.
References dlp_decode_finddb_response(), dlp_exec(), dlp_FindDBByOpenHandle(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new_with_argid(), dlp_response_free(), dlpFindDBOptFlagGetAttributes, dlpFindDBOptFlagGetSize, dlpFuncFindDB, flags, PI_ERR_DLP_UNSUPPORTED, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), pi_version(), set_byte, size, and Trace.
Referenced by _wrap_dlp_FindDBByOpenHandle(), dlp_FindDBByOpenHandle(), and main().
01354 { 01355 int result; 01356 struct dlpRequest *req; 01357 struct dlpResponse *res; 01358 int flags = 0; 01359 01360 Trace(dlp_FindDBByOpenHandle); 01361 pi_reset_errors(sd); 01362 01363 if (pi_version(sd) < 0x0102) 01364 return pi_set_error(sd, PI_ERR_DLP_UNSUPPORTED); 01365 01366 req = dlp_request_new_with_argid(dlpFuncFindDB, 0x21, 1, 2); 01367 if (req == NULL) 01368 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01369 01370 /* Note: there is a bug in HotSync -- requesting the maxRecSize 01371 * crashes the device, so we don't. This is supposed to work only 01372 * for this variant of FindDB anyway. 01373 */ 01374 if (cardno || localid || info) 01375 flags |= dlpFindDBOptFlagGetAttributes; 01376 if (size) 01377 flags |= dlpFindDBOptFlagGetSize; 01378 01379 set_byte(DLP_REQUEST_DATA(req, 0, 0), flags); 01380 set_byte(DLP_REQUEST_DATA(req, 0, 1), dbhandle); 01381 01382 result = dlp_exec(sd, req, &res); 01383 01384 dlp_request_free(req); 01385 01386 if (result > 0) 01387 dlp_decode_finddb_response(res, cardno, localid, NULL, info, size); 01388 01389 dlp_response_free(res); 01390 01391 return result; 01392 }
Here is the call graph for this function:

| int dlp_FindDBByTypeCreator | ( | int | sd, | |
| unsigned long | type, | |||
| unsigned long | creator, | |||
| int | start, | |||
| int | latest, | |||
| int * | cardno, | |||
| unsigned long * | localid, | |||
| int * | dbhandle, | |||
| struct DBInfo * | dbInfo, | |||
| struct DBSizeInfo * | dbSize | |||
| ) |
Find databases by type and/or creator.
Supported on Palm OS 3.0 (DLP 1.2) and later. To look for multiple databases, make a first call with start set to 1, then subsequent calls with start set to 0 until no more database is found.
| sd | Socket number | |
| type | If not 0, type code to look for | |
| creator | If not 0, creator code to look for | |
| start | If set, start a new search | |
| latest | If set, returns the database with the latest version if there are several identical databases | |
| cardno | If not NULL, on return contains the memory card number the database resides on | |
| localid | If not NULL, on return contains the LocalID of the database | |
| dbhandle | If not NULL, on return contains the handle of the database if it is currently open | |
| dbInfo | If not NULL, on return contains information about the database | |
| dbSize | If not NULL, on return contains information about the database size |
Definition at line 1395 of file dlp.c.
References dlp_decode_finddb_response(), dlp_exec(), dlp_FindDBByTypeCreator(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new_with_argid(), dlp_response_free(), dlpFindDBOptFlagGetAttributes, dlpFindDBOptFlagGetSize, dlpFindDBOptFlagMaxRecSize, dlpFindDBSrchFlagNewSearch, dlpFindDBSrchFlagOnlyLatest, dlpFuncFindDB, flags, PI_ERR_DLP_UNSUPPORTED, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), pi_version(), set_byte, set_long, size, and TraceX.
Referenced by _wrap_dlp_FindDBByTypeCreator(), dlp_FindDBByTypeCreator(), and main().
01398 { 01399 int result; 01400 struct dlpRequest *req; 01401 struct dlpResponse *res; 01402 int flags = 0, search_flags = 0; 01403 01404 TraceX(dlp_FindDBByTypeCreator,"type='%4.4s' creator='%4.4s' start=%d latest=%d", 01405 (const char *)&type,(const char *)&creator,start,latest); 01406 pi_reset_errors(sd); 01407 01408 if (pi_version(sd) < 0x0102) 01409 return pi_set_error(sd, PI_ERR_DLP_UNSUPPORTED); 01410 01411 req = dlp_request_new_with_argid(dlpFuncFindDB, 0x22, 1, 10); 01412 if (req == NULL) 01413 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01414 01415 if (cardno || localid || dbhandle || info) 01416 flags |= dlpFindDBOptFlagGetAttributes; 01417 if (size) 01418 flags |= (dlpFindDBOptFlagGetSize | 01419 dlpFindDBOptFlagMaxRecSize); 01420 01421 if (start) 01422 search_flags |= dlpFindDBSrchFlagNewSearch; 01423 if (latest) 01424 search_flags |= dlpFindDBSrchFlagOnlyLatest; 01425 01426 01427 set_byte(DLP_REQUEST_DATA(req, 0, 0), flags); 01428 set_byte(DLP_REQUEST_DATA(req, 0, 1), search_flags); 01429 set_long(DLP_REQUEST_DATA(req, 0, 2), type); 01430 set_long(DLP_REQUEST_DATA(req, 0, 6), creator); 01431 01432 result = dlp_exec(sd, req, &res); 01433 01434 dlp_request_free(req); 01435 01436 if (result > 0) 01437 dlp_decode_finddb_response(res, cardno, localid, dbhandle, info, size); 01438 01439 dlp_response_free(res); 01440 01441 return result; 01442 }
Here is the call graph for this function:

| int dlp_FindDBInfo | ( | int | sd, | |
| int | cardno, | |||
| int | start, | |||
| const char * | dbname, | |||
| unsigned long | type, | |||
| unsigned long | creator, | |||
| struct DBInfo * | info | |||
| ) |
Definition at line 1143 of file dlp.c.
References buf, DBInfo::creator, dlp_FindDBInfo(), dlp_ReadDBList(), dlpDBListMultiple, DBInfo::index, DBInfo::name, pi_buffer_free(), pi_buffer_new(), PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), TraceX, and DBInfo::type.
01146 { 01147 int i, 01148 j; 01149 pi_buffer_t *buf; 01150 01151 TraceX(dlp_FindDBInfo,"cardno=%d start=%d",cardno,start); 01152 pi_reset_errors(sd); 01153 01154 buf = pi_buffer_new (sizeof (struct DBInfo)); 01155 if (buf == NULL) 01156 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01157 01158 if (start < 0x1000) { 01159 i = start; 01160 while (dlp_ReadDBList(sd, cardno, 0x80 | dlpDBListMultiple, i, buf) >= 0) { 01161 for (j=0; j < (int)(buf->used / sizeof(struct DBInfo)); j++) { 01162 memcpy (info, buf->data + j * sizeof(struct DBInfo), sizeof(struct DBInfo)); 01163 if ((!dbname || strcmp(info->name, dbname) == 0) 01164 && (!type || info->type == type) 01165 && (!creator || info->creator == creator)) 01166 goto found; 01167 i = info->index + 1; 01168 } 01169 } 01170 start = 0x1000; 01171 } 01172 01173 i = start & 0xFFF; 01174 while (dlp_ReadDBList(sd, cardno, 0x40 | dlpDBListMultiple, i, buf) >= 0) { 01175 for (j=0; j < (int)(buf->used / sizeof(struct DBInfo)); j++) { 01176 memcpy (info, buf->data + j * sizeof(struct DBInfo), sizeof(struct DBInfo)); 01177 if ((!dbname || strcmp(info->name, dbname) == 0) 01178 && (!type || info->type == type) 01179 && (!creator || info->creator == creator)) 01180 { 01181 info->index |= 0x1000; 01182 goto found; 01183 } 01184 i = info->index + 1; 01185 } 01186 } 01187 01188 pi_buffer_free (buf); 01189 return -1; 01190 01191 found: 01192 pi_buffer_free (buf); 01193 return 0; 01194 }
Here is the call graph for this function:

| int dlp_GetROMToken | ( | int | sd, | |
| unsigned long | token, | |||
| void * | databuf, | |||
| size_t * | datasize | |||
| ) |
Emulation of the SysGetROMToken function on the device.
Supported on Palm OS 2.0 through 4.0. Using this function is not recommended.
| sd | Socket number | |
| token | ROM token to read | |
| databuf | Buffer to store the token data in | |
| datasize | Size of data to read |
Definition at line 2331 of file dlp.c.
References dlp_errorlist, dlp_GetROMToken(), dlp_RPC(), PackRPC(), pi_reset_errors(), printlong(), RPC_End, RPC_IntReply, RPC_Long, RPC_LongPtr, RPC_Ptr, RPC_Short, RPC_ShortPtr, and Trace.
Referenced by _wrap_dlp_GetROMToken(), dlp_GetROMToken(), and do_get_token().
02332 { 02333 unsigned long result; 02334 02335 struct RPC_params p; 02336 02337 int val; 02338 unsigned long buffer_ptr; 02339 02340 Trace(dlp_GetROMToken); 02341 pi_reset_errors(sd); 02342 02343 #ifdef DLP_TRACE 02344 if (dlp_trace) { 02345 fprintf(stderr, 02346 " Wrote: Token: '%s'\n", 02347 printlong(token)); 02348 } 02349 #endif 02350 02351 PackRPC(&p, 0xa340, RPC_IntReply, /* sysTrapHwrGetROMToken */ 02352 RPC_Short(0), 02353 RPC_Long(token), 02354 RPC_LongPtr(&buffer_ptr), 02355 RPC_ShortPtr(size), RPC_End); 02356 02357 val = dlp_RPC(sd, &p, &result); 02358 02359 #ifdef DLP_TRACE 02360 if (dlp_trace) { 02361 if (val < 0) 02362 fprintf(stderr, 02363 "Result: Error: %s (%d)\n", 02364 dlp_errorlist[-val], val); 02365 else if (result) 02366 fprintf(stderr, 02367 "FtrGet error 0x%8.8lX\n", 02368 (unsigned long) result); 02369 else 02370 fprintf(stderr, 02371 " Read: Buffer Ptr: 0x%8.8lX Size: %d\n", 02372 (unsigned long) buffer_ptr, *size); 02373 } 02374 #endif 02375 02376 if (buffer) { 02377 ((unsigned char *)buffer)[*size] = 0; 02378 02379 PackRPC(&p, 0xa026, RPC_IntReply, /* sysTrapMemMove */ 02380 RPC_Ptr(buffer, *size), 02381 RPC_Long(buffer_ptr), 02382 RPC_Long((unsigned long) *size), 02383 RPC_End); 02384 02385 val = dlp_RPC(sd, &p, &result); 02386 } 02387 02388 #ifdef DLP_TRACE 02389 if (dlp_trace) { 02390 if (val < 0) 02391 fprintf(stderr, 02392 "Result: Error: %s (%d)\n", 02393 dlp_errorlist[-val], val); 02394 else if (result) 02395 fprintf(stderr, 02396 "FtrGet error 0x%8.8lX\n", 02397 (unsigned long) result); 02398 else 02399 fprintf(stderr, 02400 " Read: Buffer: %s\n", buffer); 02401 } 02402 #endif 02403 02404 if (val < 0) 02405 return val; 02406 02407 if (result) 02408 return -((int)result); 02409 02410 return result; 02411 }
Here is the call graph for this function:

| int dlp_GetSysDateTime | ( | int | sd, | |
| time_t * | palm_time | |||
| ) |
Get the time from the device and return it as a local time_t value.
| sd | Socket number | |
| palm_time | Pointer to a time_t to fill |
Definition at line 851 of file dlp.c.
References dlp_exec(), dlp_GetSysDateTime(), dlp_ptohdate(), dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncGetSysDateTime, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), and Trace.
Referenced by _wrap_dlp_GetSysDateTime_(), dlp_GetSysDateTime(), and main().
00852 { 00853 int result; 00854 struct dlpRequest *req; 00855 struct dlpResponse *res; 00856 00857 Trace(dlp_GetSysDateTime); 00858 pi_reset_errors(sd); 00859 00860 req = dlp_request_new(dlpFuncGetSysDateTime, 0); 00861 if (req == NULL) 00862 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 00863 00864 result = dlp_exec(sd, req, &res); 00865 00866 dlp_request_free(req); 00867 00868 if (result > 0) { 00869 *t = dlp_ptohdate((const unsigned char *)DLP_RESPONSE_DATA (res, 0, 0)); 00870 00871 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 00872 "DLP GetSysDateTime %s", ctime(t))); 00873 } 00874 00875 dlp_response_free(res); 00876 00877 return result; 00878 }
Here is the call graph for this function:

| void dlp_htopdate | ( | time_t | palm_time, | |
| unsigned char * | timeDateData | |||
| ) |
Convert a date to Palm OS date.
If the local date is 0x83DAC000 (Fri Jan 1 00:00:00 1904 GMT) the Palm OS date is set to undefined. Otherwise the date is converted from local time to Palm OS
| palm_time | The date to convert | |
| timeDateData | Ptr to an 8 byte buffer to hold the Palm OS date |
Definition at line 822 of file dlp.c.
References ASSERT.
Referenced by _wrap_dlp_htopdate(), and dlp_SetSysDateTime().
00823 { /* @+ptrnegate@ */ 00824 int year; 00825 const struct tm *t; 00826 00827 /* Fri Jan 1 00:00:00 1904 GMT */ 00828 time_t palm_epoch = 0x83DAC000; 00829 00830 if (time_interval == palm_epoch) { 00831 memset(data, 0, 8); 00832 return; 00833 } 00834 00835 t = localtime(&time_interval); 00836 ASSERT(t != NULL); 00837 00838 year = t->tm_year + 1900; 00839 00840 data[7] = (unsigned char) 0; /* packing spacer */ 00841 data[6] = (unsigned char) t->tm_sec; 00842 data[5] = (unsigned char) t->tm_min; 00843 data[4] = (unsigned char) t->tm_hour; 00844 data[3] = (unsigned char) t->tm_mday; 00845 data[2] = (unsigned char) (t->tm_mon + 1); 00846 data[0] = (unsigned char) (year >> 8); 00847 data[1] = (unsigned char) year; 00848 }
| int dlp_MoveCategory | ( | int | sd, | |
| int | dbhandle, | |||
| int | fromcat, | |||
| int | tocat | |||
| ) |
Move all records from a category to another category.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() | |
| fromcat | Category to move from (0-15) | |
| tocat | Category to move to (0-15) |
Definition at line 1847 of file dlp.c.
References dlp_exec(), dlp_MoveCategory(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlpFuncMoveCategory, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, and TraceX.
Referenced by _wrap_dlp_MoveCategory(), dlp_MoveCategory(), and main().
01848 { 01849 int result; 01850 struct dlpRequest *req; 01851 struct dlpResponse *res; 01852 01853 TraceX(dlp_MoveCategory,"from %d to %d",fromcat,tocat); 01854 pi_reset_errors(sd); 01855 01856 req = dlp_request_new(dlpFuncMoveCategory, 1, 4); 01857 if (req == NULL) 01858 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01859 01860 set_byte(DLP_REQUEST_DATA(req, 0, 0), handle); 01861 set_byte(DLP_REQUEST_DATA(req, 0, 1), fromcat); 01862 set_byte(DLP_REQUEST_DATA(req, 0, 2), tocat); 01863 set_byte(DLP_REQUEST_DATA(req, 0, 3), 0); 01864 01865 result = dlp_exec(sd, req, &res); 01866 01867 dlp_request_free(req); 01868 dlp_response_free(res); 01869 01870 if (result >= 0) { 01871 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01872 "DLP MoveCategory Handle: %d, From: %d, To: %d\n", 01873 handle, fromcat, tocat)); 01874 } 01875 01876 return result; 01877 }
Here is the call graph for this function:

| int dlp_OpenConduit | ( | int | sd | ) |
State that a conduit has started running on the desktop.
Puts up a status message on the device. Calling this method regularly is also the only reliable way to know whether the user pressed the Cancel button on the device.
| sd | Socket number |
Definition at line 1880 of file dlp.c.
References dlp_exec(), dlp_OpenConduit(), dlp_request_free(), dlp_request_new(), dlp_response_free(), dlpFuncOpenConduit, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), pi_version(), and Trace.
Referenced by _wrap_dlp_OpenConduit(), dlp_OpenConduit(), do_get_ram(), do_get_rom(), Java_org_gnu_pilotlink_PilotLink_openConduit(), main(), OpenConduitCmd(), palm_backup(), palm_fetch_VFS(), palm_install_internal(), palm_install_VFS(), pilot_connect(), and plu_connect().
01881 { 01882 int result; 01883 struct dlpRequest *req; 01884 struct dlpResponse *res; 01885 01886 Trace(dlp_OpenConduit); 01887 pi_reset_errors(sd); 01888 01889 req = dlp_request_new(dlpFuncOpenConduit, 0); 01890 if (req == NULL) 01891 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01892 01893 result = dlp_exec(sd, req, &res); 01894 01895 dlp_request_free(req); 01896 dlp_response_free(res); 01897 01898 /* if this was not done yet, this will read and cache the DLP version 01899 that the Palm is running. We need this when reading responses during 01900 record/resource transfers */ 01901 if (result >= 0) 01902 pi_version(sd); 01903 01904 return result; 01905 }
Here is the call graph for this function:

| int dlp_OpenDB | ( | int | sd, | |
| int | cardno, | |||
| int | mode, | |||
| PI_CONST char * | name, | |||
| int * | dbhandle | |||
| ) |
Definition at line 1445 of file dlp.c.
References dlp_exec(), dlp_OpenDB(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncOpenDB, get_byte, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, and TraceX.
01446 { 01447 int result; 01448 struct dlpRequest *req; 01449 struct dlpResponse *res; 01450 01451 TraceX(dlp_OpenDB,"'%s'",name); 01452 pi_reset_errors(sd); 01453 01454 req = dlp_request_new(dlpFuncOpenDB, 1, 2 + strlen(name) + 1); 01455 if (req == NULL) 01456 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01457 01458 set_byte(DLP_REQUEST_DATA(req, 0, 0), cardno); 01459 set_byte(DLP_REQUEST_DATA(req, 0, 1), mode); 01460 strcpy(DLP_REQUEST_DATA(req, 0, 2), name); 01461 01462 result = dlp_exec(sd, req, &res); 01463 01464 dlp_request_free(req); 01465 01466 if (result > 0) { 01467 *dbhandle = get_byte(DLP_RESPONSE_DATA(res, 0, 0)); 01468 01469 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01470 "-> dlp_OpenDB dbhandle=%d\n", *dbhandle)); 01471 } 01472 01473 dlp_response_free(res); 01474 01475 return result; 01476 }
Here is the call graph for this function:

| time_t dlp_ptohdate | ( | const unsigned char * | data | ) |
Definition at line 771 of file dlp.c.
00772 { 00773 struct tm t; 00774 00775 /* Seems like year comes back as all zeros if the date is "empty" 00776 (but other fields can vary). And mktime() chokes on 1900 B.C. 00777 (result of 0 minus 1900), returning -1, which the higher level 00778 code can't deal with (passes it straight on to utime(), which 00779 simply leaves the file's timestamp "as-is"). 00780 00781 So, since year 0 appears to mean "no date", we'll return an odd 00782 number that works out to precisely one day before the start of 00783 the Palm's clock (thus little chance of being run into by any 00784 Palm-based time stamp). */ 00785 00786 if (data[0] == 0 && data[1] == 0) { 00787 00788 /* This original calculation was wrong, and reported one day 00789 earlier than it was supposed to report. You can verify 00790 this with the following: 00791 00792 perl -e '$date=localtime(0x83D8FE00); print $date,"\n"' 00793 00794 return (time_t) 0x83D8FE00; // Wed Dec 30 16:00:00 1903 GMT 00795 00796 Here are others, depending on what your system requirements are: 00797 00798 return (time_t) 0x83D96E80; // Thu Dec 31 00:00:00 1903 GMT 00799 return (time_t) 0x00007080; // Thu Jan 1 00:00:00 1970 GMT 00800 00801 Palm's own Conduit Development Kit references using 1/1/1904, 00802 so that's what we'll use here until something else breaks 00803 it. 00804 */ 00805 00806 return (time_t) 0x83DAC000; /* Fri Jan 1 00:00:00 1904 GMT */ 00807 } 00808 00809 memset(&t, 0, sizeof(t)); 00810 t.tm_sec = (int) data[6]; 00811 t.tm_min = (int) data[5]; 00812 t.tm_hour = (int) data[4]; 00813 t.tm_mday = (int) data[3]; 00814 t.tm_mon = (int) data[2] - 1; 00815 t.tm_year = (((int)data[0] << 8) | (int)data[1]) - 1900; 00816 t.tm_isdst = -1; 00817 00818 return mktime(&t); 00819 }
| int dlp_ReadAppBlock | ( | int | sd, | |
| int | dbhandle, | |||
| int | offset, | |||
| int | reqbytes, | |||
| pi_buffer_t * | retbuf | |||
| ) |
Read a database's AppInfo block.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() | |
| offset | Offset to start reading from (0 based) | |
| reqbytes | Number of bytes to read (pass -1 to read all data from offset to the end of the AppInfo block) | |
| retbuf | Buffer allocated using pi_buffer_new(). On return contains the data from the AppInfo block |
Definition at line 2926 of file dlp.c.
References dlpResponse::argv, CHECK, dlp_exec(), dlp_ReadAppBlock(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncReadAppBlock, dlpArg::len, LOG, pi_buffer_append(), pi_buffer_clear(), PI_DBG_DLP, PI_DBG_LVL_DEBUG, PI_DBG_LVL_INFO, pi_dumpdata(), PI_ERR_DLP_COMMAND, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, set_short, and TraceX.
Referenced by _wrap_dlp_ReadAppBlock(), dlp_ReadAppBlock(), Java_org_gnu_pilotlink_PilotLink_getAppInfoBlock(), Java_org_gnu_pilotlink_PilotLink_readAppInfo(), main(), pi_file_retrieve(), and print_appblock().
02927 { 02928 int result, 02929 data_len; 02930 struct dlpRequest *req; 02931 struct dlpResponse *res; 02932 02933 TraceX(dlp_ReadAppBlock,"offset=%d reqbytes=%ld",offset,reqbytes); 02934 pi_reset_errors(sd); 02935 02936 if (retbuf) 02937 pi_buffer_clear(retbuf); 02938 02939 req = dlp_request_new(dlpFuncReadAppBlock, 1, 6); 02940 if (req == NULL) 02941 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 02942 02943 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 02944 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0); 02945 set_short(DLP_REQUEST_DATA(req, 0, 2), offset); 02946 set_short(DLP_REQUEST_DATA(req, 0, 4), reqbytes); 02947 02948 result = dlp_exec(sd, req, &res); 02949 02950 dlp_request_free(req); 02951 02952 if (result >= 0) { 02953 if (result < 2) 02954 data_len = PI_ERR_DLP_COMMAND; 02955 else { 02956 data_len = res->argv[0]->len - 2; 02957 if (retbuf && data_len) 02958 pi_buffer_append(retbuf, DLP_RESPONSE_DATA(res, 0, 2), 02959 (size_t)data_len); 02960 02961 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 02962 "DLP ReadAppBlock %d bytes\n", data_len)); 02963 CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG, 02964 pi_dumpdata(DLP_RESPONSE_DATA(res, 0, 2), 02965 (size_t)data_len)); 02966 } 02967 } else { 02968 data_len = result; 02969 } 02970 02971 dlp_response_free(res); 02972 02973 return data_len; 02974 }
Here is the call graph for this function:

| int dlp_ReadAppPreference | ( | int | sd, | |
| unsigned long | creator, | |||
| int | prefid, | |||
| int | backup, | |||
| int | maxsize, | |||
| void * | databuf, | |||
| size_t * | datasize, | |||
| int * | version | |||
| ) |
Convenience function to ead an app preference data block.
Supported on Palm OS 2.0 and later, emulated for Palm OS 1.x.
| sd | Socket number | |
| creator | Application creator | |
| prefid | Preference ID | |
| backup | If set, read from backup prefs (see Palm OS documentation). This flag is ignored on Palm OS 1.x. | |
| maxsize | Maximum size of the data to return in buffer | |
| databuf | If not NULL, buffer should be of size maxsize. On return, contains the preference data | |
| datasize | If not NULL, on return contains the size of the preference data block | |
| version | If not NULL |
Definition at line 3269 of file dlp.c.
References buf, CHECK, dlp_CloseDB(), dlp_exec(), dlp_OpenDB(), dlp_ReadAppPreference(), dlp_ReadResourceByType(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncReadAppPreference, dlpOpenRead, get_short, LOG, pi_buffer_free(), pi_buffer_new(), PI_DBG_DLP, PI_DBG_LVL_DEBUG, PI_DBG_LVL_INFO, pi_dumpdata(), PI_ERR_GENERIC_MEMORY, PI_ERR_SOCK_DISCONNECTED, pi_error(), pi_palmos_error(), pi_reset_errors(), pi_set_error(), pi_set_palmos_error(), pi_version(), printlong(), set_byte, set_long, set_short, and TraceX.
Referenced by _wrap_dlp_ReadAppPreference(), dlp_ReadAppPreference(), and main().
03271 { 03272 int result, 03273 data_len; 03274 struct dlpRequest *req; 03275 struct dlpResponse *res; 03276 03277 TraceX(dlp_ReadAppPreference,"creator='%4.4s' prefID=%d backup=%d maxsize=%d", 03278 (const char *)creator,prefID,backup,maxsize); 03279 pi_reset_errors(sd); 03280 03281 if (pi_version(sd) < 0x0101) { 03282 /* Emulate on PalmOS 1.0 */ 03283 int db; 03284 pi_buffer_t *buf; 03285 03286 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 03287 "DLP ReadAppPreference Emulating with: Creator: '%s', " 03288 "Id: %d, Size: %d, Backup: %d\n", 03289 printlong(creator), prefID, 03290 buffer ? maxsize : 0, backup ? 0x80 : 0)); 03291 03292 result = dlp_OpenDB(sd, 0, dlpOpenRead, "System Preferences", &db); 03293 if (result < 0) 03294 return result; 03295 03296 buf = pi_buffer_new (1024); 03297 03298 result = dlp_ReadResourceByType(sd, db, creator, prefID, buf,NULL); 03299 03300 if (result < 0) { 03301 /* have to keep the previous error codes to properly return it */ 03302 int err1 = pi_error(sd); 03303 int err2 = pi_palmos_error(sd); 03304 03305 pi_buffer_free (buf); 03306 if (err1 != PI_ERR_SOCK_DISCONNECTED) 03307 dlp_CloseDB(sd, db); 03308 03309 pi_set_error(sd, err1); 03310 pi_set_palmos_error(sd, err2); 03311 return result; 03312 } 03313 03314 if (size) 03315 *size = buf->used - 2; 03316 03317 if (version) 03318 *version = get_short(buf->data); 03319 03320 if (result > 2) { 03321 result -= 2; 03322 memcpy(buffer, buf->data + 2, (size_t)result); 03323 } else { 03324 result = 0; 03325 } 03326 03327 pi_buffer_free (buf); 03328 dlp_CloseDB(sd, db); 03329 return result; 03330 } 03331 03332 req = dlp_request_new(dlpFuncReadAppPreference, 1, 10); 03333 if (req == NULL) 03334 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03335 03336 set_long(DLP_REQUEST_DATA(req, 0, 0), creator); 03337 set_short(DLP_REQUEST_DATA(req, 0, 4), prefID); 03338 set_short(DLP_REQUEST_DATA(req, 0, 6), buffer ? maxsize : 0); 03339 set_byte(DLP_REQUEST_DATA(req, 0, 8), backup ? 0x80 : 0); 03340 set_byte(DLP_REQUEST_DATA(req, 0, 9), 0); /* Reserved */ 03341 03342 result = dlp_exec(sd, req, &res); 03343 03344 dlp_request_free(req); 03345 03346 if (result > 0) { 03347 data_len = get_short(DLP_RESPONSE_DATA(res, 0, 4)); 03348 if (version) 03349 *version = get_short(DLP_RESPONSE_DATA(res, 0, 0)); 03350 if (size && !buffer) *size = 03351 get_short(DLP_RESPONSE_DATA(res, 0, 2)); /* Total sz */ 03352 if (size && buffer) 03353 *size = data_len; /* Size returned */ 03354 if (buffer) 03355 memcpy(buffer, DLP_RESPONSE_DATA(res, 0, 6), 03356 (size_t)data_len); 03357 03358 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 03359 "DLP ReadAppPref Version: %d, " 03360 "Total size: %d, Read %d bytes:\n", 03361 get_short(DLP_RESPONSE_DATA(res, 0, 0)), 03362 get_short(DLP_RESPONSE_DATA(res, 0, 2)), 03363 get_short(DLP_RESPONSE_DATA(res, 0, 4)))); 03364 CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG, 03365 pi_dumpdata(DLP_RESPONSE_DATA(res, 0, 6), 03366 (size_t)data_len)); 03367 } else { 03368 data_len = result; 03369 } 03370 03371 dlp_response_free(res); 03372 03373 return data_len; 03374 }
Here is the call graph for this function:

| int dlp_ReadDBList | ( | int | sd, | |
| int | cardno, | |||
| int | flags, | |||
| int | start, | |||
| pi_buffer_t * | dblist | |||
| ) |
Read the database list from the device.
The database list can be read either one database at a time (slower), or passing dlpDBListMultiple in the flags member. Pass dlpDBListRAM in flags to get the list of databases in RAM, and dlpDBListROM to get the list of databases in ROM. You can mix flags to obtain the desired result. Passing dlpDBListMultiple will return several DBInfo structures at once (usually 20). Use (info->used / sizeof(DBInfo)) to know how many database information blocks were returned. For the next call, pass the last DBInfo->index value + 1 to start to the next database.
When all the database informations have been retrieved, this function returns PI_ERR_DLP_PALMOS and pi_palmos_error() returns dlpErrNotFound.
| sd | Socket number | |
| cardno | Card number (should be 0) | |
| flags | Flags (see dlpDBList enum) | |
| start | Index of first database to list (zero based) | |
| dblist | Buffer filled with one or more DBInfo structure |
Definition at line 1040 of file dlp.c.
References DBInfo::backupDate, DBInfo::createDate, DBInfo::creator, dlp_exec(), dlp_ReadDBList(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpDBFlagAppInfoDirty, dlpDBFlagBackup, dlpDBFlagCopyPrevention, dlpDBFlagNewer, dlpDBFlagOpen, dlpDBFlagReadOnly, dlpDBFlagReset, dlpDBFlagResource, dlpDBFlagStream, dlpDBListMultiple, dlpFuncReadDBList, DBInfo::flags, get_byte, get_date, get_long, get_short, DBInfo::index, LOG, DBInfo::miscFlags, DBInfo::modifyDate, DBInfo::modnum, DBInfo::more, DBInfo::name, pi_buffer_append(), pi_buffer_clear(), PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), pi_version(), printlong(), set_byte, set_short, TraceX, DBInfo::type, and DBInfo::version.
Referenced by _wrap_dlp_ReadDBList_(), dlp_FindDBInfo(), dlp_ReadDBList(), do_fetch(), do_list(), fetch_wavs(), Java_org_gnu_pilotlink_PilotLink_readDBList(), ls_fn(), main(), palm_backup(), palm_list_internal(), and palm_purge().
01041 { 01042 int result, 01043 i, 01044 count; 01045 struct dlpRequest *req; 01046 struct dlpResponse *res; 01047 unsigned char *p; 01048 struct DBInfo db; 01049 01050 TraceX(dlp_ReadDBList,"cardno=%d flags=0x%04x start=%d",cardno,flags,start); 01051 pi_reset_errors(sd); 01052 01053 req = dlp_request_new (dlpFuncReadDBList, 1, 4); 01054 if (req == NULL) 01055 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01056 01057 pi_buffer_clear (info); 01058 01059 /* `multiple' only supported in DLP 1.2 and above */ 01060 if (pi_version(sd) < 0x0102) 01061 flags &= ~dlpDBListMultiple; 01062 01063 set_byte(DLP_REQUEST_DATA(req, 0, 0), (unsigned char) flags); 01064 set_byte(DLP_REQUEST_DATA(req, 0, 1), (unsigned char) cardno); 01065 set_short(DLP_REQUEST_DATA(req, 0, 2), start); 01066 01067 result = dlp_exec (sd, req, &res); 01068 01069 dlp_request_free(req); 01070 01071 if (result > 0) { 01072 p = (unsigned char *)DLP_RESPONSE_DATA(res, 0, 0); 01073 db.more = get_byte(p + 2); 01074 count = get_byte(p + 3); 01075 01076 for (i=0; i < count; i++) { 01077 /* PalmOS 2.0 has additional flag */ 01078 if (pi_version(sd) > 0x0100) 01079 db.miscFlags = get_byte(p + 5); 01080 else 01081 db.miscFlags = 0; 01082 01083 db.flags = get_short(p + 6); 01084 db.type = get_long(p + 8); 01085 db.creator = get_long(p + 12); 01086 db.version = get_short(p + 16); 01087 db.modnum = get_long(p + 18); 01088 db.createDate = get_date(p + 22); 01089 db.modifyDate = get_date(p + 30); 01090 db.backupDate = get_date(p + 38); 01091 db.index = get_short(p + 46); 01092 01093 memset(db.name, 0, sizeof(db.name)); 01094 strncpy(db.name, (char *)(p + 48), 32); 01095 01096 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01097 "DLP ReadDBList Name: '%s', Version: %d, More: %s\n", 01098 db.name, db.version, db.more ? "Yes" : "No")); 01099 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01100 " Creator: '%s'", printlong(db.creator))); 01101 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01102 " Type: '%s' Flags: %s%s%s%s%s%s%s%s%s%s", 01103 printlong(db.type), 01104 (db.flags & dlpDBFlagResource) ? "Resource " : "", 01105 (db.flags & dlpDBFlagReadOnly) ? "ReadOnly " : "", 01106 (db.flags & dlpDBFlagAppInfoDirty) ? 01107 "AppInfoDirty " : "", 01108 (db.flags & dlpDBFlagBackup) ? "Backup " : "", 01109 (db.flags & dlpDBFlagReset) ? "Reset " : "", 01110 (db.flags & dlpDBFlagNewer) ? "Newer " : "", 01111 (db.flags & dlpDBFlagCopyPrevention) ? 01112 "CopyPrevention " : "", 01113 (db.flags & dlpDBFlagStream) ? "Stream " : "", 01114 (db.flags & dlpDBFlagOpen) ? "Open " : "", 01115 (!db.flags) ? "None" : "")); 01116 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, " (0x%2.2X)\n", db.flags)); 01117 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01118 " Modnum: %ld, Index: %d, Creation date: 0x%08lx, %s", 01119 db.modnum, db.index, db.createDate, ctime(&db.createDate))); 01120 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01121 " Modification date: 0x%08lx, %s", db.modifyDate, ctime(&db.modifyDate))); 01122 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01123 " Backup date: 0x%08lx, %s", db.backupDate, ctime(&db.backupDate))); 01124 01125 if (pi_buffer_append(info, &db, sizeof(db)) == NULL) { 01126 result = pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01127 break; 01128 } 01129 01130 p += get_byte(p + 4); 01131 } 01132 } else { 01133 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01134 "Error in dlp_ReadDBList: %d\n", result)); 01135 } 01136 01137 dlp_response_free (res); 01138 01139 return result; 01140 }
Here is the call graph for this function:

| int dlp_ReadNetSyncInfo | ( | int | sd, | |
| struct NetSyncInfo * | OUTPUT | |||
| ) |
Read Network HotSync information.
Supported on Palm OS 2.0 and later.
| sd | Socket number | |
| OUTPUT | On return, filled NetSyncInfo structure |
Definition at line 2059 of file dlp.c.
References dlp_exec(), dlp_ReadNetSyncInfo(), dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncReadNetSyncInfo, get_byte, get_short, NetSyncInfo::hostAddress, NetSyncInfo::hostName, NetSyncInfo::hostSubnetMask, NetSyncInfo::lanSync, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_DLP_UNSUPPORTED, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), pi_version(), and Trace.
Referenced by _wrap_dlp_ReadNetSyncInfo(), dlp_ReadNetSyncInfo(), and main().
02060 { 02061 int result; 02062 struct dlpRequest *req; 02063 struct dlpResponse *res; 02064 02065 Trace(dlp_ReadNetSyncInfo); 02066 pi_reset_errors(sd); 02067 02068 if (pi_version(sd) < 0x0101) 02069 return pi_set_error(sd, PI_ERR_DLP_UNSUPPORTED); 02070 02071 req = dlp_request_new(dlpFuncReadNetSyncInfo, 0); 02072 if (req == NULL) 02073 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 02074 02075 result = dlp_exec (sd, req, &res); 02076 02077 dlp_request_free(req); 02078 02079 if (result >= 0) { 02080 size_t str_offset = 24; 02081 02082 i->lanSync = get_byte(DLP_RESPONSE_DATA(res, 0, 0)); 02083 02084 i->hostName[0] = '\0'; 02085 memcpy(i->hostName, DLP_RESPONSE_DATA(res, 0, str_offset), 02086 get_short(DLP_RESPONSE_DATA(res, 0, 18))); 02087 str_offset += get_short(DLP_RESPONSE_DATA(res, 0, 18)); 02088 02089 i->hostAddress[0] = '\0'; 02090 memcpy(i->hostAddress, DLP_RESPONSE_DATA(res, 0, str_offset), 02091 get_short(DLP_RESPONSE_DATA(res, 0, 20))); 02092 str_offset += get_short(DLP_RESPONSE_DATA(res, 0, 20)); 02093 02094 i->hostSubnetMask[0] = '\0'; 02095 memcpy(i->hostSubnetMask, DLP_RESPONSE_DATA(res, 0, str_offset), 02096 get_short(DLP_RESPONSE_DATA(res, 0, 22))); 02097 02098 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 02099 "DLP ReadNetSyncInfo Active: %d\n", i->lanSync ? 1 : 0)); 02100 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 02101 " PC hostname: '%s', address '%s', mask '%s'\n", 02102 i->hostName, i->hostAddress, i->hostSubnetMask)); 02103 } 02104 02105 dlp_response_free(res); 02106 02107 return result; 02108 }
Here is the call graph for this function:

| int dlp_ReadNextModifiedRec | ( | int | sd, | |
| int | dbhandle, | |||
| pi_buffer_t * | retbuf, | |||
| recordid_t * | recuid, | |||
| int * | recindex, | |||
| int * | recattrs, | |||
| int * | category | |||
| ) |
Iterate through modified records in database.
Return subsequent modified records on each call. Use dlp_ResetDBIndex() prior to starting iterations. Once all the records have been seen, this function returns PI_ERR_DLP_PALMOS and pi_palmos_error() returns dlpErrNotFound.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() | |
| retbuf | If not NULL, a buffer created using pi_buffer_new(). Buffer is cleared first using pi_buffer_clear(). On return, contains the record data | |
| recuid | If not NULL, contains the record unique ID on return | |
| recindex | If not NULL, contains the record index on return | |
| recattrs | If not NULL, contains the record attributes on return (see dlpRecAttributes enum) | |
| category | If not NULL, contains the record category on return |
Definition at line 3537 of file dlp.c.
References dlpResponse::argv, buffer, CHECK, dlp_exec(), dlp_ReadNextModifiedRec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncReadNextModifiedRec, get_byte, get_long, get_short, dlpArg::len, pi_buffer_append(), pi_buffer_clear(), PI_DBG_DLP, PI_DBG_LVL_DEBUG, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, and Trace.
Referenced by _wrap_dlp_ReadNextModifiedRec(), dlp_ReadNextModifiedRec(), dlp_ReadNextModifiedRecInCategory(), main(), and sync_MergeFromPilot_fast().
03539 { 03540 int result, 03541 data_len; 03542 struct dlpRequest *req; 03543 struct dlpResponse *res; 03544 03545 Trace(dlp_ReadNextModifiedRec); 03546 pi_reset_errors(sd); 03547 03548 req = dlp_request_new (dlpFuncReadNextModifiedRec, 1, 1); 03549 if (req == NULL) 03550 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03551 03552 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 03553 03554 result = dlp_exec (sd, req, &res); 03555 03556 dlp_request_free(req); 03557 03558 if (result >= 0) { 03559 data_len = res->argv[0]->len -10; 03560 if (recID) 03561 *recID = get_long(DLP_RESPONSE_DATA(res, 0, 0)); 03562 if (recindex) 03563 *recindex = get_short(DLP_RESPONSE_DATA(res, 0, 4)); 03564 if (attr) 03565 *attr = get_byte(DLP_RESPONSE_DATA(res, 0, 8)); 03566 if (category) 03567 *category = get_byte(DLP_RESPONSE_DATA(res, 0, 9)); 03568 03569 if (buffer) { 03570 pi_buffer_clear (buffer); 03571 pi_buffer_append (buffer, DLP_RESPONSE_DATA(res, 0, 10), 03572 (size_t)data_len); 03573 } 03574 03575 CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG, 03576 record_dump( 03577 get_long(DLP_RESPONSE_DATA(res, 0, 0)), /* recID */ 03578 get_short(DLP_RESPONSE_DATA(res, 0, 4)), /* index */ 03579 get_byte(DLP_RESPONSE_DATA(res, 0, 8)), /* flags */ 03580 get_byte(DLP_RESPONSE_DATA(res, 0, 9)), /* catID */ 03581 DLP_RESPONSE_DATA(res, 0, 10), data_len)); 03582 } else { 03583 data_len = result; 03584 } 03585 03586 dlp_response_free(res); 03587 03588 return data_len; 03589 }
Here is the call graph for this function:

| int dlp_ReadNextModifiedRecInCategory | ( | int | sd, | |
| int | dbhandle, | |||
| int | category, | |||
| pi_buffer_t * | retbuf, | |||
| recordid_t * | recuid, | |||
| int * | recindex, | |||
| int * | recattrs | |||
| ) |
Iterate through modified records in category.
Return subsequent modified records on each call. Use dlp_ResetDBIndex() prior to starting iterations. Once all the records have been seen, this function returns PI_ERR_DLP_PALMOS and pi_palmos_error() returns dlpErrNotFound.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() * | |
| category | The category to iterate into | |
| retbuf | If not NULL, a buffer created using pi_buffer_new(). Buffer is cleared first using pi_buffer_clear(). On return, contains the record data | |
| recuid | If not NULL, contains the record unique ID on return | |
| recindex | If not NULL, contains the record index on return | |
| recattrs | If not NULL, contains the record attributes on return (see dlpRecAttributes enum) |
Definition at line 3449 of file dlp.c.
References dlpResponse::argv, buffer, CHECK, dlp_exec(), dlp_ReadNextModifiedRec(), dlp_ReadNextModifiedRecInCategory(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncReadNextModifiedRecInCategory, get_byte, get_long, get_short, dlpArg::len, LOG, pi_buffer_append(), pi_buffer_clear(), PI_DBG_DLP, PI_DBG_LVL_DEBUG, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), pi_version(), set_byte, and TraceX.
Referenced by _wrap_dlp_ReadNextModifiedRecInCategory(), dlp_ReadNextModifiedRecInCategory(), and main().
03452 { 03453 int result, 03454 data_len; 03455 struct dlpRequest *req; 03456 struct dlpResponse *res; 03457 03458 TraceX(dlp_ReadNextModifiedRecInCategory,"category=%d",category); 03459 pi_reset_errors(sd); 03460 03461 if (pi_version(sd) < 0x0101) { 03462 /* Emulate for PalmOS 1.0 */ 03463 int cat; 03464 03465 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 03466 "DLP ReadNextModifiedRecInCategory" 03467 " Emulating with: Handle: %d, Category: %d\n", 03468 dbhandle, category)); 03469 03470 do { 03471 /* Fetch next modified record (in any category) */ 03472 result = dlp_ReadNextModifiedRec(sd, dbhandle, buffer, 03473 recID, recindex, attr, &cat); 03474 03475 /* If none found, reset modified pointer so that 03476 another search on a different (or the same!) category 03477 will start from the beginning */ 03478 03479 /* Working on same assumption as ReadNextRecInCat, 03480 elide this: 03481 if (r < 0) 03482 dlp_ResetDBIndex(sd, fHandle); 03483 */ 03484 03485 /* Loop until we fail to get a record or a record 03486 is found in the proper category */ 03487 } 03488 while (result >= 0 && cat != category); 03489 03490 return result; 03491 } 03492 03493 req = dlp_request_new(dlpFuncReadNextModifiedRecInCategory, 1, 2); 03494 if (req == NULL) 03495 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03496 03497 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 03498 set_byte(DLP_REQUEST_DATA(req, 0, 1), category); 03499 03500 result = dlp_exec(sd, req, &res); 03501 03502 dlp_request_free(req); 03503 03504 if (result > 0) { 03505 data_len = res->argv[0]->len - 10; 03506 03507 if (recID) 03508 *recID = get_long(DLP_RESPONSE_DATA(res, 0, 0)); 03509 if (recindex) 03510 *recindex = get_short(DLP_RESPONSE_DATA(res, 0, 4)); 03511 if (attr) 03512 *attr = get_byte(DLP_RESPONSE_DATA(res, 0, 8)); 03513 03514 if (buffer) { 03515 pi_buffer_clear (buffer); 03516 pi_buffer_append (buffer, DLP_RESPONSE_DATA(res, 0, 10), 03517 (size_t)data_len); 03518 } 03519 03520 CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG, 03521 record_dump( 03522 get_long(DLP_RESPONSE_DATA(res, 0, 0)), /* recID */ 03523 get_short(DLP_RESPONSE_DATA(res, 0, 4)), /* index */ 03524 get_byte(DLP_RESPONSE_DATA(res, 0, 8)), /* flags */ 03525 get_byte(DLP_RESPONSE_DATA(res, 0, 9)), /* catID */ 03526 DLP_RESPONSE_DATA(res, 0, 10), data_len)); 03527 } else { 03528 data_len = result; 03529 } 03530 03531 dlp_response_free(res); 03532 03533 return data_len; 03534 }
Here is the call graph for this function:

| int dlp_ReadNextRecInCategory | ( | int | sd, | |
| int | dbhandle, | |||
| int | category, | |||
| pi_buffer_t * | retbuf, | |||
| recordid_t * | recuid, | |||
| int * | recindex, | |||
| int * | recattrs | |||
| ) |
Iterate through records in category.
Return subsequent records on each call. Use dlp_ResetDBIndex() prior to starting iterations. Once all the records have been seen, this function returns PI_ERR_DLP_PALMOS and pi_palmos_error() returns dlpErrNotFound.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() * | |
| category | The category to iterate into | |
| retbuf | If not NULL, a buffer created using pi_buffer_new(). Buffer is cleared first using pi_buffer_clear(). On return, contains the record data | |
| recuid | If not NULL, contains the record unique ID on return | |
| recindex | If not NULL, contains the record index on return | |
| recattrs | If not NULL, contains the record attributes on return (see dlpRecAttributes enum) |
Definition at line 3147 of file dlp.c.
References dlpResponse::argv, buffer, CHECK, dlp_exec(), dlp_ReadNextRecInCategory(), dlp_ReadRecordByIndex(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncReadNextRecInCategory, dlpRecAttrArchived, dlpRecAttrBusy, dlpRecAttrDeleted, dlpRecAttrDirty, dlpRecAttrSecret, pi_socket::dlprecord, find_pi_socket(), flags, get_byte, get_long, get_short, dlpArg::len, LOG, pi_buffer_append(), pi_buffer_clear(), PI_DBG_DLP, PI_DBG_LVL_DEBUG, PI_DBG_LVL_INFO, pi_dumpdata(), PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), pi_version(), set_byte, and TraceX.
Referenced by _wrap_dlp_ReadNextRecInCategory(), dlp_ReadNextRecInCategory(), and main().
03150 { 03151 int result, 03152 data_len, 03153 flags; 03154 struct dlpRequest *req; 03155 struct dlpResponse *res; 03156 03157 TraceX(dlp_ReadNextRecInCategory,"category=%d",category); 03158 pi_reset_errors(sd); 03159 03160 if (pi_version(sd) < 0x0101) { 03161 /* Emulate for PalmOS 1.0 */ 03162 int cat, 03163 rec; 03164 pi_socket_t *ps; 03165 03166 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 03167 "DLP ReadNextRecInCategory Emulating with: Handle: %d, " 03168 "Category: %d\n", 03169 dbhandle, category)); 03170 03171 if ((ps = find_pi_socket(sd)) == 0) { 03172 errno = ESRCH; 03173 return -130; 03174 } 03175 03176 for (;;) { 03177 /* Fetch next modified record (in any category) */ 03178 rec = dlp_ReadRecordByIndex(sd, dbhandle, 03179 ps->dlprecord, 0, 0, 03180 0, &cat); 03181 03182 if (rec < 0) 03183 break; 03184 03185 if (cat != category) { 03186 ps->dlprecord++; 03187 continue; 03188 } 03189 03190 rec = dlp_ReadRecordByIndex(sd, dbhandle, 03191 ps->dlprecord, buffer, 03192 recuid, attr, &cat); 03193 03194 if (rec >= 0) { 03195 if (recindex) 03196 *recindex = ps->dlprecord; 03197 ps->dlprecord++; 03198 } else { 03199 /* If none found, reset modified pointer so 03200 that another search on a different (or 03201 the same!) category will work */ 03202 03203 /* Freeow! Do _not_ reset, as the Palm 03204 itself does not! 03205 03206 ps->dlprecord = 0; */ 03207 } 03208 03209 break; 03210 } 03211 03212 return rec; 03213 } 03214 03215 req = dlp_request_new(dlpFuncReadNextRecInCategory, 1, 2); 03216 if (req == NULL) 03217 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03218 03219 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 03220 set_byte(DLP_REQUEST_DATA(req, 0, 1), category); 03221 03222 result = dlp_exec(sd, req, &res); 03223 03224 dlp_request_free(req); 03225 03226 if (result > 0) { 03227 data_len = res->argv[0]->len - 10; 03228 if (recuid) 03229 *recuid = get_long(DLP_RESPONSE_DATA(res, 0, 0)); 03230 if (recindex) 03231 *recindex = get_short(DLP_RESPONSE_DATA(res, 0, 4)); 03232 if (attr) 03233 *attr = get_byte(DLP_RESPONSE_DATA(res, 0, 8)); 03234 if (buffer) { 03235 pi_buffer_clear (buffer); 03236 pi_buffer_append (buffer, DLP_RESPONSE_DATA(res, 0, 10), 03237 (size_t)data_len); 03238 } 03239 03240 flags = get_byte(DLP_RESPONSE_DATA(res, 0, 8)); 03241 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 03242 "DLP ReadNextRecInCategory ID: 0x%8.8lX, " 03243 "Index: %d, Category: %d\n" 03244 " Flags: %s%s%s%s%s%s (0x%2.2X) and %d bytes:\n", 03245 (unsigned long) get_long(DLP_RESPONSE_DATA(res, 03246 0, 0)), 03247 get_short(DLP_RESPONSE_DATA(res, 0, 4)), 03248 (int) get_byte(DLP_RESPONSE_DATA(res, 0, 9)), 03249 (flags & dlpRecAttrDeleted) ? " Deleted" : "", 03250 (flags & dlpRecAttrDirty) ? " Dirty" : "", 03251 (flags & dlpRecAttrBusy) ? " Busy" : "", 03252 (flags & dlpRecAttrSecret) ? " Secret" : "", 03253 (flags & dlpRecAttrArchived) ? " Archive" : "", 03254 (!flags) ? " None" : "", 03255 flags, data_len)); 03256 CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG, 03257 pi_dumpdata(DLP_RESPONSE_DATA(res, 0, 10), 03258 (size_t)data_len)); 03259 } else { 03260 data_len = result; 03261 } 03262 03263 dlp_response_free(res); 03264 03265 return data_len; 03266 }
Here is the call graph for this function:

| int dlp_ReadOpenDBInfo | ( | int | sd, | |
| int | dbhandle, | |||
| int * | numrecs | |||
| ) |
Return the number of records in an opened database.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() | |
| numrecs | On return, number of records in the database |
Definition at line 1775 of file dlp.c.
References dlp_exec(), dlp_ReadOpenDBInfo(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncReadOpenDBInfo, get_short, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, and Trace.
Referenced by _wrap_dlp_ReadOpenDBInfo(), dlp_ReadOpenDBInfo(), Java_org_gnu_pilotlink_PilotLink_getRecordCount(), main(), and pi_file_retrieve().
01776 { 01777 int result; 01778 struct dlpRequest *req; 01779 struct dlpResponse *res; 01780 01781 Trace(dlp_ReadOpenDBInfo); 01782 pi_reset_errors(sd); 01783 01784 req = dlp_request_new(dlpFuncReadOpenDBInfo, 1, 1); 01785 if (req == NULL) 01786 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01787 01788 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 01789 01790 result = dlp_exec(sd, req, &res); 01791 01792 dlp_request_free(req); 01793 01794 if (result > 0) { 01795 if (records) 01796 *records = get_short(DLP_RESPONSE_DATA(res, 0, 0)); 01797 01798 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01799 "DLP ReadOpenDBInfo %d records\n", 01800 get_short(DLP_RESPONSE_DATA(res, 0, 0)))); 01801 } 01802 01803 dlp_response_free(res); 01804 01805 return result; 01806 }
Here is the call graph for this function:

| int dlp_ReadRecordById | ( | int | sd, | |
| int | dbhandle, | |||
| recordid_t | recuid, | |||
| pi_buffer_t * | retbuf, | |||
| int * | recindex, | |||
| int * | recattrs, | |||
| int * | category | |||
| ) |
Read a record using its unique ID.
Read a record identified by its unique ID. Make sure you only request records that effectively exist in the database (use dlp_ReadRecordIDList() to retrieve the unique IDs of all records in the database).
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() | |
| recuid | Record unique ID | |
| retbuf | If not NULL, a buffer allocated using pi_buffer_new(). On return, contains the record contents | |
| recindex | If not NULL, contains the record index on return. | |
| recattrs | If not NULL, contains the record attributes on return. | |
| category | If not NULL, contains the record category on return. |
Definition at line 3592 of file dlp.c.
References dlpResponse::argv, buffer, CHECK, dlp_exec(), dlp_ReadRecordById(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncReadRecord, get_byte, get_long, get_short, dlpArg::len, pi_buffer_append(), pi_buffer_clear(), PI_DBG_DLP, PI_DBG_LVL_DEBUG, PI_ERR_GENERIC_MEMORY, pi_maxrecsize(), pi_reset_errors(), pi_set_error(), RECORD_READ_SAFEGUARD_SIZE, set_byte, set_long, set_short, and TraceX.
Referenced by _wrap_dlp_ReadRecordById(), dlp_ReadRecordById(), main(), sync_MergeToPilot_fast(), and sync_MergeToPilot_slow().
03594 { 03595 int result; 03596 struct dlpRequest *req; 03597 struct dlpResponse *res; 03598 int maxBufferSize = pi_maxrecsize(sd) - RECORD_READ_SAFEGUARD_SIZE; 03599 03600 TraceX(dlp_ReadRecordById,"recuid=0x%08lx",recuid); 03601 pi_reset_errors(sd); 03602 03603 req = dlp_request_new(dlpFuncReadRecord, 1, 10); 03604 if (req == NULL) 03605 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03606 03607 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 03608 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0); 03609 set_long(DLP_REQUEST_DATA(req, 0, 2), recuid); 03610 set_short(DLP_REQUEST_DATA(req, 0, 6), 0); /* Offset into record */ 03611 set_short(DLP_REQUEST_DATA(req, 0, 8), buffer ? maxBufferSize : 0); /* length to return */ 03612 03613 result = dlp_exec(sd, req, &res); 03614 03615 dlp_request_free(req); 03616 03617 if (result > 0) { 03618 result = res->argv[0]->len - 10; 03619 if (recindex) 03620 *recindex = get_short(DLP_RESPONSE_DATA(res, 0, 4)); 03621 if (attr) 03622 *attr = get_byte(DLP_RESPONSE_DATA(res, 0, 8)); 03623 if (category) 03624 *category = get_byte(DLP_RESPONSE_DATA(res, 0, 9)); 03625 if (buffer) { 03626 pi_buffer_clear (buffer); 03627 pi_buffer_append (buffer, DLP_RESPONSE_DATA(res, 0, 10), 03628 (size_t)result); 03629 03630 /* Some devices such as the Tungsten TX, Treo 650 and Treo 700p lock up if you try to read the entire record if the 03631 ** record is almost at the maximum record size. The following mitigates this and allows the record 03632 ** to be read in two chunks. 03633 */ 03634 if (result == maxBufferSize) { 03635 dlp_response_free(res); 03636 req = dlp_request_new(dlpFuncReadRecord, 1, 10); 03637 if (req != NULL) { 03638 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 03639 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0); 03640 set_long(DLP_REQUEST_DATA(req, 0, 2), recuid); 03641 set_short(DLP_REQUEST_DATA(req, 0, 6), maxBufferSize); /* Offset into record */ 03642 set_short(DLP_REQUEST_DATA(req, 0, 8), buffer ? RECORD_READ_SAFEGUARD_SIZE : 0); /* length to return */ 03643 03644 result = dlp_exec(sd, req, &res); 03645 dlp_request_free(req); 03646 03647 if (result > 0) { 03648 result = res->argv[0]->len - 10; 03649 pi_buffer_append (buffer, DLP_RESPONSE_DATA(res, 0, 10), 03650 (size_t)result); 03651 result += maxBufferSize; 03652 } 03653 } 03654 } 03655 } 03656 03657 CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG, 03658 record_dump( 03659 get_long(DLP_RESPONSE_DATA(res, 0, 0)), /* recID */ 03660 get_short(DLP_RESPONSE_DATA(res, 0, 4)), /* index */ 03661 get_byte(DLP_RESPONSE_DATA(res, 0, 8)), /* flags */ 03662 get_byte(DLP_RESPONSE_DATA(res, 0, 9)), /* catID */ 03663 DLP_RESPONSE_DATA(res, 0, 10), result)); 03664 } 03665 03666 dlp_response_free(res); 03667 03668 return result; 03669 }
Here is the call graph for this function:

| int dlp_ReadRecordByIndex | ( | int | sd, | |
| int | dbhandle, | |||
| int | recindex, | |||
| pi_buffer_t * | retbuf, | |||
| recordid_t * | recuid, | |||
| int * | recattrs, | |||
| int * | category | |||
| ) |
Read a record using its index.
Read a record by record index (zero-based). Make sure you only request records within the bounds of database records
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() | |
| recindex | Record index (zero based) | |
| retbuf | If not NULL, a buffer allocated using pi_buffer_new(). On return, contains the record contents | |
| recuid | If not NULL, contains the record UID on return. | |
| recattrs | If not NULL, contains the record attributes on return. | |
| category | If not NULL, contains the record category on return. |
Definition at line 3672 of file dlp.c.
References dlpResponse::argv, buffer, CHECK, dlp_exec(), dlp_ReadRecordByIndex(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new_with_argid(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncReadRecord, dlpFuncReadRecordEx, get_byte, get_long, get_short, dlpArg::len, pi_buffer_append(), pi_buffer_clear(), PI_DBG_DLP, PI_DBG_LVL_DEBUG, PI_ERR_GENERIC_MEMORY, pi_maxrecsize(), pi_reset_errors(), pi_set_error(), pi_version(), RECORD_READ_SAFEGUARD_SIZE, set_byte, set_long, set_short, and TraceX.
Referenced by _wrap_dlp_ReadRecordByIndex(), DeDupe(), dlp_DeleteCategory(), dlp_ReadNextRecInCategory(), dlp_ReadRecordByIndex(), do_delete(), do_fetch(), do_list(), fetch_wavs(), GetPicData(), getrecord_pi_socket(), GetRecordCmd(), Java_org_gnu_pilotlink_PilotLink_getRecordByIndex(), main(), print_records(), sync_CopyFromPilot(), sync_MergeFromPilot_slow(), write_file(), WritePicture(), and WritePictures().
03674 { 03675 int result, 03676 large = 0; 03677 struct dlpRequest *req; 03678 struct dlpResponse *res; 03679 int maxBufferSize = pi_maxrecsize(sd) - RECORD_READ_SAFEGUARD_SIZE; 03680 03681 TraceX(dlp_ReadRecordByIndex,"recindex=%d",recindex); 03682 pi_reset_errors(sd); 03683 03684 /* TapWave (DLP 1.4) implements a `large' version of dlpFuncReadRecord, 03685 * which can return records >64k 03686 */ 03687 if (pi_version(sd) >= 0x0104) { 03688 req = dlp_request_new_with_argid(dlpFuncReadRecordEx, 0x21, 1, 12); 03689 if (req == NULL) 03690 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03691 03692 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 03693 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0x00); 03694 set_short(DLP_REQUEST_DATA(req, 0, 2), recindex); 03695 set_long(DLP_REQUEST_DATA(req, 0, 4), 0); /* Offset into record */ 03696 set_long(DLP_REQUEST_DATA(req, 0, 8), pi_maxrecsize(sd)); /* length to return */ 03697 large = 1; 03698 } else { 03699 req = dlp_request_new_with_argid(dlpFuncReadRecord, 0x21, 1, 8); 03700 if (req == NULL) 03701 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03702 03703 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 03704 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0x00); 03705 set_short(DLP_REQUEST_DATA(req, 0, 2), recindex); 03706 set_short(DLP_REQUEST_DATA(req, 0, 4), 0); /* Offset into record */ 03707 set_short(DLP_REQUEST_DATA(req, 0, 6), buffer ? maxBufferSize : 0); /* length to return */ 03708 } 03709 result = dlp_exec(sd, req, &res); 03710 dlp_request_free(req); 03711 03712 if (result > 0) { 03713 result = res->argv[0]->len - (large ? 14 : 10); 03714 if (recuid) 03715 *recuid = get_long(DLP_RESPONSE_DATA(res, 0, 0)); 03716 if (attr) 03717 *attr = get_byte(DLP_RESPONSE_DATA(res, 0, large ? 12 : 8)); 03718 if (category) 03719 *category = get_byte(DLP_RESPONSE_DATA(res, 0, large ? 13 : 9)); 03720 if (buffer) { 03721 pi_buffer_clear (buffer); 03722 pi_buffer_append (buffer, DLP_RESPONSE_DATA(res, 0, large ? 14 : 10), 03723 (size_t)result); 03724 03725 /* Some devices such as the Tungsten TX, Treo 650 and Treo 700p lock up if you try to read the entire record if the 03726 ** record is almost at the maximum record size. The following mitigates this and allows the record 03727 ** to be read in two chunks. 03728 */ 03729 if (result == maxBufferSize && !large) { 03730 dlp_response_free(res); 03731 req = dlp_request_new_with_argid(dlpFuncReadRecord, 0x21, 1, 8); 03732 if (req != NULL) { 03733 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 03734 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0x00); 03735 set_short(DLP_REQUEST_DATA(req, 0, 2), recindex); 03736 set_short(DLP_REQUEST_DATA(req, 0, 4), maxBufferSize); /* Offset into record */ 03737 set_short(DLP_REQUEST_DATA(req, 0, 6), buffer ? RECORD_READ_SAFEGUARD_SIZE : 0); /* length to return */ 03738 03739 result = dlp_exec(sd, req, &res); 03740 dlp_request_free(req); 03741 03742 if (result > 0) { 03743 result = res->argv[0]->len - (large ? 14 : 10); 03744 pi_buffer_append (buffer, DLP_RESPONSE_DATA(res, 0, large ? 14 : 10), 03745 (size_t)result); 03746 03747 result += maxBufferSize; 03748 } 03749 } 03750 } 03751 } 03752 03753 CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG, 03754 record_dump( 03755 get_long(DLP_RESPONSE_DATA(res, 0, 0)), /* recUID */ 03756 get_short(DLP_RESPONSE_DATA(res, 0, 4)), /* index */ 03757 get_byte(DLP_RESPONSE_DATA(res, 0, large ? 12 : 8)), /* flags */ 03758 get_byte(DLP_RESPONSE_DATA(res, 0, large ? 13 : 9)), /* catID */ 03759 DLP_RESPONSE_DATA(res, 0, large ? 14 : 10), result)); 03760 } 03761 03762 dlp_response_free(res); 03763 03764 return result; 03765 }
Here is the call graph for this function:

| int dlp_ReadRecordIDList | ( | int | sd, | |
| int | dbhandle, | |||
| int | sort, | |||
| int | start, | |||
| int | max, | |||
| recordid_t * | recuids, | |||
| int * | count | |||
| ) |
Read the list of record IDs from an open database.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() | |
| sort | If non-zero, the on-device application with the same DB creator will be called to re-sort the records prior to returning the list | |
| start | Index of first record ID to return (zero based) | |
| max | Maximum number of record IDs to return | |
| recuids | On return, count record UIDs | |
| count | On return, the number of record IDs found in IDs |
Definition at line 2462 of file dlp.c.
References CHECK, dlp_exec(), dlp_ReadRecordIDList(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncReadRecordIDList, get_long, get_short, LOG, PI_DBG_DLP, PI_DBG_LVL_DEBUG, PI_DBG_LVL_INFO, pi_dumpdata(), PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, set_short, and TraceX.
Referenced by _wrap_dlp_ReadRecordIDList(), dlp_ReadRecordIDList(), and main().
02464 { 02465 int result; 02466 struct dlpRequest *req; 02467 struct dlpResponse *res; 02468 02469 TraceX(dlp_ReadRecordIDList,"sort=%d start=%d max=%d", 02470 sort,start,max); 02471 pi_reset_errors(sd); 02472 02473 req = dlp_request_new(dlpFuncReadRecordIDList, 1, 6); 02474 if (req == NULL) 02475 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 02476 02477 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 02478 set_byte(DLP_REQUEST_DATA(req, 0, 1), sort ? 0x80 : 0); 02479 set_short(DLP_REQUEST_DATA(req, 0, 2), start); 02480 set_short(DLP_REQUEST_DATA(req, 0, 4), max); 02481 02482 result = dlp_exec(sd, req, &res); 02483 02484 dlp_request_free(req); 02485 02486 if (result > 0) { 02487 int ret, i; 02488 02489 ret = get_short(DLP_RESPONSE_DATA(res, 0, 0)); 02490 for (i = 0; i < ret; i++) 02491 IDs[i] = 02492 get_long(DLP_RESPONSE_DATA(res, 0, 2 + (i * 4))); 02493 02494 if (count) 02495 *count = ret; 02496 02497 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 02498 "DLP ReadRecordIDList %d IDs:\n", ret)); 02499 CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG, 02500 pi_dumpdata(DLP_RESPONSE_DATA(res, 0, 2), 02501 (size_t)(ret * 4))); 02502 } 02503 02504 dlp_response_free(res); 02505 02506 return result; 02507 }
Here is the call graph for this function:

| int dlp_ReadResourceByIndex | ( | int | sd, | |
| int | dbhandle, | |||
| unsigned int | resindex, | |||
| pi_buffer_t * | retbuf, | |||
| unsigned long * | restype, | |||
| int * | resid | |||
| ) |
Read a resource identified by its resource index.
This function supports reading resources larger than 64k on DLP 1.4 and later (Palm OS 5.2 and later).
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() | |
| resindex | Resource index | |
| retbuf | If not NULL, a buffer allocated using pi_buffer_new(). On return, contains the resource contents | |
| restype | If not NULL, on return contains the resource type | |
| resid | If not NULL, on return contains the resource ID |
Definition at line 2745 of file dlp.c.
References dlpResponse::argv, buffer, CHECK, dlp_exec(), dlp_ReadResourceByIndex(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncReadResource, dlpFuncReadResourceEx, get_long, get_short, dlpArg::len, LOG, pi_buffer_append(), pi_buffer_clear(), PI_DBG_DLP, PI_DBG_LVL_DEBUG, PI_DBG_LVL_INFO, pi_dumpdata(), PI_ERR_GENERIC_MEMORY, pi_maxrecsize(), pi_reset_errors(), pi_set_error(), pi_version(), printlong(), RECORD_READ_SAFEGUARD_SIZE, set_byte, set_long, set_short, and TraceX.
Referenced by _wrap_dlp_ReadResourceByIndex(), dlp_ReadResourceByIndex(), Java_org_gnu_pilotlink_PilotLink_getResourceByIndex(), main(), and pi_file_retrieve().
02747 { 02748 int result, 02749 data_len, 02750 large = 0; 02751 struct dlpRequest *req; 02752 struct dlpResponse *res; 02753 int maxBufferSize = pi_maxrecsize(sd) - RECORD_READ_SAFEGUARD_SIZE; 02754 02755 TraceX(dlp_ReadResourceByIndex,"resindex=%d",resindex); 02756 pi_reset_errors(sd); 02757 02758 /* TapWave (DLP 1.4) implements a `large' version of dlpFuncReadResource, 02759 * which can return resources >64k 02760 */ 02761 if (pi_version(sd) >= 0x0104) { 02762 req = dlp_request_new (dlpFuncReadResourceEx, 1, 12); 02763 if (req == NULL) 02764 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 02765 02766 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 02767 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0); 02768 set_short(DLP_REQUEST_DATA(req, 0, 2), resindex); 02769 set_long(DLP_REQUEST_DATA(req, 0, 4), 0); 02770 set_long(DLP_REQUEST_DATA(req, 0, 8), pi_maxrecsize(sd)); 02771 large = 1; 02772 } else { 02773 req = dlp_request_new (dlpFuncReadResource, 1, 8); 02774 if (req == NULL) 02775 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 02776 02777 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 02778 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0); 02779 set_short(DLP_REQUEST_DATA(req, 0, 2), resindex); 02780 set_long(DLP_REQUEST_DATA(req, 0, 4), maxBufferSize); 02781 } 02782 02783 result = dlp_exec(sd, req, &res); 02784 02785 dlp_request_free(req); 02786 02787 if (result > 0) { 02788 data_len = res->argv[0]->len - (large ? 12 : 10); 02789 if (type) 02790 *type = get_long(DLP_RESPONSE_DATA(res, 0, 0)); 02791 if (resID) 02792 *resID = get_short(DLP_RESPONSE_DATA(res, 0, 4)); 02793 if (buffer) { 02794 pi_buffer_clear (buffer); 02795 pi_buffer_append (buffer, DLP_RESPONSE_DATA(res, 0, large ? 12 : 10), 02796 (size_t)data_len); 02797 02798 /* Some devices such as the Tungsten TX, Treo 650 and Treo 700p lock up if you try to read the entire record if the 02799 ** record is almost at the maximum record size. The following mitigates this and allows the record 02800 ** to be read in two chunks. 02801 */ 02802 if (data_len == maxBufferSize && !large) { 02803 dlp_response_free(res); 02804 req = dlp_request_new (dlpFuncReadResource, 1, 8); 02805 if (req != NULL) { 02806 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 02807 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0); 02808 set_short(DLP_REQUEST_DATA(req, 0, 2), resindex); 02809 set_short(DLP_REQUEST_DATA(req, 0, 4), maxBufferSize); /* Offset in record */ 02810 set_short(DLP_REQUEST_DATA(req, 0, 6), RECORD_READ_SAFEGUARD_SIZE); 02811 02812 result = dlp_exec(sd, req, &res); 02813 02814 dlp_request_free(req); 02815 02816 if (result > 0) { 02817 data_len = res->argv[0]->len - (large ? 12 : 10); /* number of bytes returned by the second read... */ 02818 pi_buffer_append (buffer, DLP_RESPONSE_DATA(res, 0, large ? 12 : 10), 02819 (size_t)data_len); 02820 data_len += maxBufferSize; /* ...that add up to the bytes received in the first read */ 02821 } 02822 } 02823 } 02824 } 02825 02826 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 02827 "DLP ReadResourceByIndex Type: '%s', ID: %d, " 02828 "Index: %d, and %d bytes:\n", 02829 printlong(get_long(DLP_RESPONSE_DATA(res, 0, 0))), 02830 get_short(DLP_RESPONSE_DATA(res, 0, 4)), 02831 resindex, data_len)); 02832 CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG, 02833 pi_dumpdata(DLP_RESPONSE_DATA(res, 0, (large ? 12 : 10)), 02834 (size_t)data_len)); 02835 } else { 02836 data_len = result; 02837 } 02838 02839 dlp_response_free(res); 02840 02841 return data_len; 02842 }
Here is the call graph for this function:

| int dlp_ReadResourceByType | ( | int | sd, | |
| int | dbhandle, | |||
| unsigned long | type, | |||
| int | resid, | |||
| pi_buffer_t * | retbuf, | |||
| int * | resindex | |||
| ) |
Read a resource identified by its type and ID.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() | |
| type | Type code for the resource (four-char code) | |
| resid | Resource ID | |
| retbuf | If not NULL, a buffer allocated using pi_buffer_new(). On return, contains the resource contents | |
| resindex | If not NULL, on return contains the resource index |
Definition at line 2664 of file dlp.c.
References dlpResponse::argv, buffer, CHECK, dlp_exec(), dlp_ReadResourceByType(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new_with_argid(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncReadResource, get_short, dlpArg::len, LOG, pi_buffer_append(), pi_buffer_clear(), PI_DBG_DLP, PI_DBG_LVL_DEBUG, PI_DBG_LVL_INFO, pi_dumpdata(), PI_ERR_GENERIC_MEMORY, pi_maxrecsize(), pi_reset_errors(), pi_set_error(), printlong(), RECORD_READ_SAFEGUARD_SIZE, set_byte, set_long, set_short, and TraceX.
Referenced by _wrap_dlp_ReadResourceByType(), dlp_ReadAppPreference(), dlp_ReadResourceByType(), Fetch(), and main().
02666 { 02667 int result, 02668 data_len; 02669 struct dlpRequest *req; 02670 struct dlpResponse *res; 02671 int maxBufferSize = pi_maxrecsize(sd) - RECORD_READ_SAFEGUARD_SIZE; 02672 02673 TraceX(dlp_ReadResourceByType,"type='%4.4s' resID=%d",(const char *)&type,resID); 02674 pi_reset_errors(sd); 02675 02676 req = dlp_request_new_with_argid(dlpFuncReadResource, 0x21, 1, 12); 02677 if (req == NULL) 02678 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 02679 02680 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 02681 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0); 02682 set_long(DLP_REQUEST_DATA(req, 0, 2), type); 02683 set_short(DLP_REQUEST_DATA(req, 0, 6), resID); 02684 set_short(DLP_REQUEST_DATA(req, 0, 8), 0); 02685 set_short(DLP_REQUEST_DATA(req, 0, 10), buffer ? maxBufferSize : 0); 02686 02687 result = dlp_exec(sd, req, &res); 02688 02689 dlp_request_free(req); 02690 02691 if (result > 0) { 02692 data_len = res->argv[0]->len - 10; 02693 if (resindex) 02694 *resindex = get_short(DLP_RESPONSE_DATA(res, 0, 6)); 02695 if (buffer) { 02696 pi_buffer_clear (buffer); 02697 pi_buffer_append (buffer, DLP_RESPONSE_DATA(res, 0, 10), 02698 (size_t)data_len); 02699 02700 /* Some devices such as the Tungsten TX, Treo 650 and Treo 700p lock up if you try to read the entire record if the 02701 ** record is almost at the maximum record size. The following mitigates this and allows the record 02702 ** to be read in two chunks. 02703 */ 02704 if (data_len == maxBufferSize) { 02705 dlp_response_free(res); 02706 req = dlp_request_new_with_argid(dlpFuncReadResource, 0x21, 1, 12); 02707 if (req != NULL) { 02708 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 02709 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0); 02710 set_long(DLP_REQUEST_DATA(req, 0, 2), type); 02711 set_short(DLP_REQUEST_DATA(req, 0, 6), resID); 02712 set_short(DLP_REQUEST_DATA(req, 0, 8), maxBufferSize); /* Offset in record */ 02713 set_short(DLP_REQUEST_DATA(req, 0, 10), RECORD_READ_SAFEGUARD_SIZE); 02714 02715 result = dlp_exec(sd, req, &res); 02716 02717 dlp_request_free(req); 02718 02719 if (result > 0) { 02720 data_len = res->argv[0]->len - 10; /* number of bytes returned by the second read... */ 02721 pi_buffer_append (buffer, DLP_RESPONSE_DATA(res, 0, 10), (size_t)data_len); 02722 data_len += maxBufferSize; /* ...that add up to the bytes received in the first read */ 02723 } 02724 } 02725 } 02726 } 02727 02728 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 02729 "DLP ReadResourceByType Type: '%s', ID: %d, " 02730 "Index: %d, and %d bytes:\n", 02731 printlong(type), resID, 02732 get_short(DLP_RESPONSE_DATA(res, 0, 6)),(size_t)data_len)); 02733 CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG, 02734 pi_dumpdata(DLP_RESPONSE_DATA(res, 0, 10),(size_t)data_len)); 02735 } else { 02736 data_len = result; 02737 } 02738 02739 dlp_response_free(res); 02740 02741 return data_len; 02742 }
Here is the call graph for this function:

| int dlp_ReadSortBlock | ( | int | sd, | |
| int | dbhandle, | |||
| int | offset, | |||
| int | reqbytes, | |||
| pi_buffer_t * | retbuf | |||
| ) |
Read a database's SortInfo block.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() | |
| offset | Offset to start reading from (0 based) | |
| reqbytes | Number of bytes to read (pass -1 to read all data from offset to the end of the SortInfo block) | |
| retbuf | Buffer allocated using pi_buffer_new(). On return contains the data from the SortInfo block |
Definition at line 3013 of file dlp.c.
References dlpResponse::argv, CHECK, dlp_exec(), dlp_ReadSortBlock(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncReadSortBlock, dlpArg::len, LOG, pi_buffer_append(), pi_buffer_clear(), PI_DBG_DLP, PI_DBG_LVL_DEBUG, PI_DBG_LVL_INFO, pi_dumpdata(), PI_ERR_DLP_COMMAND, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, set_short, and TraceX.
Referenced by _wrap_dlp_ReadSortBlock(), dlp_ReadSortBlock(), and main().
03014 { 03015 int result, 03016 data_len; 03017 struct dlpRequest *req; 03018 struct dlpResponse *res; 03019 03020 TraceX(dlp_ReadSortBlock,"offset=%d reqbytes=%d",offset,reqbytes); 03021 pi_reset_errors(sd); 03022 03023 if (retbuf) 03024 pi_buffer_clear(retbuf); 03025 03026 req = dlp_request_new(dlpFuncReadSortBlock, 1, 6); 03027 if (req == NULL) 03028 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03029 03030 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 03031 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0); 03032 set_short(DLP_REQUEST_DATA(req, 0, 2), offset); 03033 set_short(DLP_REQUEST_DATA(req, 0, 4), reqbytes); 03034 03035 result = dlp_exec(sd, req, &res); 03036 03037 dlp_request_free(req); 03038 03039 if (result >= 0) { 03040 if (result < 2) 03041 data_len = PI_ERR_DLP_COMMAND; 03042 else { 03043 data_len = res->argv[0]->len - 2; 03044 if (retbuf) 03045 pi_buffer_append(retbuf, DLP_RESPONSE_DATA(res, 0, 2), 03046 (size_t)data_len); 03047 03048 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 03049 "DLP ReadSortBlock %d bytes\n", data_len)); 03050 CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG, 03051 pi_dumpdata(DLP_RESPONSE_DATA(res, 0, 2), 03052 (size_t)data_len)); 03053 } 03054 } else { 03055 data_len = result; 03056 } 03057 03058 dlp_response_free(res); 03059 03060 return data_len; 03061 }
Here is the call graph for this function:

| int dlp_ReadStorageInfo | ( | int | sd, | |
| int | cardno, | |||
| struct CardInfo * | cardinfo | |||
| ) |
Read information about internal handheld memory.
| sd | Socket number | |
| cardno | Card number (zero based) | |
| cardinfo | Returned information about the memory card. |
Definition at line 905 of file dlp.c.
References CardInfo::card, CardInfo::creation, dlp_exec(), dlp_ReadStorageInfo(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncReadStorageInfo, get_byte, get_date, get_long, LOG, CardInfo::manufacturer, CardInfo::more, CardInfo::name, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), CardInfo::ramFree, CardInfo::ramSize, CardInfo::romSize, set_byte, TraceX, and CardInfo::version.
Referenced by _wrap_dlp_ReadStorageInfo(), df_fn(), dlp_ReadStorageInfo(), main(), and palm_install_internal().
00906 { 00907 int result; 00908 size_t len1, len2; 00909 struct dlpRequest *req; 00910 struct dlpResponse *res; 00911 00912 TraceX(dlp_ReadStorageInfo,"cardno=%d",cardno); 00913 pi_reset_errors(sd); 00914 00915 req = dlp_request_new(dlpFuncReadStorageInfo, 1, 2); 00916 if (req == NULL) 00917 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 00918 00919 set_byte(DLP_REQUEST_DATA(req, 0, 0), cardno); 00920 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0); 00921 00922 result = dlp_exec(sd, req, &res); 00923 00924 dlp_request_free(req); 00925 00926 if (result > 0) { 00927 c->more = get_byte(DLP_RESPONSE_DATA(res, 0, 0)) 00928 || (get_byte(DLP_RESPONSE_DATA(res, 0, 3)) > 1); 00929 c->card = get_byte(DLP_RESPONSE_DATA(res, 0, 5)); 00930 c->version = get_byte(DLP_RESPONSE_DATA(res, 0, 6)); 00931 c->creation = get_date((const unsigned char *)DLP_RESPONSE_DATA(res, 0, 8)); 00932 c->romSize = get_long(DLP_RESPONSE_DATA(res, 0, 16)); 00933 c->ramSize = get_long(DLP_RESPONSE_DATA(res, 0, 20)); 00934 c->ramFree = get_long(DLP_RESPONSE_DATA(res, 0, 24)); 00935 00936 len1 = get_byte(DLP_RESPONSE_DATA(res, 0, 28)); 00937 memcpy(c->name, DLP_RESPONSE_DATA(res, 0, 30), len1); 00938 c->name[len1] = '\0'; 00939 00940 len2 = get_byte(DLP_RESPONSE_DATA(res, 0, 29)); 00941 memcpy(c->manufacturer, DLP_RESPONSE_DATA(res, 0, 30 + len1), 00942 len2); 00943 c->manufacturer[len2] = '\0'; 00944 00945 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 00946 "DLP Read Cardno: %d, Card Version: %d, Creation time: %s", 00947 c->card, c->version, ctime(&c->creation))); 00948 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 00949 " Total ROM: %lu, Total RAM: %lu, Free RAM: %lu\n", 00950 c->romSize, c->ramSize, c->ramFree)); 00951 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 00952 " Card name: '%s'\n", c->name)); 00953 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 00954 " Manufacturer name: '%s'\n", c->manufacturer)); 00955 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 00956 " More: %s\n", c->more ? "Yes" : "No")); 00957 } 00958 00959 dlp_response_free (res); 00960 00961 return result; 00962 }
Here is the call graph for this function:

| int dlp_ReadSysInfo | ( | int | sd, | |
| struct SysInfo * | sysinfo | |||
| ) |
Read the system information block.
| sd | Socket number | |
| sysinfo | Returned system information |
Definition at line 965 of file dlp.c.
References SysInfo::compatMajorVersion, SysInfo::compatMinorVersion, dlp_exec(), dlp_ReadSysInfo(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlp_version_major, dlp_version_minor, dlpFuncReadSysInfo, SysInfo::dlpMajorVersion, SysInfo::dlpMinorVersion, pi_socket::dlpversion, find_pi_socket(), get_byte, get_long, get_short, SysInfo::locale, LOG, pi_socket::maxrecsize, SysInfo::maxRecSize, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), SysInfo::prodID, SysInfo::prodIDLength, SysInfo::romVersion, set_short, and Trace.
Referenced by _wrap_dlp_ReadSysInfo(), dlp_ReadSysInfo(), do_sysinfo(), Java_org_gnu_pilotlink_PilotLink_readSysInfo(), main(), pilot_connect(), and plu_connect().
00966 { 00967 int result; 00968 struct dlpRequest *req; 00969 struct dlpResponse *res; 00970 00971 Trace(dlp_ReadSysInfo); 00972 pi_reset_errors(sd); 00973 00974 req = dlp_request_new (dlpFuncReadSysInfo, 1, 4); 00975 if (req == NULL) 00976 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 00977 00978 set_short (DLP_REQUEST_DATA (req, 0, 0), dlp_version_major); 00979 set_short (DLP_REQUEST_DATA (req, 0, 2), dlp_version_minor); 00980 00981 result = dlp_exec(sd, req, &res); 00982 00983 dlp_request_free (req); 00984 00985 if (result > 0) { 00986 s->romVersion = get_long (DLP_RESPONSE_DATA (res, 0, 0)); 00987 s->locale = get_long (DLP_RESPONSE_DATA (res, 0, 4)); 00988 /* The 8th byte is a filler byte */ 00989 s->prodIDLength = get_byte (DLP_RESPONSE_DATA (res, 0, 9)); 00990 memcpy(s->prodID, DLP_RESPONSE_DATA(res, 0, 10), 00991 s->prodIDLength); 00992 00993 if (res->argc > 1) { 00994 /* response added in DLP 1.2 */ 00995 pi_socket_t *ps = find_pi_socket(sd); 00996 00997 s->dlpMajorVersion = 00998 get_short (DLP_RESPONSE_DATA (res, 1, 0)); 00999 s->dlpMinorVersion = 01000 get_short (DLP_RESPONSE_DATA (res, 1, 2)); 01001 s->compatMajorVersion = 01002 get_short (DLP_RESPONSE_DATA (res, 1, 4)); 01003 s->compatMinorVersion = 01004 get_short (DLP_RESPONSE_DATA (res, 1, 6)); 01005 s->maxRecSize = 01006 get_long (DLP_RESPONSE_DATA (res, 1, 8)); 01007 01008 /* update socket information */ 01009 ps->dlpversion = (s->dlpMajorVersion << 8) | s->dlpMinorVersion; 01010 ps->maxrecsize = s->maxRecSize; 01011 } else { 01012 s->dlpMajorVersion = 0; 01013 s->dlpMinorVersion = 0; 01014 s->compatMajorVersion = 0; 01015 s->compatMinorVersion = 0; 01016 s->maxRecSize = 0; 01017 } 01018 01019 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01020 "DLP ReadSysInfo ROM Ver=0x%8.8lX Locale=0x%8.8lX\n", 01021 s->romVersion, s->locale)); 01022 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01023 " Product ID=0x%8.8lX\n", s->prodID)); 01024 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01025 " DLP Major Ver=0x%4.4lX DLP Minor Ver=0x%4.4lX\n", 01026 s->dlpMajorVersion, s->dlpMinorVersion)); 01027 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01028 " Compat Major Ver=0x%4.4lX Compat Minor Vers=0x%4.4lX\n", 01029 s->compatMajorVersion, s->compatMinorVersion)); 01030 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 01031 " Max Rec Size=%ld\n", s->maxRecSize)); 01032 } 01033 01034 dlp_response_free (res); 01035 01036 return result; 01037 }
Here is the call graph for this function:

| int dlp_ReadUserInfo | ( | int | sd, | |
| struct PilotUser * | user | |||
| ) |
Read the device user information.
| sd | Socket number | |
| user | Returned user info |
Definition at line 1996 of file dlp.c.
References dlp_exec(), dlp_ReadUserInfo(), dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlpFuncReadUserInfo, get_byte, get_date, get_long, PilotUser::lastSyncDate, PilotUser::lastSyncPC, LOG, PilotUser::password, PilotUser::passwordLength, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), PilotUser::successfulSyncDate, Trace, PilotUser::userID, PilotUser::username, and PilotUser::viewerID.
Referenced by _wrap_dlp_ReadUserInfo(), dlp_ReadUserInfo(), dlp_ResetLastSyncPC(), Java_org_gnu_pilotlink_PilotLink_readUserInfo(), main(), and user_fn().
01997 { 01998 int result; 01999 size_t userlen; 02000 struct dlpRequest *req; 02001 struct dlpResponse *res; 02002 02003 Trace(dlp_ReadUserInfo); 02004 pi_reset_errors(sd); 02005 02006 req = dlp_request_new (dlpFuncReadUserInfo, 0); 02007 if (req == NULL) 02008 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 02009 02010 result = dlp_exec (sd, req, &res); 02011 02012 dlp_request_free (req); 02013 02014 if (result > 0) { 02015 User->userID = 02016 get_long(DLP_RESPONSE_DATA (res, 0, 0)); 02017 User->viewerID = 02018 get_long(DLP_RESPONSE_DATA (res, 0, 4)); 02019 User->lastSyncPC = 02020 get_long(DLP_RESPONSE_DATA (res, 0, 8)); 02021 User->successfulSyncDate = 02022 get_date((const unsigned char *)DLP_RESPONSE_DATA (res, 0, 12)); 02023 User->lastSyncDate = 02024 get_date((const unsigned char *)DLP_RESPONSE_DATA (res, 0, 20)); 02025 userlen = 02026 get_byte(DLP_RESPONSE_DATA (res, 0, 28)); 02027 User->passwordLength = 02028 get_byte(DLP_RESPONSE_DATA (res, 0, 29)); 02029 02030 memcpy(User->username, 02031 DLP_RESPONSE_DATA (res, 0, 30), userlen); 02032 memcpy(User->password, 02033 DLP_RESPONSE_DATA (res, 0, 30 + userlen), 02034 User->passwordLength); 02035 02036 if (userlen < sizeof(User->username)) 02037 User->username[userlen] = '\0'; 02038 if (User->passwordLength < sizeof(User->password)) 02039 User->password[User->passwordLength] = '\0'; 02040 02041 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 02042 "DLP ReadUserInfo UID=0x%8.8lX VID=0x%8.8lX " 02043 "PCID=0x%8.8lX\n", 02044 User->userID, User->viewerID, User->lastSyncPC)); 02045 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 02046 " Last Sync=%s Last Successful Sync=%s", 02047 ctime (&User->lastSyncDate), 02048 ctime (&User->successfulSyncDate))); 02049 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 02050 " Username=%s\n", User->username)); 02051 } 02052 02053 dlp_response_free (res); 02054 02055 return result; 02056 }
Here is the call graph for this function:

| void dlp_request_free | ( | struct dlpRequest * | req | ) |
Definition at line 644 of file dlp.c.
References dlpRequest::argc, dlpRequest::argv, and dlp_arg_free().
Referenced by dlp_AddSyncLogEntry(), dlp_CallApplication(), dlp_CleanUpDatabase(), dlp_CloseDB(), dlp_CloseDB_All(), dlp_CreateDB(), dlp_DeleteCategory(), dlp_DeleteDB(), dlp_DeleteRecord(), dlp_DeleteResource(), dlp_EndOfSync(), dlp_ExpCardInfo(), dlp_ExpCardPresent(), dlp_ExpSlotEnumerate(), dlp_ExpSlotMediaType(), dlp_FindDBByName(), dlp_FindDBByOpenHandle(), dlp_FindDBByTypeCreator(), dlp_GetSysDateTime(), dlp_MoveCategory(), dlp_OpenConduit(), dlp_OpenDB(), dlp_ReadAppBlock(), dlp_ReadAppPreference(), dlp_ReadDBList(), dlp_ReadNetSyncInfo(), dlp_ReadNextModifiedRec(), dlp_ReadNextModifiedRecInCategory(), dlp_ReadNextRecInCategory(), dlp_ReadOpenDBInfo(), dlp_ReadRecordById(), dlp_ReadRecordByIndex(), dlp_ReadRecordIDList(), dlp_ReadResourceByIndex(), dlp_ReadResourceByType(), dlp_ReadSortBlock(), dlp_ReadStorageInfo(), dlp_ReadSysInfo(), dlp_ReadUserInfo(), dlp_ResetDBIndex(), dlp_ResetSyncFlags(), dlp_ResetSystem(), dlp_SetDBInfo(), dlp_SetSysDateTime(), dlp_VFSDirCreate(), dlp_VFSDirEntryEnumerate(), dlp_VFSExportDatabaseToFile(), dlp_VFSFileClose(), dlp_VFSFileCreate(), dlp_VFSFileDelete(), dlp_VFSFileEOF(), dlp_VFSFileGetAttributes(), dlp_VFSFileGetDate(), dlp_VFSFileOpen(), dlp_VFSFileRead(), dlp_VFSFileRename(), dlp_VFSFileResize(), dlp_VFSFileSeek(), dlp_VFSFileSetAttributes(), dlp_VFSFileSetDate(), dlp_VFSFileSize(), dlp_VFSFileTell(), dlp_VFSFileWrite(), dlp_VFSGetDefaultDir(), dlp_VFSImportDatabaseFromFile(), dlp_VFSVolumeEnumerate(), dlp_VFSVolumeFormat(), dlp_VFSVolumeGetLabel(), dlp_VFSVolumeInfo(), dlp_VFSVolumeSetLabel(), dlp_VFSVolumeSize(), dlp_WriteAppBlock(), dlp_WriteAppPreference(), dlp_WriteNetSyncInfo(), dlp_WriteRecord(), dlp_WriteResource(), dlp_WriteSortBlock(), and dlp_WriteUserInfo().
00645 { 00646 int i; 00647 00648 if (req == NULL) 00649 return; 00650 00651 if (req->argv != NULL) { 00652 for (i = 0; i < req->argc; i++) { 00653 if (req->argv[i] != NULL) 00654 dlp_arg_free (req->argv[i]); 00655 } 00656 free (req->argv); 00657 } 00658 00659 free (req); 00660 }
Here is the call graph for this function:

| struct dlpRequest* dlp_request_new | ( | enum dlpFunctions | cmd, | |
| int | argc, | |||
| ... | ||||
| ) |
Definition at line 318 of file dlp.c.
References dlpRequest::argc, dlpRequest::argv, dlpRequest::cmd, dlp_arg_free(), dlp_arg_new(), dlpArg::len, and PI_DLP_ARG_FIRST_ID.
Referenced by dlp_AddSyncLogEntry(), dlp_CallApplication(), dlp_CleanUpDatabase(), dlp_CloseDB(), dlp_CreateDB(), dlp_DeleteCategory(), dlp_DeleteDB(), dlp_DeleteRecord(), dlp_DeleteResource(), dlp_EndOfSync(), dlp_ExpCardInfo(), dlp_ExpCardPresent(), dlp_ExpSlotEnumerate(), dlp_ExpSlotMediaType(), dlp_FindDBByName(), dlp_GetSysDateTime(), dlp_MoveCategory(), dlp_OpenConduit(), dlp_OpenDB(), dlp_ReadAppBlock(), dlp_ReadAppPreference(), dlp_ReadDBList(), dlp_ReadNetSyncInfo(), dlp_ReadNextModifiedRec(), dlp_ReadNextModifiedRecInCategory(), dlp_ReadNextRecInCategory(), dlp_ReadOpenDBInfo(), dlp_ReadRecordById(), dlp_ReadRecordIDList(), dlp_ReadResourceByIndex(), dlp_ReadSortBlock(), dlp_ReadStorageInfo(), dlp_ReadSysInfo(), dlp_ReadUserInfo(), dlp_ResetDBIndex(), dlp_ResetSyncFlags(), dlp_ResetSystem(), dlp_SetDBInfo(), dlp_SetSysDateTime(), dlp_VFSDirCreate(), dlp_VFSDirEntryEnumerate(), dlp_VFSExportDatabaseToFile(), dlp_VFSFileClose(), dlp_VFSFileCreate(), dlp_VFSFileDelete(), dlp_VFSFileEOF(), dlp_VFSFileGetAttributes(), dlp_VFSFileGetDate(), dlp_VFSFileOpen(), dlp_VFSFileRead(), dlp_VFSFileRename(), dlp_VFSFileResize(), dlp_VFSFileSeek(), dlp_VFSFileSetAttributes(), dlp_VFSFileSetDate(), dlp_VFSFileSize(), dlp_VFSFileTell(), dlp_VFSFileWrite(), dlp_VFSGetDefaultDir(), dlp_VFSImportDatabaseFromFile(), dlp_VFSVolumeEnumerate(), dlp_VFSVolumeFormat(), dlp_VFSVolumeGetLabel(), dlp_VFSVolumeInfo(), dlp_VFSVolumeSetLabel(), dlp_VFSVolumeSize(), dlp_WriteAppBlock(), dlp_WriteAppPreference(), dlp_WriteNetSyncInfo(), dlp_WriteRecord(), dlp_WriteResource(), dlp_WriteSortBlock(), and dlp_WriteUserInfo().
00319 { 00320 struct dlpRequest *req; 00321 va_list ap; 00322 int i, 00323 j; 00324 00325 req = (struct dlpRequest *)malloc (sizeof (struct dlpRequest)); 00326 00327 if (req != NULL) { 00328 req->cmd = cmd; 00329 req->argc = argc; 00330 req->argv = NULL; 00331 00332 if (argc) { 00333 req->argv = (struct dlpArg **) malloc (sizeof (struct dlpArg *) * argc); 00334 if (req->argv == NULL) { 00335 free(req); 00336 return NULL; 00337 } 00338 } 00339 00340 va_start (ap, argc); 00341 for (i = 0; i < argc; i++) { 00342 size_t len; 00343 00344 len = va_arg (ap, size_t); 00345 req->argv[i] = dlp_arg_new (PI_DLP_ARG_FIRST_ID + i, 00346 len); 00347 if (req->argv[i] == NULL) { 00348 for (j = 0; j < i; j++) 00349 dlp_arg_free(req->argv[j]); 00350 free(req->argv); 00351 free(req); 00352 req = NULL; 00353 break; 00354 } 00355 } 00356 va_end (ap); 00357 } 00358 00359 return req; 00360 }
Here is the call graph for this function:

| struct dlpRequest* dlp_request_new_with_argid | ( | enum dlpFunctions | cmd, | |
| int | argid, | |||
| int | argc, | |||
| ... | ||||
| ) |
Definition at line 376 of file dlp.c.
References dlpRequest::argc, dlpRequest::argv, dlpRequest::cmd, dlp_arg_free(), dlp_arg_new(), and dlpArg::len.
Referenced by dlp_CallApplication(), dlp_CloseDB_All(), dlp_FindDBByOpenHandle(), dlp_FindDBByTypeCreator(), dlp_ReadRecordByIndex(), dlp_ReadResourceByType(), and dlp_WriteResource().
00377 { 00378 struct dlpRequest *req; 00379 va_list ap; 00380 int i, 00381 j; 00382 00383 req = (struct dlpRequest *) malloc (sizeof (struct dlpRequest)); 00384 00385 if (req != NULL) { 00386 req->cmd = cmd; 00387 req->argc = argc; 00388 req->argv = NULL; 00389 00390 if (argc) { 00391 req->argv = (struct dlpArg **) malloc (sizeof (struct dlpArg *) * argc); 00392 if (req->argv == NULL) { 00393 free(req); 00394 return NULL; 00395 } 00396 } 00397 00398 va_start (ap, argc); 00399 for (i = 0; i < argc; i++) { 00400 size_t len; 00401 00402 len = va_arg (ap, size_t); 00403 req->argv[i] = dlp_arg_new (argid + i, len); 00404 if (req->argv[i] == NULL) { 00405 for (j = 0; j < i; j++) 00406 dlp_arg_free(req->argv[j]); 00407 free(req->argv); 00408 free(req); 00409 req = NULL; 00410 break; 00411 } 00412 } 00413 va_end (ap); 00414 } 00415 00416 return req; 00417 }
Here is the call graph for this function:

| ssize_t dlp_request_write | ( | struct dlpRequest * | req, | |
| int | sd | |||
| ) |
Definition at line 574 of file dlp.c.
References dlpRequest::argc, dlpRequest::argv, buf, dlpRequest::cmd, dlp_arg_len(), dlpArg::id_, PI_DLP_ARG_FLAG_LONG, PI_DLP_ARG_FLAG_SHORT, PI_DLP_ARG_FLAG_TINY, PI_DLP_ARG_SHORT_LEN, PI_DLP_ARG_TINY_LEN, PI_DLP_OFFSET_ARGC, PI_DLP_OFFSET_ARGV, PI_DLP_OFFSET_CMD, PI_ERR_GENERIC_MEMORY, pi_set_error(), set_byte, set_long, and set_short.
Referenced by dlp_exec().
00575 { 00576 unsigned char *exec_buf, *buf; 00577 int i; 00578 size_t len; 00579 00580 len = dlp_arg_len (req->argc, req->argv) + 2; 00581 exec_buf = (unsigned char *) malloc (sizeof (unsigned char) * len); 00582 if (exec_buf == NULL) 00583 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 00584 00585 set_byte (&exec_buf[PI_DLP_OFFSET_CMD], req->cmd); 00586 set_byte (&exec_buf[PI_DLP_OFFSET_ARGC], req->argc); 00587 00588 buf = &exec_buf[PI_DLP_OFFSET_ARGV]; 00589 for (i = 0; i < req->argc; i++) { 00590 struct dlpArg *arg = req->argv[i]; 00591 short argid = arg->id_; 00592 00593 if (arg->len < PI_DLP_ARG_TINY_LEN && 00594 (argid & (PI_DLP_ARG_FLAG_SHORT | PI_DLP_ARG_FLAG_LONG)) == 0) { 00595 set_byte(&buf[0], argid | PI_DLP_ARG_FLAG_TINY); 00596 set_byte(&buf[1], arg->len); 00597 00598 memcpy(&buf[2], arg->data, arg->len); 00599 buf += arg->len + 2; 00600 } else if (arg->len < PI_DLP_ARG_SHORT_LEN && 00601 (argid & PI_DLP_ARG_FLAG_LONG) == 0) { 00602 set_byte(&buf[0], argid | PI_DLP_ARG_FLAG_SHORT); 00603 set_byte(&buf[1], 0); 00604 set_short(&buf[2], arg->len); 00605 00606 memcpy (&buf[4], arg->data, arg->len); 00607 buf += arg->len + 4; 00608 } else { 00609 set_byte (&buf[0], argid | PI_DLP_ARG_FLAG_LONG); 00610 set_byte(&buf[1], 0); 00611 set_long (&buf[2], arg->len); 00612 00613 memcpy (&buf[6], arg->data, arg->len); 00614 buf += arg->len + 6; 00615 } 00616 } 00617 00618 pi_flush(sd, PI_FLUSH_INPUT); 00619 00620 if ((i = pi_write(sd, exec_buf, len)) < (ssize_t)len) { 00621 errno = -EIO; 00622 if (i >= 0 && i < (ssize_t)len) 00623 i = -1; 00624 } 00625 00626 free (exec_buf); 00627 00628 return i; 00629 }
Here is the call graph for this function:

| int dlp_ResetDBIndex | ( | int | sd, | |
| int | dbhandle | |||
| ) |
Reset the nextRecord position used in dlp_ReadNextRecInCategory().
This resets the nextRecord both internally and on the device.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() |
Definition at line 2430 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_ResetDBIndex(), dlp_response_free(), dlpFuncResetRecordIndex, pi_socket::dlprecord, find_pi_socket(), PI_ERR_GENERIC_MEMORY, PI_ERR_SOCK_INVALID, pi_reset_errors(), pi_set_error(), set_byte, and Trace.
Referenced by _wrap_dlp_ResetDBIndex(), dlp_ResetDBIndex(), and main().
02431 { 02432 int result; 02433 pi_socket_t *ps; 02434 struct dlpRequest *req; 02435 struct dlpResponse *res; 02436 02437 Trace(dlp_ResetDBIndex); 02438 pi_reset_errors(sd); 02439 02440 if ((ps = find_pi_socket(sd)) == NULL) { 02441 errno = ESRCH; 02442 return PI_ERR_SOCK_INVALID; 02443 } 02444 02445 ps->dlprecord = 0; 02446 02447 req = dlp_request_new(dlpFuncResetRecordIndex, 1, 1); 02448 if (req == NULL) 02449 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 02450 02451 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 02452 02453 result = dlp_exec(sd, req, &res); 02454 02455 dlp_request_free(req); 02456 dlp_response_free(res); 02457 02458 return result; 02459 }
Here is the call graph for this function:

| int dlp_ResetLastSyncPC | ( | int | sd | ) |
Convenience function to reset lastSyncPC in the UserInfo to 0.
| sd | Socket number |
Definition at line 2414 of file dlp.c.
References dlp_ReadUserInfo(), dlp_ResetLastSyncPC(), dlp_WriteUserInfo(), PilotUser::lastSyncPC, and Trace.
Referenced by _wrap_dlp_ResetLastSyncPC(), dlp_ResetLastSyncPC(), and main().
02415 { 02416 int err; 02417 struct PilotUser User; 02418 02419 Trace(dlp_ResetLastSyncPC); 02420 02421 if ((err = dlp_ReadUserInfo(sd, &User)) < 0) 02422 return err; 02423 02424 User.lastSyncPC = 0; 02425 02426 return dlp_WriteUserInfo(sd, &User); 02427 }
Here is the call graph for this function:

| int dlp_ResetSyncFlags | ( | int | sd, | |
| int | dbhandle | |||
| ) |
Reset dirty record flags, update sync time.
For record databases, reset all dirty flags. For both record and resource databases, set the last sync time to now.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() |
Definition at line 3123 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlpFuncResetSyncFlags, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, and Trace.
Referenced by _wrap_dlp_ResetSyncFlags(), close_db(), do_delete(), install_tux_with_name(), main(), and palm_purge().
03124 { 03125 int result; 03126 struct dlpRequest *req; 03127 struct dlpResponse *res; 03128 03129 Trace(dpl_ResetSyncFlags); 03130 pi_reset_errors(sd); 03131 03132 req = dlp_request_new(dlpFuncResetSyncFlags, 1, 1); 03133 if (req == NULL) 03134 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03135 03136 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 03137 03138 result = dlp_exec(sd, req, &res); 03139 03140 dlp_request_free(req); 03141 dlp_response_free(res); 03142 03143 return result; 03144 }
Here is the call graph for this function:

| int dlp_ResetSystem | ( | int | sd | ) |
Require reboot of device after HotSync terminates.
| sd | Socket number |
Definition at line 1724 of file dlp.c.
References dlp_exec(), dlp_request_free(), dlp_request_new(), dlp_ResetSystem(), dlp_response_free(), dlpFuncResetSystem, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), and Trace.
Referenced by _wrap_dlp_ResetSystem(), dlp_ResetSystem(), Java_org_gnu_pilotlink_PilotLink_resetSystem(), pi_file_install(), and pi_file_merge().
01725 { 01726 int result; 01727 struct dlpRequest *req; 01728 struct dlpResponse *res; 01729 01730 Trace(dlp_ResetSystem); 01731 pi_reset_errors(sd); 01732 01733 req = dlp_request_new(dlpFuncResetSystem, 0); 01734 01735 result = dlp_exec(sd, req, &res); 01736 if (req == NULL) 01737 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01738 01739 dlp_request_free(req); 01740 dlp_response_free(res); 01741 01742 return result; 01743 }
Here is the call graph for this function:

| void dlp_response_free | ( | struct dlpResponse * | res | ) |
Definition at line 675 of file dlp.c.
References dlpResponse::argc, dlpResponse::argv, and dlp_arg_free().
Referenced by dlp_AddSyncLogEntry(), dlp_CallApplication(), dlp_CleanUpDatabase(), dlp_CloseDB(), dlp_CloseDB_All(), dlp_CreateDB(), dlp_DeleteCategory(), dlp_DeleteDB(), dlp_DeleteRecord(), dlp_DeleteResource(), dlp_EndOfSync(), dlp_ExpCardInfo(), dlp_ExpCardPresent(), dlp_ExpSlotEnumerate(), dlp_ExpSlotMediaType(), dlp_FindDBByName(), dlp_FindDBByOpenHandle(), dlp_FindDBByTypeCreator(), dlp_GetSysDateTime(), dlp_MoveCategory(), dlp_OpenConduit(), dlp_OpenDB(), dlp_ReadAppBlock(), dlp_ReadAppPreference(), dlp_ReadDBList(), dlp_ReadNetSyncInfo(), dlp_ReadNextModifiedRec(), dlp_ReadNextModifiedRecInCategory(), dlp_ReadNextRecInCategory(), dlp_ReadOpenDBInfo(), dlp_ReadRecordById(), dlp_ReadRecordByIndex(), dlp_ReadRecordIDList(), dlp_ReadResourceByIndex(), dlp_ReadResourceByType(), dlp_ReadSortBlock(), dlp_ReadStorageInfo(), dlp_ReadSysInfo(), dlp_ReadUserInfo(), dlp_ResetDBIndex(), dlp_ResetSyncFlags(), dlp_ResetSystem(), dlp_SetDBInfo(), dlp_SetSysDateTime(), dlp_VFSDirCreate(), dlp_VFSDirEntryEnumerate(), dlp_VFSExportDatabaseToFile(), dlp_VFSFileClose(), dlp_VFSFileCreate(), dlp_VFSFileDelete(), dlp_VFSFileEOF(), dlp_VFSFileGetAttributes(), dlp_VFSFileGetDate(), dlp_VFSFileOpen(), dlp_VFSFileRead(), dlp_VFSFileRename(), dlp_VFSFileResize(), dlp_VFSFileSeek(), dlp_VFSFileSetAttributes(), dlp_VFSFileSetDate(), dlp_VFSFileSize(), dlp_VFSFileTell(), dlp_VFSFileWrite(), dlp_VFSGetDefaultDir(), dlp_VFSImportDatabaseFromFile(), dlp_VFSVolumeEnumerate(), dlp_VFSVolumeFormat(), dlp_VFSVolumeGetLabel(), dlp_VFSVolumeInfo(), dlp_VFSVolumeSetLabel(), dlp_VFSVolumeSize(), dlp_WriteAppBlock(), dlp_WriteAppPreference(), dlp_WriteNetSyncInfo(), dlp_WriteRecord(), dlp_WriteResource(), dlp_WriteSortBlock(), and dlp_WriteUserInfo().
00676 { 00677 int i; 00678 00679 if (res == NULL) 00680 return; 00681 00682 if (res->argv != NULL) { 00683 for (i = 0; i < res->argc; i++) { 00684 if (res->argv[i] != NULL) 00685 dlp_arg_free (res->argv[i]); 00686 } 00687 free (res->argv); 00688 } 00689 00690 free (res); 00691 }
Here is the call graph for this function:

| struct dlpResponse* dlp_response_new | ( | enum dlpFunctions | cmd, | |
| int | argc | |||
| ) |
Definition at line 432 of file dlp.c.
References dlpResponse::argc, dlpResponse::argv, dlpResponse::cmd, dlpErrNoError, and dlpResponse::err.
Referenced by dlp_response_read().
00433 { 00434 struct dlpResponse *res; 00435 00436 res = (struct dlpResponse *) malloc (sizeof (struct dlpResponse)); 00437 00438 if (res != NULL) { 00439 00440 res->cmd = cmd; 00441 res->err = dlpErrNoError; 00442 res->argc = argc; 00443 res->argv = NULL; 00444 00445 if (argc) { 00446 res->argv = (struct dlpArg **) malloc (sizeof (struct dlpArg *) * argc); 00447 if (res->argv == NULL) { 00448 free(res); 00449 return NULL; 00450 } 00451 /* zero-out argv so that in case of error during 00452 response read, dlp_response_free() won't try to 00453 free uninitialized ptrs */ 00454 memset(res->argv, 0, sizeof (struct dlpArg *) * argc); 00455 } 00456 } 00457 00458 return res; 00459 }
| ssize_t dlp_response_read | ( | struct dlpResponse ** | res, | |
| int | sd | |||
| ) |
Definition at line 474 of file dlp.c.
References pi_buffer_t::allocated, dlpResponse::argc, dlpResponse::argv, buf, dlpArg::data, pi_buffer_t::data, dlp_arg_new(), DLP_BUF_SIZE, dlp_response_new(), dlpResponse::err, get_byte, get_long, get_short, dlpArg::len, LOG, pi_buffer_free(), pi_buffer_new(), PI_DBG_DLP, PI_DBG_LVL_ERR, PI_DLP_ARG_FLAG_LONG, PI_DLP_ARG_FLAG_SHORT, pi_dumpdata(), PI_ERR_DLP_COMMAND, PI_ERR_DLP_DATASIZE, PI_ERR_GENERIC_MEMORY, pi_read(), pi_set_error(), pi_set_palmos_error(), pi_version(), and pi_buffer_t::used.
Referenced by dlp_exec(), and dlp_VFSFileWrite().
00475 { 00476 struct dlpResponse *response; 00477 unsigned char *buf; 00478 short argid; 00479 int i; 00480 ssize_t bytes; 00481 size_t len; 00482 pi_buffer_t *dlp_buf; 00483 00484 dlp_buf = pi_buffer_new (DLP_BUF_SIZE); 00485 if (dlp_buf == NULL) 00486 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 00487 00488 bytes = pi_read (sd, dlp_buf, dlp_buf->allocated); /* buffer will grow as needed */ 00489 if (bytes < 0) { 00490 pi_buffer_free (dlp_buf); 00491 return bytes; 00492 } 00493 if (bytes < 4) { 00494 /* packet is probably incomplete */ 00495 #ifdef DEBUG 00496 LOG((PI_DBG_DLP, PI_DBG_LVL_ERR, 00497 "dlp_response_read: response too short (%d bytes)\n", 00498 bytes)); 00499 if (bytes) 00500 pi_dumpdata(dlp_buf->data, (size_t)dlp_buf->used); 00501 #endif 00502 return pi_set_error(sd, PI_ERR_DLP_COMMAND); 00503 } 00504 00505 response = dlp_response_new ((enum dlpFunctions)(dlp_buf->data[0] & 0x7f), dlp_buf->data[1]); 00506 *res = response; 00507 00508 /* note that in case an error occurs, we do not deallocate the response 00509 since callers already do it under all circumstances */ 00510 if (response == NULL) { 00511 pi_buffer_free (dlp_buf); 00512 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 00513 } 00514 00515 response->err = (enum dlpErrors) get_short (&dlp_buf->data[2]); 00516 pi_set_palmos_error(sd, (int)response->err); 00517 00518 /* FIXME: add bounds checking to make sure we don't access past 00519 * the end of the buffer in case the data is corrupt */ 00520 buf = dlp_buf->data + 4; 00521 for (i = 0; i < response->argc; i++) { 00522 argid = get_byte (buf) & 0x3f; 00523 if (get_byte(buf) & PI_DLP_ARG_FLAG_LONG) { 00524 if (pi_version(sd) < 0x0104) { 00525 /* we received a response from a device indicating that 00526 it would have transmitted a >64k data block but DLP 00527 versions prior to 1.4 don't have this capacity. In 00528 this case (as observed on a T3), there is NO length 00529 stored after the argid, it goes straigt to the data 00530 contents. We need to report that the data is too large 00531 to be transferred. 00532 */ 00533 pi_buffer_free (dlp_buf); 00534 return pi_set_error(sd, PI_ERR_DLP_DATASIZE); 00535 } 00536 len = get_long (&buf[2]); 00537 buf += 6; 00538 } else if (get_byte(buf) & PI_DLP_ARG_FLAG_SHORT) { 00539 len = get_short (&buf[2]); 00540 buf += 4; 00541 } else { 00542 argid = get_byte(buf); 00543 len = get_byte(&buf[1]); 00544 buf += 2; 00545 } 00546 00547 response->argv[i] = dlp_arg_new (argid, len); 00548 if (response->argv[i] == NULL) { 00549 pi_buffer_free (dlp_buf); 00550 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 00551 } 00552 memcpy (response->argv[i]->data, buf, len); 00553 buf += len; 00554 } 00555 00556 pi_buffer_free (dlp_buf); 00557 00558 return response->argc ? response->argv[0]->len : 0; 00559 }
Here is the call graph for this function:

| void dlp_set_protocol_version | ( | int | major, | |
| int | minor | |||
| ) |
Set the version of the DLP protocol we report to the device.
During the handshake phase, the device and the desktop exchange the version of the DLP protocol both support. If the device's DLP version is higher than the desktop's, the device usually refuses to connect.
| major | Protocol major version | |
| minor | Protocol minor version |
Definition at line 181 of file dlp.c.
References dlp_version_major, and dlp_version_minor.
Referenced by _wrap_dlp_set_protocol_version().
00182 { 00183 dlp_version_major = major; 00184 dlp_version_minor = minor; 00185 }
| int dlp_SetDBInfo | ( | int | sd, | |
| int | dbhandle, | |||
| int | flags, | |||
| int | clearFlags, | |||
| unsigned int | version, | |||
| time_t | createDate, | |||
| time_t | modifyDate, | |||
| time_t | backupDate, | |||
| unsigned long | type, | |||
| unsigned long | creator | |||
| ) |
Change information for an open database.
Supported on Palm OS 3.0 (DLP 1.2) and later.
| sd | Socket number | |
| dbhandle | Open database handle, obtained from dlp_OpenDB() | |
| flags | Flags to set for this database (see dlpDBFlags enum) | |
| clearFlags | Flags to clear for this database (see dlpDBFlags enum) | |
| version | Version of this database | |
| createDate | Creation date of this database | |
| modifyDate | Modification date of this database (use 0x83DAC000 to unset) | |
| backupDate | Last backup date of this database (use 0x83DAC000 to unset) | |
| type | Database type code (four-char code) | |
| creator | Database creator code (four-char code) |
Definition at line 1809 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_SetDBInfo(), dlpFuncSetDBInfo, PI_ERR_DLP_UNSUPPORTED, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), pi_version(), set_byte, set_date, set_long, set_short, and Trace.
Referenced by _wrap_dlp_SetDBInfo(), dlp_SetDBInfo(), and main().
01812 { 01813 int result; 01814 struct dlpRequest *req; 01815 struct dlpResponse *res; 01816 01817 Trace(dlp_SetDBInfo); 01818 pi_reset_errors(sd); 01819 01820 if (pi_version(sd) < 0x0102) 01821 return pi_set_error(sd, PI_ERR_DLP_UNSUPPORTED); 01822 01823 req = dlp_request_new(dlpFuncSetDBInfo, 1, 40); 01824 if (req == NULL) 01825 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01826 01827 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 01828 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0); 01829 set_short(DLP_REQUEST_DATA(req, 0, 2), clearFlags); 01830 set_short(DLP_REQUEST_DATA(req, 0, 4), flags); 01831 set_short(DLP_REQUEST_DATA(req, 0, 6), version); 01832 set_date((unsigned char *)DLP_REQUEST_DATA(req, 0, 8), createDate); 01833 set_date((unsigned char *)DLP_REQUEST_DATA(req, 0, 16), modifyDate); 01834 set_date((unsigned char *)DLP_REQUEST_DATA(req, 0, 24), backupDate); 01835 set_long(DLP_REQUEST_DATA(req, 0, 32), type); 01836 set_long(DLP_REQUEST_DATA(req, 0, 36), creator); 01837 01838 result = dlp_exec(sd, req, &res); 01839 01840 dlp_request_free(req); 01841 dlp_response_free(res); 01842 01843 return result; 01844 }
Here is the call graph for this function:

| int dlp_SetSysDateTime | ( | int | sd, | |
| time_t | palm_time | |||
| ) |
Set the time on the Palm using a local time_t value.
| sd | Socket number | |
| palm_time | New time to set the device to (expressed using the computer's timezone) |
Definition at line 881 of file dlp.c.
References dlp_exec(), dlp_htopdate(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_SetSysDateTime(), dlpFuncSetSysDateTime, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), and TraceX.
Referenced by _wrap_dlp_SetSysDateTime(), dlp_SetSysDateTime(), main(), and time_fn().
00882 { 00883 int result; 00884 struct dlpRequest *req; 00885 struct dlpResponse *res; 00886 00887 TraceX(dlp_SetSysDateTime,"time=0x%08lx",t); 00888 pi_reset_errors(sd); 00889 00890 req = dlp_request_new(dlpFuncSetSysDateTime, 1, 8); 00891 if (req == NULL) 00892 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 00893 00894 dlp_htopdate(t, (unsigned char *)DLP_REQUEST_DATA(req, 0, 0)); 00895 00896 result = dlp_exec(sd, req, &res); 00897 00898 dlp_request_free(req); 00899 dlp_response_free(res); 00900 00901 return result; 00902 }
Here is the call graph for this function:

| char* dlp_strerror | ( | int | error | ) |
Definition at line 199 of file dlp.c.
References dlp_errorlist.
Referenced by _wrap_dlp_ReadRecordIDList(), GetRecordCmd(), OpenDBCmd(), postPilotLinkException(), pythonWrapper_handlePiErr(), and SetRecordCmd().
00200 { 00201 if (error < 0) 00202 error = -error; 00203 00204 if ((unsigned int) error >= (sizeof(dlp_errorlist)/(sizeof(char *)))) 00205 return "Unknown error"; 00206 00207 return dlp_errorlist[error]; 00208 }
| int dlp_VFSDirCreate | ( | int | sd, | |
| int | volRefNum, | |||
| const char * | path | |||
| ) |
Definition at line 4446 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_VFSDirCreate(), dlpFuncVFSDirCreate, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_short, and TraceX.
04447 { 04448 int result; 04449 struct dlpRequest *req; 04450 struct dlpResponse *res; 04451 04452 RequireDLPVersion(sd,1,2); 04453 TraceX(dlp_VFSDirCreate,"volRefNum=%d path='%s'",volRefNum,path); 04454 pi_reset_errors(sd); 04455 04456 req = dlp_request_new (dlpFuncVFSDirCreate, 1, 2 + (strlen(path) + 1)); 04457 if (req == NULL) 04458 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04459 04460 set_short (DLP_REQUEST_DATA (req, 0, 0), volRefNum); 04461 strcpy (DLP_REQUEST_DATA (req, 0, 2), path); 04462 04463 result = dlp_exec (sd, req, &res); 04464 04465 dlp_request_free (req); 04466 dlp_response_free (res); 04467 04468 return result; 04469 }
Here is the call graph for this function:

| int dlp_VFSDirEntryEnumerate | ( | int | sd, | |
| FileRef | dirref, | |||
| unsigned long * | diriterator, | |||
| int * | maxitems, | |||
| struct VFSDirInfo * | diritems | |||
| ) |
Iterate through the entries in a directory.
Supported on Palm OS 4.0 and later. At the beginning you set dirIterator to vfsIteratorStart, then call this function repeatedly until it returns an error code of the iterator becomes vfsIteratorStop.
| sd | Socket number | |
| dirref | Directory reference obtained from dlp_VFSFileOpen() | |
| diriterator | Ptr to an iterator. Start with vfsIteratorStart | |
| maxitems | On input, the max number of VFSDirInfo structures stored in dirItems. On output, the actual number of items. | |
| diritems | Preallocated array that contains a number of VFSDirInfo structures on return. |
Definition at line 4472 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlp_VFSDirEntryEnumerate(), dlpFuncVFSDirEntryEnumerate, get_long, LOG, VFSDirInfo::name, name, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_long, TraceX, vfsIteratorStop, and vfsMAXFILENAME.
Referenced by _wrap_dlp_VFSDirEntryEnumerate(), dlp_VFSDirEntryEnumerate(), dump_dir(), main(), and print_dir().
04474 { 04475 unsigned int result, 04476 entries, 04477 from, 04478 at, 04479 slen, 04480 count; 04481 struct dlpRequest *req; 04482 struct dlpResponse *res; 04483 04484 RequireDLPVersion(sd,1,2); 04485 TraceX(dlp_VFSDirEntryEnumerate,"dirRef=%ld",dirRefNum); 04486 pi_reset_errors(sd); 04487 04488 req = dlp_request_new (dlpFuncVFSDirEntryEnumerate, 1, 12); 04489 if (req == NULL) 04490 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04491 04492 set_long (DLP_REQUEST_DATA (req, 0, 0), dirRefNum); 04493 set_long (DLP_REQUEST_DATA (req, 0, 4), *dirIterator); 04494 set_long (DLP_REQUEST_DATA (req, 0, 8), 8 + *maxDirItems * (4 + vfsMAXFILENAME)); 04495 04496 result = dlp_exec (sd, req, &res); 04497 04498 dlp_request_free (req); 04499 04500 if (result > 0) { 04501 if (result) { 04502 *dirIterator = get_long (DLP_RESPONSE_DATA (res, 0, 0)); 04503 entries = get_long (DLP_RESPONSE_DATA (res, 0, 4)); 04504 } else { 04505 *dirIterator = vfsIteratorStop; 04506 entries = 0; 04507 } 04508 04509 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04510 "%d results returnd (ilterator: %d)\n", entries, 04511 *dirIterator)); 04512 04513 from = 8; 04514 count = 0; 04515 04516 for (at = 0; at < entries; at++) { 04517 if (*maxDirItems > at) { 04518 data[at].attr = 04519 get_long(DLP_RESPONSE_DATA (res, 0, from)); 04520 04521 /* fix for Sony sims (and probably devices too): they return 04522 the attributes in the high word of attr instead of the low 04523 word. We can safely shift it since the high 16 bits are not 04524 used for VFS flags */ 04525 if ((data[at].attr & 0x0000FFFF) == 0 && 04526 (data[at].attr & 0xFFFF0000) != 0) 04527 data[at].attr >>= 16; 04528 04529 strncpy (data[at].name, 04530 DLP_RESPONSE_DATA(res, 0, from + 4), 04531 vfsMAXFILENAME); 04532 data[at].name[vfsMAXFILENAME-1] = 0; 04533 count++; 04534 } 04535 04536 /* Zero terminated string. Strings that have an 04537 even length will be null terminated and have a 04538 pad byte. */ 04539 slen = strlen (DLP_RESPONSE_DATA(res, 0, from + 4)) + 1; 04540 if (slen & 1) 04541 slen++; /* make even stringlen + NULL */ 04542 04543 /* 6 = 4 (attr) + 1 (NULL) -+ 1 (PADDING) */ 04544 from += slen + 4; 04545 } 04546 *maxDirItems = count; 04547 } 04548 04549 dlp_response_free (res); 04550 04551 return result; 04552 }
Here is the call graph for this function:

| int dlp_VFSExportDatabaseToFile | ( | int | sd, | |
| int | volRefNum, | |||
| const char * | path, | |||
| int | cardno, | |||
| unsigned int | localid | |||
| ) |
Definition at line 3981 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_VFSExportDatabaseToFile(), dlpFuncVFSExportDatabaseToFile, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_long, set_short, and TraceX.
03983 { 03984 int result; 03985 struct dlpRequest *req; 03986 struct dlpResponse *res; 03987 03988 RequireDLPVersion(sd,1,2); 03989 TraceX(dlp_VFSExportDatabaseToFile,"cardno=%d localid=0x%08lx volRefNum=%d path='%s'", 03990 cardno,(long)localid,volRefNum,path); 03991 pi_reset_errors(sd); 03992 03993 req = dlp_request_new(dlpFuncVFSExportDatabaseToFile, 03994 1, 8 + (strlen(path) + 1)); 03995 if (req == NULL) 03996 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03997 03998 set_short(DLP_REQUEST_DATA(req, 0, 0), volRefNum); 03999 set_short(DLP_REQUEST_DATA(req, 0, 2), cardno); 04000 set_long(DLP_REQUEST_DATA(req, 0, 4), localid); 04001 strcpy(DLP_REQUEST_DATA(req, 0, 8), path); 04002 04003 result = dlp_exec(sd, req, &res); 04004 04005 dlp_request_free(req); 04006 dlp_response_free(res); 04007 04008 return result; 04009 }
Here is the call graph for this function:

| int dlp_VFSFileClose | ( | int | sd, | |
| FileRef | fileref | |||
| ) |
Close an open VFS file.
Supported on Palm OS 4.0 and later.
| sd | Socket number | |
| fileref | File reference obtained from dlp_VFSFileOpen() |
Definition at line 4075 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_VFSFileClose(), dlpFuncVFSFileClose, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_long, and TraceX.
Referenced by _wrap_dlp_VFSFileClose(), dlp_VFSFileClose(), dump_dir(), main(), palm_list_VFSDir(), pi_file_install_VFS(), pi_file_retrieve_VFS(), and print_dir().
04076 { 04077 int result; 04078 struct dlpRequest *req; 04079 struct dlpResponse *res; 04080 04081 RequireDLPVersion(sd,1,2); 04082 TraceX(dlp_VFSFileClose,"fileRef=%ld",fileRef); 04083 pi_reset_errors(sd); 04084 04085 req = dlp_request_new (dlpFuncVFSFileClose, 1, 4); 04086 if (req == NULL) 04087 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04088 04089 set_long (DLP_REQUEST_DATA (req, 0, 0), fileRef); 04090 04091 result = dlp_exec (sd, req, &res); 04092 04093 dlp_request_free (req); 04094 dlp_response_free (res); 04095 04096 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04097 "Closed FileRef: %x\n", fileRef)); 04098 04099 return result; 04100 }
Here is the call graph for this function:

| int dlp_VFSFileCreate | ( | int | sd, | |
| int | volRefNum, | |||
| const char * | name | |||
| ) |
Definition at line 4012 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_VFSFileCreate(), dlpFuncVFSFileCreate, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_short, and TraceX.
04013 { 04014 int result; 04015 struct dlpRequest *req; 04016 struct dlpResponse *res; 04017 04018 RequireDLPVersion(sd,1,2); 04019 TraceX(dlp_VFSFileCreate,"volRefNum=%d name='%s'",volRefNum,name); 04020 pi_reset_errors(sd); 04021 04022 req = dlp_request_new (dlpFuncVFSFileCreate, 1, 2 + (strlen(name) + 1)); 04023 if (req == NULL) 04024 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04025 04026 set_short (DLP_REQUEST_DATA (req, 0, 0), volRefNum); 04027 strcpy (DLP_REQUEST_DATA (req, 0, 2), name); 04028 04029 result = dlp_exec (sd, req, &res); 04030 04031 dlp_request_free (req); 04032 dlp_response_free (res); 04033 04034 return result; 04035 }
Here is the call graph for this function:

| int dlp_VFSFileDelete | ( | int | sd, | |
| int | volRefNum, | |||
| const char * | path | |||
| ) |
Definition at line 4212 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_VFSFileDelete(), dlpFuncVFSFileDelete, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_short, and TraceX.
04213 { 04214 int result; 04215 struct dlpRequest *req; 04216 struct dlpResponse *res; 04217 04218 RequireDLPVersion(sd,1,2); 04219 TraceX(dlp_VFSFileDelete,"volRefNum=%d path='%s'",volRefNum,path); 04220 pi_reset_errors(sd); 04221 04222 req = dlp_request_new (dlpFuncVFSFileDelete, 1, 2 + (strlen (path) + 1)); 04223 if (req == NULL) 04224 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04225 04226 set_short (DLP_REQUEST_DATA (req, 0, 0), volRefNum); 04227 strcpy (DLP_REQUEST_DATA (req, 0, 2), path); 04228 04229 result = dlp_exec (sd, req, &res); 04230 04231 dlp_request_free (req); 04232 dlp_response_free (res); 04233 04234 return result; 04235 }
Here is the call graph for this function:

| int dlp_VFSFileEOF | ( | int | sd, | |
| FileRef | fileref | |||
| ) |
Checks whether the current position is at the end of file.
Supported on Palm OS 4.0 and later.
| sd | Socket number | |
| fileref | File reference obtained from dlp_VFSFileOpen() |
Definition at line 4269 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_VFSFileEOF(), dlpFuncVFSFileEOF, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_long, and TraceX.
Referenced by _wrap_dlp_VFSFileEOF(), dlp_VFSFileEOF(), and main().
04270 { 04271 int result; 04272 struct dlpRequest *req; 04273 struct dlpResponse *res; 04274 04275 RequireDLPVersion(sd,1,2); 04276 TraceX(dlp_VFSFileEOF,"fileRef=%ld",fileRef); 04277 pi_reset_errors(sd); 04278 04279 req = dlp_request_new (dlpFuncVFSFileEOF, 1, 4); 04280 if (req == NULL) 04281 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04282 04283 set_long (DLP_REQUEST_DATA (req, 0, 0), fileRef); 04284 04285 result = dlp_exec (sd, req, &res); 04286 04287 dlp_request_free (req); 04288 dlp_response_free (res); 04289 04290 return result; 04291 }
Here is the call graph for this function:

| int dlp_VFSFileGetAttributes | ( | int | sd, | |
| FileRef | fileref, | |||
| unsigned long * | fileattrs | |||
| ) |
Return the attributes of an open file.
Supported on Palm OS 4.0 and later.
| sd | Socket number | |
| fileref | File reference obtained from dlp_VFSFileOpen() | |
| fileattrs | On return, file attributes (see dlpVFSFileAttributeConstants enum) |
Definition at line 4324 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlp_VFSFileGetAttributes(), dlpFuncVFSFileGetAttributes, get_long, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_long, and TraceX.
Referenced by _wrap_dlp_VFSFileGetAttributes(), dlp_VFSFileGetAttributes(), main(), palm_list_VFSDir(), pi_file_install_VFS(), and pi_file_retrieve_VFS().
04325 { 04326 int result; 04327 struct dlpRequest *req; 04328 struct dlpResponse *res; 04329 04330 RequireDLPVersion(sd,1,2); 04331 TraceX(dlp_VFSFileGetAttributes,"fileRef=%ld",fileRef); 04332 pi_reset_errors(sd); 04333 04334 req = dlp_request_new (dlpFuncVFSFileGetAttributes, 1, 4); 04335 if (req == NULL) 04336 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04337 04338 set_long (DLP_REQUEST_DATA (req, 0, 0), fileRef); 04339 04340 result = dlp_exec (sd, req, &res); 04341 04342 dlp_request_free (req); 04343 04344 if (result > 0) { 04345 *attributes = get_long (DLP_RESPONSE_DATA (res, 0, 0)); 04346 } 04347 04348 dlp_response_free(res); 04349 04350 return result; 04351 }
Here is the call graph for this function:

| int dlp_VFSFileGetDate | ( | int | sd, | |
| FileRef | fileref, | |||
| int | which, | |||
| time_t * | date | |||
| ) |
Return one of the dates associated with an open file or directory.
Supported on Palm OS 4.0 and later.
| sd | Socket number | |
| fileref | File or directory reference obtained from dlp_VFSFileOpen() | |
| which | The date you want (see dlpVFSDateConstants enum) | |
| date | On return, the requested date |
Definition at line 4381 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlp_VFSFileGetDate(), dlpFuncVFSFileGetDate, get_long, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_long, set_short, and TraceX.
Referenced by _wrap_dlp_VFSFileGetDate(), dlp_VFSFileGetDate(), main(), and print_fileinfo().
04382 { 04383 int result; 04384 struct dlpRequest *req; 04385 struct dlpResponse *res; 04386 04387 RequireDLPVersion(sd,1,2); 04388 TraceX(dlp_VFSFileGetDate,"fileRef=%ld which=%d",fileRef,which); 04389 pi_reset_errors(sd); 04390 04391 req = dlp_request_new (dlpFuncVFSFileGetDate, 1, 6); 04392 if (req == NULL) 04393 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04394 04395 set_long (DLP_REQUEST_DATA (req, 0, 0), fileRef); 04396 set_short (DLP_REQUEST_DATA (req, 0, 4), which); 04397 04398 result = dlp_exec (sd, req, &res); 04399 04400 dlp_request_free (req); 04401 04402 if (result > 0) { 04403 *date = get_long (DLP_RESPONSE_DATA (res, 0, 0)) - 2082852000; 04404 04405 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04406 "Requested date(%d): %d / %x calc %d / %x\n",which, 04407 get_long(DLP_RESPONSE_DATA (res, 0, 0)), 04408 get_long(DLP_RESPONSE_DATA (res, 0, 0)), 04409 *date,*date)); 04410 } 04411 04412 dlp_response_free (res); 04413 04414 return result; 04415 }
Here is the call graph for this function:

| int dlp_VFSFileOpen | ( | int | sd, | |
| int | volRefNum, | |||
| const char * | path, | |||
| int | openMode, | |||
| FileRef * | fileRef | |||
| ) |
Definition at line 4038 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlp_VFSFileOpen(), dlpFuncVFSFileOpen, get_long, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_short, and TraceX.
04040 { 04041 int result; 04042 struct dlpRequest *req; 04043 struct dlpResponse *res; 04044 04045 RequireDLPVersion(sd,1,2); 04046 TraceX(dlp_VFSFileOpen,"volRefNum=%d mode=0x%04x path='%s'", 04047 volRefNum,openMode,path); 04048 pi_reset_errors(sd); 04049 04050 req = dlp_request_new (dlpFuncVFSFileOpen, 1, 4 + (strlen (path) + 1)); 04051 if (req == NULL) 04052 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04053 04054 set_short (DLP_REQUEST_DATA (req, 0, 0), volRefNum); 04055 set_short (DLP_REQUEST_DATA (req, 0, 2), openMode); 04056 strcpy (DLP_REQUEST_DATA (req, 0, 4), path); 04057 04058 result = dlp_exec (sd, req, &res); 04059 04060 dlp_request_free (req); 04061 04062 if (result > 0) { 04063 *fileRef = get_long(DLP_RESPONSE_DATA (res, 0, 0)); 04064 04065 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04066 "OpenFileRef: 0x%x\n", *fileRef)); 04067 } 04068 04069 dlp_response_free(res); 04070 04071 return result; 04072 }
Here is the call graph for this function:

| int dlp_VFSFileRead | ( | int | sd, | |
| FileRef | fileref, | |||
| pi_buffer_t * | retbuf, | |||
| size_t | reqbytes | |||
| ) |
Read data from an open file.
Supported on Palm OS 4.0 and later. Will return the total number of bytes actually read.
| sd | Socket number | |
| fileref | File reference obtained from dlp_VFSFileOpen() | |
| retbuf | Buffer allocated using pi_buffer_new(). Buffer is being emptied first with pi_buffer_clear(). On return contains the data read from the file. | |
| reqbytes | Number of bytes to read from the file. |
Definition at line 4154 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_VFSFileRead(), dlpFuncVFSFileRead, LOG, pi_buffer_clear(), PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, PI_LEVEL_PADP, PI_PADP_FREEZE_TXID, pi_read(), pi_reset_errors(), pi_set_error(), pi_setsockopt(), RequireDLPVersion, set_long, and TraceX.
Referenced by _wrap_dlp_VFSFileRead(), dlp_VFSFileRead(), main(), and pi_file_retrieve_VFS().
04155 { 04156 int result; 04157 struct dlpRequest *req; 04158 struct dlpResponse *res; 04159 size_t bytes = 0; 04160 int freeze_txid = 1; 04161 size_t opt_size = sizeof(int); 04162 04163 RequireDLPVersion(sd,1,2); 04164 TraceX(dlp_VFSFileRead,"fileRef=%ld len=%ld",(long)fileRef,(long)len); 04165 pi_reset_errors(sd); 04166 04167 req = dlp_request_new (dlpFuncVFSFileRead, 1, 8); 04168 if (req == NULL) 04169 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04170 04171 set_long (DLP_REQUEST_DATA (req, 0, 0), fileRef); 04172 set_long (DLP_REQUEST_DATA (req, 0, 4), len); 04173 04174 /* if we're using PADP, this socket option is required so that 04175 * the transfer can complete without error 04176 */ 04177 pi_setsockopt(sd, PI_LEVEL_PADP, PI_PADP_FREEZE_TXID, &freeze_txid, &opt_size); 04178 04179 result = dlp_exec (sd, req, &res); 04180 04181 dlp_request_free (req); 04182 04183 pi_buffer_clear (data); 04184 04185 if (result >= 0) { 04186 04187 do { 04188 result = pi_read(sd, data, len); 04189 if (result > 0) { 04190 len -= result; 04191 bytes += result; 04192 } 04193 } while (result > 0 && len > 0); 04194 04195 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04196 "dlp_VFSFileRead: read %u bytes (last pi_read was %d)\n", 04197 (unsigned)bytes, result)); 04198 04199 if (result >= 0) 04200 result = bytes; 04201 } 04202 04203 dlp_response_free(res); 04204 04205 freeze_txid = 0; 04206 pi_setsockopt(sd, PI_LEVEL_PADP, PI_PADP_FREEZE_TXID, &freeze_txid, &opt_size); 04207 04208 return result; 04209 }
Here is the call graph for this function:

| int dlp_VFSFileRename | ( | int | sd, | |
| int | volRefNum, | |||
| const char * | path, | |||
| const char * | newname | |||
| ) |
Definition at line 4238 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_VFSFileRename(), dlpFuncVFSFileRename, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_short, and TraceX.
04240 { 04241 int result; 04242 struct dlpRequest *req; 04243 struct dlpResponse *res; 04244 04245 RequireDLPVersion(sd,1,2); 04246 TraceX(dlp_VFSFileRename,"volRefNum=%d file '%s' renamed '%s'", 04247 volRefNum,path,rename); 04248 pi_reset_errors(sd); 04249 04250 req = dlp_request_new (dlpFuncVFSFileRename, 04251 1, 4 + (strlen (path) + 1) + (strlen (newname) + 1)); 04252 if (req == NULL) 04253 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04254 04255 set_short (DLP_REQUEST_DATA (req, 0, 0), volRefNum); 04256 set_short (DLP_REQUEST_DATA (req, 0, 2), 2); 04257 strcpy (DLP_REQUEST_DATA (req, 0, 4), path); 04258 strcpy (DLP_REQUEST_DATA (req, 0, 4 + (strlen(path) + 1)), newname); 04259 04260 result = dlp_exec (sd, req, &res); 04261 04262 dlp_request_free (req); 04263 dlp_response_free (res); 04264 04265 return result; 04266 }
Here is the call graph for this function:

| int dlp_VFSFileResize | ( | int | sd, | |
| FileRef | fileref, | |||
| int | newsize | |||
| ) |
Resize an open file.
Supported on Palm OS 4.0 and later.
| sd | Socket number | |
| fileref | File or directory reference obtained from dlp_VFSFileOpen() | |
| newsize | New file size |
Definition at line 4814 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_VFSFileResize(), dlpFuncVFSFileResize, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_long, and TraceX.
Referenced by _wrap_dlp_VFSFileResize(), dlp_VFSFileResize(), and main().
04815 { 04816 int result; 04817 struct dlpRequest *req; 04818 struct dlpResponse *res; 04819 04820 RequireDLPVersion(sd,1,2); 04821 TraceX(dlp_VFSFileResize,"fileRef=%ld newSize=%d",fileRef,newSize); 04822 pi_reset_errors(sd); 04823 04824 req = dlp_request_new(dlpFuncVFSFileResize, 1, 8); 04825 if (req == NULL) 04826 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04827 04828 set_long(DLP_REQUEST_DATA(req, 0, 0), fileRef); 04829 set_long(DLP_REQUEST_DATA(req, 0, 4), newSize); 04830 04831 result = dlp_exec(sd, req, &res); 04832 04833 dlp_request_free (req); 04834 dlp_response_free (res); 04835 04836 return result; 04837 }
Here is the call graph for this function:

| int dlp_VFSFileSeek | ( | int | sd, | |
| FileRef | fileref, | |||
| int | origin, | |||
| int | offset | |||
| ) |
Change the current seek position in an open file.
Supported on Palm OS 4.0 and later.
| sd | Socket number | |
| fileref | File or directory reference obtained from dlp_VFSFileOpen() | |
| origin | Where to seek from (see dlpVFSSeekConstants enum) | |
| offset | Seek offset |
Definition at line 4786 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_VFSFileSeek(), dlpFuncVFSFileSeek, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_long, set_short, and TraceX.
Referenced by _wrap_dlp_VFSFileSeek(), dlp_VFSFileSeek(), and main().
04787 { 04788 int result; 04789 struct dlpRequest *req; 04790 struct dlpResponse *res; 04791 04792 RequireDLPVersion(sd,1,2); 04793 TraceX(dlp_VFSFileSeek,"fileRef=%ld origin=%d offset=%d", 04794 fileRef,origin,offset); 04795 pi_reset_errors(sd); 04796 04797 req = dlp_request_new (dlpFuncVFSFileSeek, 1, 10); 04798 if (req == NULL) 04799 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04800 04801 set_long (DLP_REQUEST_DATA (req, 0, 0), fileRef); 04802 set_short (DLP_REQUEST_DATA (req, 0, 4), origin); 04803 set_long (DLP_REQUEST_DATA (req, 0, 6), offset); 04804 04805 result = dlp_exec (sd, req, &res); 04806 04807 dlp_request_free (req); 04808 dlp_response_free (res); 04809 04810 return result; 04811 }
Here is the call graph for this function:

| int dlp_VFSFileSetAttributes | ( | int | sd, | |
| FileRef | fileref, | |||
| unsigned long | fileattrs | |||
| ) |
Change the attributes of an open file.
Supported on Palm OS 4.0 and later.
| sd | Socket number | |
| fileref | File reference obtained from dlp_VFSFileOpen() | |
| fileattrs | n-New file attributes (see dlpVFSFileAttributeConstants enum) |
Definition at line 4354 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_VFSFileSetAttributes(), dlpFuncVFSFileSetAttributes, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_long, and TraceX.
Referenced by _wrap_dlp_VFSFileSetAttributes(), dlp_VFSFileSetAttributes(), and main().
04355 { 04356 int result; 04357 struct dlpRequest *req; 04358 struct dlpResponse *res; 04359 04360 RequireDLPVersion(sd,1,2); 04361 TraceX(dlp_VFSFileSetAttributes,"fileRef=%ld attributes=0x%08lx", 04362 fileRef,attributes); 04363 pi_reset_errors(sd); 04364 04365 req = dlp_request_new (dlpFuncVFSFileSetAttributes, 1, 8); 04366 if (req == NULL) 04367 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04368 04369 set_long (DLP_REQUEST_DATA (req, 0, 0), fileRef); 04370 set_long (DLP_REQUEST_DATA (req, 0, 4), attributes); 04371 04372 result = dlp_exec (sd, req, &res); 04373 04374 dlp_request_free (req); 04375 dlp_response_free (res); 04376 04377 return result; 04378 }
Here is the call graph for this function:

| int dlp_VFSFileSetDate | ( | int | sd, | |
| FileRef | fileref, | |||
| int | which, | |||
| time_t | date | |||
| ) |
Change one of the dates for an open file or directory.
Supported on Palm OS 4.0 and later.
| sd | Socket number | |
| fileref | File or directory reference obtained from dlp_VFSFileOpen() | |
| which | The date you want to change (see dlpVFSDateConstants enum) | |
| date | The new date to set |
Definition at line 4418 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_VFSFileSetDate(), dlpFuncVFSFileSetDate, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_long, set_short, and TraceX.
Referenced by _wrap_dlp_VFSFileSetDate(), dlp_VFSFileSetDate(), and main().
04419 { 04420 int result; 04421 struct dlpRequest *req; 04422 struct dlpResponse *res; 04423 04424 RequireDLPVersion(sd,1,2); 04425 TraceX(dlp_VFSFileSetDate,"fileRef=%ld which=%d date=0x%08lx", 04426 (long)fileRef,which,(long)date); 04427 pi_reset_errors(sd); 04428 04429 req = dlp_request_new(dlpFuncVFSFileSetDate, 1, 10); 04430 if (req == NULL) 04431 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04432 04433 set_long (DLP_REQUEST_DATA(req, 0, 0), fileRef); 04434 set_short (DLP_REQUEST_DATA(req, 0, 4), which); 04435 set_long (DLP_REQUEST_DATA(req, 0, 6), date + 2082852000); 04436 04437 result = dlp_exec (sd, req, &res); 04438 04439 dlp_request_free (req); 04440 dlp_response_free (res); 04441 04442 return result; 04443 }
Here is the call graph for this function:

| int dlp_VFSFileSize | ( | int | sd, | |
| FileRef | fileref, | |||
| int * | size | |||
| ) |
Return the size of an open file.
Supported on Palm OS 4.0 and later.
| sd | Socket number | |
| fileref | File or directory reference obtained from dlp_VFSFileOpen() | |
| size | On return, the actual size of the file |
Definition at line 4840 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlp_VFSFileSize(), dlpFuncVFSFileSize, get_long, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_long, and TraceX.
Referenced by _wrap_dlp_VFSFileSize(), dlp_VFSFileSize(), main(), pi_file_retrieve_VFS(), and print_fileinfo().
04841 { 04842 int result; 04843 struct dlpRequest *req; 04844 struct dlpResponse *res; 04845 04846 RequireDLPVersion(sd,1,2); 04847 TraceX(dlp_VFSFileSize,"fileRef=%ld",fileRef); 04848 pi_reset_errors(sd); 04849 04850 req = dlp_request_new (dlpFuncVFSFileSize, 1, 4); 04851 if (req == NULL) 04852 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04853 04854 set_long (DLP_REQUEST_DATA (req, 0, 0), fileRef); 04855 04856 result = dlp_exec (sd, req, &res); 04857 04858 dlp_request_free (req); 04859 04860 if (result > 0) { 04861 *size = get_long (DLP_RESPONSE_DATA (res, 0, 0)); 04862 04863 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04864 "DLP VFS File Size: %d\n", *size)); 04865 } 04866 04867 dlp_response_free (res); 04868 04869 return result; 04870 }
Here is the call graph for this function:

| int dlp_VFSFileTell | ( | int | sd, | |
| FileRef | fileref, | |||
| int * | position | |||
| ) |
Return the current seek position in an open file.
Supported on Palm OS 4.0 and later.
| sd | Socket number | |
| fileref | File reference obtained from dlp_VFSFileOpen() | |
| position | On return, current absolute position in the file |
Definition at line 4294 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlp_VFSFileTell(), dlpFuncVFSFileTell, get_long, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_long, and TraceX.
Referenced by _wrap_dlp_VFSFileTell(), dlp_VFSFileTell(), and main().
04295 { 04296 int result; 04297 struct dlpRequest *req; 04298 struct dlpResponse *res; 04299 04300 RequireDLPVersion(sd,1,2); 04301 TraceX(dlp_VFSFileTell,"fileRef=%ld",fileRef); 04302 pi_reset_errors(sd); 04303 04304 req = dlp_request_new(dlpFuncVFSFileTell, 1, 4); 04305 if (req == NULL) 04306 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04307 04308 set_long (DLP_REQUEST_DATA (req, 0, 0), fileRef); 04309 04310 result = dlp_exec (sd, req, &res); 04311 04312 dlp_request_free (req); 04313 04314 if (result > 0) { 04315 *position = get_long (DLP_RESPONSE_DATA (res, 0, 0)); 04316 } 04317 04318 dlp_response_free (res); 04319 04320 return result; 04321 }
Here is the call graph for this function:

| int dlp_VFSFileWrite | ( | int | sd, | |
| FileRef | fileRef, | |||
| const void * | data, | |||
| size_t | len | |||
| ) |
Definition at line 4103 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlp_response_read(), dlp_VFSFileWrite(), dlpFuncVFSFileWrite, get_short, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_palmos_error(), pi_reset_errors(), pi_set_error(), pi_set_palmos_error(), pi_write(), RequireDLPVersion, set_long, and TraceX.
04104 { 04105 int result; 04106 struct dlpRequest *req; 04107 struct dlpResponse *res = NULL; 04108 04109 RequireDLPVersion(sd,1,2); 04110 TraceX(dlp_VFSFileWrite,"fileRef=%ld len=%ld",(long)fileRef,(long)len); 04111 pi_reset_errors(sd); 04112 04113 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04114 "Write to FileRef: %x bytes %d\n", fileRef, len)); 04115 04116 req = dlp_request_new (dlpFuncVFSFileWrite, 1, 8); 04117 if (req == NULL) 04118 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04119 04120 set_long (DLP_REQUEST_DATA (req, 0, 0), fileRef); 04121 set_long (DLP_REQUEST_DATA (req, 0, 4), len); 04122 04123 result = dlp_exec (sd, req, &res); 04124 04125 dlp_request_free (req); 04126 04127 if (result >= 0) { 04128 int bytes = pi_write (sd, data, len); 04129 result = bytes; 04130 if (result < (int)len) { 04131 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04132 "send failed %d\n", result)); 04133 } else { 04134 dlp_response_free (res); 04135 res = NULL; 04136 04137 result = dlp_response_read (&res, sd); 04138 04139 if (result > 0) { 04140 pi_set_palmos_error(sd, get_short(DLP_RESPONSE_DATA (res, 0, 2))); 04141 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04142 "send success (%d) res 0x%04x!\n", len, pi_palmos_error(sd))); 04143 result = bytes; 04144 } 04145 } 04146 } 04147 04148 dlp_response_free (res); 04149 04150 return result; 04151 }
Here is the call graph for this function:

| int dlp_VFSGetDefaultDir | ( | int | sd, | |
| int | volRefNum, | |||
| const char * | type, | |||
| char * | dir, | |||
| int * | len | |||
| ) |
Definition at line 3889 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlp_VFSGetDefaultDir(), dlpFuncVFSGetDefaultDir, get_short, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_DLP_BUFSIZE, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_short, and TraceX.
03891 { 03892 int result, buflen; 03893 struct dlpRequest *req; 03894 struct dlpResponse *res; 03895 03896 RequireDLPVersion(sd,1,2); 03897 TraceX(dlp_VFSGetDefaultDir,"volRefNum=%d",volRefNum); 03898 pi_reset_errors(sd); 03899 03900 req = dlp_request_new(dlpFuncVFSGetDefaultDir, 03901 1, 2 + (strlen(type) + 1)); 03902 if (req == NULL) 03903 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03904 03905 set_short(DLP_REQUEST_DATA(req, 0, 0), volRefNum); 03906 strcpy(DLP_REQUEST_DATA(req, 0, 2), type); 03907 03908 result = dlp_exec(sd, req, &res); 03909 03910 dlp_request_free(req); 03911 03912 if (result > 0) { 03913 buflen = get_short(DLP_RESPONSE_DATA (res, 0, 0)); 03914 03915 if (*len < buflen + 1) 03916 result = pi_set_error(sd, PI_ERR_DLP_BUFSIZE); 03917 else { 03918 if (buflen) 03919 strncpy(dir, DLP_RESPONSE_DATA (res, 0, 2), 03920 (size_t)buflen); 03921 else 03922 dir[0] = '\0'; 03923 03924 *len = buflen; 03925 03926 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 03927 "Default dir is %s\n", dir)); 03928 } 03929 } 03930 03931 dlp_response_free(res); 03932 03933 return result; 03934 }
Here is the call graph for this function:

| int dlp_VFSImportDatabaseFromFile | ( | int | sd, | |
| int | volRefNum, | |||
| const char * | path, | |||
| int * | cardno, | |||
| unsigned long * | localid | |||
| ) |
Definition at line 3937 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlp_VFSImportDatabaseFromFile(), dlpFuncVFSImportDatabaseFromFile, get_short, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_short, and TraceX.
03939 { 03940 int result; 03941 struct dlpRequest *req; 03942 struct dlpResponse *res; 03943 03944 RequireDLPVersion(sd,1,2); 03945 TraceX(dlp_VFSImportDatabaseFromFile,"volRefNum=%d path='%s'",volRefNum,path); 03946 pi_reset_errors(sd); 03947 03948 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 03949 "Import file <%s>%d\n", path)); 03950 03951 req = dlp_request_new(dlpFuncVFSImportDatabaseFromFile, 03952 1, 2 + (strlen(path) + 1)); 03953 if (req == NULL) 03954 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03955 03956 set_short(DLP_REQUEST_DATA(req, 0, 0), volRefNum); 03957 strcpy(DLP_REQUEST_DATA(req, 0, 2), path); 03958 03959 result = dlp_exec(sd, req, &res); 03960 03961 dlp_request_free(req); 03962 03963 if (result > 0) { 03964 if (cardno) 03965 *cardno = get_short(DLP_RESPONSE_DATA (res, 0, 0)); 03966 if (localid) 03967 *localid = get_short(DLP_RESPONSE_DATA (res, 0, 2)); 03968 03969 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 03970 "Database imported as: cardNo:%d dbID:%d\n", 03971 get_short(DLP_RESPONSE_DATA (res, 0, 0)), 03972 get_short(DLP_RESPONSE_DATA (res, 0, 2)))); 03973 } 03974 03975 dlp_response_free(res); 03976 03977 return result; 03978 }
Here is the call graph for this function:

| int dlp_VFSVolumeEnumerate | ( | int | sd, | |
| int * | numvols, | |||
| int * | volrefs | |||
| ) |
Returns a list of connected VFS volumes.
Supported on Palm OS 4.0 and later.
| sd | Socket number | |
| numvols | On input, the maximum number of volume references that can be returned. On output, the actual number of volume references | |
| volrefs | On output, numVols volume references |
Definition at line 4592 of file dlp.c.
References dlp_exec(), dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlp_VFSVolumeEnumerate(), dlpFuncVFSVolumeEnumerate, get_short, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, and Trace.
Referenced by _wrap_dlp_VFSVolumeEnumerate(), dlp_VFSVolumeEnumerate(), findVFSRoot_clumsy(), main(), and palm_cardinfo().
04593 { 04594 int result; 04595 struct dlpRequest *req; 04596 struct dlpResponse *res; 04597 04598 RequireDLPVersion(sd,1,2); 04599 Trace(dlp_VFSVolumeEnumerate); 04600 pi_reset_errors(sd); 04601 04602 req = dlp_request_new (dlpFuncVFSVolumeEnumerate, 0); 04603 if (req == NULL) 04604 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04605 04606 result = dlp_exec (sd, req, &res); 04607 04608 dlp_request_free (req); 04609 04610 if (result > 0) { 04611 int vols, i; 04612 04613 vols = get_short (DLP_RESPONSE_DATA (res, 0, 0)); 04614 04615 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04616 "DLP VFSVolumeEnumerate %d\n", vols)); 04617 04618 if (vols) { 04619 for (i = 0; i < vols && i < *numVols; i++) { 04620 volRefs[i] = 04621 get_short (DLP_RESPONSE_DATA (res, 04622 0, 2 + (2 * i))); 04623 04624 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04625 " %d Volume-Refnum %d\n", i, volRefs[i])); 04626 } 04627 } 04628 *numVols = vols; 04629 } 04630 else 04631 *numVols = 0; 04632 04633 dlp_response_free (res); 04634 04635 return result; 04636 }
Here is the call graph for this function:

| int dlp_VFSVolumeFormat | ( | int | sd, | |
| unsigned char | fmtflags, | |||
| int | fsLibRef, | |||
| struct VFSSlotMountParam * | param | |||
| ) |
Format a VFS volume.
Supported on Palm OS 4.0 and later.
| sd | Socket number | |
| fmtflags | Format flags (undocumented for now) | |
| fsLibRef | File system lib ref (undocumented for now) | |
| param | Slot mount parameters (undocumented for now) |
Definition at line 4555 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_VFSVolumeFormat(), dlpFuncVFSVolumeFormat, VFSAnyMountParam::mountClass, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, VFSAnyMountParam::reserved, set_byte, set_long, set_short, VFSSlotMountParam::slotLibRefNum, VFSSlotMountParam::slotRefNum, Trace, VFSSlotMountParam::vfsMountParam, and VFSAnyMountParam::volRefNum.
Referenced by _wrap_dlp_VFSVolumeFormat(), and dlp_VFSVolumeFormat().
04557 { 04558 int result; 04559 struct dlpRequest *req; 04560 struct dlpResponse *res; 04561 04562 RequireDLPVersion(sd,1,2); 04563 Trace(dlp_VFSVolumeFormat); 04564 pi_reset_errors(sd); 04565 04566 req = dlp_request_new(dlpFuncVFSVolumeFormat, 1, 4); 04567 if (req == NULL) 04568 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04569 04570 /* FIXME check sizes, list the mount params properly */ 04571 set_short(DLP_REQUEST_DATA(req, 0, 0), fsLibRef); 04572 set_short(DLP_REQUEST_DATA(req, 0, 2), 04573 sizeof(struct VFSSlotMountParam)); 04574 set_byte(DLP_REQUEST_DATA(req, 0, 4), flags); 04575 set_byte(DLP_REQUEST_DATA(req, 0, 4), 0); /* unused */ 04576 04577 set_short(DLP_REQUEST_DATA(req, 0, 6), param->vfsMountParam.volRefNum); 04578 set_short(DLP_REQUEST_DATA(req, 0, 8), param->vfsMountParam.reserved); 04579 set_long(DLP_REQUEST_DATA(req, 0, 10), param->vfsMountParam.mountClass); 04580 set_short(DLP_REQUEST_DATA(req, 0, 14), param->slotLibRefNum); 04581 set_short(DLP_REQUEST_DATA(req, 0, 16), param->slotRefNum); 04582 04583 result = dlp_exec(sd, req, &res); 04584 04585 dlp_request_free(req); 04586 dlp_response_free(res); 04587 04588 return result; 04589 }
Here is the call graph for this function:

| int dlp_VFSVolumeGetLabel | ( | int | sd, | |
| int | volref, | |||
| int * | len, | |||
| char * | name | |||
| ) |
Return the label (name) of a VFS volume.
Supported on Palm OS 4.0 and later.
| sd | Socket number | |
| volref | Volume reference number (obtained from dlp_VFSVolumeEnumerate()) | |
| len | On input, the maximum size of the name buffer. On output, the name length (including the ending nul byte) | |
| name | On output, the nul-terminated volume name |
Definition at line 4688 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlp_VFSVolumeGetLabel(), dlpFuncVFSVolumeGetLabel, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_short, and TraceX.
Referenced by _wrap_dlp_VFSVolumeGetLabel(), dlp_VFSVolumeGetLabel(), findVFSRoot_clumsy(), main(), and palm_cardinfo().
04689 { 04690 int result; 04691 struct dlpRequest *req; 04692 struct dlpResponse *res; 04693 04694 RequireDLPVersion(sd,1,2); 04695 TraceX(dlp_VFSVolumeGetLabel,"volRefNum=%d",volRefNum); 04696 pi_reset_errors(sd); 04697 04698 req = dlp_request_new (dlpFuncVFSVolumeGetLabel, 1, 2); 04699 if (req == NULL) 04700 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04701 04702 set_short (DLP_REQUEST_DATA (req, 0, 0), volRefNum); 04703 04704 result = dlp_exec (sd, req, &res); 04705 04706 dlp_request_free (req); 04707 04708 if (result > 0) { 04709 strncpy(name, DLP_RESPONSE_DATA(res, 0, 0), 04710 (size_t)(*len - 1)); 04711 *len = strlen(name); 04712 04713 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04714 "DLP VFSVolumeGetLabel %s\n", name)); 04715 } 04716 04717 dlp_response_free(res); 04718 04719 return result; 04720 }
Here is the call graph for this function:

| int dlp_VFSVolumeInfo | ( | int | sd, | |
| int | volref, | |||
| struct VFSInfo * | volinfo | |||
| ) |
Returns information about a VFS volume.
Supported on Palm OS 4.0 and later.
| sd | Socket number | |
| volref | Volume reference number (obtained from dlp_VFSVolumeEnumerate()) | |
| volinfo | On return, volume information |
Definition at line 4639 of file dlp.c.
References VFSInfo::attributes, dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlp_VFSVolumeInfo(), dlpFuncVFSVolumeInfo, VFSInfo::fsCreator, VFSInfo::fsType, get_long, get_short, LOG, VFSInfo::mediaType, VFSInfo::mountClass, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), printlong(), RequireDLPVersion, VFSInfo::reserved, set_short, VFSInfo::slotLibRefNum, VFSInfo::slotRefNum, and TraceX.
Referenced by _wrap_dlp_VFSVolumeInfo(), dlp_VFSVolumeInfo(), findVFSRoot_clumsy(), main(), and palm_cardinfo().
04640 { 04641 int result; 04642 struct dlpRequest *req; 04643 struct dlpResponse *res; 04644 04645 RequireDLPVersion(sd,1,2); 04646 TraceX(dlp_VFSVolumeInfo,"volRefNum=%d",volRefNum); 04647 pi_reset_errors(sd); 04648 04649 req = dlp_request_new (dlpFuncVFSVolumeInfo, 1, 2); 04650 if (req == NULL) 04651 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04652 04653 set_short (DLP_REQUEST_DATA(req, 0, 0), volRefNum); 04654 04655 result = dlp_exec (sd, req, &res); 04656 04657 dlp_request_free (req); 04658 04659 if (result > 0) { 04660 volInfo->attributes = get_long (DLP_RESPONSE_DATA (res, 0, 0)); 04661 volInfo->fsType = get_long (DLP_RESPONSE_DATA (res, 0, 4)); 04662 volInfo->fsCreator = get_long (DLP_RESPONSE_DATA (res, 0, 8)); 04663 volInfo->mountClass = get_long (DLP_RESPONSE_DATA (res, 0, 12)); 04664 volInfo->slotLibRefNum = get_short (DLP_RESPONSE_DATA (res, 0, 16)); 04665 volInfo->slotRefNum = get_short (DLP_RESPONSE_DATA (res, 0, 18)); 04666 volInfo->mediaType = get_long (DLP_RESPONSE_DATA (res, 0, 20)); 04667 volInfo->reserved = get_long (DLP_RESPONSE_DATA (res, 0, 24)); 04668 04669 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04670 "VFSVolumeInfo: fstype '%s' ", printlong(volInfo->fsType))); 04671 04672 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04673 "fscreator: '%s'\nSlotlibref %d Slotref %d\n", 04674 printlong(volInfo->fsCreator), 04675 volInfo->slotLibRefNum, 04676 volInfo->slotRefNum)); 04677 04678 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04679 "Media: '%s'\n", printlong(volInfo->mediaType))); 04680 } 04681 04682 dlp_response_free(res); 04683 04684 return result; 04685 }
Here is the call graph for this function:

| int dlp_VFSVolumeSetLabel | ( | int | sd, | |
| int | volRefNum, | |||
| const char * | name | |||
| ) |
Definition at line 4723 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_VFSVolumeSetLabel(), dlpFuncVFSVolumeSetLabel, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_short, and TraceX.
04724 { 04725 int result; 04726 struct dlpRequest *req; 04727 struct dlpResponse *res; 04728 04729 RequireDLPVersion(sd,1,2); 04730 TraceX(dlp_VFSVolumeSetLabel,"volRefNum=%d name='%s'",volRefNum,name); 04731 pi_reset_errors(sd); 04732 04733 req = dlp_request_new (dlpFuncVFSVolumeSetLabel, 1, 04734 2 + (strlen(name) + 1)); 04735 if (req == NULL) 04736 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04737 04738 set_short (DLP_REQUEST_DATA (req, 0, 0), volRefNum); 04739 strcpy (DLP_REQUEST_DATA (req, 0, 2), name); 04740 04741 result = dlp_exec (sd, req, &res); 04742 04743 dlp_response_free (res); 04744 dlp_request_free (req); 04745 04746 return result; 04747 }
Here is the call graph for this function:

| int dlp_VFSVolumeSize | ( | int | sd, | |
| int | volref, | |||
| long * | usedbytes, | |||
| long * | totalbytes | |||
| ) |
Return the total and used size of a VFS volume.
Supported on Palm OS 4.0 and later.
| sd | Socket number | |
| volref | Volume reference number (obtained from dlp_VFSVolumeEnumerate()) | |
| usedbytes | On return, number of bytes used on the volume | |
| totalbytes | On return, total size of the volume in bytes |
Definition at line 4750 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlp_VFSVolumeSize(), dlpFuncVFSVolumeSize, get_long, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), RequireDLPVersion, set_short, and TraceX.
Referenced by _wrap_dlp_VFSVolumeSize(), dlp_VFSVolumeSize(), main(), palm_cardinfo(), and pi_file_install_VFS().
04752 { 04753 int result; 04754 struct dlpRequest *req; 04755 struct dlpResponse *res; 04756 04757 RequireDLPVersion(sd,1,2); 04758 TraceX(dlp_VFSVolumeSize,"volRefNum=%d",volRefNum); 04759 pi_reset_errors(sd); 04760 04761 req = dlp_request_new (dlpFuncVFSVolumeSize, 1, 2); 04762 if (req == NULL) 04763 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 04764 04765 set_short (DLP_REQUEST_DATA (req, 0, 0), volRefNum); 04766 04767 result = dlp_exec (sd, req, &res); 04768 04769 dlp_request_free (req); 04770 04771 if (result > 0) { 04772 *volSizeUsed = get_long (DLP_RESPONSE_DATA (res, 0, 0)); 04773 *volSizeTotal = get_long (DLP_RESPONSE_DATA (res, 0, 4)); 04774 04775 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 04776 "DLP VFS Volume Size total: %d used: %d\n", 04777 *volSizeTotal, *volSizeUsed)); 04778 } 04779 04780 dlp_response_free (res); 04781 04782 return result; 04783 }
Here is the call graph for this function:

| int dlp_WriteAppBlock | ( | int | sd, | |
| int | dbhandle, | |||
| const void * | data, | |||
| size_t | length | |||
| ) |
Definition at line 2977 of file dlp.c.
References DLP_BUF_SIZE, dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_WriteAppBlock(), dlpFuncWriteAppBlock, LOG, PI_DBG_DLP, PI_DBG_LVL_ERR, PI_ERR_DLP_DATASIZE, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, set_short, and TraceX.
02979 { 02980 int result; 02981 struct dlpRequest *req; 02982 struct dlpResponse *res; 02983 02984 TraceX(dlp_WriteAppBlock,"length=%ld",length); 02985 pi_reset_errors(sd); 02986 02987 req = dlp_request_new(dlpFuncWriteAppBlock, 1, 4 + length); 02988 if (req == NULL) 02989 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 02990 02991 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 02992 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0); 02993 set_short(DLP_REQUEST_DATA(req, 0, 2), length); 02994 02995 if (length + 10 > DLP_BUF_SIZE) { 02996 LOG((PI_DBG_DLP, PI_DBG_LVL_ERR, 02997 "DLP WriteAppBlock: data too large (>64k)")); 02998 pi_set_error(sd, PI_ERR_DLP_DATASIZE); 02999 return -131; 03000 } 03001 if (length) 03002 memcpy(DLP_REQUEST_DATA(req, 0, 4), data, length); 03003 03004 result = dlp_exec(sd, req, &res); 03005 03006 dlp_request_free(req); 03007 dlp_response_free(res); 03008 03009 return result; 03010 }
Here is the call graph for this function:

| int dlp_WriteAppPreference | ( | int | sd, | |
| unsigned long | creator, | |||
| int | prefID, | |||
| int | backup, | |||
| int | version, | |||
| const void * | buffer, | |||
| size_t | size | |||
| ) |
Definition at line 3377 of file dlp.c.
References DLP_BUF_SIZE, dlp_CloseDB(), dlp_exec(), dlp_OpenDB(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_WriteAppPreference(), dlp_WriteResource(), dlpFuncWriteAppPreference, dlpOpenWrite, LOG, PI_DBG_DLP, PI_DBG_LVL_ERR, PI_ERR_DLP_DATASIZE, PI_ERR_GENERIC_MEMORY, PI_ERR_SOCK_DISCONNECTED, pi_error(), pi_palmos_error(), pi_reset_errors(), pi_set_error(), pi_set_palmos_error(), pi_version(), set_byte, set_long, set_short, and TraceX.
03379 { 03380 int result; 03381 struct dlpRequest *req; 03382 struct dlpResponse *res; 03383 03384 TraceX(dlp_WriteAppPreference,"creator='%4.4s' prefID=%d backup=%d version=%d size=%ld", 03385 (const char *)&creator,prefID,backup,version,size); 03386 pi_reset_errors(sd); 03387 03388 if (pi_version(sd) < 0x0101) { 03389 /* Emulate on PalmOS 1.0 */ 03390 int db, 03391 err1, 03392 err2; 03393 03394 if ((result = dlp_OpenDB(sd, 0, dlpOpenWrite, "System Preferences", 03395 &db)) < 0) 03396 return result; 03397 03398 if (buffer && size) { 03399 unsigned char dlp_buf[DLP_BUF_SIZE]; 03400 memcpy(dlp_buf + 2, buffer, size); 03401 set_short(dlp_buf, version); 03402 result = dlp_WriteResource(sd, db, creator, prefID, dlp_buf, 03403 size); 03404 } else { 03405 result = dlp_WriteResource(sd, db, creator, prefID, NULL, 03406 0); 03407 } 03408 err1 = pi_error(sd); 03409 err2 = pi_palmos_error(sd); 03410 03411 if (err1 != PI_ERR_SOCK_DISCONNECTED) 03412 dlp_CloseDB(sd, db); 03413 03414 if (result < 0) { 03415 /* restore previous error after DB close */ 03416 pi_set_error(sd, err1); 03417 pi_set_palmos_error(sd, err2); 03418 } 03419 return result; 03420 } 03421 03422 req = dlp_request_new(dlpFuncWriteAppPreference, 1, 12 + size); 03423 if (req == NULL) 03424 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03425 03426 set_long(DLP_REQUEST_DATA(req, 0, 0), creator); 03427 set_short(DLP_REQUEST_DATA(req, 0, 4), prefID); 03428 set_short(DLP_REQUEST_DATA(req, 0, 6), version); 03429 set_short(DLP_REQUEST_DATA(req, 0, 8), size); 03430 set_byte(DLP_REQUEST_DATA(req, 0, 10), backup ? 0x80 : 0); 03431 set_byte(DLP_REQUEST_DATA(req, 0, 11), 0); /* Reserved */ 03432 03433 if ((size + 12) > DLP_BUF_SIZE) { 03434 LOG((PI_DBG_DLP, PI_DBG_LVL_ERR, 03435 "DLP WriteAppPreferenceV2: data too large (>64k)")); 03436 return PI_ERR_DLP_DATASIZE; 03437 } 03438 memcpy(DLP_REQUEST_DATA(req, 0, 12), buffer, size); 03439 03440 result = dlp_exec (sd, req, &res); 03441 03442 dlp_request_free(req); 03443 dlp_response_free(res); 03444 03445 return result; 03446 }
Here is the call graph for this function:

| int dlp_WriteNetSyncInfo | ( | int | sd, | |
| const struct NetSyncInfo * | i | |||
| ) |
Definition at line 2111 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_WriteNetSyncInfo(), dlpFuncWriteNetSyncInfo, NetSyncInfo::hostAddress, NetSyncInfo::hostName, NetSyncInfo::hostSubnetMask, NetSyncInfo::lanSync, LOG, PI_DBG_DLP, PI_DBG_LVL_INFO, PI_ERR_DLP_UNSUPPORTED, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), pi_version(), set_byte, set_long, set_short, and Trace.
02112 { 02113 int result, 02114 str_offset = 24; 02115 struct dlpRequest *req; 02116 struct dlpResponse *res; 02117 02118 Trace(dlp_WriteNetSyncInfo); 02119 pi_reset_errors(sd); 02120 02121 if (pi_version(sd) < 0x0101) 02122 return pi_set_error(sd, PI_ERR_DLP_UNSUPPORTED); 02123 02124 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 02125 "DLP ReadNetSyncInfo Active: %d\n", i->lanSync ? 1 : 0)); 02126 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 02127 " PC hostname: '%s', address '%s', mask '%s'\n", 02128 i->hostName, i->hostAddress, i->hostSubnetMask)); 02129 02130 req = dlp_request_new(dlpFuncWriteNetSyncInfo, 1, 02131 24 + strlen(i->hostName) + 02132 strlen(i->hostAddress) + strlen(i->hostSubnetMask) + 3); 02133 if (req == NULL) 02134 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 02135 02136 /* Change all settings */ 02137 set_byte(DLP_REQUEST_DATA(req, 0, 0), 0x80 | 0x40 | 0x20 | 0x10); 02138 02139 set_byte(DLP_REQUEST_DATA(req, 0, 1), i->lanSync); 02140 set_long(DLP_REQUEST_DATA(req, 0, 2), 0); /* Reserved1 */ 02141 set_long(DLP_REQUEST_DATA(req, 0, 6), 0); /* Reserved2 */ 02142 set_long(DLP_REQUEST_DATA(req, 0, 10), 0); /* Reserved3 */ 02143 set_long(DLP_REQUEST_DATA(req, 0, 14), 0); /* Reserved4 */ 02144 set_short(DLP_REQUEST_DATA(req, 0, 18), strlen(i->hostName) + 1); 02145 set_short(DLP_REQUEST_DATA(req, 0, 20), strlen(i->hostAddress) + 1); 02146 set_short(DLP_REQUEST_DATA(req, 0, 22), strlen(i->hostSubnetMask) + 1); 02147 02148 strcpy(DLP_REQUEST_DATA(req, 0, str_offset), i->hostName); 02149 str_offset += strlen(i->hostName) + 1; 02150 strcpy(DLP_REQUEST_DATA(req, 0, str_offset), i->hostAddress); 02151 str_offset += strlen(i->hostAddress) + 1; 02152 strcpy(DLP_REQUEST_DATA(req, 0, str_offset), i->hostSubnetMask); 02153 02154 result = dlp_exec(sd, req, &res); 02155 02156 dlp_request_free(req); 02157 dlp_response_free(res); 02158 02159 return result; 02160 }
Here is the call graph for this function:

| int dlp_WriteRecord | ( | int | sd, | |
| int | dbhandle, | |||
| int | flags, | |||
| recordid_t | recID, | |||
| int | catID, | |||
| const void * | data, | |||
| size_t | length, | |||
| recordid_t * | pNewRecID | |||
| ) |
Definition at line 2510 of file dlp.c.
References CHECK, DLP_BUF_SIZE, dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), DLP_RESPONSE_DATA, dlp_response_free(), dlp_WriteRecord(), dlpFuncWriteRecord, dlpFuncWriteRecordEx, get_long, LOG, PI_DBG_DLP, PI_DBG_LVL_DEBUG, PI_DBG_LVL_ERR, PI_DBG_LVL_INFO, PI_ERR_DLP_DATASIZE, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), pi_version(), set_byte, set_long, and Trace.
02512 { 02513 int result; 02514 struct dlpRequest *req; 02515 struct dlpResponse *res; 02516 02517 Trace(dlp_WriteRecord); 02518 pi_reset_errors(sd); 02519 02520 if (length == (size_t)-1) 02521 length = strlen((char *) data) + 1; 02522 02523 if (pi_version(sd) >= 0x0104) { 02524 req = dlp_request_new(dlpFuncWriteRecordEx, 1, 12 + length); 02525 if (req == NULL) 02526 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 02527 02528 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 02529 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0x80); /* "data included" */ 02530 set_long(DLP_REQUEST_DATA(req, 0, 2), recID); 02531 set_byte(DLP_REQUEST_DATA(req, 0, 6), flags); 02532 set_byte(DLP_REQUEST_DATA(req, 0, 7), catID); 02533 set_long(DLP_REQUEST_DATA(req, 0, 8), 0); 02534 02535 memcpy(DLP_REQUEST_DATA(req, 0, 12), data, length); 02536 } else { 02537 if ((length + 8) > DLP_BUF_SIZE) { 02538 LOG((PI_DBG_DLP, PI_DBG_LVL_ERR, 02539 "DLP WriteRecord: data too large (>64k)")); 02540 return PI_ERR_DLP_DATASIZE; 02541 } 02542 02543 req = dlp_request_new(dlpFuncWriteRecord, 1, 8 + length); 02544 if (req == NULL) 02545 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 02546 02547 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 02548 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0x80); /* "data included" */ 02549 set_long(DLP_REQUEST_DATA(req, 0, 2), recID); 02550 set_byte(DLP_REQUEST_DATA(req, 0, 6), flags); 02551 set_byte(DLP_REQUEST_DATA(req, 0, 7), catID); 02552 02553 memcpy(DLP_REQUEST_DATA(req, 0, 8), data, length); 02554 } 02555 02556 result = dlp_exec(sd, req, &res); 02557 02558 dlp_request_free(req); 02559 02560 if (result > 0) { 02561 if (pNewRecID) 02562 *pNewRecID = get_long(DLP_RESPONSE_DATA(res, 0, 0)); 02563 02564 LOG((PI_DBG_DLP, PI_DBG_LVL_INFO, 02565 "DLP WriteRecord Record ID: 0x%8.8lX\n", 02566 get_long(DLP_RESPONSE_DATA(res, 0, 0)))); 02567 02568 CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG, 02569 record_dump( 02570 get_long(DLP_RESPONSE_DATA(res, 0, 0)), /* recID */ 02571 0xffff, /* index */ 02572 flags, 02573 catID, 02574 (const char *)data, (int)length)); 02575 } 02576 02577 dlp_response_free(res); 02578 02579 return result; 02580 }
Here is the call graph for this function:

| int dlp_WriteResource | ( | int | sd, | |
| int | dbhandle, | |||
| unsigned long | type, | |||
| int | resID, | |||
| const void * | data, | |||
| size_t | length | |||
| ) |
Definition at line 2845 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_request_new_with_argid(), dlp_response_free(), dlp_WriteResource(), dlpFuncWriteResource, dlpFuncWriteResourceEx, LOG, PI_DBG_DLP, PI_DBG_LVL_ERR, PI_DLP_ARG_FIRST_ID, PI_DLP_ARG_FLAG_LONG, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), pi_version(), set_byte, set_long, set_short, and TraceX.
02847 { 02848 int result, 02849 large = 0; 02850 struct dlpRequest *req; 02851 struct dlpResponse *res; 02852 02853 TraceX(dlp_WriteResource,"'%4.4s' #%d",(const char *)&type,resID); 02854 pi_reset_errors(sd); 02855 02856 /* TapWave (DLP 1.4) implements a `large' version of dlpFuncWriteResource, 02857 * which can store records >64k 02858 */ 02859 if (pi_version(sd) >= 0x0104) { 02860 req = dlp_request_new_with_argid(dlpFuncWriteResourceEx, 02861 PI_DLP_ARG_FIRST_ID | PI_DLP_ARG_FLAG_LONG, 1, 12 + length); 02862 large = 1; 02863 } else { 02864 if (length > 0xffff) 02865 length = 0xffff; 02866 req = dlp_request_new(dlpFuncWriteResource, 1, 10 + length); 02867 } 02868 if (req == NULL) { 02869 LOG((PI_DBG_DLP, PI_DBG_LVL_ERR, 02870 "DLP sd:%i large:%i dlp_request_new failed\n", 02871 sd, large)); 02872 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 02873 } 02874 02875 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 02876 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0); 02877 set_long(DLP_REQUEST_DATA(req, 0, 2), type); 02878 set_short(DLP_REQUEST_DATA(req, 0, 6), resID); 02879 if (large) 02880 set_long (DLP_REQUEST_DATA(req, 0, 8), 0); /* device doesn't want length here (it computes it) */ 02881 else 02882 set_short(DLP_REQUEST_DATA(req, 0, 8), length); 02883 02884 memcpy(DLP_REQUEST_DATA(req, 0, large ? 12 : 10), data, length); 02885 02886 result = dlp_exec(sd, req, &res); 02887 02888 dlp_request_free(req); 02889 dlp_response_free(res); 02890 02891 return result; 02892 }
Here is the call graph for this function:

| int dlp_WriteSortBlock | ( | int | sd, | |
| int | dbhandle, | |||
| const void * | data, | |||
| size_t | length | |||
| ) |
Definition at line 3064 of file dlp.c.
References DLP_BUF_SIZE, dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_WriteSortBlock(), dlpFuncWriteSortBlock, LOG, PI_DBG_DLP, PI_DBG_LVL_ERR, PI_ERR_DLP_DATASIZE, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, set_short, and TraceX.
03066 { 03067 int result; 03068 struct dlpRequest *req; 03069 struct dlpResponse *res; 03070 03071 TraceX(dlp_WriteSortBlock,"length=%ld",length); 03072 pi_reset_errors(sd); 03073 03074 req = dlp_request_new(dlpFuncWriteSortBlock, 1, 4 + length); 03075 if (req == NULL) 03076 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 03077 03078 set_byte(DLP_REQUEST_DATA(req, 0, 0), dbhandle); 03079 set_byte(DLP_REQUEST_DATA(req, 0, 1), 0); 03080 set_short(DLP_REQUEST_DATA(req, 0, 2), length); 03081 03082 if (length + 10 > DLP_BUF_SIZE) { 03083 LOG((PI_DBG_DLP, PI_DBG_LVL_ERR, 03084 "DLP WriteSortBlock: data too large (>64k)")); 03085 pi_set_error(sd, PI_ERR_DLP_DATASIZE); 03086 return -131; 03087 } 03088 memcpy(DLP_REQUEST_DATA(req, 0, 4), data, length); 03089 03090 result = dlp_exec(sd, req, &res); 03091 03092 dlp_request_free(req); 03093 dlp_response_free(res); 03094 03095 return result; 03096 }
Here is the call graph for this function:

| int dlp_WriteUserInfo | ( | int | sd, | |
| const struct PilotUser * | User | |||
| ) |
Definition at line 1963 of file dlp.c.
References dlp_exec(), DLP_REQUEST_DATA, dlp_request_free(), dlp_request_new(), dlp_response_free(), dlp_WriteUserInfo(), dlpFuncWriteUserInfo, PilotUser::lastSyncDate, PilotUser::lastSyncPC, PI_ERR_GENERIC_MEMORY, pi_reset_errors(), pi_set_error(), set_byte, set_date, set_long, Trace, PilotUser::userID, PilotUser::username, and PilotUser::viewerID.
01964 { 01965 int result; 01966 struct dlpRequest *req; 01967 struct dlpResponse *res; 01968 int len; 01969 01970 Trace(dlp_WriteUserInfo); 01971 pi_reset_errors(sd); 01972 01973 len = strlen (User->username) + 1; 01974 01975 req = dlp_request_new (dlpFuncWriteUserInfo, 1, 22 + len); 01976 if (req == NULL) 01977 return pi_set_error(sd, PI_ERR_GENERIC_MEMORY); 01978 01979 set_long(DLP_REQUEST_DATA(req, 0, 0), User->userID); 01980 set_long(DLP_REQUEST_DATA(req, 0, 4), User->viewerID); 01981 set_long(DLP_REQUEST_DATA(req, 0, 8), User->lastSyncPC); 01982 set_date((unsigned char *)DLP_REQUEST_DATA(req, 0, 12), User->lastSyncDate); 01983 set_byte(DLP_REQUEST_DATA(req, 0, 20), 0xff); 01984 set_byte(DLP_REQUEST_DATA(req, 0, 21), len); 01985 strcpy(DLP_REQUEST_DATA(req, 0, 22), User->username); 01986 01987 result = dlp_exec (sd, req, &res); 01988 01989 dlp_request_free (req); 01990 dlp_response_free (res); 01991 01992 return result; 01993 }
Here is the call graph for this function:

| char* dlp_errorlist[] |
Initial value:
{
"No error",
"General System error",
"Illegal Function",
"Out of memory",
"Invalid parameter",
"Not found",
"None Open",
"Already Open",
"Too many Open",
"Already Exists",
"Cannot Open",
"Record deleted",
"Record busy",
"Operation not supported",
"-Unused-",
"Read only",
"Not enough space",
"Limit exceeded",
"Sync cancelled",
"Bad arg wrapper",
"Argument missing",
"Bad argument size"
}
Definition at line 67 of file dlp.c.
Referenced by dlp_GetROMToken(), and dlp_strerror().
int dlp_version_major = PI_DLP_VERSION_MAJOR [static] |
Definition at line 141 of file dlp.c.
Referenced by dlp_ReadSysInfo(), and dlp_set_protocol_version().
int dlp_version_minor = PI_DLP_VERSION_MINOR [static] |
Definition at line 142 of file dlp.c.
Referenced by dlp_ReadSysInfo(), and dlp_set_protocol_version().
| char* exp_errorlist[] |
Initial value:
{
"No error",
"Unsupported Operation",
"Not enough Power",
"Card not present",
"Invalid slotreference number",
"Slot deallocated",
"Card no sector read/write",
"Card read only",
"Card bad sector",
"Protected sector",
"Not open (slot driver)",
"still open (slot driver)",
"Unimplemented",
"Enumeration empty",
"Incompatible API version"
}
| char* vfs_errorlist[] |
Initial value:
{
"No error",
"Buffer Overflow",
"Generic file error",
"File reference is invalid",
"File still open",
"Permission denied",
"File or folder already exists",
"FileEOF",
"File not found",
"volumereference is invalid",
"Volume still mounted",
"No filesystem",
"Bad data",
"Non-empty directory",
"Invalid path or filename",
"Volume full - not enough space",
"Unimplemented",
"Not a directory",
"Is a directory",
"Directory not found",
"Name truncated"
}