*/
apr_status_t ap_init_ebcdic(apr_pool_t *pool);
+/**
+ * Convert protocol data from the implementation character
+ * set to ASCII.
+ * @param buffer buffer to translate
+ * @param len number of bytes to translate
+ */
+void ap_xlate_proto_to_ascii(char *buffer, apr_size_t len);
+
+/**
+ * Convert protocol data to the implementation character
+ * set from ASCII.
+ * @param buffer buffer to translate
+ * @param len number of bytes to translate
+ */
+void ap_xlate_proto_from_ascii(char *buffer, apr_size_t len);
+
#ifdef __cplusplus
}
#endif
+#else /* CHARSET_EBCDIC */
+
+#define ap_xlate_proto_to_ascii(x,y) /* NOOP */
+#define ap_xlate_proto_from_ascii(x,y) /* NOOP */
+
#endif /* CHARSET_EBCDIC */
#endif /* !APACHE_UTIL_EBCDIC_H */
/* XXX might be nice to have APR_OFF_T_FMT_HEX */
hdr_len = apr_snprintf(chunk_hdr, sizeof(chunk_hdr),
"%qx" CRLF, (apr_uint64_t)bytes);
-#ifdef CHARSET_EBCDIC
- {
- apr_size_t inbytes_left = hdr_len, outbytes_left = hdr_len;
-
- apr_xlate_conv_buffer(ap_hdrs_to_ascii,
- chunk_hdr, &inbytes_left,
- chunk_hdr, &outbytes_left);
- }
-#endif
+ ap_xlate_proto_to_ascii(chunk_hdr, hdr_len);
e = ap_bucket_create_transient(chunk_hdr, hdr_len);
AP_BRIGADE_INSERT_HEAD(b, e);
char *cp;
char buffer[RFC1413_MAXDATA + 1];
int buflen;
-#ifdef CHARSET_EBCDIC
- apr_size_t inbytes_left, outbytes_left;
-#endif
/*
* Bind the local and remote ends of the query socket to the same
/* send the data */
buflen = apr_snprintf(buffer, sizeof(buffer), "%u,%u\r\n", sav_rmt_port,
sav_our_port);
-#ifdef CHARSET_EBCDIC
- inbytes_left = outbytes_left = buflen;
- apr_xlate_conv_buffer(ap_hdrs_to_ascii, buffer, &inbytes_left,
- buffer, &outbytes_left);
-#endif
+ ap_xlate_proto_to_ascii(buffer, buflen);
/* send query to server. Handle short write. */
i = 0;
/*
* Read response from server. - the response should be newline
- * terminated according to rfc - make sure it doesn't stomp it's
+ * terminated according to rfc - make sure it doesn't stomp its
* way out of the buffer.
*/
}
/* RFC1413_USERLEN = 512 */
-#ifdef CHARSET_EBCDIC
- inbytes_left = outbytes_left = i;
- apr_xlate_conv_buffer(ap_hdrs_from_ascii, buffer, &inbytes_left,
- buffer, &outbytes_left);
-#endif
+ ap_xlate_proto_from_ascii(buffer, i);
if (sscanf(buffer, "%u , %u : USERID :%*[^:]:%512s", &rmt_port, &our_port,
user) != 3 || sav_rmt_port != rmt_port
|| sav_our_port != our_port)
return APR_SUCCESS;
}
+void ap_xlate_proto_to_ascii(char *buffer, apr_size_t len)
+{
+ apr_size_t inbytes_left, outbytes_left;
+
+ inbytes_left = outbytes_left = len;
+ apr_xlate_conv_buffer(ap_hdrs_to_ascii, buffer, &inbytes_left,
+ buffer, &outbytes_left);
+}
+
+void ap_xlate_proto_from_ascii(char *buffer, apr_size_t len)
+{
+ apr_size_t inbytes_left, outbytes_left;
+
+ inbytes_left = outbytes_left = len;
+ apr_xlate_conv_buffer(ap_hdrs_from_ascii, buffer, &inbytes_left,
+ buffer, &outbytes_left);
+}
+
#endif /* CHARSET_EBCDIC */