2 * Sun RPC; see RFC 1057
6 #pragma lib "libsunrpc.a"
7 #pragma src "/sys/src/libsunrpc"
12 typedef struct SunAuthInfo SunAuthInfo;
13 typedef struct SunAuthUnix SunAuthUnix;
14 typedef struct SunRpc SunRpc;
15 typedef struct SunCall SunCall;
27 SunAcceptError = 0x10000,
28 SunRejectError = 0x20000,
29 SunAuthError = 0x40000,
34 SunProgUnavail = SunAcceptError | 1,
40 SunRpcMismatch = SunRejectError | 0,
42 SunAuthBadCred = SunAuthError | 1,
74 * only sent on wire in call
75 * caller fills in for the reply unpackers.
107 void sunerrstr(SunStatus);
109 void sunrpcprint(Fmt*, SunRpc*);
110 uint sunrpcsize(SunRpc*);
111 SunStatus sunrpcpack(uchar*, uchar*, uchar**, SunRpc*);
112 SunStatus sunrpcunpack(uchar*, uchar*, uchar**, SunRpc*);
114 void sunauthinfoprint(Fmt*, SunAuthInfo*);
115 uint sunauthinfosize(SunAuthInfo*);
116 int sunauthinfopack(uchar*, uchar*, uchar**, SunAuthInfo*);
117 int sunauthinfounpack(uchar*, uchar*, uchar**, SunAuthInfo*);
119 void sunauthunixprint(Fmt*, SunAuthUnix*);
120 uint sunauthunixsize(SunAuthUnix*);
121 int sunauthunixpack(uchar*, uchar*, uchar**, SunAuthUnix*);
122 int sunauthunixunpack(uchar*, uchar*, uchar**, SunAuthUnix*);
124 int sunenumpack(uchar*, uchar*, uchar**, int*);
125 int sunenumunpack(uchar*, uchar*, uchar**, int*);
126 int sunuint1pack(uchar*, uchar*, uchar**, u1int*);
127 int sunuint1unpack(uchar*, uchar*, uchar**, u1int*);
129 int sunstringpack(uchar*, uchar*, uchar**, char**, u32int);
130 int sunstringunpack(uchar*, uchar*, uchar**, char**, u32int);
131 uint sunstringsize(char*);
133 int sunuint32pack(uchar*, uchar*, uchar**, u32int*);
134 int sunuint32unpack(uchar*, uchar*, uchar**, u32int*);
135 int sunuint64pack(uchar*, uchar*, uchar**, u64int*);
136 int sunuint64unpack(uchar*, uchar*, uchar**, u64int*);
138 int sunvaropaquepack(uchar*, uchar*, uchar**, uchar**, u32int*, u32int);
139 int sunvaropaqueunpack(uchar*, uchar*, uchar**, uchar**, u32int*, u32int);
140 uint sunvaropaquesize(u32int);
142 int sunfixedopaquepack(uchar*, uchar*, uchar**, uchar*, u32int);
143 int sunfixedopaqueunpack(uchar*, uchar*, uchar**, uchar*, u32int);
144 uint sunfixedopaquesize(u32int);
149 typedef struct SunProc SunProc;
150 typedef struct SunProg SunProg;
161 int (*pack)(uchar*, uchar*, uchar**, SunCall*);
162 int (*unpack)(uchar*, uchar*, uchar**, SunCall*);
163 uint (*size)(SunCall*);
164 void (*fmt)(Fmt*, SunCall*);
168 SunStatus suncallpack(SunProg*, uchar*, uchar*, uchar**, SunCall*);
169 SunStatus suncallunpack(SunProg*, uchar*, uchar*, uchar**, SunCall*);
170 SunStatus suncallunpackalloc(SunProg*, SunCallType, uchar*, uchar*, uchar**, SunCall**);
171 void suncallsetup(SunCall*, SunProg*, uint);
172 uint suncallsize(SunProg*, SunCall*);
176 #pragma varargck type "B" SunRpc*
177 #pragma varargck type "C" SunCall*
181 int suncallfmt(Fmt*);
182 void sunfmtinstall(SunProg*);
188 typedef struct SunMsg SunMsg;
189 typedef struct SunSrv SunSrv;
193 SunStackSize = 32768,
204 Channel *creply; /* chan(SunMsg*) */
217 /* implementation use only */
226 SunSrv *sunsrv(void);
228 void sunsrvprog(SunSrv *srv, SunProg *prog, Channel *c);
229 int sunsrvannounce(SunSrv *srv, char *address);
230 int sunsrvudp(SunSrv *srv, char *address);
231 int sunsrvnet(SunSrv *srv, char *address);
232 int sunsrvfd(SunSrv *srv, int fd);
233 void sunsrvthreadcreate(SunSrv *srv, void (*fn)(void*), void*);
234 void sunsrvclose(SunSrv*);
236 int sunmsgreply(SunMsg*, SunCall*);
237 int sunmsgdrop(SunMsg*);
238 int sunmsgreplyerror(SunMsg*, SunStatus);
243 typedef struct SunClient SunClient;
270 SunClient *sundial(char*);
272 int sunclientrpc(SunClient*, ulong, SunCall*, SunCall*, uchar**);
273 void sunclientclose(SunClient*);
274 void sunclientflushrpc(SunClient*, ulong);
275 void sunclientprog(SunClient*, SunProg*);
279 * Provided by callers.
280 * Should remove dependence on this, but hard.
282 void *emalloc(ulong);
283 void *erealloc(void*, ulong);
287 * Sun RPC port mapper; see RFC 1057 Appendix A
290 typedef struct PortMap PortMap;
291 typedef struct PortTNull PortTNull;
292 typedef struct PortRNull PortRNull;
293 typedef struct PortTSet PortTSet;
294 typedef struct PortRSet PortRSet;
295 typedef struct PortTUnset PortTUnset;
296 typedef struct PortRUnset PortRUnset;
297 typedef struct PortTGetport PortTGetport;
298 typedef struct PortRGetport PortRGetport;
299 typedef struct PortTDump PortTDump;
300 typedef struct PortRDump PortRDump;
301 typedef struct PortTCallit PortTCallit;
302 typedef struct PortRCallit PortRCallit;
322 PortProgram = 100000,
325 PortProtoTcp = 6, /* protocol number for TCP/IP */
326 PortProtoUdp = 17 /* protocol number for UDP/IP */
364 struct PortTGetport {
369 struct PortRGetport {
400 extern SunProg portprog;