2 * Sun RPC; see RFC 1057
6 #pragma lib "libsunrpc.a"
7 #pragma src "/sys/src/libsunrpc"
13 typedef struct SunAuthInfo SunAuthInfo;
14 typedef struct SunAuthUnix SunAuthUnix;
15 typedef struct SunRpc SunRpc;
16 typedef struct SunCall SunCall;
28 SunAcceptError = 0x10000,
29 SunRejectError = 0x20000,
30 SunAuthError = 0x40000,
35 SunProgUnavail = SunAcceptError | 1,
41 SunRpcMismatch = SunRejectError | 0,
43 SunAuthBadCred = SunAuthError | 1,
75 * only sent on wire in call
76 * caller fills in for the reply unpackers.
90 /* SunAuthInfo verf; */
108 void sunerrstr(SunStatus);
110 void sunrpcprint(Fmt*, SunRpc*);
111 uint sunrpcsize(SunRpc*);
112 SunStatus sunrpcpack(uchar*, uchar*, uchar**, SunRpc*);
113 SunStatus sunrpcunpack(uchar*, uchar*, uchar**, SunRpc*);
115 void sunauthinfoprint(Fmt*, SunAuthInfo*);
116 uint sunauthinfosize(SunAuthInfo*);
117 int sunauthinfopack(uchar*, uchar*, uchar**, SunAuthInfo*);
118 int sunauthinfounpack(uchar*, uchar*, uchar**, SunAuthInfo*);
120 void sunauthunixprint(Fmt*, SunAuthUnix*);
121 uint sunauthunixsize(SunAuthUnix*);
122 int sunauthunixpack(uchar*, uchar*, uchar**, SunAuthUnix*);
123 int sunauthunixunpack(uchar*, uchar*, uchar**, SunAuthUnix*);
125 int sunenumpack(uchar*, uchar*, uchar**, int*);
126 int sunenumunpack(uchar*, uchar*, uchar**, int*);
127 int sunuint1pack(uchar*, uchar*, uchar**, u1int*);
128 int sunuint1unpack(uchar*, uchar*, uchar**, u1int*);
130 int sunstringpack(uchar*, uchar*, uchar**, char**, u32int);
131 int sunstringunpack(uchar*, uchar*, uchar**, char**, u32int);
132 uint sunstringsize(char*);
134 int sunuint32pack(uchar*, uchar*, uchar**, u32int*);
135 int sunuint32unpack(uchar*, uchar*, uchar**, u32int*);
136 int sunuint64pack(uchar*, uchar*, uchar**, u64int*);
137 int sunuint64unpack(uchar*, uchar*, uchar**, u64int*);
139 int sunvaropaquepack(uchar*, uchar*, uchar**, uchar**, u32int*, u32int);
140 int sunvaropaqueunpack(uchar*, uchar*, uchar**, uchar**, u32int*, u32int);
141 uint sunvaropaquesize(u32int);
143 int sunfixedopaquepack(uchar*, uchar*, uchar**, uchar*, u32int);
144 int sunfixedopaqueunpack(uchar*, uchar*, uchar**, uchar*, u32int);
145 uint sunfixedopaquesize(u32int);
150 typedef struct SunProc SunProc;
151 typedef struct SunProg SunProg;
162 int (*pack)(uchar*, uchar*, uchar**, SunCall*);
163 int (*unpack)(uchar*, uchar*, uchar**, SunCall*);
164 uint (*size)(SunCall*);
165 void (*fmt)(Fmt*, SunCall*);
169 SunStatus suncallpack(SunProg*, uchar*, uchar*, uchar**, SunCall*);
170 SunStatus suncallunpack(SunProg*, uchar*, uchar*, uchar**, SunCall*);
171 SunStatus suncallunpackalloc(SunProg*, SunCallType, uchar*, uchar*, uchar**, SunCall**);
172 void suncallsetup(SunCall*, SunProg*, uint);
173 uint suncallsize(SunProg*, SunCall*);
177 #pragma varargck type "B" SunRpc*
178 #pragma varargck type "C" SunCall*
182 int suncallfmt(Fmt*);
183 void sunfmtinstall(SunProg*);
189 typedef struct SunMsg SunMsg;
190 typedef struct SunSrv SunSrv;
205 Channel *creply; /* chan(SunMsg*) */
217 int (*ipokay)(uchar*, ushort);
219 /* implementation use only */
228 SunSrv *sunsrv(void);
230 void sunsrvprog(SunSrv *srv, SunProg *prog, Channel *c);
231 int sunsrvannounce(SunSrv *srv, char *address);
232 int sunsrvudp(SunSrv *srv, char *address);
233 int sunsrvnet(SunSrv *srv, char *address);
234 int sunsrvfd(SunSrv *srv, int fd);
235 void sunsrvthreadcreate(SunSrv *srv, void (*fn)(void*), void*);
236 void sunsrvclose(SunSrv*);
238 int sunmsgreply(SunMsg*, SunCall*);
239 int sunmsgdrop(SunMsg*);
240 int sunmsgreplyerror(SunMsg*, SunStatus);
245 typedef struct SunClient SunClient;
272 SunClient *sundial(char*);
274 int sunclientrpc(SunClient*, ulong, SunCall*, SunCall*, uchar**);
275 void sunclientclose(SunClient*);
276 void sunclientflushrpc(SunClient*, ulong);
277 void sunclientprog(SunClient*, SunProg*);
281 * Provided by callers.
282 * Should remove dependence on this, but hard.
284 void *emalloc(ulong);
285 void *erealloc(void*, ulong);
289 * Sun RPC port mapper; see RFC 1057 Appendix A
292 typedef struct PortMap PortMap;
293 typedef struct PortTNull PortTNull;
294 typedef struct PortRNull PortRNull;
295 typedef struct PortTSet PortTSet;
296 typedef struct PortRSet PortRSet;
297 typedef struct PortTUnset PortTUnset;
298 typedef struct PortRUnset PortRUnset;
299 typedef struct PortTGetport PortTGetport;
300 typedef struct PortRGetport PortRGetport;
301 typedef struct PortTDump PortTDump;
302 typedef struct PortRDump PortRDump;
303 typedef struct PortTCallit PortTCallit;
304 typedef struct PortRCallit PortRCallit;
324 PortProgram = 100000,
327 PortProtoTcp = 6, /* protocol number for TCP/IP */
328 PortProtoUdp = 17 /* protocol number for UDP/IP */
366 struct PortTGetport {
371 struct PortRGetport {
402 extern SunProg portprog;