2 * Sun RPC; see RFC 1057
5 #pragma lib "libsunrpc.a"
6 #pragma src "/sys/src/libsunrpc"
10 typedef struct SunAuthInfo SunAuthInfo;
11 typedef struct SunAuthUnix SunAuthUnix;
12 typedef struct SunRpc SunRpc;
13 typedef struct SunCall SunCall;
25 SunAcceptError = 0x10000,
26 SunRejectError = 0x20000,
27 SunAuthError = 0x40000,
32 SunProgUnavail = SunAcceptError | 1,
38 SunRpcMismatch = SunRejectError | 0,
40 SunAuthBadCred = SunAuthError | 1,
72 * only sent on wire in call
73 * caller fills in for the reply unpackers.
105 void sunErrstr(SunStatus);
107 void sunRpcPrint(Fmt*, SunRpc*);
108 uint sunRpcSize(SunRpc*);
109 SunStatus sunRpcPack(uchar*, uchar*, uchar**, SunRpc*);
110 SunStatus sunRpcUnpack(uchar*, uchar*, uchar**, SunRpc*);
112 void sunAuthInfoPrint(Fmt*, SunAuthInfo*);
113 uint sunAuthInfoSize(SunAuthInfo*);
114 int sunAuthInfoPack(uchar*, uchar*, uchar**, SunAuthInfo*);
115 int sunAuthInfoUnpack(uchar*, uchar*, uchar**, SunAuthInfo*);
117 void sunAuthUnixPrint(Fmt*, SunAuthUnix*);
118 uint sunAuthUnixSize(SunAuthUnix*);
119 int sunAuthUnixPack(uchar*, uchar*, uchar**, SunAuthUnix*);
120 int sunAuthUnixUnpack(uchar*, uchar*, uchar**, SunAuthUnix*);
122 int sunEnumPack(uchar*, uchar*, uchar**, int*);
123 int sunEnumUnpack(uchar*, uchar*, uchar**, int*);
124 int sunUint1Pack(uchar*, uchar*, uchar**, u1int*);
125 int sunUint1Unpack(uchar*, uchar*, uchar**, u1int*);
127 int sunStringPack(uchar*, uchar*, uchar**, char**, u32int);
128 int sunStringUnpack(uchar*, uchar*, uchar**, char**, u32int);
129 uint sunStringSize(char*);
131 int sunUint32Pack(uchar*, uchar*, uchar**, u32int*);
132 int sunUint32Unpack(uchar*, uchar*, uchar**, u32int*);
133 int sunUint64Pack(uchar*, uchar*, uchar**, u64int*);
134 int sunUint64Unpack(uchar*, uchar*, uchar**, u64int*);
136 int sunVarOpaquePack(uchar*, uchar*, uchar**, uchar**, u32int*, u32int);
137 int sunVarOpaqueUnpack(uchar*, uchar*, uchar**, uchar**, u32int*, u32int);
138 uint sunVarOpaqueSize(u32int);
140 int sunFixedOpaquePack(uchar*, uchar*, uchar**, uchar*, u32int);
141 int sunFixedOpaqueUnpack(uchar*, uchar*, uchar**, uchar*, u32int);
142 uint sunFixedOpaqueSize(u32int);
147 typedef struct SunProc SunProc;
148 typedef struct SunProg SunProg;
159 int (*pack)(uchar*, uchar*, uchar**, SunCall*);
160 int (*unpack)(uchar*, uchar*, uchar**, SunCall*);
161 uint (*size)(SunCall*);
162 void (*fmt)(Fmt*, SunCall*);
166 SunStatus sunCallPack(SunProg*, uchar*, uchar*, uchar**, SunCall*);
167 SunStatus sunCallUnpack(SunProg*, uchar*, uchar*, uchar**, SunCall*);
168 SunStatus sunCallUnpackAlloc(SunProg*, SunCallType, uchar*, uchar*, uchar**, SunCall**);
169 uint sunCallSize(SunProg*, SunCall*);
170 void sunCallSetup(SunCall*, SunProg*, uint);
175 #pragma varargck type "B" SunRpc*
176 #pragma varargck type "C" SunCall*
179 int sunCallFmt(Fmt*);
180 void sunFmtInstall(SunProg*);
186 typedef struct SunMsg SunMsg;
187 typedef struct SunSrv SunSrv;
202 Channel *creply; /* chan(SunMsg*) */
213 /* implementation use only */
222 SunSrv *sunSrv(void);
224 void sunSrvProg(SunSrv *srv, SunProg *prog, Channel *c);
225 int sunSrvAnnounce(SunSrv *srv, char *address);
226 int sunSrvUdp(SunSrv *srv, char *address);
227 int sunSrvNet(SunSrv *srv, char *address);
228 int sunSrvFd(SunSrv *srv, int fd);
229 void sunSrvThreadCreate(SunSrv *srv, void (*fn)(void*), void*);
230 void sunSrvClose(SunSrv*);
232 int sunMsgReply(SunMsg*, SunCall*);
233 int sunMsgDrop(SunMsg*);
234 int sunMsgReplyError(SunMsg*, SunStatus);
239 typedef struct SunClient SunClient;
266 SunClient *sunDial(char*);
268 int sunClientRpc(SunClient*, ulong, SunCall*, SunCall*, uchar**);
269 void sunClientClose(SunClient*);
270 void sunClientFlushRpc(SunClient*, ulong);
271 void sunClientProg(SunClient*, SunProg*);
275 * Provided by callers.
276 * Should remove dependence on this, but hard.
278 void *emalloc(ulong);
279 void *erealloc(void*, ulong);
283 * Sun RPC port mapper; see RFC 1057 Appendix A
286 typedef struct PortMap PortMap;
287 typedef struct PortTNull PortTNull;
288 typedef struct PortRNull PortRNull;
289 typedef struct PortTSet PortTSet;
290 typedef struct PortRSet PortRSet;
291 typedef struct PortTUnset PortTUnset;
292 typedef struct PortRUnset PortRUnset;
293 typedef struct PortTGetport PortTGetport;
294 typedef struct PortRGetport PortRGetport;
295 typedef struct PortTDump PortTDump;
296 typedef struct PortRDump PortRDump;
297 typedef struct PortTCallit PortTCallit;
298 typedef struct PortRCallit PortRCallit;
318 PortProgram = 100000,
321 PortProtoTcp = 6, /* protocol number for TCP/IP */
322 PortProtoUdp = 17 /* protocol number for UDP/IP */
360 struct PortTGetport {
365 struct PortRGetport {
396 extern SunProg portProg;