Tor
0.4.7.0-alpha-dev
|
Formatting functions for controller data. More...
#include "core/or/or.h"
#include "core/mainloop/connection.h"
#include "core/or/circuitbuild.h"
#include "core/or/circuitlist.h"
#include "core/or/connection_edge.h"
#include "feature/control/control_proto.h"
#include "feature/nodelist/nodelist.h"
#include "core/or/cpath_build_state_st.h"
#include "core/or/entry_connection_st.h"
#include "core/or/or_connection_st.h"
#include "core/or/origin_circuit_st.h"
#include "core/or/socks_request_st.h"
#include "feature/control/control_connection_st.h"
#include "lib/container/smartlist.h"
#include "lib/encoding/kvline.h"
Go to the source code of this file.
Functions | |
void | connection_write_str_to_buf (const char *s, control_connection_t *conn) |
void | connection_printf_to_buf (control_connection_t *conn, const char *format,...) |
size_t | write_escaped_data (const char *data, size_t len, char **out) |
size_t | read_escaped_data (const char *data, size_t len, char **out) |
void | send_control_done (control_connection_t *conn) |
void | control_write_reply (control_connection_t *conn, int code, int c, const char *s) |
void | control_vprintf_reply (control_connection_t *conn, int code, int c, const char *fmt, va_list ap) |
void | control_write_endreply (control_connection_t *conn, int code, const char *s) |
void | control_printf_endreply (control_connection_t *conn, int code, const char *fmt,...) |
void | control_write_midreply (control_connection_t *conn, int code, const char *s) |
void | control_printf_midreply (control_connection_t *conn, int code, const char *fmt,...) |
void | control_write_datareply (control_connection_t *conn, int code, const char *s) |
void | control_printf_datareply (control_connection_t *conn, int code, const char *fmt,...) |
void | control_write_data (control_connection_t *conn, const char *data) |
void | control_write_reply_line (control_connection_t *conn, const control_reply_line_t *line, bool lastone) |
void | control_write_reply_lines (control_connection_t *conn, smartlist_t *lines) |
void | control_reply_add_one_kv (smartlist_t *reply, int code, int flags, const char *key, const char *val) |
void | control_reply_append_kv (smartlist_t *reply, const char *key, const char *val) |
void | control_reply_add_str (smartlist_t *reply, int code, const char *s) |
void | control_reply_add_printf (smartlist_t *reply, int code, const char *fmt,...) |
void | control_reply_add_done (smartlist_t *reply) |
void | control_reply_line_free_ (control_reply_line_t *line) |
void | control_reply_clear (smartlist_t *reply) |
void | control_reply_free_ (smartlist_t *reply) |
Formatting functions for controller data.
Definition in file control_proto.c.
void connection_printf_to_buf | ( | control_connection_t * | conn, |
const char * | format, | ||
... | |||
) |
Acts like sprintf, but writes its formatted string to the end of conn->outbuf.
Definition at line 41 of file control_proto.c.
Referenced by control_write_reply().
void connection_write_str_to_buf | ( | const char * | s, |
control_connection_t * | conn | ||
) |
Append a NUL-terminated string s to the end of conn->outbuf.
Definition at line 32 of file control_proto.c.
Referenced by control_send_http_reject().
void control_printf_datareply | ( | control_connection_t * | conn, |
int | code, | ||
const char * | fmt, | ||
... | |||
) |
Write a formatted DataReplyLine
Definition at line 259 of file control_proto.c.
Referenced by control_write_reply_line().
void control_printf_endreply | ( | control_connection_t * | conn, |
int | code, | ||
const char * | fmt, | ||
... | |||
) |
Write a formatted EndReplyLine
Definition at line 221 of file control_proto.c.
Referenced by handle_control_command(), handle_control_hspost(), handle_control_postdescriptor(), handle_control_protocolinfo(), handle_control_usefeature(), and handle_single_control_command().
void control_printf_midreply | ( | control_connection_t * | conn, |
int | code, | ||
const char * | fmt, | ||
... | |||
) |
Write a formatted MidReplyLine
Definition at line 240 of file control_proto.c.
void control_vprintf_reply | ( | control_connection_t * | conn, |
int | code, | ||
int | c, | ||
const char * | fmt, | ||
va_list | ap | ||
) |
Write a formatted reply to the control channel.
conn | control connection |
code | numeric result code |
c | separator character, usually ' ', '-', or '+' |
fmt | format string |
ap | va_list from caller |
Definition at line 197 of file control_proto.c.
Referenced by control_printf_datareply(), control_printf_endreply(), and control_printf_midreply().
void control_write_data | ( | control_connection_t * | conn, |
const char * | data | ||
) |
Write a CmdData
Definition at line 271 of file control_proto.c.
Referenced by control_write_reply_line().
void control_write_datareply | ( | control_connection_t * | conn, |
int | code, | ||
const char * | s | ||
) |
Write a DataReplyLine
Definition at line 252 of file control_proto.c.
void control_write_endreply | ( | control_connection_t * | conn, |
int | code, | ||
const char * | s | ||
) |
Write an EndReplyLine
Definition at line 214 of file control_proto.c.
Referenced by control_write_reply_line(), handle_control_getinfo(), handle_control_hspost(), handle_control_postdescriptor(), handle_control_saveconf(), and send_control_done().
void control_write_midreply | ( | control_connection_t * | conn, |
int | code, | ||
const char * | s | ||
) |
Write a MidReplyLine
Definition at line 233 of file control_proto.c.
Referenced by control_write_reply_line().
void control_write_reply | ( | control_connection_t * | conn, |
int | code, | ||
int | c, | ||
const char * | s | ||
) |
Write a reply to the control channel.
conn | control connection |
code | numeric result code |
c | separator character, usually ' ', '-', or '+' |
s | string reply content |
Definition at line 183 of file control_proto.c.
Referenced by control_write_datareply(), control_write_endreply(), and control_write_midreply().
size_t read_escaped_data | ( | const char * | data, |
size_t | len, | ||
char ** | out | ||
) |
Given a len-character string in data, made of lines terminated by CRLF, allocate a new string in *out, and copy the contents of data into *out, removing any period that appears at the start of a line, and replacing all CRLF sequences with LF. Return the number of bytes in *out.
This corresponds to CmdData in control-spec.txt.
Definition at line 130 of file control_proto.c.
void send_control_done | ( | control_connection_t * | conn | ) |
Send a "DONE" message down the control connection conn.
Definition at line 169 of file control_proto.c.
Referenced by handle_control_hspost(), handle_control_postdescriptor(), and handle_control_saveconf().
size_t write_escaped_data | ( | const char * | data, |
size_t | len, | ||
char ** | out | ||
) |
Given a len-character string in data, made of lines terminated by CRLF, allocate a new string in *out, and copy the contents of data into *out, adding a period before any period that appears at the start of a line, and adding a period-CRLF line at the end. Replace all LF characters sequences with CRLF. Return the number of bytes in *out.
This corresponds to CmdData in control-spec.txt.
Definition at line 71 of file control_proto.c.
Referenced by control_write_data().