7 /* vsf_cmdio_sock_setup()
9 * Initialise a few socket settings (keepalive, nonagle, etc). on the FTP
12 void vsf_cmdio_sock_setup(void);
16 * Write a response to the FTP control connection.
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
,
25 /* vsf_cmdio_write_hyphen()
27 * Write a response to the FTP control connection, with a hyphen '-'
28 * continuation indicator.
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
,
37 /* vsf_cmdio_write_raw()
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.
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()
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
,
56 /* vsf_cmdio_write_str()
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()
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()
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.
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()
85 * Read an FTP command (and optional argument) from the FTP control connection.
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 */