exglib.pp 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. unit exglib;
  24. interface
  25. uses palmos, libtraps, exgmgr;
  26. // special exchange mgr event key
  27. const
  28. exgIntDataChr = $01ff;
  29. //-----------------------------------------------------------------------------
  30. // Obx library call ID's. Each library call gets the trap number:
  31. // exgTrapXXXX which serves as an index into the library's dispatch table.
  32. // The constant sysLibTrapCustom is the first available trap number after
  33. // the system predefined library traps Open,Close,Sleep & Wake.
  34. //
  35. // WARNING!!! This order of these traps MUST match the order of the dispatch
  36. // table in and Exchange library!!!
  37. //-----------------------------------------------------------------------------
  38. type
  39. ExgLibTrapNumberEnum = Enum;
  40. const
  41. exgLibTrapHandleEvent = sysLibTrapCustom;
  42. exgLibTrapConnect = Succ(exgLibTrapHandleEvent);
  43. exgLibTrapAccept = Succ(exgLibTrapConnect);
  44. exgLibTrapDisconnect = Succ(exgLibTrapAccept);
  45. exgLibTrapPut = Succ(exgLibTrapDisconnect);
  46. exgLibTrapGet = Succ(exgLibTrapPut);
  47. exgLibTrapSend = Succ(exgLibTrapGet);
  48. exgLibTrapReceive = Succ(exgLibTrapSend);
  49. exgLibTrapControl = Succ(exgLibTrapReceive);
  50. exgLibTrapRequest = Succ(exgLibTrapControl);
  51. exgLibTrapReserved1 = Succ(exgLibTrapRequest);
  52. exgLibTrapReserved2 = Succ(exgLibTrapReserved1);
  53. exgLibTrapReserved3 = Succ(exgLibTrapReserved2);
  54. exgLibTrapReserved4 = Succ(exgLibTrapReserved3);
  55. exgLibTrapReserved5 = Succ(exgLibTrapReserved4);
  56. exgLibTrapReserved6 = Succ(exgLibTrapReserved5);
  57. exgLibTrapReserved7 = Succ(exgLibTrapReserved6);
  58. exgLibTrapReserved8 = Succ(exgLibTrapReserved7);
  59. exgLibTrapReserved9 = Succ(exgLibTrapReserved8);
  60. exgLibTrapReserved10 = Succ(exgLibTrapReserved9);
  61. exgLibTrapLast = Succ(exgLibTrapReserved10);
  62. (************************************************************
  63. * Net Library procedures.
  64. *************************************************************)
  65. //--------------------------------------------------
  66. // Library initialization, shutdown, sleep and wake
  67. //--------------------------------------------------
  68. // Open the library - enable server for receiving data.
  69. function ExgLibOpen(libRefnum: UInt16): Err; syscall sysLibTrapOpen;
  70. function ExgLibClose(libRefnum: UInt16): Err; syscall sysLibTrapClose;
  71. function ExgLibSleep(libRefnum: UInt16): Err; syscall sysLibTrapSleep;
  72. function ExgLibWake(libRefnum: UInt16): Err; syscall sysLibTrapWake;
  73. // MemHandle events that this library needs. This will be called by
  74. // sysHandle event when certain low level events are triggered.
  75. function ExgLibHandleEvent(libRefnum: UInt16; eventP: Pointer): Boolean; syscall exgLibTrapHandleEvent;
  76. // Establish a new connection
  77. function ExgLibConnect(libRefNum: UInt16; exgSocketP: ExgSocketPtr): Err; syscall exgLibTrapConnect;
  78. // Accept a connection request from remote end
  79. function ExgLibAccept(libRefnum: UInt16; exgSocketP: ExgSocketPtr): Err; syscall exgLibTrapAccept;
  80. // Disconnect
  81. function ExgLibDisconnect(libRefnum: UInt16; exgSocketP: ExgSocketPtr; error: Err): Err; syscall exgLibTrapDisconnect;
  82. // Initiate a Put command. This passes the name and other information about
  83. // an object to be sent
  84. function ExgLibPut(libRefnum: UInt16; exgSocketP: ExgSocketPtr): Err; syscall exgLibTrapPut;
  85. // Initiate a Get command. This requests an object from the remote end.
  86. function ExgLibGet(libRefNum: UInt16; exgSocketP: ExgSocketPtr): Err; syscall exgLibTrapGet;
  87. // Send data to remote end - called after a Put command
  88. function ExgLibSend(libRefNum: UInt16; exgSocketP: ExgSocketPtr; const bufP: Pointer; const bufLen: UInt32; var errP: Err): UInt32; syscall exgLibTrapSend;
  89. // Receive data from remote end -- called after Accept
  90. function ExgLibReceive(libRefNum: UInt16; exgSocketP: ExgSocketPtr; bufP: Pointer; const bufSize: UInt32; var errP: Err): UInt32; syscall exgLibTrapReceive;
  91. // Send various option commands to the Exg library
  92. function ExgLibControl(libRefNum: UInt16; op: UInt16; valueP: Pointer; var valueLenP: UInt16): Err; syscall exgLibTrapControl;
  93. // Tell the Exg library to check for incoming data
  94. function ExgLibRequest(libRefNum: UInt16; socketP: ExgSocketPtr): Err; syscall exgLibTrapRequest;
  95. implementation
  96. end.