usbmodeswitch: Updated to v.1.2.6 from shibby's branch.
[tomato.git] / release / src / router / vsftpd / ftpcmdio.h
blob6dec96e6578a485f0d8f12facab98fc51195bc34
1 #ifndef VSF_FTPCMDIO_H
2 #define VSF_FTPCMDIO_H
4 struct mystr;
5 struct vsf_session;
7 /* vsf_cmdio_sock_setup()
8 * PURPOSE
9 * Initialise a few socket settings (keepalive, nonagle, etc). on the FTP
10 * control connection.
12 void vsf_cmdio_sock_setup(void);
14 /* vsf_cmdio_write()
15 * PURPOSE
16 * Write a response to the FTP control connection.
17 * PARAMETERS
18 * p_sess - the current session object
19 * status - the status code to report
20 * p_text - the text to report
22 void vsf_cmdio_write(struct vsf_session* p_sess, int status,
23 const char* p_text);
25 /* vsf_cmdio_write_hyphen()
26 * PURPOSE
27 * Write a response to the FTP control connection, with a hyphen '-'
28 * continuation indicator.
29 * PARAMETERS
30 * p_sess - the current session object
31 * status - the status code to report
32 * p_text - the text to report
34 void vsf_cmdio_write_hyphen(struct vsf_session* p_sess, int status,
35 const char* p_text);
37 /* vsf_cmdio_write_raw()
38 * PURPOSE
39 * Write a raw response to the FTP control connection. A status code is
40 * not prepended, and it is also the client's responsibility to include
41 * newline characters if required.
42 * PARAMETERS
43 * p_sess - the current session object
44 * p_text - the text to report
46 void vsf_cmdio_write_raw(struct vsf_session* p_sess, const char* p_text);
48 /* vsf_cmdio_write_exit()
49 * PURPOSE
50 * The same as vsf_cmdio_write(), and then the calling process is exited. The
51 * write is _guaranteed_ to not block (ditching output if neccessary).
53 void vsf_cmdio_write_exit(struct vsf_session* p_sess, int status,
54 const char* p_text);
56 /* vsf_cmdio_write_str()
57 * PURPOSE
58 * The same as vsf_cmdio_write(), apart from the text is specified as a
59 * string buffer object "p_str".
61 void vsf_cmdio_write_str(struct vsf_session* p_sess, int status,
62 const struct mystr* p_str);
64 /* vsf_cmdio_write_str_hyphen()
65 * PURPOSE
66 * The same as vsf_cmdio_write_str(), apart from the response line is
67 * output with the continuation indicator '-' between the response code and
68 * the response text. This indicates there are more lines of response.
70 void vsf_cmdio_write_str_hyphen(struct vsf_session* p_sess, int status,
71 const struct mystr* p_str);
73 /* vsf_cmdio_set_alarm()
74 * PURPOSE
75 * Activate the control connection inactivity timeout. This is explicitly
76 * exposed in the API so that we can play it safe, and activate the alarm
77 * before _any_ potentially blocking calls.
78 * PARAMETERS
79 * p_sess - The current session object
81 void vsf_cmdio_set_alarm(struct vsf_session* p_sess);
83 /* vsf_cmdio_get_cmd_and_arg()
84 * PURPOSE
85 * Read an FTP command (and optional argument) from the FTP control connection.
86 * PARAMETERS
87 * p_sess - The current session object
88 * p_cmd_str - Where to put the FTP command string (may be empty)
89 * p_arg_str - Where to put the FTP argument string (may be empty)
90 * set_alarm - If true, the control connection inactivity monitor is used
92 void vsf_cmdio_get_cmd_and_arg(struct vsf_session* p_sess,
93 struct mystr* p_cmd_str,
94 struct mystr* p_arg_str, int set_alarm);
96 #endif /* VSF_FTPCMDIO_H */