home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / pub / palmos / wapuniverse-src-0.3.5.build9.tar.gz / wapuniverse-src-0.3.5.build9.tar / wapuniverse-0.3.5.build9 / WAPUniverse.h < prev    next >
C/C++ Source or Header  |  2000-11-12  |  8KB  |  296 lines

  1. #ifndef _wapuniverse_h_
  2. #define _wapuniverse_h_
  3. //---------------------------------------------------------------------------
  4. // MobileToken 
  5. // Contains all PalmOS User Interface specific code, including PilotMain
  6. //
  7. // Project: WAPUniverse for PalmOS
  8. // Copyright ⌐ 1999-2000 Filip Onkelinx
  9. //
  10. // http://www.wapuniverse.com/
  11. // filip@onkelinx.com
  12. //
  13. // This program is free software; you can redistribute it and/or
  14. // modify it under the terms of the GNU General Public License
  15. // as published by the Free Software Foundation; either version 2
  16. // of the License, or (at your option) any later version.
  17. //
  18. // This program is distributed in the hope that it will be useful,
  19. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. // GNU General Public License for more details.
  22. //
  23. // You should have received a copy of the GNU General Public License
  24. // along with this program; if not, write to the Free Software 
  25. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
  26. //
  27. //
  28. // $Workfile: MobileToken.h $  
  29. // $Author: wapuniverse $  
  30. // $Date: 2000/11/11 20:51:09 $     
  31. // $Revision: 1.10 $
  32. //
  33. // $Header: /cvsroot/wapuniverse/wapuniverse/src/WAPUniverse.h,v 1.10 2000/11/11 20:51:09 wapuniverse Exp $
  34. //
  35. //---------------------------------------------------------------------------
  36. #include <PalmOS.h>
  37. #include <SysEvtMgr.h>
  38. #include <sys_socket.h>
  39.  
  40. #define SEC_1  __attribute__ ((section ("sec_1")))
  41.  
  42. #define version20             0x02000000  // PalmOS 2.0 version number
  43. #define wuAppType             'gWAP'      // type for application.  must be 4 chars, mixed case.
  44. #define noRecordSelected    -1          // index for no current record.
  45. #define localizedAppInfoStr 1000    // default category strings ** tAIS **
  46. #define REPLY_TIMEOUT        20 // 20 seconds maximum timeout
  47. #define MAX_URL_LEN         255
  48.  
  49. // states for FormBrowser Statemachine
  50. #define BS_IDLE         1
  51. #define BS_GET_URL      2
  52. #define BS_GET_REPLY    3
  53. #define BS_WSP_DECODE   4
  54. #define BS_WBXML_PARSE  5
  55. #define BS_RENDER        6
  56. #define BS_NEW_CARD     7
  57. #define BS_ONTIMER        8
  58. #define BS_GET_OFFLINE  9
  59.  
  60. extern void MyErrorFunc (char* error, char* additional);
  61. #define DisplayError(str)    MyErrorFunc(str,__FILE__);  
  62.  
  63. #define ftrGlobals         1000
  64.  
  65. // history.c
  66. // history: the stack containing the URL history
  67. #define MAX_HISTORY      20 // min. 10 cfr SPEC-WML 12.2.1 
  68.  
  69. typedef struct historyEntryType {
  70.   Char    *url;
  71.   // TODO : add cache location and exporation here as well
  72. } historyEntryType;
  73.  
  74. typedef struct historyType {
  75.   historyEntryType    hist[MAX_HISTORY]; 
  76.   int                index;
  77. } historyType;
  78.  
  79. typedef struct historyType *historyPtr;
  80.  
  81. // WML.C
  82. // CardType: used to  build an internal list of all cards in a deck
  83. typedef struct CardType {
  84.   Char                *card_id;
  85.   int                 offset;
  86.   struct CardType    *next; 
  87. } CardType;
  88.  
  89. typedef struct CardType *CardPtr;
  90.  
  91.  
  92. typedef struct WMLDeckStruct *WMLDeckPtr;
  93.  
  94. typedef struct WMLDeckStruct {
  95.   int             version;
  96.   int             publicID;
  97.   int             charSet;
  98.   char           *strTable;
  99.   int            decksize;
  100.   int            offset;
  101.   unsigned char tag;
  102.   int            action;
  103.   int            stackDepth;
  104.   unsigned char *stack;
  105.   int            maxstack;
  106.   int            template;
  107.   CardPtr        card;
  108.   int            timerVal;   // for ontimer event, -1 if no timer
  109.   unsigned char *ontimerUrl;  
  110.   unsigned char    *data;
  111.   // temp vars, put here to avoid stack overflows.
  112.   unsigned char *attrstr;
  113.   unsigned char *tmpstr;
  114. } WMLDeck ;
  115.  
  116. // dbURL.c
  117. // Connection Settings record    
  118. typedef struct {
  119.     char    name[31];
  120.     char    urlstr[MAX_URL_LEN+1];
  121.     char    connection[16];
  122. } dbUrlURL;
  123.  
  124. typedef dbUrlURL * dbUrlURLPtr;
  125.  
  126. typedef struct {
  127.     char    name[1];    // actually may be longer than 1
  128. } dbUrlPackedURL;
  129.  
  130.  
  131.  
  132. // Connection Settings record, mostly used in dbConn.c
  133. typedef struct {
  134.     char    name[31];
  135.     char    ipaddress[16];      // e.g. 172.116.212.123 
  136.     char    security;           // 'Y'es or 'N'o
  137.     char    bearer;             // 'C'SD or 'S'MS
  138.     char    connectionType;     // C'O' or C'L'
  139. } dbConnConnection;
  140.  
  141. typedef dbConnConnection * dbConnConnectionPtr;
  142.  
  143. typedef struct {
  144.     char    name[1];    // actually may be longer than 1
  145. } dbConnPackedConnection;
  146.  
  147.   
  148. typedef struct {
  149.     UInt16   renamedCategories;        // bitfield of categories with a changed name
  150.     Char     categoryLabels[dmRecNumCategories][dmCategoryLength];
  151.     UInt8    categoryUniqIDs[dmRecNumCategories];
  152.     UInt8    lastUniqID;         // Uniq IDs for categories generated by the device 
  153.     // are between 0 - 127.  Those from the PC are 128 - 255.
  154.     UInt8    reserved1;          // from the compiler UInt16 aligning things
  155.     UInt16   reserved2;
  156. } gWAPAppInfoType;
  157.  
  158. typedef gWAPAppInfoType * gWAPAppInfoPtr; 
  159.  
  160. typedef struct HyperLinkType {
  161.   Int16 x1;
  162.   Int16 y1;
  163.   Int16 x2;
  164.   Int16 y2;
  165.   Char *url;
  166.   struct HyperLinkType *next;
  167. } HyperLinkType;
  168.  
  169. typedef HyperLinkType *HyperLinkPtr;
  170.  
  171. typedef struct VarType {
  172.   Char *name;
  173.   Char *value;
  174.   struct VarType *next;
  175. } VarType;
  176.  
  177. typedef VarType *VarPtr    ;
  178.  
  179. typedef struct InputType {
  180.   Int16 x1;
  181.   Int16 y1;
  182.   Int16 x2;
  183.   Int16 y2;
  184.   Char *name;
  185.   Boolean passwordType;  // true = Password/ false = text
  186.   Char *format;
  187.   Boolean emptyOK;
  188.   Int16 size;
  189.   Int16 maxlength;
  190.   struct InputType *next;
  191. } InputType;
  192.  
  193. typedef InputType *InputPtr;
  194.  
  195. typedef struct OptionType {
  196.   Char                 *value;
  197.   Char                 *txt;
  198.   struct OptionType *next;
  199. } OptionType;
  200.  
  201. typedef OptionType *OptionPtr;
  202.  
  203. typedef struct SelectType {
  204.   Int16     x1;
  205.   Int16     y1;
  206.   Int16     x2;
  207.   Int16     y2;
  208.   Char         *name;
  209.   OptionPtr options;
  210.   struct SelectType *next;
  211. } SelectType;
  212.  
  213. typedef SelectType *SelectPtr;
  214.  
  215. // 
  216.  
  217. // WSP.C
  218. typedef struct {
  219.   unsigned char transaction_id;
  220.   unsigned char pdu_type;
  221.   unsigned char status_code;
  222.   unsigned char *data;
  223.   int length;
  224. } WSPPDU ;
  225.  
  226. typedef WSPPDU * WSPPDUPtr;
  227.  
  228. typedef struct {
  229.     InputPtr            InputFldActive;
  230.     Boolean              NetLibOpen;
  231.     WSPPDU               wsppdu;
  232.     MemHandle            srcHandle;
  233.     Int16                x,y;
  234.     Int16                state;
  235.     char                 *inBuf;
  236.     Int16                sock;
  237.     dbConnConnection    conn;
  238.     MemHandle            resBmpPrgrs[4];
  239.     Int16                progress;
  240.     WinHandle            DrawWin;
  241.     Int16                DrawHeight;
  242.     Int16                ScrollY;
  243.     HyperLinkPtr         HyperLinks; // linked list of hyperlinks
  244.     InputPtr            Input;         // linked list of input elements
  245.     VarPtr                Var;         // linked list of variables
  246.     SelectPtr            Select;
  247.     Char                *Url;
  248.     WMLDeck             wmldck;
  249.     Int16                CardOffset;
  250.     DmOpenRef            DbUrlDb;           // handle for URL database (bookmarks)
  251.     DmOpenRef            DbConnDb;          // handle for Connection database 
  252.     UInt16               CurrentView;       // id of current form
  253.     gWAPAppInfoType     WAPAppInfo;
  254.     dbConnConnection     CurrentConnection;
  255.     Char *                EditURLConnection;
  256.     MemHandle           ConnectionsHandle;
  257.     MemHandle           ConnectionsListArrayH;    // for the connectionslist in the URLEditForm
  258.     historyPtr             History;
  259.     char                 WapLastUrl[MAX_URL_LEN+1];
  260.     Boolean             NewCategoryEdited;    // true if category name has been edited
  261.     Int16                  DbConnCurrentRecord;       // index of current Connection database record
  262.     Int16                DbUrlCurrentRecord;       // index of current URL database record
  263.     dbUrlURL             DbUrlCurrentURL;
  264.     Int16                  DbUrlCurrentCategory;
  265.     char                 DbUrlCategoryName[dmCategoryLength];     // Storage for the name
  266.     char                   ActiveConnection[16];
  267.     Int16                CurrentCategory;  // category filter
  268.     UInt16               RecordCategory;   // edited record's category (never All)
  269.     UInt16               NewCategory;    // category in details form (never All)
  270.     Boolean             Render;
  271.     struct sockaddr_in     RmtAddress;
  272.     struct sockaddr_in     LclAddress;
  273. } GlobalsType;
  274.  
  275. /* 
  276.  
  277.  // get globals reference
  278. GlobalsType *g;
  279.  FtrGet(wuAppType, ftrGlobals, (UInt32 *)&g);
  280.  
  281.  
  282.  // create the globals object, and register it
  283. GlobalsType *g;
  284.  globals = (Globals *)MemPtrNew(sizeof(Globals));
  285.  MemSet(globals, sizeof(Globals), 0);
  286.  FtrSet(wuAppType, ftrGlobals, (UInt32)globals);
  287.  
  288. */
  289.  
  290. void SwitchForm(UInt16 formID, GlobalsType *g);
  291. void DisplayAbout();
  292. void DisplayLicense();
  293.  
  294. #endif
  295.  
  296.