Dillo v3.1.1-98-g318d1f14
|
#include "../dlib/dlib.h"
Go to the source code of this file.
Classes | |
struct | Dsh |
Dpip socket handler type. More... | |
Macros | |
#define | DPIP_TAG 1 |
Dpip tags in the socket. | |
#define | DPIP_LAST_TAG 2 |
Dpip mode-switching tag. | |
#define | DPIP_RAW 4 |
Raw data in the socket | |
#define | DPIP_NONBLOCK 8 |
Nonblocking IO | |
#define | a_Dpip_dsh_printf(sh, flush, ...) |
Enumerations | |
enum | DpipDshStatus { DPIP_EAGAIN , DPIP_ERROR , DPIP_EOF } |
Functions | |
char * | a_Dpip_build_cmd (const char *format,...) |
Printf like function for building dpip commands. | |
char * | a_Dpip_get_attr (const char *tag, const char *attrname) |
Task: given a tag and an attribute name, return its value. | |
char * | a_Dpip_get_attr_l (const char *tag, size_t tagsize, const char *attrname) |
Task: given a tag, its size and an attribute name, return the attribute value (stuffing of ' is removed here). | |
int | a_Dpip_check_auth (const char *auth) |
Check whether the given 'auth' string equals what dpid saved. | |
Dsh * | a_Dpip_dsh_new (int fd_in, int fd_out, int flush_sz) |
Create and initialize a dpip socket handler. | |
int | a_Dpip_dsh_write (Dsh *dsh, int flush, const char *Data, int DataSize) |
Streamed write to socket. | |
int | a_Dpip_dsh_write_str (Dsh *dsh, int flush, const char *str) |
Convenience function. | |
int | a_Dpip_dsh_tryflush (Dsh *dsh) |
int | a_Dpip_dsh_trywrite (Dsh *dsh, const char *Data, int DataSize) |
char * | a_Dpip_dsh_read_token (Dsh *dsh, int blocking) |
Return a newlly allocated string with the next dpip token in the socket. | |
char * | a_Dpip_dsh_read_token2 (Dsh *dsh, int blocking, int *DataSize) |
Return a newlly allocated string with the next dpip token in the socket. | |
void | a_Dpip_dsh_close (Dsh *dsh) |
Close this socket for reading and writing. | |
void | a_Dpip_dsh_free (Dsh *dsh) |
Free the SockHandler structure. | |
#define a_Dpip_dsh_printf | ( | sh, | |
flush, | |||
... | |||
) |
enum DpipDshStatus |
char * a_Dpip_build_cmd | ( | const char * | format, |
... | |||
) |
Printf like function for building dpip commands.
It takes care of dpip escaping of its arguments. NOTE : It ONLY accepts string parameters, and only one s per parameter.
Definition at line 83 of file dpip.c.
References dStr_append(), dStr_append_c(), dStr_free(), dStr_sized_new(), FALSE, Quote, and Dstr::str.
Referenced by a_Bookmarks_add(), a_Bookmarks_chat_add(), a_Cookies_get_query(), a_Cookies_get_query(), a_Cookies_set(), a_Cookies_set(), Bmsrv_dpi_send_status_msg(), Bmsrv_parse_token(), Bmsrv_send_modify_answer(), Bmsrv_send_reload_request(), Capi_dpi_build_cmd(), Capi_dpi_send_source(), Dpi_connect_socket(), Dpi_connect_socket(), Dpi_get_server_port(), Dpi_get_server_port(), Dpiapi_dialog_answer_cb(), File_send_dir(), File_send_error_page(), File_send_file(), File_toggle_html_style(), get_command(), get_message(), main(), main(), send_decoded_data(), send_failure_message(), send_sockport(), srv_parse_tok(), stop_active_dpis(), and try_ftp_transfer().
int a_Dpip_check_auth | ( | const char * | auth_tag | ) |
Check whether the given 'auth' string equals what dpid saved.
Return value: 1 if equal, -1 otherwise
Definition at line 201 of file dpip.c.
References a_Dpip_get_attr(), dFree(), dGethomedir(), dGetline(), dStrconcat(), dStrerror, and MSG_ERR.
Referenced by File_serve_client(), main(), main(), read_req_cb(), and srv_parse_tok().
void a_Dpip_dsh_close | ( | Dsh * | dsh | ) |
Close this socket for reading and writing.
(flush pending data)
Definition at line 504 of file dpip.c.
References a_Dpip_dsh_write(), dClose(), dStrerror, Dsh::fd_in, Dsh::fd_out, and MSG_ERR.
Referenced by File_remove_client(), main(), main(), and read_req_cb().
void a_Dpip_dsh_free | ( | Dsh * | dsh | ) |
Free the SockHandler structure.
Definition at line 525 of file dpip.c.
References dFree(), dReturn_if, dStr_free(), Dsh::rdbuf, and Dsh::wrbuf.
Referenced by File_remove_client(), main(), main(), and read_req_cb().
Dsh * a_Dpip_dsh_new | ( | int | fd_in, |
int | fd_out, | ||
int | flush_sz | ||
) |
Create and initialize a dpip socket handler.
Definition at line 247 of file dpip.c.
References dNew, DPIP_NONBLOCK, DPIP_TAG, dStr_sized_new(), Dsh::fd_in, Dsh::fd_out, Dsh::flush_sz, Dsh::mode, Dsh::rdbuf, Dsh::status, and Dsh::wrbuf.
Referenced by File_add_client(), main(), main(), and read_req_cb().
char * a_Dpip_dsh_read_token | ( | Dsh * | dsh, |
int | blocking | ||
) |
Return a newlly allocated string with the next dpip token in the socket.
Return value: token string on success, NULL otherwise
Definition at line 493 of file dpip.c.
References a_Dpip_dsh_read_token2().
Referenced by File_serve_client(), get_request(), main(), main(), and read_req_cb().
char * a_Dpip_dsh_read_token2 | ( | Dsh * | dsh, |
int | blocking, | ||
int * | DataSize | ||
) |
Return a newlly allocated string with the next dpip token in the socket.
Return value: token string and length on success, NULL otherwise. (useful for handling null characters in the data stream)
Definition at line 438 of file dpip.c.
References Dpip_dsh_read(), DPIP_EOF, DPIP_ERROR, DPIP_LAST_TAG, DPIP_MODE_SWITCH_TAG, DPIP_RAW, DPIP_TAG, DPIP_TAG_END, dStr_erase(), dStr_truncate(), dStrndup(), Dstr::len, Dsh::mode, Dsh::rdbuf, Dsh::status, and Dstr::str.
Referenced by a_Dpip_dsh_read_token(), send_html_text(), send_numbered_text(), and send_plain_text().
int a_Dpip_dsh_tryflush | ( | Dsh * | dsh | ) |
Definition at line 340 of file dpip.c.
References Dpip_dsh_write(), dStr_erase(), Dstr::len, Dstr::str, and Dsh::wrbuf.
Referenced by File_send_file().
int a_Dpip_dsh_trywrite | ( | Dsh * | dsh, |
const char * | Data, | ||
int | DataSize | ||
) |
Definition at line 359 of file dpip.c.
References Dpip_dsh_write(), dStr_append_l(), and Dsh::wrbuf.
Referenced by File_send_file().
int a_Dpip_dsh_write | ( | Dsh * | dsh, |
int | flush, | ||
const char * | Data, | ||
int | DataSize | ||
) |
Streamed write to socket.
Return: 0 on success, 1 on error.
Definition at line 317 of file dpip.c.
References Dpip_dsh_write(), dStr_append_l(), dStr_truncate(), Dstr::len, Dstr::str, and Dsh::wrbuf.
Referenced by a_Dpip_dsh_close(), a_Dpip_dsh_write_str(), main(), send_decoded_data(), send_html_text(), send_numbered_text(), send_plain_text(), and try_ftp_transfer().
int a_Dpip_dsh_write_str | ( | Dsh * | dsh, |
int | flush, | ||
const char * | str | ||
) |
Convenience function.
Definition at line 374 of file dpip.c.
References a_Dpip_dsh_write().
Referenced by Bmsrv_dpi_send_status_msg(), Bmsrv_parse_token(), Bmsrv_send_modify_answer(), Bmsrv_send_modify_page(), Bmsrv_send_modify_page_add_section(), Bmsrv_send_modify_page_add_url(), Bmsrv_send_modify_update(), Bmsrv_send_reload_request(), File_info2html(), File_send_dir(), File_send_error_page(), File_send_file(), File_toggle_html_style(), get_command(), main(), main(), send_bm_page(), send_decoded_data(), send_dpip_tag(), send_failure_message(), send_html_text(), send_numbered_text(), send_plain_text(), srv_parse_tok(), and try_ftp_transfer().
char * a_Dpip_get_attr | ( | const char * | tag, |
const char * | attrname | ||
) |
Task: given a tag and an attribute name, return its value.
(dpip character escaping is removed here) Return value: the attribute value, or NULL if not present or malformed.
Return value: the attribute value, or NULL if not present or malformed.
Definition at line 192 of file dpip.c.
References a_Dpip_get_attr_l().
Referenced by a_Cookies_get_query(), a_Cookies_get_query(), a_Dpip_check_auth(), Dpi_get_server_port(), Dpi_get_server_port(), File_serve_client(), get_command(), get_message(), main(), main(), and read_req_cb().
char * a_Dpip_get_attr_l | ( | const char * | tag, |
size_t | tagsize, | ||
const char * | attrname | ||
) |
Task: given a tag, its size and an attribute name, return the attribute value (stuffing of ' is removed here).
Return value: the attribute value, or NULL if not present or malformed.
Definition at line 134 of file dpip.c.
References dStrndup(), FOUND, MATCH_NAME, Quote, SEEK_NAME, SKIP_QUOTE, and SKIP_VALUE.
Referenced by a_Dpiapi_dialog(), a_Dpip_get_attr(), Bmsrv_parse_token(), Dpi_parse_token(), and srv_parse_tok().