Commit 2a4bf00694016189e8de8646561a6e44bcb1a336
1 parent
c9bcffc4
Exists in
master
and in
3 other branches
Removendo funções sem uso, atualizando tradução
Showing
4 changed files
with
77 additions
and
70 deletions
Show diff stats
iocalls.c
@@ -55,7 +55,7 @@ static void * internal_add_input(int source, H3270 *session, void (*fn)(H3270 *s | @@ -55,7 +55,7 @@ static void * internal_add_input(int source, H3270 *session, void (*fn)(H3270 *s | ||
55 | static void * internal_add_output(int source, H3270 *session, void (*fn)(H3270 *session)); | 55 | static void * internal_add_output(int source, H3270 *session, void (*fn)(H3270 *session)); |
56 | static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 *session)); | 56 | static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 *session)); |
57 | 57 | ||
58 | -static int internal_callthread(int(*callback)(H3270 *, void *), H3270 *session, void *parm); | 58 | +// static int internal_callthread(int(*callback)(H3270 *, void *), H3270 *session, void *parm); |
59 | static int internal_wait(H3270 *hSession, int seconds); | 59 | static int internal_wait(H3270 *hSession, int seconds); |
60 | 60 | ||
61 | static int internal_event_dispatcher(H3270 *hSession, int block); | 61 | static int internal_event_dispatcher(H3270 *hSession, int block); |
@@ -81,8 +81,8 @@ static void internal_ring_bell(H3270 *); | @@ -81,8 +81,8 @@ static void internal_ring_bell(H3270 *); | ||
81 | static void * (*add_except)(int source, H3270 *session, void (*fn)(H3270 *session)) | 81 | static void * (*add_except)(int source, H3270 *session, void (*fn)(H3270 *session)) |
82 | = internal_add_except; | 82 | = internal_add_except; |
83 | 83 | ||
84 | - static int (*callthread)(int(*callback)(H3270 *, void *), H3270 *session, void *parm) | ||
85 | - = internal_callthread; | 84 | +// static int (*callthread)(int(*callback)(H3270 *, void *), H3270 *session, void *parm) |
85 | +// = internal_callthread; | ||
86 | 86 | ||
87 | static int (*wait)(H3270 *hSession, int seconds) | 87 | static int (*wait)(H3270 *hSession, int seconds) |
88 | = internal_wait; | 88 | = internal_wait; |
@@ -621,10 +621,12 @@ retry: | @@ -621,10 +621,12 @@ retry: | ||
621 | 621 | ||
622 | } | 622 | } |
623 | 623 | ||
624 | +/* | ||
624 | static int internal_callthread(int(*callback)(H3270 *, void *), H3270 *session, void *parm) | 625 | static int internal_callthread(int(*callback)(H3270 *, void *), H3270 *session, void *parm) |
625 | { | 626 | { |
626 | return callback(session,parm); | 627 | return callback(session,parm); |
627 | } | 628 | } |
629 | +*/ | ||
628 | 630 | ||
629 | static int internal_wait(H3270 *hSession, int seconds) | 631 | static int internal_wait(H3270 *hSession, int seconds) |
630 | { | 632 | { |
@@ -755,8 +757,8 @@ LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk | @@ -755,8 +757,8 @@ LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk | ||
755 | if(cbk->AddExcept) | 757 | if(cbk->AddExcept) |
756 | add_except = cbk->AddExcept; | 758 | add_except = cbk->AddExcept; |
757 | 759 | ||
758 | - if(cbk->callthread) | ||
759 | - callthread = cbk->callthread; | 760 | +// if(cbk->callthread) |
761 | +// callthread = cbk->callthread; | ||
760 | 762 | ||
761 | if(cbk->Wait) | 763 | if(cbk->Wait) |
762 | wait = cbk->Wait; | 764 | wait = cbk->Wait; |
@@ -771,6 +773,7 @@ LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk | @@ -771,6 +773,7 @@ LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk | ||
771 | 773 | ||
772 | } | 774 | } |
773 | 775 | ||
776 | +/* | ||
774 | LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 *h, void *parm) | 777 | LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 *h, void *parm) |
775 | { | 778 | { |
776 | int rc; | 779 | int rc; |
@@ -786,6 +789,7 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 * | @@ -786,6 +789,7 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 * | ||
786 | 789 | ||
787 | return rc; | 790 | return rc; |
788 | } | 791 | } |
792 | +*/ | ||
789 | 793 | ||
790 | LIB3270_EXPORT void lib3270_main_iterate(H3270 *hSession, int block) | 794 | LIB3270_EXPORT void lib3270_main_iterate(H3270 *hSession, int block) |
791 | { | 795 | { |
proxy.c
@@ -694,15 +694,15 @@ static int proxy_socks4(H3270 *hSession, int fd, char *host, unsigned short port | @@ -694,15 +694,15 @@ static int proxy_socks4(H3270 *hSession, int fd, char *host, unsigned short port | ||
694 | } | 694 | } |
695 | #endif // HAVE_GETADDRINFO | 695 | #endif // HAVE_GETADDRINFO |
696 | 696 | ||
697 | -/* SOCKS version 5 (RFC 1928) proxy. */ | 697 | +/* SOCKS version 5 (RFC 1928) proxy. */ /* |
698 | static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port, int force_d) | 698 | static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port, int force_d) |
699 | { | 699 | { |
700 | union { | 700 | union { |
701 | struct sockaddr sa; | 701 | struct sockaddr sa; |
702 | struct sockaddr_in sin; | 702 | struct sockaddr_in sin; |
703 | -#if defined(AF_INET6) /*[*/ | 703 | +#if defined(AF_INET6) |
704 | struct sockaddr_in6 sin6; | 704 | struct sockaddr_in6 sin6; |
705 | -#endif /*]*/ | 705 | +#endif |
706 | } ha; | 706 | } ha; |
707 | socklen_t ha_len = 0; | 707 | socklen_t ha_len = 0; |
708 | int use_name = 0; | 708 | int use_name = 0; |
@@ -715,7 +715,7 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | @@ -715,7 +715,7 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | ||
715 | char nbuf[256]; | 715 | char nbuf[256]; |
716 | int done = 0; | 716 | int done = 0; |
717 | 717 | ||
718 | -#if defined(X3270_TRACE) /*[*/ | 718 | +#if defined(X3270_TRACE) |
719 | const char *atype_name[] = | 719 | const char *atype_name[] = |
720 | { | 720 | { |
721 | "", | 721 | "", |
@@ -725,7 +725,7 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | @@ -725,7 +725,7 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | ||
725 | "IPv6" | 725 | "IPv6" |
726 | }; | 726 | }; |
727 | unsigned char *portp; | 727 | unsigned char *portp; |
728 | -#endif /*]*/ | 728 | +#endif |
729 | unsigned short rport; | 729 | unsigned short rport; |
730 | 730 | ||
731 | if (force_d) | 731 | if (force_d) |
@@ -734,7 +734,7 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | @@ -734,7 +734,7 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | ||
734 | char errmsg[1024]; | 734 | char errmsg[1024]; |
735 | int rv; | 735 | int rv; |
736 | 736 | ||
737 | - /* Resolve the hostname. */ | 737 | + // Resolve the hostname. |
738 | rv = resolve_host_and_port(hSession,host, CN, &rport, &ha.sa, &ha_len,errmsg, sizeof(errmsg)); | 738 | rv = resolve_host_and_port(hSession,host, CN, &rport, &ha.sa, &ha_len,errmsg, sizeof(errmsg)); |
739 | if (rv == -2) | 739 | if (rv == -2) |
740 | use_name = 1; | 740 | use_name = 1; |
@@ -744,22 +744,22 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | @@ -744,22 +744,22 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | ||
744 | } | 744 | } |
745 | } | 745 | } |
746 | 746 | ||
747 | - /* Send the authentication request to the server. */ | 747 | + // Send the authentication request to the server. |
748 | strcpy((char *)rbuf, "\005\001\000"); | 748 | strcpy((char *)rbuf, "\005\001\000"); |
749 | -#if defined(X3270_TRACE) /*[*/ | 749 | +#if defined(X3270_TRACE) |
750 | trace_dsn(hSession,_("SOCKS5 Proxy: xmit version 5 nmethods 1 (no auth)\n")); | 750 | trace_dsn(hSession,_("SOCKS5 Proxy: xmit version 5 nmethods 1 (no auth)\n")); |
751 | trace_netdata(hSession, '>', rbuf, 3); | 751 | trace_netdata(hSession, '>', rbuf, 3); |
752 | -#endif /*]*/ | 752 | +#endif |
753 | if (send(fd, (const char *) rbuf, 3, 0) < 0) | 753 | if (send(fd, (const char *) rbuf, 3, 0) < 0) |
754 | { | 754 | { |
755 | popup_a_sockerr(hSession,_("SOCKS5 Proxy: send error")); | 755 | popup_a_sockerr(hSession,_("SOCKS5 Proxy: send error")); |
756 | return -1; | 756 | return -1; |
757 | } | 757 | } |
758 | 758 | ||
759 | - /* | ||
760 | - * Wait for the server reply. | ||
761 | - * Read 2 bytes of response. | ||
762 | - */ | 759 | + // |
760 | + // Wait for the server reply. | ||
761 | + // Read 2 bytes of response. | ||
762 | + // | ||
763 | nread = 0; | 763 | nread = 0; |
764 | for (;;) { | 764 | for (;;) { |
765 | fd_set rfds; | 765 | fd_set rfds; |
@@ -772,10 +772,10 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | @@ -772,10 +772,10 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | ||
772 | if (select(fd + 1, &rfds, NULL, NULL, &tv) < 0) | 772 | if (select(fd + 1, &rfds, NULL, NULL, &tv) < 0) |
773 | { | 773 | { |
774 | popup_an_error(hSession,_("SOCKS5 Proxy: server timeout")); | 774 | popup_an_error(hSession,_("SOCKS5 Proxy: server timeout")); |
775 | -#if defined(X3270_TRACE) /*[*/ | 775 | +#if defined(X3270_TRACE) |
776 | if (nread) | 776 | if (nread) |
777 | trace_netdata(hSession, '<', rbuf, nread); | 777 | trace_netdata(hSession, '<', rbuf, nread); |
778 | -#endif /*]*/ | 778 | +#endif |
779 | return -1; | 779 | return -1; |
780 | } | 780 | } |
781 | 781 | ||
@@ -783,28 +783,28 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | @@ -783,28 +783,28 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | ||
783 | if (nr < 0) | 783 | if (nr < 0) |
784 | { | 784 | { |
785 | popup_a_sockerr(hSession,_("SOCKS5 Proxy: receive error")); | 785 | popup_a_sockerr(hSession,_("SOCKS5 Proxy: receive error")); |
786 | -#if defined(X3270_TRACE) /*[*/ | 786 | +#if defined(X3270_TRACE) |
787 | if (nread) | 787 | if (nread) |
788 | trace_netdata(hSession, '<', rbuf, nread); | 788 | trace_netdata(hSession, '<', rbuf, nread); |
789 | -#endif /*]*/ | 789 | +#endif |
790 | return -1; | 790 | return -1; |
791 | } | 791 | } |
792 | if (nr == 0) | 792 | if (nr == 0) |
793 | { | 793 | { |
794 | popup_a_sockerr(hSession,_("SOCKS5 Proxy: unexpected EOF")); | 794 | popup_a_sockerr(hSession,_("SOCKS5 Proxy: unexpected EOF")); |
795 | -#if defined(X3270_TRACE) /*[*/ | 795 | +#if defined(X3270_TRACE) |
796 | if (nread) | 796 | if (nread) |
797 | trace_netdata(hSession, '<', rbuf, nread); | 797 | trace_netdata(hSession, '<', rbuf, nread); |
798 | -#endif /*]*/ | 798 | +#endif |
799 | return -1; | 799 | return -1; |
800 | } | 800 | } |
801 | if (++nread >= 2) | 801 | if (++nread >= 2) |
802 | break; | 802 | break; |
803 | } | 803 | } |
804 | 804 | ||
805 | -#if defined(X3270_TRACE) /*[*/ | 805 | +#if defined(X3270_TRACE) |
806 | trace_netdata(hSession, '<', rbuf, nread); | 806 | trace_netdata(hSession, '<', rbuf, nread); |
807 | -#endif /*]*/ | 807 | +#endif |
808 | 808 | ||
809 | if (rbuf[0] != 0x05 || (rbuf[1] != 0 && rbuf[1] != 0xff)) | 809 | if (rbuf[0] != 0x05 || (rbuf[1] != 0 && rbuf[1] != 0xff)) |
810 | { | 810 | { |
@@ -812,9 +812,9 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | @@ -812,9 +812,9 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | ||
812 | return -1; | 812 | return -1; |
813 | } | 813 | } |
814 | 814 | ||
815 | -#if defined(X3270_TRACE) /*[*/ | 815 | +#if defined(X3270_TRACE) |
816 | trace_dsn(hSession,"SOCKS5 Proxy: recv version %d method %d\n", rbuf[0],rbuf[1]); | 816 | trace_dsn(hSession,"SOCKS5 Proxy: recv version %d method %d\n", rbuf[0],rbuf[1]); |
817 | -#endif /*]*/ | 817 | +#endif |
818 | 818 | ||
819 | if (rbuf[1] == 0xff) | 819 | if (rbuf[1] == 0xff) |
820 | { | 820 | { |
@@ -822,40 +822,40 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | @@ -822,40 +822,40 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | ||
822 | return -1; | 822 | return -1; |
823 | } | 823 | } |
824 | 824 | ||
825 | - /* Send the request to the server. */ | 825 | + // Send the request to the server. |
826 | buf = lib3270_malloc(32 + strlen(host)); | 826 | buf = lib3270_malloc(32 + strlen(host)); |
827 | s = buf; | 827 | s = buf; |
828 | - *s++ = 0x05; /* protocol version 5 */ | ||
829 | - *s++ = 0x01; /* CONNECT */ | ||
830 | - *s++ = 0x00; /* reserved */ | 828 | + *s++ = 0x05; // protocol version 5 |
829 | + *s++ = 0x01; // CONNECT | ||
830 | + *s++ = 0x00; // reserved | ||
831 | if (use_name) { | 831 | if (use_name) { |
832 | - *s++ = 0x03; /* domain name */ | 832 | + *s++ = 0x03; // domain name |
833 | *s++ = strlen(host); | 833 | *s++ = strlen(host); |
834 | strcpy(s, host); | 834 | strcpy(s, host); |
835 | s += strlen(host); | 835 | s += strlen(host); |
836 | } else if (ha.sa.sa_family == AF_INET) { | 836 | } else if (ha.sa.sa_family == AF_INET) { |
837 | - *s++ = 0x01; /* IPv4 */ | 837 | + *s++ = 0x01; // IPv4 |
838 | memcpy(s, &ha.sin.sin_addr, 4); | 838 | memcpy(s, &ha.sin.sin_addr, 4); |
839 | s += 4; | 839 | s += 4; |
840 | strcpy(nbuf, inet_ntoa(ha.sin.sin_addr)); | 840 | strcpy(nbuf, inet_ntoa(ha.sin.sin_addr)); |
841 | -#if defined(AF_INET6) /*[*/ | 841 | +#if defined(AF_INET6) |
842 | } else { | 842 | } else { |
843 | - *s++ = 0x04; /* IPv6 */ | 843 | + *s++ = 0x04; // IPv6 |
844 | memcpy(s, &ha.sin6.sin6_addr, sizeof(struct in6_addr)); | 844 | memcpy(s, &ha.sin6.sin6_addr, sizeof(struct in6_addr)); |
845 | s += sizeof(struct in6_addr); | 845 | s += sizeof(struct in6_addr); |
846 | (void) inet_ntop(AF_INET6, &ha.sin6.sin6_addr, nbuf, sizeof(nbuf)); | 846 | (void) inet_ntop(AF_INET6, &ha.sin6.sin6_addr, nbuf, sizeof(nbuf)); |
847 | -#endif /*]*/ | 847 | +#endif |
848 | } | 848 | } |
849 | SET16(s, port); | 849 | SET16(s, port); |
850 | 850 | ||
851 | -#if defined(X3270_TRACE) /*[*/ | 851 | +#if defined(X3270_TRACE) |
852 | trace_dsn(hSession,"SOCKS5 Proxy: xmit version 5 connect %s %s port %u\n", | 852 | trace_dsn(hSession,"SOCKS5 Proxy: xmit version 5 connect %s %s port %u\n", |
853 | use_name? "domainname": | 853 | use_name? "domainname": |
854 | ((ha.sa.sa_family == AF_INET)? "IPv4": "IPv6"), | 854 | ((ha.sa.sa_family == AF_INET)? "IPv4": "IPv6"), |
855 | use_name? host: nbuf, | 855 | use_name? host: nbuf, |
856 | port); | 856 | port); |
857 | trace_netdata(hSession, '>', (unsigned char *)buf, s - buf); | 857 | trace_netdata(hSession, '>', (unsigned char *)buf, s - buf); |
858 | -#endif /*]*/ | 858 | +#endif |
859 | 859 | ||
860 | if (send(fd, buf, s - buf, 0) < 0) { | 860 | if (send(fd, buf, s - buf, 0) < 0) { |
861 | popup_a_sockerr(hSession,_("SOCKS5 Proxy: send error")); | 861 | popup_a_sockerr(hSession,_("SOCKS5 Proxy: send error")); |
@@ -864,11 +864,11 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | @@ -864,11 +864,11 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | ||
864 | } | 864 | } |
865 | lib3270_free(buf); | 865 | lib3270_free(buf); |
866 | 866 | ||
867 | - /* | ||
868 | - * Process the reply. | ||
869 | - * Only the first two bytes of the response are interesting; | ||
870 | - * skip the rest. | ||
871 | - */ | 867 | + // |
868 | + // Process the reply. | ||
869 | + // Only the first two bytes of the response are interesting; | ||
870 | + // skip the rest. | ||
871 | + // | ||
872 | nread = 0; | 872 | nread = 0; |
873 | done = 0; | 873 | done = 0; |
874 | buf = NULL; | 874 | buf = NULL; |
@@ -892,19 +892,19 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | @@ -892,19 +892,19 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | ||
892 | if (nr < 0) | 892 | if (nr < 0) |
893 | { | 893 | { |
894 | popup_a_sockerr(hSession,_("SOCKS5 Proxy: receive error")); | 894 | popup_a_sockerr(hSession,_("SOCKS5 Proxy: receive error")); |
895 | -#if defined(X3270_TRACE) /*[*/ | 895 | +#if defined(X3270_TRACE) |
896 | if (nread) | 896 | if (nread) |
897 | trace_netdata(hSession, '<', (unsigned char *)buf, nread); | 897 | trace_netdata(hSession, '<', (unsigned char *)buf, nread); |
898 | -#endif /*]*/ | 898 | +#endif |
899 | return -1; | 899 | return -1; |
900 | } | 900 | } |
901 | if (nr == 0) | 901 | if (nr == 0) |
902 | { | 902 | { |
903 | popup_an_error(hSession, _("SOCKS5 Proxy: unexpected EOF")); | 903 | popup_an_error(hSession, _("SOCKS5 Proxy: unexpected EOF")); |
904 | -#if defined(X3270_TRACE) /*[*/ | 904 | +#if defined(X3270_TRACE) |
905 | if (nread) | 905 | if (nread) |
906 | trace_netdata(hSession, '<', (unsigned char *)buf, nread); | 906 | trace_netdata(hSession, '<', (unsigned char *)buf, nread); |
907 | -#endif /*]*/ | 907 | +#endif |
908 | return -1; | 908 | return -1; |
909 | } | 909 | } |
910 | 910 | ||
@@ -916,18 +916,18 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | @@ -916,18 +916,18 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | ||
916 | if (r != 0x05) | 916 | if (r != 0x05) |
917 | { | 917 | { |
918 | popup_an_error(hSession, _("SOCKS5 Proxy: incorrect reply version 0x%02x"), r); | 918 | popup_an_error(hSession, _("SOCKS5 Proxy: incorrect reply version 0x%02x"), r); |
919 | -#if defined(X3270_TRACE) /*[*/ | 919 | +#if defined(X3270_TRACE) |
920 | if (nread) | 920 | if (nread) |
921 | trace_netdata(hSession, '<', (unsigned char *)buf, nread); | 921 | trace_netdata(hSession, '<', (unsigned char *)buf, nread); |
922 | -#endif /*]*/ | 922 | +#endif |
923 | return -1; | 923 | return -1; |
924 | } | 924 | } |
925 | break; | 925 | break; |
926 | case 1: | 926 | case 1: |
927 | -#if defined(X3270_TRACE) /*[*/ | 927 | +#if defined(X3270_TRACE) |
928 | if (r != 0x00) | 928 | if (r != 0x00) |
929 | trace_netdata(hSession, '<', (unsigned char *)buf, nread); | 929 | trace_netdata(hSession, '<', (unsigned char *)buf, nread); |
930 | -#endif /*]*/ | 930 | +#endif |
931 | switch (r) | 931 | switch (r) |
932 | { | 932 | { |
933 | case 0x00: | 933 | case 0x00: |
@@ -973,17 +973,17 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | @@ -973,17 +973,17 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | ||
973 | case 0x03: | 973 | case 0x03: |
974 | n2read = -1; | 974 | n2read = -1; |
975 | break; | 975 | break; |
976 | -#if defined(AF_INET6) /*[*/ | 976 | +#if defined(AF_INET6) |
977 | case 0x04: | 977 | case 0x04: |
978 | n2read = sizeof(struct in6_addr) + 2; | 978 | n2read = sizeof(struct in6_addr) + 2; |
979 | break; | 979 | break; |
980 | -#endif /*]*/ | 980 | +#endif |
981 | default: | 981 | default: |
982 | popup_an_error(hSession, _("SOCKS5 Proxy: unknown server address type 0x%02x"), r); | 982 | popup_an_error(hSession, _("SOCKS5 Proxy: unknown server address type 0x%02x"), r); |
983 | -#if defined(X3270_TRACE) /*[*/ | 983 | +#if defined(X3270_TRACE) |
984 | if (nread) | 984 | if (nread) |
985 | trace_netdata(hSession, '<', (unsigned char *)buf, nread); | 985 | trace_netdata(hSession, '<', (unsigned char *)buf, nread); |
986 | -#endif /*]*/ | 986 | +#endif |
987 | return -1; | 987 | return -1; |
988 | } | 988 | } |
989 | break; | 989 | break; |
@@ -996,29 +996,29 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | @@ -996,29 +996,29 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | ||
996 | } | 996 | } |
997 | } | 997 | } |
998 | 998 | ||
999 | -#if defined(X3270_TRACE) /*[*/ | 999 | +#if defined(X3270_TRACE) |
1000 | trace_netdata(hSession, '<', (unsigned char *)buf, nread); | 1000 | trace_netdata(hSession, '<', (unsigned char *)buf, nread); |
1001 | switch (buf[3]) { | 1001 | switch (buf[3]) { |
1002 | - case 0x01: /* IPv4 */ | 1002 | + case 0x01: // IPv4 |
1003 | memcpy(&ha.sin.sin_addr, &buf[4], 4); | 1003 | memcpy(&ha.sin.sin_addr, &buf[4], 4); |
1004 | strcpy(nbuf, inet_ntoa(ha.sin.sin_addr)); | 1004 | strcpy(nbuf, inet_ntoa(ha.sin.sin_addr)); |
1005 | portp = (unsigned char *)&buf[4 + 4]; | 1005 | portp = (unsigned char *)&buf[4 + 4]; |
1006 | break; | 1006 | break; |
1007 | - case 0x03: /* domainname */ | 1007 | + case 0x03: // domainname |
1008 | strncpy(nbuf, &buf[5], buf[4]); | 1008 | strncpy(nbuf, &buf[5], buf[4]); |
1009 | nbuf[(unsigned char)buf[4]] = '\0'; | 1009 | nbuf[(unsigned char)buf[4]] = '\0'; |
1010 | portp = (unsigned char *)&buf[5 + (unsigned char)buf[4]]; | 1010 | portp = (unsigned char *)&buf[5 + (unsigned char)buf[4]]; |
1011 | break; | 1011 | break; |
1012 | -#if defined(AF_INET6) /*[*/ | ||
1013 | - case 0x04: /* IPv6 */ | 1012 | +#if defined(AF_INET6) |
1013 | + case 0x04: // IPv6 | ||
1014 | memcpy(&ha.sin6.sin6_addr, &buf[4], sizeof(struct in6_addr)); | 1014 | memcpy(&ha.sin6.sin6_addr, &buf[4], sizeof(struct in6_addr)); |
1015 | (void) inet_ntop(AF_INET6, &ha.sin6.sin6_addr, nbuf, | 1015 | (void) inet_ntop(AF_INET6, &ha.sin6.sin6_addr, nbuf, |
1016 | sizeof(nbuf)); | 1016 | sizeof(nbuf)); |
1017 | portp = (unsigned char *)&buf[4 + sizeof(struct in6_addr)]; | 1017 | portp = (unsigned char *)&buf[4 + sizeof(struct in6_addr)]; |
1018 | break; | 1018 | break; |
1019 | -#endif /*]*/ | 1019 | +#endif |
1020 | default: | 1020 | default: |
1021 | - /* can't happen */ | 1021 | + // can't happen |
1022 | nbuf[0] = '\0'; | 1022 | nbuf[0] = '\0'; |
1023 | portp = (unsigned char *)buf; | 1023 | portp = (unsigned char *)buf; |
1024 | break; | 1024 | break; |
@@ -1029,8 +1029,9 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | @@ -1029,8 +1029,9 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port | ||
1029 | atype_name[(unsigned char)buf[3]], | 1029 | atype_name[(unsigned char)buf[3]], |
1030 | nbuf, | 1030 | nbuf, |
1031 | rport); | 1031 | rport); |
1032 | -#endif /*]*/ | 1032 | +#endif |
1033 | lib3270_free(buf); | 1033 | lib3270_free(buf); |
1034 | 1034 | ||
1035 | return 0; | 1035 | return 0; |
1036 | } | 1036 | } |
1037 | +*/ |
resolver.c
@@ -83,7 +83,7 @@ struct parms | @@ -83,7 +83,7 @@ struct parms | ||
83 | * Resolve a hostname and port. | 83 | * Resolve a hostname and port. |
84 | * Returns 0 for success, -1 for fatal error (name resolution impossible), | 84 | * Returns 0 for success, -1 for fatal error (name resolution impossible), |
85 | * -2 for simple error (cannot resolve the name). | 85 | * -2 for simple error (cannot resolve the name). |
86 | - */ | 86 | + */ /* |
87 | static int cresolve_host_and_port(H3270 *h, struct parms *p) | 87 | static int cresolve_host_and_port(H3270 *h, struct parms *p) |
88 | { | 88 | { |
89 | #if defined( HAVE_GETADDRINFO ) || defined(WIN32) | 89 | #if defined( HAVE_GETADDRINFO ) || defined(WIN32) |
@@ -91,7 +91,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | @@ -91,7 +91,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | ||
91 | struct addrinfo hints, *res; | 91 | struct addrinfo hints, *res; |
92 | int rc; | 92 | int rc; |
93 | 93 | ||
94 | - /* Use getaddrinfo() to resolve the hostname and port together. */ | 94 | + // Use getaddrinfo() to resolve the hostname and port together. |
95 | (void) memset(&hints, '\0', sizeof(struct addrinfo)); | 95 | (void) memset(&hints, '\0', sizeof(struct addrinfo)); |
96 | hints.ai_flags = 0; | 96 | hints.ai_flags = 0; |
97 | hints.ai_family = PF_UNSPEC; | 97 | hints.ai_family = PF_UNSPEC; |
@@ -138,7 +138,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | @@ -138,7 +138,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | ||
138 | char *ptr; | 138 | char *ptr; |
139 | struct sockaddr_in *sin = (struct sockaddr_in *) p->sa; | 139 | struct sockaddr_in *sin = (struct sockaddr_in *) p->sa; |
140 | 140 | ||
141 | - /* Get the port number. */ | 141 | + // Get the port number. |
142 | lport = strtoul(p->portname, &ptr, 0); | 142 | lport = strtoul(p->portname, &ptr, 0); |
143 | if (ptr == p->portname || *ptr != '\0' || lport == 0L || lport & ~0xffff) | 143 | if (ptr == p->portname || *ptr != '\0' || lport == 0L || lport & ~0xffff) |
144 | { | 144 | { |
@@ -155,7 +155,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | @@ -155,7 +155,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | ||
155 | } | 155 | } |
156 | *p->pport = ntohs(port); | 156 | *p->pport = ntohs(port); |
157 | 157 | ||
158 | - /* Use gethostbyname() to resolve the hostname. */ | 158 | + // Use gethostbyname() to resolve the hostname. |
159 | hp = gethostbyname(p->host); | 159 | hp = gethostbyname(p->host); |
160 | if (hp == (struct hostent *) 0) | 160 | if (hp == (struct hostent *) 0) |
161 | { | 161 | { |
@@ -178,8 +178,9 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | @@ -178,8 +178,9 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | ||
178 | #endif // HAVE_GETADDRINFO | 178 | #endif // HAVE_GETADDRINFO |
179 | 179 | ||
180 | return 0; | 180 | return 0; |
181 | -} | 181 | +} */ |
182 | 182 | ||
183 | +/* | ||
183 | int resolve_host_and_port(H3270 *hSession, const char *host, char *portname, unsigned short *pport,struct sockaddr *sa, socklen_t *sa_len, char *errmsg, int em_len) | 184 | int resolve_host_and_port(H3270 *hSession, const char *host, char *portname, unsigned short *pport,struct sockaddr *sa, socklen_t *sa_len, char *errmsg, int em_len) |
184 | { | 185 | { |
185 | int rc; | 186 | int rc; |
@@ -203,3 +204,4 @@ int resolve_host_and_port(H3270 *hSession, const char *host, char *portname, uns | @@ -203,3 +204,4 @@ int resolve_host_and_port(H3270 *hSession, const char *host, char *portname, uns | ||
203 | return rc; | 204 | return rc; |
204 | 205 | ||
205 | } | 206 | } |
207 | +*/ |
resolverc.h
@@ -17,6 +17,6 @@ | @@ -17,6 +17,6 @@ | ||
17 | * Hostname resolution. | 17 | * Hostname resolution. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | -LIB3270_INTERNAL int resolve_host_and_port(H3270 *session, const char *host, char *portname, unsigned short *pport,struct sockaddr *sa, socklen_t *sa_len, char *errmsg, int em_size); | 20 | +// LIB3270_INTERNAL int resolve_host_and_port(H3270 *session, const char *host, char *portname, unsigned short *pport,struct sockaddr *sa, socklen_t *sa_len, char *errmsg, int em_size); |
21 | 21 | ||
22 | 22 |