3
(******************************************************************************
5
* Copyright (c) 1997-2000 Palm, Inc. or its subsidiaries.
10
* Release: Palm OS SDK 4.0 (63220)
13
* Include file the Exchange Library interface. The Exchange Library is a
14
* generic interface to any number of librarys. Any Exchange Library
15
* MUST have entrypoint traps in exactly the order listed here.
16
* The System Exchange manager functions call these functions when
17
* applications make calls to the Exchange manager. Applications will
18
* usually not make direct calls to this API.
21
* 5/23/97 Created by Gavin Peacock
23
*****************************************************************************)
29
uses palmos, libtraps, exgmgr;
31
// special exchange mgr event key
33
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.
41
// WARNING!!! This order of these traps MUST match the order of the dispatch
42
// table in and Exchange library!!!
43
//-----------------------------------------------------------------------------
46
ExgLibTrapNumberEnum = Enum;
49
exgLibTrapHandleEvent = sysLibTrapCustom;
50
exgLibTrapConnect = Succ(exgLibTrapHandleEvent);
51
exgLibTrapAccept = Succ(exgLibTrapConnect);
52
exgLibTrapDisconnect = Succ(exgLibTrapAccept);
53
exgLibTrapPut = Succ(exgLibTrapDisconnect);
54
exgLibTrapGet = Succ(exgLibTrapPut);
55
exgLibTrapSend = Succ(exgLibTrapGet);
56
exgLibTrapReceive = Succ(exgLibTrapSend);
57
exgLibTrapControl = Succ(exgLibTrapReceive);
58
exgLibTrapRequest = Succ(exgLibTrapControl);
59
exgLibTrapReserved1 = Succ(exgLibTrapRequest);
60
exgLibTrapReserved2 = Succ(exgLibTrapReserved1);
61
exgLibTrapReserved3 = Succ(exgLibTrapReserved2);
62
exgLibTrapReserved4 = Succ(exgLibTrapReserved3);
63
exgLibTrapReserved5 = Succ(exgLibTrapReserved4);
64
exgLibTrapReserved6 = Succ(exgLibTrapReserved5);
65
exgLibTrapReserved7 = Succ(exgLibTrapReserved6);
66
exgLibTrapReserved8 = Succ(exgLibTrapReserved7);
67
exgLibTrapReserved9 = Succ(exgLibTrapReserved8);
68
exgLibTrapReserved10 = Succ(exgLibTrapReserved9);
69
exgLibTrapLast = Succ(exgLibTrapReserved10);
71
(************************************************************
72
* Net Library procedures.
73
*************************************************************)
75
//--------------------------------------------------
76
// Library initialization, shutdown, sleep and wake
77
//--------------------------------------------------
78
// Open the library - enable server for receiving data.
79
function ExgLibOpen(libRefnum: UInt16): Err; syscall sysLibTrapOpen;
81
function ExgLibClose(libRefnum: UInt16): Err; syscall sysLibTrapClose;
83
function ExgLibSleep(libRefnum: UInt16): Err; syscall sysLibTrapSleep;
85
function ExgLibWake(libRefnum: UInt16): Err; syscall sysLibTrapWake;
87
// MemHandle events that this library needs. This will be called by
88
// sysHandle event when certain low level events are triggered.
89
function ExgLibHandleEvent(libRefnum: UInt16; eventP: Pointer): Boolean; syscall exgLibTrapHandleEvent;
91
// Establish a new connection
92
function ExgLibConnect(libRefNum: UInt16; exgSocketP: ExgSocketPtr): Err; syscall exgLibTrapConnect;
94
// Accept a connection request from remote end
95
function ExgLibAccept(libRefnum: UInt16; exgSocketP: ExgSocketPtr): Err; syscall exgLibTrapAccept;
98
function ExgLibDisconnect(libRefnum: UInt16; exgSocketP: ExgSocketPtr; error: Err): Err; syscall exgLibTrapDisconnect;
100
// Initiate a Put command. This passes the name and other information about
101
// an object to be sent
102
function ExgLibPut(libRefnum: UInt16; exgSocketP: ExgSocketPtr): Err; syscall exgLibTrapPut;
104
// Initiate a Get command. This requests an object from the remote end.
105
function ExgLibGet(libRefNum: UInt16; exgSocketP: ExgSocketPtr): Err; syscall exgLibTrapGet;
107
// Send data to remote end - called after a Put command
108
function ExgLibSend(libRefNum: UInt16; exgSocketP: ExgSocketPtr; const bufP: Pointer; const bufLen: UInt32; var errP: Err): UInt32; syscall exgLibTrapSend;
110
// Receive data from remote end -- called after Accept
111
function ExgLibReceive(libRefNum: UInt16; exgSocketP: ExgSocketPtr; bufP: Pointer; const bufSize: UInt32; var errP: Err): UInt32; syscall exgLibTrapReceive;
113
// Send various option commands to the Exg library
114
function ExgLibControl(libRefNum: UInt16; op: UInt16; valueP: Pointer; var valueLenP: UInt16): Err; syscall exgLibTrapControl;
116
// Tell the Exg library to check for incoming data
117
function ExgLibRequest(libRefNum: UInt16; socketP: ExgSocketPtr): Err; syscall exgLibTrapRequest;