Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / vsftpd / ascii.h
blob8e9d5a28885c99c28721ac7be48bfa4aceb4b65f
1 #ifndef VSFTP_ASCII_H
2 #define VSFTP_ASCII_H
4 struct mystr;
6 /* vsf_ascii_ascii_to_bin()
7 * PURPOSE
8 * This function converts an input buffer from ascii format to binary format.
9 * This entails ripping out all occurences of '\r' that are followed by '\n'.
10 * The result is stored in "p_out".
11 * PARAMETERS
12 * p_in - the input and output buffer, which MUST BE at least as big as
13 * "in_len" PLUS ONE. This is to cater for a leading '\r' in the
14 * buffer if certain conditions are met.
15 * in_len - the length in bytes of the buffer.
16 * prev_cr - set to non-zero if this buffer fragment was immediately
17 * preceeded by a '\r'.
18 * RETURNS
19 * The number of characters stored in the buffer, the buffer address, and
20 * if we ended on a '\r'.
22 struct ascii_to_bin_ret
24 unsigned int stored;
25 int last_was_cr;
26 char* p_buf;
28 struct ascii_to_bin_ret vsf_ascii_ascii_to_bin(
29 char* p_in, unsigned int in_len, int prev_cr);
31 /* vsf_ascii_bin_to_ascii()
32 * PURPOSE
33 * This function converts an input buffer from binary format to ascii format.
34 * This entails replacing all occurences of '\n' with '\r\n'. The result is
35 * stored in "p_out".
36 * PARAMETERS
37 * p_in - the input buffer, which is not modified
38 * p_out - the output buffer, which MUST BE at least TWICE as big as
39 * "in_len"
40 * in_len - the length in bytes of the input buffer
41 * prev_cr - set to non-zero if this buffer fragment was immediately
42 * preceeded by a '\r'.
43 * RETURNS
44 * The number of characters stored in the output buffer, and whether the last
45 * character stored was '\r'.
47 struct bin_to_ascii_ret
49 unsigned int stored;
50 int last_was_cr;
52 struct bin_to_ascii_ret vsf_ascii_bin_to_ascii(const char* p_in,
53 char* p_out,
54 unsigned int in_len,
55 int prev_cr);
57 #endif /* VSFTP_ASCII_H */