exglib.pp 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. {$MACRO ON}
  2. (******************************************************************************
  3. *
  4. * Copyright (c) 1997-2000 Palm, Inc. or its subsidiaries.
  5. * All rights reserved.
  6. *
  7. * File: ExgLib.h
  8. *
  9. * Release: Palm OS SDK 4.0 (63220)
  10. *
  11. * Description:
  12. * Include file the Exchange Library interface. The Exchange Library is a
  13. * generic interface to any number of librarys. Any Exchange Library
  14. * MUST have entrypoint traps in exactly the order listed here.
  15. * The System Exchange manager functions call these functions when
  16. * applications make calls to the Exchange manager. Applications will
  17. * usually not make direct calls to this API.
  18. *
  19. * History:
  20. * 5/23/97 Created by Gavin Peacock
  21. *
  22. *****************************************************************************)
  23. {$IFNDEF FPC_DOTTEDUNITS}
  24. unit exglib;
  25. {$ENDIF FPC_DOTTEDUNITS}
  26. interface
  27. {$IFDEF FPC_DOTTEDUNITS}
  28. uses PalmApi.Palmos, PalmApi.Libtraps, PalmApi.Exgmgr;
  29. {$ELSE FPC_DOTTEDUNITS}
  30. uses palmos, libtraps, exgmgr;
  31. {$ENDIF FPC_DOTTEDUNITS}
  32. // special exchange mgr event key
  33. const
  34. exgIntDataChr = $01ff;
  35. //-----------------------------------------------------------------------------
  36. // Obx library call ID's. Each library call gets the trap number:
  37. // exgTrapXXXX which serves as an index into the library's dispatch table.
  38. // The constant sysLibTrapCustom is the first available trap number after
  39. // the system predefined library traps Open,Close,Sleep & Wake.
  40. //
  41. // WARNING!!! This order of these traps MUST match the order of the dispatch
  42. // table in and Exchange library!!!
  43. //-----------------------------------------------------------------------------
  44. type
  45. ExgLibTrapNumberEnum = Enum;
  46. const
  47. exgLibTrapHandleEvent = sysLibTrapCustom;
  48. exgLibTrapConnect = Succ(exgLibTrapHandleEvent);
  49. exgLibTrapAccept = Succ(exgLibTrapConnect);
  50. exgLibTrapDisconnect = Succ(exgLibTrapAccept);
  51. exgLibTrapPut = Succ(exgLibTrapDisconnect);
  52. exgLibTrapGet = Succ(exgLibTrapPut);
  53. exgLibTrapSend = Succ(exgLibTrapGet);
  54. exgLibTrapReceive = Succ(exgLibTrapSend);
  55. exgLibTrapControl = Succ(exgLibTrapReceive);
  56. exgLibTrapRequest = Succ(exgLibTrapControl);
  57. exgLibTrapReserved1 = Succ(exgLibTrapRequest);
  58. exgLibTrapReserved2 = Succ(exgLibTrapReserved1);
  59. exgLibTrapReserved3 = Succ(exgLibTrapReserved2);
  60. exgLibTrapReserved4 = Succ(exgLibTrapReserved3);
  61. exgLibTrapReserved5 = Succ(exgLibTrapReserved4);
  62. exgLibTrapReserved6 = Succ(exgLibTrapReserved5);
  63. exgLibTrapReserved7 = Succ(exgLibTrapReserved6);
  64. exgLibTrapReserved8 = Succ(exgLibTrapReserved7);
  65. exgLibTrapReserved9 = Succ(exgLibTrapReserved8);
  66. exgLibTrapReserved10 = Succ(exgLibTrapReserved9);
  67. exgLibTrapLast = Succ(exgLibTrapReserved10);
  68. (************************************************************
  69. * Net Library procedures.
  70. *************************************************************)
  71. //--------------------------------------------------
  72. // Library initialization, shutdown, sleep and wake
  73. //--------------------------------------------------
  74. // Open the library - enable server for receiving data.
  75. function ExgLibOpen(libRefnum: UInt16): Err; syscall sysLibTrapOpen;
  76. function ExgLibClose(libRefnum: UInt16): Err; syscall sysLibTrapClose;
  77. function ExgLibSleep(libRefnum: UInt16): Err; syscall sysLibTrapSleep;
  78. function ExgLibWake(libRefnum: UInt16): Err; syscall sysLibTrapWake;
  79. // MemHandle events that this library needs. This will be called by
  80. // sysHandle event when certain low level events are triggered.
  81. function ExgLibHandleEvent(libRefnum: UInt16; eventP: Pointer): Boolean; syscall exgLibTrapHandleEvent;
  82. // Establish a new connection
  83. function ExgLibConnect(libRefNum: UInt16; exgSocketP: ExgSocketPtr): Err; syscall exgLibTrapConnect;
  84. // Accept a connection request from remote end
  85. function ExgLibAccept(libRefnum: UInt16; exgSocketP: ExgSocketPtr): Err; syscall exgLibTrapAccept;
  86. // Disconnect
  87. function ExgLibDisconnect(libRefnum: UInt16; exgSocketP: ExgSocketPtr; error: Err): Err; syscall exgLibTrapDisconnect;
  88. // Initiate a Put command. This passes the name and other information about
  89. // an object to be sent
  90. function ExgLibPut(libRefnum: UInt16; exgSocketP: ExgSocketPtr): Err; syscall exgLibTrapPut;
  91. // Initiate a Get command. This requests an object from the remote end.
  92. function ExgLibGet(libRefNum: UInt16; exgSocketP: ExgSocketPtr): Err; syscall exgLibTrapGet;
  93. // Send data to remote end - called after a Put command
  94. function ExgLibSend(libRefNum: UInt16; exgSocketP: ExgSocketPtr; const bufP: Pointer; const bufLen: UInt32; var errP: Err): UInt32; syscall exgLibTrapSend;
  95. // Receive data from remote end -- called after Accept
  96. function ExgLibReceive(libRefNum: UInt16; exgSocketP: ExgSocketPtr; bufP: Pointer; const bufSize: UInt32; var errP: Err): UInt32; syscall exgLibTrapReceive;
  97. // Send various option commands to the Exg library
  98. function ExgLibControl(libRefNum: UInt16; op: UInt16; valueP: Pointer; var valueLenP: UInt16): Err; syscall exgLibTrapControl;
  99. // Tell the Exg library to check for incoming data
  100. function ExgLibRequest(libRefNum: UInt16; socketP: ExgSocketPtr): Err; syscall exgLibTrapRequest;
  101. implementation
  102. end.