| Tor 0.4.9.3-alpha-dev
    | 
Key-value structures for control reply lines. More...
| Data Structures | |
| struct | control_reply_line_t | 
| A reply line for the control protocol.  More... | |
| Macros | |
| #define | control_reply_line_free(line) | 
| Free and null a control_reply_line_t. | |
| #define | control_reply_free(r) FREE_AND_NULL(smartlist_t, control_reply_free_, (r)) | 
| Free and null a smartlist of control_reply_line_t. | |
| Functions | |
| void | control_reply_line_free_ (control_reply_line_t *line) | 
| 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_clear (smartlist_t *reply) | 
| void | control_reply_free_ (smartlist_t *reply) | 
Key-value structures for control reply lines.
Control reply lines are config_line_t key-value structures with some additional information to help formatting, such as the numeric result code specified in the control protocol and flags affecting the way kvline_encode() formats the kvline.
Generally, modules implementing control commands will work with smartlists of these structures, using functions like control_reply_add_str() for adding a reply line consisting of a single string, or control_reply_add_one_kv() and control_reply_append_kv() for composing a line containing one or more key-value pairs.
| #define control_reply_free | ( | r | ) | FREE_AND_NULL(smartlist_t, control_reply_free_, (r)) | 
Free and null a smartlist of control_reply_line_t.
| r | pointer to smartlist_t of control_reply_line_t to free | 
Definition at line 116 of file control_proto.h.
| #define control_reply_line_free | ( | line | ) | 
Free and null a control_reply_line_t.
| line | pointer to control_reply_line_t to free | 
Definition at line 55 of file control_proto.h.
| void control_reply_add_done | ( | smartlist_t * | reply | ) | 
Add a "250 OK" line to a set of control reply lines
Definition at line 401 of file control_proto.c.
Referenced by handle_control_getinfo(), and handle_control_protocolinfo().
| void control_reply_add_one_kv | ( | smartlist_t * | reply, | 
| int | code, | ||
| int | flags, | ||
| const char * | key, | ||
| const char * | val | ||
| ) | 
Add a single key-value pair as a new reply line to a control reply line list.
| reply | smartlist of pointers to control_reply_line_t | 
| code | numeric control reply code | 
| flags | kvline encoding flags | 
| key | key | 
| val | value | 
Definition at line 338 of file control_proto.c.
Referenced by control_reply_add_str(), handle_control_getconf(), and handle_control_getinfo().
| void control_reply_add_printf | ( | smartlist_t * | reply, | 
| int | code, | ||
| const char * | fmt, | ||
| ... | |||
| ) | 
Format a new reply line
| reply | smartlist of pointers to control_reply_line_t | 
| code | numeric control reply code | 
| fmt | format string | 
Definition at line 387 of file control_proto.c.
Referenced by handle_control_getconf(), and handle_control_getinfo().
| void control_reply_add_str | ( | smartlist_t * | reply, | 
| int | code, | ||
| const char * | s | ||
| ) | 
Add new reply line consisting of the string s
| reply | smartlist of pointers to control_reply_line_t | 
| code | numeric control reply code | 
| s | string containing the rest of the reply line | 
Definition at line 375 of file control_proto.c.
Referenced by add_authmethods(), control_reply_add_done(), control_reply_add_printf(), handle_control_getinfo(), and handle_control_protocolinfo().
| void control_reply_append_kv | ( | smartlist_t * | reply, | 
| const char * | key, | ||
| const char * | val | ||
| ) | 
Append a single key-value pair to last reply line in a control reply line list.
| reply | smartlist of pointers to control_reply_line_t | 
| key | key | 
| val | value | 
Definition at line 357 of file control_proto.c.
Referenced by add_authmethods(), and handle_control_protocolinfo().
| void control_reply_clear | ( | smartlist_t * | reply | ) | 
Clear a smartlist of control_reply_line_t. Doesn't free the smartlist, but does free each individual line.
Definition at line 420 of file control_proto.c.
Referenced by control_reply_free_().
| void control_reply_free_ | ( | smartlist_t * | reply | ) | 
Free a smartlist of control_reply_line_t. Don't call this directly; use the control_reply_free() macro instead.
Definition at line 430 of file control_proto.c.
| void control_reply_line_free_ | ( | control_reply_line_t * | line | ) | 
Free a control_reply_line_t. Don't call this directly; use the control_reply_line_free() macro instead.
Definition at line 409 of file control_proto.c.
| void control_write_reply_line | ( | control_connection_t * | conn, | 
| const control_reply_line_t * | line, | ||
| bool | lastone | ||
| ) | 
Write a single reply line to conn.
| conn | control connection | 
| line | control reply line to write | 
| lastone | true if this is the last reply line of a multi-line reply | 
Definition at line 288 of file control_proto.c.
Referenced by control_write_reply_lines().
| void control_write_reply_lines | ( | control_connection_t * | conn, | 
| smartlist_t * | lines | ||
| ) | 
Write a set of reply lines to conn.
| conn | control connection | 
| lines | smartlist of pointers to control_reply_line_t to write | 
Definition at line 317 of file control_proto.c.
Referenced by handle_control_getconf(), handle_control_getinfo(), and handle_control_protocolinfo().