Lines Matching refs:fwd
107 /* Context for stdio fwd open confirmation callback */
517 format_forward(u_int ftype, struct Forward *fwd)
524 (fwd->listen_path != NULL) ? fwd->listen_path :
525 (fwd->listen_host == NULL) ?
527 fwd->listen_host, fwd->listen_port,
528 (fwd->connect_path != NULL) ? fwd->connect_path :
529 fwd->connect_host, fwd->connect_port);
533 (fwd->listen_host == NULL) ?
535 fwd->listen_host, fwd->listen_port);
539 (fwd->listen_path != NULL) ? fwd->listen_path :
540 (fwd->listen_host == NULL) ?
541 "LOCALHOST" : fwd->listen_host,
542 fwd->listen_port,
543 (fwd->connect_path != NULL) ? fwd->connect_path :
544 fwd->connect_host, fwd->connect_port);
661 struct Forward fwd;
668 memset(&fwd, 0, sizeof(fwd));
691 memset(&fwd, 0, sizeof(fwd));
692 fwd.listen_port = lport;
693 if (fwd.listen_port == PORT_STREAMLOCAL)
694 fwd.listen_path = listen_addr;
696 fwd.listen_host = listen_addr;
697 fwd.connect_port = cport;
698 if (fwd.connect_port == PORT_STREAMLOCAL)
699 fwd.connect_path = connect_addr;
701 fwd.connect_host = connect_addr;
704 (fwd_desc = format_forward(ftype, &fwd)));
717 if (ftype == MUX_FWD_DYNAMIC && fwd.listen_path) {
722 if (fwd.listen_port != PORT_STREAMLOCAL && fwd.listen_port >= 65536) {
724 fwd.listen_port);
727 if ((fwd.connect_port != PORT_STREAMLOCAL && fwd.connect_port >= 65536)
728 || (ftype != MUX_FWD_DYNAMIC && ftype != MUX_FWD_REMOTE && fwd.connect_port == 0)) {
730 fwd.connect_port);
733 if (ftype != MUX_FWD_DYNAMIC && fwd.connect_host == NULL && fwd.connect_path == NULL) {
743 if (compare_forward(&fwd,
756 if (compare_forward(&fwd,
758 if (fwd.listen_port != 0)
784 if (!channel_setup_local_fwd_listener(&fwd,
793 add_local_forward(&options, &fwd);
798 fwd.handle = channel_request_remote_forwarding(&fwd);
799 if (fwd.handle < 0)
801 add_remote_forward(&options, &fwd);
818 free(fwd.listen_host);
819 free(fwd.listen_path);
820 free(fwd.connect_host);
821 free(fwd.connect_path);
829 struct Forward fwd, *found_fwd;
837 memset(&fwd, 0, sizeof(fwd));
860 memset(&fwd, 0, sizeof(fwd));
861 fwd.listen_port = lport;
862 if (fwd.listen_port == PORT_STREAMLOCAL)
863 fwd.listen_path = listen_addr;
865 fwd.listen_host = listen_addr;
866 fwd.connect_port = cport;
867 if (fwd.connect_port == PORT_STREAMLOCAL)
868 fwd.connect_path = connect_addr;
870 fwd.connect_host = connect_addr;
873 (fwd_desc = format_forward(ftype, &fwd)));
881 if (compare_forward(&fwd,
890 if (compare_forward(&fwd,
912 if (channel_cancel_lport_listener(&fwd, fwd.connect_port,
961 debug2("%s: channel %d: request stdio fwd to %s:%u",
1003 debug2("%s: stdio fwd refused by user", __func__);
1037 /* Callback on open confirmation in mux master for a mux stdio fwd session. */
1689 mux_client_forward(int fd, int cancel_flag, u_int ftype, struct Forward *fwd)
1695 fwd_desc = format_forward(ftype, fwd);
1704 if (fwd->listen_path != NULL) {
1705 buffer_put_cstring(&m, fwd->listen_path);
1708 fwd->listen_host == NULL ? "" :
1709 (*fwd->listen_host == '\0' ? "*" : fwd->listen_host));
1711 buffer_put_int(&m, fwd->listen_port);
1712 if (fwd->connect_path != NULL) {
1713 buffer_put_cstring(&m, fwd->connect_path);
1716 fwd->connect_host == NULL ? "" : fwd->connect_host);
1718 buffer_put_int(&m, fwd->connect_port);
1741 fwd->allocated_port = buffer_get_int(&m);
1743 fwd->allocated_port,
1744 fwd->connect_host ? fwd->connect_host : "",
1745 fwd->connect_port);
1747 fprintf(stdout, "%u\n", fwd->allocated_port);