Author: hgomez
Date: Tue Apr 24 01:02:47 2007
New Revision: 531819
URL: http://svn.apache.org/viewvc?view=rev&rev=531819
Log:
Define a jk_inet_addr. On i5/OS jk_inet_addr make ASCII-EBCDIC conversion then
call inet_addr.
On other platform jk_inet_addr = inet_addr
Modified:
tomcat/connectors/trunk/jk/native/common/jk_connect.c
tomcat/connectors/trunk/jk/native/common/jk_connect.h
Modified: tomcat/connectors/trunk/jk/native/common/jk_connect.c
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_connect.c?view=diff&rev=531819&r1=531818&r2=531819
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_connect.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_connect.c Tue Apr 24 01:02:47
2007
@@ -222,6 +222,27 @@
}
#endif
+
+#ifdef AS400_UTF8
+
+/*
+ * i5/OS V5R4 need EBCDIC for its runtime calls but APR/APACHE works in UTF
+ */
+in_addr_t jk_inet_addr(const char * addrstr)
+{
+ in_addr_t addr;
+ char *ptr;
+
+ ptr = (char *)malloc(strlen(addrstr) + 1);
+ jk_ascii2ebcdic((char *)addrstr, ptr);
+ addr = inet_addr(ptr);
+ free(ptr);
+
+ return(addr);
+}
+
+#endif
+
/** resolve the host IP */
int jk_resolve(const char *host, int port, struct sockaddr_in *rc)
@@ -271,11 +292,7 @@
apr_sockaddr_ip_get(&remote_ipaddr, remote_sa);
- /* i5/OS V5R4 need EBCDIC for its runtime calls but APR/APACHE
works in UTF */
-#ifdef AS400_UTF8
- jk_ascii2ebcdic(remote_ipaddr, remote_ipaddr);
-#endif
- laddr.s_addr = inet_addr(remote_ipaddr);
+ laddr.s_addr = jk_inet_addr(remote_ipaddr);
#else /* HAVE_APR */
@@ -295,12 +312,8 @@
#endif /* HAVE_APR */
}
else {
- /* i5/OS V5R4 need EBCDIC for its runtime calls but APR/APACHE
works in UTF */
-#ifdef AS400_UTF8
- jk_ascii2ebcdic((char *)host, (char *)host);
-#endif
/* If we found only digits we use inet_addr() */
- laddr.s_addr = inet_addr(host);
+ laddr.s_addr = jk_inet_addr(host);
}
memcpy(&(rc->sin_addr), &laddr, sizeof(laddr));
Modified: tomcat/connectors/trunk/jk/native/common/jk_connect.h
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_connect.h?view=diff&rev=531819&r1=531818&r2=531819
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_connect.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_connect.h Tue Apr 24 01:02:47
2007
@@ -56,6 +56,17 @@
int jk_is_socket_connected(jk_sock_t sd);
+
+/***
+ * i5/OS V5R4 need ASCII<->EBCDIC translation for inet_addr() call
+ */
+#if !defined(AS400_UTF8)
+
+#define jk_inet_addr inet_addr
+
+#endif
+
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]