Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Goulet
Tor
Commits
81922a12
Commit
81922a12
authored
May 10, 2004
by
Nick Mathewson
🏃
Browse files
More doxygenation.
svn:r1832
parent
397466a2
Changes
14
Hide whitespace changes
Inline
Side-by-side
src/or/connection.c
View file @
81922a12
...
...
@@ -13,7 +13,7 @@
extern
or_options_t
options
;
/**< command-line and config-file options */
/** Array of strings to make conn->type human-readable */
/** Array of strings to make conn-
\
>type human-readable */
char
*
conn_type_to_string
[]
=
{
""
,
/* 0 */
"OP listener"
,
/* 1 */
...
...
@@ -29,7 +29,7 @@ char *conn_type_to_string[] = {
"CPU worker"
,
/* 11 */
};
/** Array of string arrays to make {conn->type,conn->state} human-readable */
/** Array of string arrays to make {conn-
\
>type,conn-
\
>state} human-readable */
char
*
conn_state_to_string
[][
_CONN_TYPE_MAX
+
1
]
=
{
{
NULL
},
/* no type associated with 0 */
{
NULL
},
/* op listener, obsolete */
...
...
@@ -82,7 +82,7 @@ static int connection_receiver_bucket_should_increase(connection_t *conn);
/** Allocate space for a new connection_t. This function just initializes
* conn; you must call connection_add() to link it into the main array.
*
* Set conn->type to
'
type
'
. Set conn->s and conn->poll_index to
* Set conn-
\
>type to
<b>
type
</b>
. Set conn-
\
>s and conn-
\
>poll_index to
* -1 to signify they are not yet assigned.
*
* If conn is not a listener type, allocate buffers for it. If it's
...
...
@@ -357,7 +357,7 @@ int connection_create_listener(char *bindaddress, uint16_t bindport, int type) {
}
/** The listener connection <b>conn</b> told poll() it wanted to read.
* Call accept() on conn->s, and add the new connection if necessary.
* Call accept() on conn-
\
>s, and add the new connection if necessary.
*/
static
int
connection_handle_listener_read
(
connection_t
*
conn
,
int
new_type
)
{
int
news
;
/* the new socket */
...
...
@@ -421,11 +421,11 @@ static int connection_init_accepted_conn(connection_t *conn) {
/** Take conn, make a nonblocking socket; try to connect to
* addr:port (they arrive in *host order*). If fail, return -1. Else
* assign s to conn->s: if connected return 1, if
eagain
return 0.
* assign s to conn->
\
s: if connected return 1, if
EAGAIN
return 0.
*
* address is used to make the logs useful.
*
* On success, add
'
conn
'
to the list of polled connections.
* On success, add conn to the list of polled connections.
*/
int
connection_connect
(
connection_t
*
conn
,
char
*
address
,
uint32_t
addr
,
uint16_t
port
)
{
int
s
;
...
...
@@ -522,7 +522,7 @@ int retry_all_connections(void) {
return
0
;
}
extern
int
global_read_bucket
;
/**< from main.c */
extern
int
global_read_bucket
;
/** How many bytes at most can we read onto this connection? */
int
connection_bucket_read_limit
(
connection_t
*
conn
)
{
...
...
@@ -643,7 +643,7 @@ static int connection_receiver_bucket_should_increase(connection_t *conn) {
return
1
;
}
/** Read bytes from conn->s and process them.
/** Read bytes from conn->
\
s and process them.
*
* This function gets called from conn_read() in main.c, either
* when poll() has declared that conn wants to read, or (for OR conns)
...
...
@@ -687,7 +687,7 @@ int connection_handle_read(connection_t *conn) {
return
0
;
}
/** Pull in new bytes from conn->s onto conn->inbuf, either
/** Pull in new bytes from conn-
\
>s onto conn-
\
>inbuf, either
* directly or via TLS. Reduce the token buckets by the number of
* bytes read.
*
...
...
@@ -745,7 +745,7 @@ int connection_fetch_from_buf(char *string, int len, connection_t *conn) {
return
fetch_from_buf
(
string
,
len
,
conn
->
inbuf
);
}
/** Return conn->outbuf_flushlen: how many bytes conn wants to flush
/** Return conn-
\
>outbuf_flushlen: how many bytes conn wants to flush
* from its outbuf. */
int
connection_wants_to_flush
(
connection_t
*
conn
)
{
return
conn
->
outbuf_flushlen
;
...
...
@@ -759,13 +759,13 @@ int connection_outbuf_too_full(connection_t *conn) {
return
(
conn
->
outbuf_flushlen
>
10
*
CELL_PAYLOAD_SIZE
);
}
/** Try to flush more bytes onto conn->s.
/** Try to flush more bytes onto conn-
\
>s.
*
* This function gets called either from conn_write() in main.c
* when poll() has declared that conn wants to write, or below
* from connection_write_to_buf() when an entire TLS record is ready.
*
* Update conn->timestamp_lastwritten to now, and call flush_buf
* Update conn-
\
>timestamp_lastwritten to now, and call flush_buf
* or flush_buf_tls appropriately. If it succeeds and there no more
* more bytes on conn->outbuf, then call connection_finished_flushing
* on it too.
...
...
@@ -895,7 +895,7 @@ connection_t *connection_exact_get_by_addr_port(uint32_t addr, uint16_t port) {
/** Find a connection to the router described by addr and port,
* or alternately any router with the same identity key.
* This connection
*must*
be in
'
open
'
state.
* This connection
<em>must</em>
be in
an "
open
"
state.
* If not, return NULL.
*/
/* XXX this twin thing is busted, now that we're rotating onion
...
...
@@ -1013,7 +1013,7 @@ int connection_is_listener(connection_t *conn) {
return
0
;
}
/** Return 1 if <b>conn</b> is in state
'
open
'
and is not marked
/** Return 1 if <b>conn</b> is in state
"
open
"
and is not marked
* for close, else return 0.
*/
int
connection_state_is_open
(
connection_t
*
conn
)
{
...
...
@@ -1030,7 +1030,7 @@ int connection_state_is_open(connection_t *conn) {
return
0
;
}
/** Write a
'
destroy
'
cell with circ ID <b>circ_id</b> onto OR connection
/** Write a destroy cell with circ ID <b>circ_id</b> onto OR connection
* <b>conn</b>.
*
* Return 0.
...
...
@@ -1049,7 +1049,7 @@ int connection_send_destroy(uint16_t circ_id, connection_t *conn) {
return
0
;
}
/** Process new bytes that have arrived on conn->inbuf.
/** Process new bytes that have arrived on conn-
\
>inbuf.
*
* This function just passes conn to the connection-specific
* connection_*_process_inbuf() function.
...
...
@@ -1076,7 +1076,7 @@ int connection_process_inbuf(connection_t *conn) {
}
}
/** We just finished flushing bytes from conn->outbuf, and there
/** We just finished flushing bytes from conn-
\
>outbuf, and there
* are no more bytes remaining.
*
* This function just passes conn to the connection-specific
...
...
src/or/connection_or.c
View file @
81922a12
...
...
@@ -59,10 +59,10 @@ int connection_or_process_inbuf(connection_t *conn) {
/** Connection <b>conn</b> has finished writing and has no bytes left on
* its outbuf.
*
* If it's in state
'
connecting
'
, then take a look at the socket, and
* If it's in state
"
connecting
"
, then take a look at the socket, and
* begin the tls handshake if the connect succeeded.
*
* Otherwise it's in state
'
open
'
: stop writing and return.
* Otherwise it's in state
"
open
"
: stop writing and return.
*
* If <b>conn</b> is broken, mark it for close and return -1, else
* return 0.
...
...
src/or/cpuworker.c
View file @
81922a12
...
...
@@ -61,7 +61,7 @@ static void tag_pack(char *tag, uint32_t addr, uint16_t port, uint16_t circ_id)
*
(
uint16_t
*
)(
tag
+
6
)
=
circ_id
;
}
/** Unpack
'tag'
into addr, port, and circ_id.
/** Unpack
<b>tag</b>
into addr, port, and circ_id.
*/
static
void
tag_unpack
(
const
char
*
tag
,
uint32_t
*
addr
,
uint16_t
*
port
,
uint16_t
*
circ_id
)
{
struct
in_addr
in
;
...
...
src/or/directory.c
View file @
81922a12
...
...
@@ -27,14 +27,14 @@ char rend_fetch_url[] = "/rendezvous/";
/********* END VARIABLES ************/
/** Launch a new connection to the directory server
'
router
'
to upload
*
or
download a service or rendezvous descriptor.
'
purpose
'
determines what
/** Launch a new connection to the directory server
<b>
router
</b>
to upload
or
* download a service or rendezvous descriptor.
<b>
purpose
</b>
determines what
* kind of directory connection we're launching, and must be one of
* DIR_PURPOSE_{FETCH|UPLOAD}_{DIR|RENDDESC}.
*
* When uploading,
'
payload
'
and
'
payload_len
'
determine the content
* of the HTTP post. When fetching a rendezvous descriptor,
'
payload
'
* and
'
payload_len
'
are the service ID we want to fetch.
* When uploading,
<b>
payload
</b>
and
<b>
payload_len
</b>
determine the content
* of the HTTP post. When fetching a rendezvous descriptor,
<b>
payload
</b>
* and
<b>
payload_len
</b>
are the service ID we want to fetch.
*/
void
directory_initiate_command
(
routerinfo_t
*
router
,
int
purpose
,
const
char
*
payload
,
int
payload_len
)
{
...
...
@@ -118,8 +118,8 @@ void directory_initiate_command(routerinfo_t *router, int purpose,
}
}
/** Queue an appropriate HTTP command on conn->outbuf. The args
*
'
purpose
', '
payload
'
, and
'
payload_len
'
are as in
/** Queue an appropriate HTTP command on conn-
\
>outbuf. The args
*
<b>
purpose
</b>, <b>
payload
</b>
, and
<b>
payload_len
</b>
are as in
* directory_initiate_command.
*/
static
void
directory_send_command
(
connection_t
*
conn
,
int
purpose
,
...
...
@@ -164,8 +164,8 @@ static void directory_send_command(connection_t *conn, int purpose,
}
}
/** Parse an HTTP request string
'
headers
'
of the form "%s %s HTTP/1..."
* If it's well-formed, point *
url
to the second %s,
/** Parse an HTTP request string
<b>
headers
</b>
of the form "
\
%s
\
%s HTTP/1..."
* If it's well-formed, point *
<b>url</b>
to the second
\
%s,
* null-terminate it (this modifies headers!) and return 0.
* Otherwise, return -1.
*/
...
...
@@ -186,8 +186,9 @@ int parse_http_url(char *headers, char **url) {
return
0
;
}
/** Parse an HTTP response string 'headers' of the form "HTTP/1.%d %d%s\r\n...".
* If it's well-formed, assign *code, point *message to the first
/** Parse an HTTP response string <b>headers</b> of the form
* "HTTP/1.\%d \%d\%s\r\n...".
* If it's well-formed, assign *<b>code</b>, point *<b>message</b> to the first
* non-space character after code if there is one and message is non-NULL
* (else leave it alone), and return 0.
* Otherwise, return -1.
...
...
@@ -211,8 +212,8 @@ int parse_http_response(char *headers, int *code, char **message) {
return
0
;
}
/** Read handler for directory connections. (That's connections
*to*
* directory servers and connections
*at*
directory servers.)
/** Read handler for directory connections. (That's connections
<em>to</em>
* directory servers and connections
<em>at</em>
directory servers.)
*/
int
connection_dir_process_inbuf
(
connection_t
*
conn
)
{
char
*
body
;
...
...
@@ -365,7 +366,7 @@ static char answer503[] = "HTTP/1.0 503 Directory unavailable\r\n\r\n";
/** Helper function: called when a dirserver gets a complete HTTP GET
* request. Look for a request for a directory or for a rendezvous
* service descriptor. On finding one, write a response into
* conn->outbuf. If the request is unrecognized, send a 404.
* conn-
\
>outbuf. If the request is unrecognized, send a 404.
* Always return 0. */
static
int
directory_handle_command_get
(
connection_t
*
conn
,
char
*
headers
,
char
*
body
,
...
...
@@ -431,7 +432,7 @@ static int directory_handle_command_get(connection_t *conn,
/** Helper function: called when a dirserver gets a complete HTTP POST
* request. Look for an uploaded server descriptor or rendezvous
* service descriptor. On finding one, process it and write a
* response into conn->outbuf. If the request is unrecognized, send a
* response into conn-
\
>outbuf. If the request is unrecognized, send a
* 404. Always return 0. */
static
int
directory_handle_command_post
(
connection_t
*
conn
,
char
*
headers
,
char
*
body
,
...
...
src/or/dirserv.c
View file @
81922a12
...
...
@@ -7,7 +7,7 @@
/**
* \file dirserv.c
* \brief Directory server core implementation.
***
**/
**/
/** How old do we allow a router to get before removing it? (seconds) */
#define ROUTER_MAX_AGE (60*60*24)
...
...
@@ -30,13 +30,13 @@ typedef struct fingerprint_entry_t {
char
*
fingerprint
;
}
fingerprint_entry_t
;
/** List of nickname->identity fingerprint mappings for all the routers
/** List of nickname-
\
>identity fingerprint mappings for all the routers
* that we recognize. Used to prevent Sybil attacks. */
static
fingerprint_entry_t
fingerprint_list
[
MAX_ROUTERS_IN_DIR
];
static
int
n_fingerprints
=
0
;
/** Add the fingerprint
'fp'
for the nickname
'
nickname
' to the global
* list of recognized identity key fingerprints.
/** Add the fingerprint
<b>fp</b>
for the nickname
<b>
nickname
</b> to
*
the global
list of recognized identity key fingerprints.
*/
void
/* Should be static; exposed for testing */
add_fingerprint_to_dir
(
const
char
*
nickname
,
const
char
*
fp
)
...
...
@@ -68,11 +68,11 @@ dirserv_add_own_fingerprint(const char *nickname, crypto_pk_env_t *pk)
return
0
;
}
/** Parse the nickname->fingerprint mappings stored in the file named
*
'
fname
'
. The file format is line-based, with each non-blank
/** Parse the nickname-
\
>fingerprint mappings stored in the file named
*
<b>
fname
</b>
. The file format is line-based, with each non-blank
* holding one nickname, some space, and a fingerprint for that
* nickname. On success, replace the current fingerprint list with
* the contents of
'
fname
'
and return 0. On failure, leave the
* the contents of
<b>
fname
</b>
and return 0. On failure, leave the
* current fingerprint list untouched, and return -1. */
int
dirserv_parse_fingerprint_file
(
const
char
*
fname
)
...
...
@@ -130,7 +130,7 @@ dirserv_parse_fingerprint_file(const char *fname)
return
-
1
;
}
/** Check whether
'
router
'
has a nickname/identity key combination that
/** Check whether
<b>
router
</b>
has a nickname/identity key combination that
* we recognize from the fingerprint list. Return 1 if router's
* identity and nickname match, -1 if we recognize the nickname but
* the identity key is wrong, and 0 if the nickname is not known. */
...
...
@@ -167,7 +167,7 @@ dirserv_router_fingerprint_is_known(const routerinfo_t *router)
}
}
/** Return true iff any router named
'
nickname
'
is in the fingerprint
/** Return true iff any router named
<b>
nickname
</b>
is in the fingerprint
* list. */
static
int
router_nickname_is_approved
(
const
char
*
nickname
)
...
...
@@ -211,7 +211,7 @@ typedef struct descriptor_entry_t {
static
descriptor_entry_t
*
descriptor_list
[
MAX_ROUTERS_IN_DIR
];
static
int
n_descriptors
=
0
;
/** Release the storage held by
'
desc
'
*/
/** Release the storage held by
<b>
desc
</b>
*/
static
void
free_descriptor_entry
(
descriptor_entry_t
*
desc
)
{
tor_free
(
desc
->
descriptor
);
...
...
@@ -368,7 +368,7 @@ directory_remove_unrecognized(void)
}
}
/** Mark the directory as
'
dirty
'
-- when we're next asked for a
/** Mark the directory as
<b>
dirty
</b>
-- when we're next asked for a
* directory, we will rebuild it instead of reusing the most recently
* generated one.
*/
...
...
@@ -379,7 +379,7 @@ directory_set_dirty()
}
/** Load all descriptors from an earlier directory stored in the string
*
'dir'
.
*
<b>dir</b>
.
*/
int
dirserv_init_from_directory_string
(
const
char
*
dir
)
...
...
@@ -397,7 +397,7 @@ dirserv_init_from_directory_string(const char *dir)
return
0
;
}
/** Set *nicknames_out to a comma-separated list of all the ORs that we
/** Set *
<b>
nicknames_out
</b>
to a comma-separated list of all the ORs that we
* believe are currently running (because we have open connections to
* them). Return 0 on success; -1 on error.
*/
...
...
@@ -462,9 +462,10 @@ dirserv_remove_old_servers(void)
}
}
/** Dump all routers currently in the directory into the string <s>, using
* at most <maxlen> characters, and signing the directory with <private_key>.
* Return 0 on success, -1 on failure.
/** Dump all routers currently in the directory into the string
* <b>s</b>, using at most <b>maxlen</b> characters, and signing the
* directory with <b>private_key</b>. Return 0 on success, -1 on
* failure.
*/
int
dirserv_dump_directory_to_string
(
char
*
s
,
unsigned
int
maxlen
,
...
...
@@ -536,11 +537,12 @@ dirserv_dump_directory_to_string(char *s, unsigned int maxlen,
return
-
1
;
}
/**
XXX
*/
/**
Most recently generated encoded signed directory.
*/
static
char
*
the_directory
=
NULL
;
static
int
the_directory_len
=
-
1
;
/** XXX */
/** Set *<b>directory</b> to the most recently generated encoded signed
* directory, generating a new one as necessary. */
size_t
dirserv_get_directory
(
const
char
**
directory
)
{
char
*
new_directory
;
...
...
src/or/dns.c
View file @
81922a12
...
...
@@ -99,7 +99,7 @@ void dns_init(void) {
static
struct
cached_resolve
*
oldest_cached_resolve
=
NULL
;
static
struct
cached_resolve
*
newest_cached_resolve
=
NULL
;
/** Remove every cached_resolve whose
'
expire
'
time is before
'now'
/** Remove every cached_resolve whose
<b>
expire
</b>
time is before
<b>now</b>
* from the cache. */
static
void
purge_expired_resolves
(
uint32_t
now
)
{
struct
cached_resolve
*
resolve
;
...
...
@@ -124,8 +124,8 @@ static void purge_expired_resolves(uint32_t now) {
}
}
/** See if we have a cache entry for
'
exitconn
-
>address
'
. if so,
* if resolve valid, put it into exitconn
-
>addr and return 1.
/** See if we have a cache entry for
<b>
exitconn
</b>-\
>address. if so,
* if resolve valid, put it into
<b>
exitconn
</b>-\
>addr and return 1.
* If resolve failed, return -1.
*
* Else, if seen before and pending, add conn to the pending list,
...
...
@@ -206,7 +206,7 @@ int dns_resolve(connection_t *exitconn) {
}
/** Find or spawn a dns worker process to handle resolving
* exitconn
-
>address; tell that dns worker to begin resolving.
*
<b>
exitconn
</b>-\
>address; tell that dns worker to begin resolving.
*/
static
int
assign_to_dnsworker
(
connection_t
*
exitconn
)
{
connection_t
*
dnsconn
;
...
...
@@ -240,7 +240,7 @@ static int assign_to_dnsworker(connection_t *exitconn) {
return
0
;
}
/** Remove
'
conn
'
from the list of connections waiting for conn->address.
/** Remove
<b>
conn
</b>
from the list of connections waiting for conn-
\
>address.
*/
void
connection_dns_remove
(
connection_t
*
conn
)
{
...
...
@@ -313,9 +313,9 @@ void assert_all_pending_dns_resolves_ok(void) {
}
}
/** Mark all connections waiting for
'
address
'
for close. Then cancel
* the resolve for
'
address
'
itself, and remove any cached results for
*
'
address
'
from the cache.
/** Mark all connections waiting for
<b>
address
</b>
for close. Then cancel
* the resolve for
<b>
address
</b>
itself, and remove any cached results for
*
<b>
address
</b>
from the cache.
*/
void
dns_cancel_pending_resolve
(
char
*
address
)
{
struct
pending_connection_t
*
pend
;
...
...
@@ -351,7 +351,7 @@ void dns_cancel_pending_resolve(char *address) {
dns_purge_resolve
(
resolve
);
}
/** Remove
'
resolve
'
from the cache.
/** Remove
<b>
resolve
</b>
from the cache.
*/
static
void
dns_purge_resolve
(
struct
cached_resolve
*
resolve
)
{
struct
cached_resolve
*
tmp
;
...
...
@@ -379,9 +379,10 @@ static void dns_purge_resolve(struct cached_resolve *resolve) {
/** Called on the OR side when a DNS worker tells us the outcome of a DNS
* resolve: tell all pending connections about the result of the lookup, and
* cache the value. ('address' is a NUL-terminated string containing the
* address to look up; 'addr' is an IPv4 address in host order; 'outcome' is
* one of DNS_RESOLVE_{FAILED_TRANSIENT|FAILED_PERMANENT|SUCCEEDED}.
* cache the value. (<b>address</b> is a NUL-terminated string containing the
* address to look up; <b>addr</b> is an IPv4 address in host order;
* <b>outcome</b> is one of
* DNS_RESOLVE_{FAILED_TRANSIENT|FAILED_PERMANENT|SUCCEEDED}.
*/
static
void
dns_found_answer
(
char
*
address
,
uint32_t
addr
,
char
outcome
)
{
struct
pending_connection_t
*
pend
;
...
...
@@ -459,9 +460,9 @@ static void dns_found_answer(char *address, uint32_t addr, char outcome) {
/******************************************************************/
/*
****
/*
* Connection between OR and dnsworker
****
*/
*/
/** Write handler: called when we've pushed a request to a dnsworker. */
int
connection_dns_finished_flushing
(
connection_t
*
conn
)
{
...
...
@@ -518,12 +519,12 @@ int connection_dns_process_inbuf(connection_t *conn) {
* execution context. It takes as its argument an fdarray as returned
* by socketpair(), and communicates via fdarray[1]. The protocol is
* as follows:
* The OR says:
*
ADDRESSLEN [1 byte]
*
ADDRESS [ADDRESSLEN bytes]
* The DNS worker does the lookup, and replies:
*
OUTCOME [1 byte]
*
IP [4 bytes]
*
-
The OR says:
*
-
ADDRESSLEN [1 byte]
*
-
ADDRESS [ADDRESSLEN bytes]
*
-
The DNS worker does the lookup, and replies:
*
-
OUTCOME [1 byte]
*
-
IP [4 bytes]
*
* OUTCOME is one of DNS_RESOLVE_{FAILED_TRANSIENT|FAILED_PERMANENT|SUCCEEDED}.
* IP is in host order.
...
...
src/or/main.c
View file @
81922a12
...
...
@@ -16,7 +16,7 @@ static int init_from_config(int argc, char **argv);
/********* START VARIABLES **********/
/*
*
declared in connection.c */
/* declared in connection.c */
extern
char
*
conn_state_to_string
[][
_CONN_TYPE_MAX
+
1
];
or_options_t
options
;
/**< command-line and config-file options */
...
...
src/or/onion.c
View file @
81922a12
...
...
@@ -9,8 +9,8 @@
#include "or.h"
/*
*
prototypes for smartlist operations from routerlist.h
*
t
hey're here to prevent precedence issues with the .h files
/* prototypes for smartlist operations from routerlist.h
*
T
hey're here to prevent precedence issues with the .h files
*/
void
router_add_running_routers_to_smartlist
(
smartlist_t
*
sl
);
void
add_nickname_list_to_smartlist
(
smartlist_t
*
sl
,
char
*
list
);
...
...
src/or/rendclient.c
View file @
81922a12
...
...
@@ -218,7 +218,7 @@ rend_client_introduction_acked(circuit_t *circ,
/** If we are not currently fetching a rendezvous service descriptor
* for the service ID
'
query
'
, start a directory connection to fetch a
* for the service ID
<b>
query
</b>
, start a directory connection to fetch a
* new one.
*/
void
...
...
src/or/rendcommon.c
View file @
81922a12
...
...
@@ -10,7 +10,7 @@
#include "or.h"
/** Free the storage held by the service descriptor
'
desc
'
.
/** Free the storage held by the service descriptor
<b>
desc
</b>
.
*/
void
rend_service_descriptor_free
(
rend_service_descriptor_t
*
desc
)
{
...
...
@@ -26,8 +26,9 @@ void rend_service_descriptor_free(rend_service_descriptor_t *desc)
tor_free
(
desc
);
}
/** Encode a service descriptor for 'desc', and sign it with 'key'. Store
* the descriptor in *str_out, and set *len_out to its length.
/** Encode a service descriptor for <b>desc</b>, and sign it with
* <b>key</b>. Store the descriptor in *<b>str_out</b>, and set
* *<b>len_out</b> to its length.
*/
int
rend_encode_service_descriptor
(
rend_service_descriptor_t
*
desc
,
...
...
@@ -72,9 +73,9 @@ rend_encode_service_descriptor(rend_service_descriptor_t *desc,
return
0
;
}
/** Parse a service descriptor at
'str' (len
bytes). On
success,
* return a newly alloced service_descriptor_t. On failure,
return
* NULL.
/** Parse a service descriptor at
<b>str</b> (<b>len</b>
bytes). On
*
success,
return a newly alloced service_descriptor_t. On failure,
*
return
NULL.
*/
rend_service_descriptor_t
*
rend_parse_service_descriptor
(
const
char
*
str
,
int
len
)
...
...
@@ -129,9 +130,9 @@ rend_service_descriptor_t *rend_parse_service_descriptor(
return
NULL
;
}
/** Sets
out
to the first 10 bytes of the digest of
'pk', base32
* encoded. NUL-terminates out. (We use this string to
identify
* services in directory requests and .onion URLs.)
/** Sets
<b>out</b>
to the first 10 bytes of the digest of
<b>pk</b>,
*
base32
encoded. NUL-terminates out. (We use this string to
*
identify
services in directory requests and .onion URLs.)
*/
int
rend_get_service_id
(
crypto_pk_env_t
*
pk
,
char
*
out
)
{
...
...
@@ -184,7 +185,7 @@ void rend_cache_clean(void)
}
}
/** Return true iff
'
query
'
is a syntactically valid service ID (as
/** Return true iff
<b>
query
</b>
is a syntactically valid service ID (as
* generated by rend_get_service_id). */
int
rend_valid_service_id
(
const
char
*
query
)
{
if
(
strlen
(
query
)
!=
REND_SERVICE_ID_LEN
)
...
...
@@ -196,8 +197,8 @@ int rend_valid_service_id(const char *query) {
return
1
;
}
/** If we have a cached rend_cache_entry_t for the service ID
'
query
'
, set
* *
e
to that entry and return 1. Else return 0.
/** If we have a cached rend_cache_entry_t for the service ID
<b>
query
</b>
, set
* *
<b>e</b>
to that entry and return 1. Else return 0.
*/
int
rend_cache_lookup_entry
(
const
char
*
query
,
rend_cache_entry_t
**
e
)
{
...
...
@@ -210,11 +211,11 @@ int rend_cache_lookup_entry(const char *query, rend_cache_entry_t **e)
return
1
;
}
/**
'
query
'
is a base-32'ed service id. If it's malformed, return -1.
/**
<b>
query
</b>
is a base-32'ed service id. If it's malformed, return -1.
* Else look it up.
* If it is found, point *desc to it, and write its length into
* *desc_len, and return 1.
* If it is not found, return 0.
*
-
If it is found, point *desc to it, and write its length into
*
*desc_len, and return 1.
*
-
If it is not found, return 0.
* Note: calls to rend_cache_clean or rend_cache_store may invalidate
* *desc.
*/
...
...
@@ -292,7 +293,7 @@ int rend_cache_store(const char *desc, int desc_len)
}
/** Called when we get a rendezvous-related relay cell on circuit
*
*
circ. Dispatch on rendezvous relay command. */
*
<b>
circ
</b>
. Dispatch on rendezvous relay command. */
void
rend_process_relay_cell
(
circuit_t
*
circ
,
int
command
,
int
length
,
const
char
*
payload
)
{
...
...
src/or/rendservice.c
View file @
81922a12
...
...
@@ -44,7 +44,7 @@ typedef struct rend_service_t {
*/
static
smartlist_t
*
rend_service_list
=
NULL
;
/** Release the storage held by
'
service
'
.
/** Release the storage held by
<b>
service
</b>
.
*/
static
void
rend_service_free
(
rend_service_t
*
service
)
{
...
...
@@ -78,7 +78,7 @@ static void rend_service_free_all(void)
rend_service_list
=
smartlist_create
();
}
/** Validate
'
service
'
and add it to rend_service_list if possible.
/** Validate
<b>
service
<b>
and add it to rend_service_list if possible.
*/
static
void
add_service
(
rend_service_t
*
service
)
{
...
...
@@ -111,7 +111,8 @@ static void add_service(rend_service_t *service)
* rend_service_port_config_t.
*
* The format is: VirtualPort (IP|RealPort|IP:RealPort)?
* IP defaults to 127.0.0.1; RealPort defaults to VirtualPort.
*
* IP defaults to 127.0.0.1; RealPort defaults to VirtualPort.
*/
static
rend_service_port_config_t
*
parse_port_config
(
const
char
*
string
)
{
...
...
@@ -176,7 +177,7 @@ static rend_service_port_config_t *parse_port_config(const char *string)
}
/** Set up rend_service_list, based on the values of HiddenServiceDir and
* HiddenServicePort in
'
options
'
. Return 0 on success and -1 on
* HiddenServicePort in
<b>
options
</b>
. Return 0 on success and -1 on
* failure.
*/
int
rend_config_services
(
or_options_t
*
options
)
...
...
@@ -229,7 +230,7 @@ int rend_config_services(or_options_t *options)
return
0
;
}
/** Replace the old value of service
-
>desc with one that reflects
/** Replace the old value of
<b>
service
</b>-\
>desc with one that reflects
* the other fields in service.
*/
static
void
rend_service_update_descriptor
(
rend_service_t
*
service
)
...
...
@@ -310,7 +311,7 @@ int rend_service_load_keys(void)
return
0
;
}
/** Return the service whose public key has a digest of
'
digest
'
. Return
/** Return the service whose public key has a digest of
<b>
digest
</b>
. Return
* NULL if no such service exists.
*/
static
rend_service_t
*
...
...
@@ -503,7 +504,7 @@ rend_service_relaunch_rendezvous(circuit_t *oldcirc)
}
/** Launch a circuit to serve as an introduction point for the service
*
'
service
'
at the introduction point
'
nickname
'
*
<b>
service
</b>
at the introduction point
<b>
nickname
</b>
*/
static
int
rend_service_launch_establish_intro
(
rend_service_t
*
service
,
const
char
*
nickname
)
...
...
@@ -687,12 +688,12 @@ rend_service_rendezvous_is_ready(circuit_t *circuit)
circuit_mark_for_close
(
circuit
);
}
/*
*****
/*
* Manage introduction points
*****
*/
*/