+void pmap3_set_cb(struct rpc_context *rpc, int status, void *data, void *private_data)
+{
+ struct client *client = private_data;
+ uint32_t res = *(uint32_t *)data;
+
+ if (status == RPC_STATUS_ERROR) {
+ printf("PORTMAP3/SET call failed with \"%s\"\n", (char *)data);
+ exit(10);
+ }
+ if (status != RPC_STATUS_SUCCESS) {
+ printf("PORTMAP3/SET call failed, status:%d\n", status);
+ exit(10);
+ }
+
+ printf("PORTMAP3/SET:\n");
+ printf(" Res:%d\n", res);
+
+ client->is_finished = 1;
+}
+
+void pmap3_unset_cb(struct rpc_context *rpc, int status, void *data, void *private_data)
+{
+ struct client *client = private_data;
+ uint32_t res = *(uint32_t *)data;
+
+ if (status == RPC_STATUS_ERROR) {
+ printf("PORTMAP3/UNSET call failed with \"%s\"\n", (char *)data);
+ exit(10);
+ }
+ if (status != RPC_STATUS_SUCCESS) {
+ printf("PORTMAP3/UNSET call failed, status:%d\n", status);
+ exit(10);
+ }
+
+ printf("PORTMAP3/UNSET:\n");
+ printf(" Res:%d\n", res);
+
+ client->is_finished = 1;
+}
+
+void pmap3_gettime_cb(struct rpc_context *rpc, int status, void *data, void *private_data)
+{
+ struct client *client = private_data;
+ time_t t = *(uint32_t *)data;
+
+ if (status == RPC_STATUS_ERROR) {
+ printf("PORTMAP3/GETTIME call failed with \"%s\"\n", (char *)data);
+ exit(10);
+ }
+ if (status != RPC_STATUS_SUCCESS) {
+ printf("PORTMAP3/GETTIME call failed, status:%d\n", status);
+ exit(10);
+ }
+
+ printf("PORTMAP3/GETTIME:\n");
+ printf(" Time:%d %s\n", (int)t, ctime(&t));
+
+ client->is_finished = 1;
+}
+
+void pmap3_uaddr2taddr_cb(struct rpc_context *rpc, int status, void *data, void *private_data)
+{
+ struct client *client = private_data;
+ struct pmap3_netbuf *nb = data;
+ struct sockaddr_storage *ss;
+ char host[256], port[6];
+ int i;
+
+ if (status == RPC_STATUS_ERROR) {
+ printf("PORTMAP3/UADDR2TADDR call failed with \"%s\"\n", (char *)data);
+ exit(10);
+ }
+ if (status != RPC_STATUS_SUCCESS) {
+ printf("PORTMAP3/UADDR2TADDR call failed, status:%d\n", status);
+ exit(10);
+ }
+
+ printf("PORTMAP3/UADDR2TADDR:\n");
+ printf(" MaxLen:%d\n", nb->maxlen);
+ printf(" ");
+ for (i = 0; i < nb->maxlen; i++) {
+ printf("%02x ", nb->buf.buf_val[i]);
+ if (i %16 == 15) {
+ printf("\n ");
+ }
+ }
+ printf("\n");
+ printf(" ---\n");
+ ss = (struct sockaddr_storage *)&nb->buf.buf_val[0];
+ getnameinfo((struct sockaddr *)ss, sizeof(struct sockaddr_storage),
+ &host[0], sizeof(host), &port[0], sizeof(port),
+ NI_NUMERICHOST|NI_NUMERICSERV);
+ switch (ss->ss_family) {
+ case AF_INET:
+ printf(" IPv4: %s:%s\n", &host[0], &port[0]);
+ break;
+ case AF_INET6:
+ printf(" IPv6: %s:%s\n", &host[0], &port[0]);
+ break;
+ }
+ client->is_finished = 1;
+}
+