WHIZOO.COM Checkout
Home Products Bluetooth Source Code Bill of Rights Consulting Support About Us

Description
The network library runs on all Palm OS devices using OS 3.3 and higher. It even runs on OS 5 devices, including the Tungsten T, Sony TG50 and others! The library is a compile-time library that you link into your product. There is no separate PRC file to deliver to the users of your application. The library is royalty-free, meaning you can use it in all your products no matter how many copies you sell. All you pay is a low upfront license fee. Click here to read the full license agreement.

The network library is accompanied by a C header file that is reproduced below (with some deliberate errors). You also get a fully working application (Net Sync) that uses the library. Net Sync is provided as a Metrowerks CodeWarrior project.

/************************************************************************* Copyright © Whizoo, 2003 . All rights reserved. This software and documentation constitute an unpublished work and contain valuable trade secrets and proprietary information belonging to Author. None of the foregoing material may be copied, duplicated or disclosed without the express written permission of Author. Author EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES CONCERNING THIS SOFTWARE AND DOCUMENTATION, INCLUDING ANY WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR ANY PARTICULAR PURPOSE, AND WARRANTIES OF PERFORMANCE, AND ANY WARRANTY THAT MIGHT OTHERWISE ARISE FROM COURSE OF DEALING OR USAGE OF TRADE. NO WARRANTY IS EITHER EXPRESS OR IMPLIED WITH RESPECT TO THE USE OF THE SOFTWARE OR DOCUMENTATION. Under no circumstances shall Author be liable for incidental, special, indirect, direct or consequential damages or loss of profits, interruption of business, or related expenses which may arise from use of software or documentation, including but not limited to those resulting from defects in software and/or documentation, or loss or inaccuracy of data of any kind. More information: http://www.whizoo.com *************************************************************************** // PE_NetLib.h
#pragma mark ***** Error Codes
// Error Codes
#define PE_ErrorClass 0x9000 #define PE_ErrNone errNone // Zero #define PE_ErrParameter (PE_ErrorClass | 1) // Invalid parameter passed to function #define PE_ErrOSIncompatible (PE_ErrorClass | 2) // Wrong OS version (only 3.3 and higher) #define PE_ErrDatabaseReadWrite (PE_ErrorClass | 3) // Error reading / writing to network service #define PE_ErrNoSuchRecord (PE_ErrorClass | 4) // Specified record doesn't exist #define PE_ErrNoMemory (PE_ErrorClass | 5) // Insufficient memory

#pragma mark ***** Defines

// Defines
#define PE_NEW_RECORD dmMaxRecordIndex // Create a new record #define PE_SERVICE_NAME_LEN 32 // Max length of network service name #define PE_CONN_NAME_LEN 22 // Max length of connection name #pragma mark ***** Structures
// Structures
typedef struct PE_ServiceListType { Char service[PE_SERVICE_NAME_LEN]; // name of service Char connection[PE_CONN_NAME_LEN]; // name of connection the service uses UInt16 recordNum; // the record number of the service } PE_ServiceListType; typedef struct PE_ServicePreferencesType { UInt32 interface; // 'slip', 'ppp-' or 'loop' UInt32 ipAddr; // IP address if static UInt32 primaryDNS; // Primary DNS server if static UInt32 secondaryDNS; // Secondary DNS server if static UInt32 closeWaitTime; // Wait before closing connection after NetLibClose UInt16 inactivityTimer; // Wait before closing connection due to inactivity UInt16 establishmentTimeout; // Time before giving up on connection establishment UInt8 reserved; // Not used UInt8 reserved2:6; // Not used UInt8 useVJCompression:1; // Use VJ header compression UInt8 useModem:1; // Use modem (phone number) to connect MemHandle serviceNameH; // Name of the service MemHandle usernameH; // Username MemHandle passwordH; // Password MemHandle loginScriptH; // Login script (each line is NULL terminated) MemHandle connectionH; // Connection to use (from connection database) } PE_ServicePreferencesType; typedef struct PE_PhonePreferencesType { UInt16 reserved: 12; // reserved UInt16 dialPrefixEnabled:1; // dial prefix string provided UInt16 callWaitingEnabled:1; // call waiting string provided UInt16 callingCardEnabled:1; // calling card string provided UInt16 pulseDial:1; // pulse dial or touch-tone MemHandle phoneNoH; // phone number MemHandle prefixH; // dial prefix MemHandle callWaitingH; // call waiting string MemHandle callingCardH; // calling card number string } PE_PhonePreferencesType; #pragma mark ***** Functions
// Functions // Function: PE_GetLibraryVersion // Returns the library version number // // Parameters IN: // none // // Parameters OUT: // none // // RETURNS: // Returns the library version number
const Char *PE_GetLibraryVersion();
// Function: PE_GetActiveService // Gets the record number of the currently active service. The active service is the service // used whenever NetLibOpen is called. // // Parameters IN: // none // // Parameters OUT: // none // // RETURNS: // The record number of the currently active service. If the record is not found then the first // record (0) is returned.
UInt16 PE_GetActiveService();
// Function: PE_SetActiveService // Sets the active service to be the service specified // // Parameters IN: // recordNum - record number of service that should be made the active service // // Parameters OUT: // none // // RETURNS: // PE_ErrNone - no error // PE_ErrOSIncompatible - wrong Palm OS version // PE_ErrDatabaseReadWrite - error writing to network service database // PE_ErrNoSuchRecord - the specified record was not found
Err PE_SetActiveService(UInt16 recordNum);
// Function: PE_GetRecordIDFromNumber // Converts a service record number into a unique service ID // // Parameters IN: // recordNum - record number to convert // // Parameters OUT: // none // // RETURNS: // The record ID corresponding to the given record number. If the record is not found then // zero is returned.
UInt32 PE_GetRecordIDFromNumber(UInt16 recordNum);
// Function: PE_GetServiceList // Gets a list of all the network services in the network database. An array of services // it created. The developer is responsible for freeing this list (call MemPtrFree) // // Parameters IN: // none // // Parameters OUT: // numOfServices - number of services in the network database // serviceList - an array of these services, the connection they use and the record number // // RETURNS: // PE_ErrNone - no error // PE_ErrParameter - serviceList is already allocated // PE_ErrOSIncompatible - wrong Palm OS version // PE_ErrDatabaseReadWrite - error writing to network service database // PE_ErrNoMemory - unable to allocate memory for the list // // Note: Don't forget to call MemPtrFree to free the memory used by the list
Err PE_GetServiceList(UInt16 *numOfServices, PE_ServiceListType **serviceList);
// Function: PE_SaveService // Saves the service into the network service database // // Parameters IN: // recordNum - record number of service to change or PE_NEW_RECORD if a new // record should be created // service - new or modified network service record // phone - new or modified phone record // // Parameters OUT: // newRecord - the new record number for the service. This will typically be the same // as recordNum, except if the record is a new record or the service // name has changed (the service database is sorted into alphabetical order) // // RETURNS: // PE_ErrNone - no error // PE_ErrParameter - service or phone not provided // PE_ErrOSIncompatible - wrong Palm OS version // PE_ErrDatabaseReadWrite - error writing to network service database // PE_ErrNoSuchRecord - invalid record specified
Err PE_SaveService(UInt16 recordNum, UInt16 *newRecord, PE_ServicePreferencesType *service, \ PE_PhonePreferencesType *phone);
// Function: PE_LoadService // Loads the service from the network service database. When the data is no longer needed // you should call PE_FreeService, which will free the string handles used by the record. // // Parameters IN: // recordNum - record number of the service to be retrieved // // Parameters OUT: // service - service record is populated from network database // phone - phone record is populated from network database // // RETURNS: // PE_ErrNone - no error // PE_ErrParameter - service or phone not provided // PE_ErrOSIncompatible - wrong Palm OS version // PE_ErrDatabaseReadWrite - error writing to network service database // PE_ErrNoSuchRecord - invalid record specified // // Note: Don't forget to call PE_FreeService to free the allocated memory
Err PE_LoadService(UInt16 recordNum, PE_ServicePreferencesType *service, \ PE_PhonePreferencesType *phone);
// Function: PE_FreeService // Frees the string handles used for network and phone services // // Parameters IN: // service - service record populated by prior PE_LoadService call // phone - phone record populated by prior PE_LoadService call // // Parameters OUT: // none // // RETURNS: // PE_ErrNone - no error // PE_ErrParameter - service or phone not provided // PE_ErrOSIncompatible - wrong Palm OS version
Err PE_FreeService(PE_ServicePreferencesType *service, PE_PhonePreferencesType *phone);
Click here to return to the previous page.