ReactOS 0.4.16-dev-340-g0540c21
rpcb_clnt.h File Reference
#include <rpc/types.h>
#include <rpc/rpcb_prot.h>
Include dependency graph for rpcb_clnt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

__BEGIN_DECLS bool_t rpcb_set (const rpcprog_t, const rpcvers_t, const struct netconfig *, const struct netbuf *)
 
bool_t rpcb_unset (const rpcprog_t, const rpcvers_t, const struct netconfig *)
 
rpcblistrpcb_getmaps (const struct netconfig *, const char *)
 
enum clnt_stat rpcb_rmtcall (const struct netconfig *, const char *, const rpcprog_t, const rpcvers_t, const rpcproc_t, const xdrproc_t, const caddr_t, const xdrproc_t, const caddr_t, const struct timeval, const struct netbuf *)
 
bool_t rpcb_getaddr (const rpcprog_t, const rpcvers_t, const struct netconfig *, struct netbuf *, const char *)
 
bool_t rpcb_gettime (const char *, time_t *)
 
charrpcb_taddr2uaddr (struct netconfig *, struct netbuf *)
 
struct netbufrpcb_uaddr2taddr (struct netconfig *, char *)
 

Function Documentation

◆ rpcb_getaddr()

bool_t rpcb_getaddr ( const  rpcprog_t,
const  rpcvers_t,
const struct netconfig nconf,
struct netbuf address,
const char host 
)

Definition at line 939 of file rpcb_clnt.c.

945{
946 struct netbuf *na;
947
949 (struct netconfig *) nconf, (char *) host,
950 (CLIENT **) NULL, (struct timeval *) NULL)) == NULL)
951 return (FALSE);
952
953 if (na->len > address->maxlen) {
954 /* Too long address */
955 free(na->buf);
956 free(na);
958 return (FALSE);
959 }
960 memcpy(address->buf, na->buf, (size_t)na->len);
961 address->len = na->len;
962 free(na->buf);
963 free(na);
964 return (TRUE);
965}
@ RPC_FAILED
Definition: clnt_stat.h:68
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const WCHAR version[]
Definition: asmname.c:66
GLuint address
Definition: glext.h:9393
GLuint program
Definition: glext.h:6723
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct netbuf * __rpcb_findaddr_timed(rpcprog_t program, rpcvers_t version, const struct netconfig *nconf, const char *host, CLIENT **clpp, struct timeval *tp)
Definition: rpcb_clnt.c:709
Definition: types.h:144
void * buf
Definition: types.h:147
unsigned int len
Definition: types.h:146
enum clnt_stat cf_stat
Definition: clnt.h:496
char * host
Definition: whois.c:55

◆ rpcb_getmaps()

rpcblist * rpcb_getmaps ( const struct netconfig ,
const char  
)

◆ rpcb_gettime()

bool_t rpcb_gettime ( const char ,
time_t  
)

◆ rpcb_rmtcall()

enum clnt_stat rpcb_rmtcall ( const struct netconfig ,
const char ,
const  rpcprog_t,
const  rpcvers_t,
const  rpcproc_t,
const  xdrproc_t,
const  caddr_t,
const  xdrproc_t,
const  caddr_t,
const struct timeval  ,
const struct netbuf  
)

◆ rpcb_set()

__BEGIN_DECLS bool_t rpcb_set ( const  rpcprog_t,
const  rpcvers_t,
const struct netconfig nconf,
const struct netbuf address 
)

Definition at line 520 of file rpcb_clnt.c.

525{
526 CLIENT *client;
527 bool_t rslt = FALSE;
528 RPCB parms;
529 char uidbuf[32];
530
531 /* parameter checking */
532 if (nconf == NULL) {
534 return (FALSE);
535 }
536 if (address == NULL) {
538 return (FALSE);
539 }
540 client = local_rpcb();
541 if (! client) {
542 return (FALSE);
543 }
544
545 /* convert to universal */
546 /*LINTED const castaway*/
547 parms.r_addr = taddr2uaddr((struct netconfig *) nconf,
548 (struct netbuf *)address);
549 if (!parms.r_addr) {
552 return (FALSE); /* no universal address */
553 }
554 parms.r_prog = program;
555 parms.r_vers = version;
556 parms.r_netid = nconf->nc_netid;
557 /*
558 * Though uid is not being used directly, we still send it for
559 * completeness. For non-unix platforms, perhaps some other
560 * string or an empty string can be sent.
561 */
562 (void) snprintf(uidbuf, sizeof uidbuf, "%d", 20010 /*geteuid()*/);
563 parms.r_owner = uidbuf;
564
566 (char *)&parms, (xdrproc_t) xdr_bool,
567 (char *)&rslt, tottimeout);
568
570 free(parms.r_addr);
571 return (rslt);
572}
bool_t xdr_bool(XDR *xdrs, bool_t *bp)
Definition: xdr.c:428
#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs)
Definition: clnt.h:199
#define CLNT_DESTROY(rh)
Definition: clnt.h:275
@ RPC_UNKNOWNADDR
Definition: clnt_stat.h:50
@ RPC_N2AXLATEFAILURE
Definition: clnt_stat.h:59
@ RPC_UNKNOWNPROTO
Definition: clnt_stat.h:49
int32_t bool_t
Definition: types.h:101
u_int32_t rpcproc_t
Definition: types.h:106
char * taddr2uaddr(const struct netconfig *nconf, const struct netbuf *nbuf)
Definition: rpc_generic.c:609
static struct timeval tottimeout
Definition: rpcb_clnt.c:63
static CLIENT * local_rpcb(void)
Definition: rpcb_clnt.c:420
bool_t xdr_rpcb(XDR *xdrs, RPCB *objp)
Definition: rpcb_prot.c:50
#define RPCBPROC_SET
Definition: rpcb_prot.h:682
static FILE * client
Definition: client.c:41
char * nc_netid
Definition: netconfig.h:16
char * r_netid
Definition: rpcb_prot.h:143
rpcvers_t r_vers
Definition: rpcb_prot.h:142
char * r_owner
Definition: rpcb_prot.h:145
rpcprog_t r_prog
Definition: rpcb_prot.h:141
char * r_addr
Definition: rpcb_prot.h:144
#define snprintf
Definition: wintirpc.h:48
bool_t(* xdrproc_t)(XDR *,...)
Definition: xdr.h:144

Referenced by pmap_set(), and svc_reg().

◆ rpcb_taddr2uaddr()

char * rpcb_taddr2uaddr ( struct netconfig nconf,
struct netbuf taddr 
)

Definition at line 1170 of file rpcb_clnt.c.

1173{
1174 CLIENT *client;
1175 char *uaddr = NULL;
1176
1177
1178 /* parameter checking */
1179 if (nconf == NULL) {
1181 return (NULL);
1182 }
1183 if (taddr == NULL) {
1185 return (NULL);
1186 }
1187 client = local_rpcb();
1188 if (! client) {
1189 return (NULL);
1190 }
1191
1193 (xdrproc_t) xdr_netbuf, (char *)(void *)taddr,
1194 (xdrproc_t) xdr_wrapstring, (char *)(void *)&uaddr, tottimeout);
1196 return (uaddr);
1197}
bool_t xdr_wrapstring(XDR *, char **)
Definition: xdr.c:772
bool_t xdr_netbuf(XDR *xdrs, struct netbuf *objp)
Definition: rpcb_prot.c:344
#define RPCBPROC_TADDR2UADDR
Definition: rpcb_prot.h:703

◆ rpcb_uaddr2taddr()

struct netbuf * rpcb_uaddr2taddr ( struct netconfig nconf,
char uaddr 
)

Definition at line 1204 of file rpcb_clnt.c.

1207{
1208 CLIENT *client;
1209 struct netbuf *taddr;
1210
1211
1212 /* parameter checking */
1213 if (nconf == NULL) {
1215 return (NULL);
1216 }
1217 if (uaddr == NULL) {
1219 return (NULL);
1220 }
1221 client = local_rpcb();
1222 if (! client) {
1223 return (NULL);
1224 }
1225
1226 taddr = (struct netbuf *)calloc(1, sizeof (struct netbuf));
1227 if (taddr == NULL) {
1229 return (NULL);
1230 }
1232 (xdrproc_t) xdr_wrapstring, (char *)(void *)&uaddr,
1233 (xdrproc_t) xdr_netbuf, (char *)(void *)taddr,
1234 tottimeout) != RPC_SUCCESS) {
1235 free(taddr);
1236 taddr = NULL;
1237 }
1239 return (taddr);
1240}
@ RPC_SUCCESS
Definition: clnt_stat.h:22
#define calloc
Definition: rosglue.h:14
#define RPCBPROC_UADDR2TADDR
Definition: rpcb_prot.h:700

◆ rpcb_unset()

bool_t rpcb_unset ( const  rpcprog_t,
const  rpcvers_t,
const struct netconfig nconf 
)

Definition at line 581 of file rpcb_clnt.c.

585{
586 CLIENT *client;
587 bool_t rslt = FALSE;
588 RPCB parms;
589 char uidbuf[32];
590
591 client = local_rpcb();
592 if (! client) {
593 return (FALSE);
594 }
595
596 parms.r_prog = program;
597 parms.r_vers = version;
598 if (nconf)
599 parms.r_netid = nconf->nc_netid;
600 else {
601 /*LINTED const castaway*/
602 parms.r_netid = (char *) &nullstring[0]; /* unsets all */
603 }
604 /*LINTED const castaway*/
605 parms.r_addr = (char *) &nullstring[0];
606 (void) snprintf(uidbuf, sizeof uidbuf, "%d", 20010 /*geteuid()*/);
607 parms.r_owner = uidbuf;
608
610 (char *)(void *)&parms, (xdrproc_t) xdr_bool,
611 (char *)(void *)&rslt, tottimeout);
612
614 return (rslt);
615}
static const char nullstring[]
Definition: rpcb_clnt.c:69
#define RPCBPROC_UNSET
Definition: rpcb_prot.h:685

Referenced by pmap_unset(), rpc_reg(), svc_create(), svc_tp_create(), and svc_unreg().