Hi all, new to the forum.  Glad to see it's as active as it is.

I'm starting off writing an experimental VPN client, and I want
to use the PalmVPPI.h (the 'VPN' prefs panel) interface to
configure it.

Is this a mistake?  I've noticed that Mergic VPN sidesteps
the VPN prefs panel altogether. and don't provide
a 'Vppi', they just have a config 'appl', a 'libr', and a 'neti'
driver.  It's occurred to me that they know something
I don't know about the Palm VPN infrastructure. :)

My immediate problem, however, is sort of fundamental.
When my 'Vppi' app gets a launch code of 'GetAccounts',
the cmdPBP is pointing to a structure of type VPNAccountType.
Fine.  I can fill that in with my accounts, right?

My stumbling block is that it has a pointer (not array) member
called 'accounts', and I don't know what type of memory it's safe
to point it to.  My first guess was that it would
be initialized to some "big-enough" space, and I could just naiively fill that up. Well no.
Device resets on exit from PilotMain.

Next I tried a static inside my own app's space.  Nope.
Device resets on exit from PilotMain.

So where else is there?  Seems I shouldn't use MemPtrNew.
There are no init/cleanup launch codes, so who would MemPtrFree it?

Found nothing in the docs, headers, or samples about this.
Is there an implicit folklore S.O.P. for plugin panels
missing from my education?  Any advice appreciated.
I'm debugging on a PalmTX over USB with the Palm OS Debugger.

========== PalmSDK/Incs/68k/libraries/network/PalmVPPI.h ==========

/** @brief VPN Account structure. */
typedef struct
{
   UInt32  vppiCreator; /**< Creator ID of the VPPI that "owns" the account. */
   UInt32  accountID;           /**< Arbitrary 32-bit ID used by the VPI to 
identify the account. */
   Char    accountName[kMaxVPNAccountNameLength + 1]; /**< User-specified 
account name. */
} VPNAccountType;

/** Launch code used by the VPN Panel to get the account list. */
#define sysVPPILaunchCmdGetAccounts  sysAppLaunchCmdCustomBase   // 0x8000

/** @brief Structure used by the VPN Panel to query the account from a VPPI. */
typedef struct
{
   UInt32          numAccounts; /**< Number of accounts. */
   VPNAccountType* accounts;    /**< Array of accounts. */
   Err             err;         /**< Error set by the VPPI before returning the 
account list. */
} SysVPPILaunchCmdGetAccountsType;

========== Main.c ==========


static VPNAccountType accounts[1];

UInt32 PilotMain (UInt16 cmd, void *cmdPBP, UInt16 launchFlags) {
   switch(cmd){
       case sysVPPILaunchCmdGetAccounts:
           {
               SysVPPILaunchCmdGetAccountsType *blk = cmdPBP;
               accounts[1].vppiCreator = AppCrid;
               accounts[0].accountID = 0;
               StrCopy(accounts[0].accountName,"myvpn");
               blk->accounts = accounts;
               blk->numAccounts = 1;
               blk->err = errNone;
               return errNone;
           }
   }
}



--
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to