Lines Matching +full:host +full:- +full:port
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
116 int port; /* host order */ in rpc_call() local
124 port = rpc_getport(d, prog, vers); in rpc_call()
125 if (port == -1) in rpc_call()
126 return (-1); in rpc_call()
128 d->destport = htons(port); in rpc_call()
138 send_head -= sizeof(*auth); in rpc_call()
140 auth->authtype = htonl(RPCAUTH_NULL); in rpc_call()
141 auth->authlen = 0; in rpc_call()
144 send_head -= sizeof(struct auth_unix); in rpc_call()
146 send_head -= sizeof(*auth); in rpc_call()
148 auth->authtype = htonl(RPCAUTH_UNIX); in rpc_call()
149 auth->authlen = htonl(sizeof(struct auth_unix)); in rpc_call()
152 send_head -= sizeof(*call); in rpc_call()
155 call->rp_xid = htonl(rpc_xid); in rpc_call()
156 call->rp_direction = htonl(RPC_CALL); in rpc_call()
157 call->rp_rpcvers = htonl(RPC_VER2); in rpc_call()
158 call->rp_prog = htonl(prog); in rpc_call()
159 call->rp_vers = htonl(vers); in rpc_call()
160 call->rp_proc = htonl(proc); in rpc_call()
164 sendudp, send_head, send_tail - send_head, in rpc_call()
171 if (cc == -1) in rpc_call()
172 return (-1); in rpc_call()
177 return (-1); in rpc_call()
184 auth = &reply->rp_u.rpu_rok.rok_auth; in rpc_call()
185 x = ntohl(auth->authlen); in rpc_call()
193 return (-1); in rpc_call()
195 x = ntohl(reply->rp_u.rpu_rok.rok_status); in rpc_call()
200 return (-1); in rpc_call()
203 rsize = cc - sizeof(*reply); in rpc_call()
232 return (-1); in recvrpc()
235 x = ntohl(reply->rp_xid); in recvrpc()
242 return (-1); in recvrpc()
245 x = ntohl(reply->rp_direction); in recvrpc()
252 return (-1); in recvrpc()
255 x = ntohl(reply->rp_astatus); in recvrpc()
257 errno = ntohl(reply->rp_u.rpu_errno); in recvrpc()
260 return (-1); in recvrpc()
271 * dig out the IP address/port from the headers.
274 rpc_fromaddr(void *pkt, struct in_addr *addr, u_short *port) in rpc_fromaddr() argument
281 uint16_t uh_sport; /* source port */ in rpc_fromaddr()
282 uint16_t uh_dport; /* destination port */ in rpc_fromaddr()
289 hhdr = ((struct hackhdr *)pkt) - 1; in rpc_fromaddr()
290 addr->s_addr = hhdr->ip_src; in rpc_fromaddr()
291 *port = hhdr->uh_sport; in rpc_fromaddr()
302 u_int prog; /* host order */
303 u_int vers; /* host order */
304 int port; /* host order */ member
308 * return port number in host order, or -1.
311 * prog .. host order.
312 * vers .. host order.
320 if (pl->addr.s_addr == addr.s_addr && in rpc_pmap_getcache()
321 pl->prog == prog && pl->vers == vers ) in rpc_pmap_getcache()
323 return (pl->port); in rpc_pmap_getcache()
326 return (-1); in rpc_pmap_getcache()
332 * prog .. host order.
333 * vers .. host order.
334 * port .. host order.
337 rpc_pmap_putcache(struct in_addr addr, u_int prog, u_int vers, int port) in rpc_pmap_putcache() argument
343 /* ... just re-use the last entry. */ in rpc_pmap_putcache()
344 rpc_pmap_num = PMAP_NUM - 1; in rpc_pmap_putcache()
354 pl->addr = addr; in rpc_pmap_putcache()
355 pl->prog = prog; in rpc_pmap_putcache()
356 pl->vers = vers; in rpc_pmap_putcache()
357 pl->port = port; in rpc_pmap_putcache()
362 * Request a port number from the port mapper.
363 * Returns the port in host order.
364 * prog and vers are host order.
373 n_long port; /* call port (unused) */ in rpc_getport() member
376 n_long port; in rpc_getport() member
384 int port; in rpc_getport() local
393 port = PMAPPORT; in rpc_getport()
398 port = rpc_pmap_getcache(d->destip, prog, vers); in rpc_getport()
399 if (port != -1) in rpc_getport()
403 args->prog = htonl(prog); in rpc_getport()
404 args->vers = htonl(vers); in rpc_getport()
405 args->proto = htonl(IPPROTO_UDP); in rpc_getport()
406 args->port = 0; in rpc_getport()
415 return (-1); in rpc_getport()
417 port = (int)ntohl(res->port); in rpc_getport()
420 rpc_pmap_putcache(d->destip, prog, vers, port); in rpc_getport()
425 printf("%s: port=%u\n", __func__, port); in rpc_getport()
427 return (port); in rpc_getport()