Tor
0.4.7.0-alpha-dev
feature
hs
hs_metrics.h
Go to the documentation of this file.
1
/* Copyright (c) 2020-2021, The Tor Project, Inc. */
2
/* See LICENSE for licensing information */
3
4
/**
5
* @file hs_metrics.h
6
* @brief Header for feature/hs/hs_metrics.c
7
**/
8
9
#ifndef TOR_FEATURE_HS_HS_METRICS_H
10
#define TOR_FEATURE_HS_HS_METRICS_H
11
12
#include "
lib/container/smartlist.h
"
13
#include "
lib/crypt_ops/crypto_ed25519.h
"
14
15
#define HS_METRICS_ENTRY_PRIVATE
16
#include "
feature/hs/hs_metrics_entry.h
"
17
#include "
feature/hs/hs_service.h
"
18
19
/* Init and Free. */
20
void
hs_metrics_service_init
(
hs_service_t
*service);
21
void
hs_metrics_service_free
(
hs_service_t
*service);
22
23
/* Accessors. */
24
const
smartlist_t
*
hs_metrics_get_stores
(
void
);
25
26
/* Metrics Update. */
27
void
hs_metrics_update_by_ident
(
const
hs_metrics_key_t key,
28
const
ed25519_public_key_t
*ident_pk,
29
const
uint16_t port, int64_t n);
30
void
hs_metrics_update_by_service
(
const
hs_metrics_key_t key,
31
hs_service_t
*service,
const
uint16_t port,
32
int64_t n);
33
34
/** New introducion request received. */
35
#define hs_metrics_new_introduction(s) \
36
hs_metrics_update_by_service(HS_METRICS_NUM_INTRODUCTIONS, (s), 0, 1)
37
38
/** Number of bytes written to the application from the service. */
39
#define hs_metrics_app_write_bytes(i, port, n) \
40
hs_metrics_update_by_ident(HS_METRICS_APP_WRITE_BYTES, (i), (port), (n))
41
42
/** Number of bytes read from the application to the service. */
43
#define hs_metrics_app_read_bytes(i, port, n) \
44
hs_metrics_update_by_ident(HS_METRICS_APP_READ_BYTES, (i), (port), (n))
45
46
/** Newly established rendezvous. This is called as soon as the circuit purpose
47
* is REND_JOINED which is when the RENDEZVOUS2 cell is sent. */
48
#define hs_metrics_new_established_rdv(s) \
49
hs_metrics_update_by_service(HS_METRICS_NUM_ESTABLISHED_RDV, (s), 0, 1)
50
51
/** Established rendezvous closed. This is called when the circuit in
52
* REND_JOINED state is marked for close. */
53
#define hs_metrics_close_established_rdv(i) \
54
hs_metrics_update_by_ident(HS_METRICS_NUM_ESTABLISHED_RDV, (i), 0, -1)
55
56
/** New rendezvous circuit being launched. */
57
#define hs_metrics_new_rdv(i) \
58
hs_metrics_update_by_ident(HS_METRICS_NUM_RDV, (i), 0, 1)
59
60
/** New introduction circuit has been established. This is called when the
61
* INTRO_ESTABLISHED has been received by the service. */
62
#define hs_metrics_new_established_intro(s) \
63
hs_metrics_update_by_service(HS_METRICS_NUM_ESTABLISHED_INTRO, (s), 0, 1)
64
65
/** Established introduction circuit closes. This is called when
66
* INTRO_ESTABLISHED circuit is marked for close. */
67
#define hs_metrics_close_established_intro(i) \
68
hs_metrics_update_by_ident(HS_METRICS_NUM_ESTABLISHED_INTRO, (i), 0, 1)
69
70
#endif
/* !defined(TOR_FEATURE_HS_HS_METRICS_H) */
crypto_ed25519.h
Header for crypto_ed25519.c.
hs_metrics_update_by_ident
void hs_metrics_update_by_ident(const hs_metrics_key_t key, const ed25519_public_key_t *ident_pk, const uint16_t port, int64_t n)
Definition:
hs_metrics.c:101
hs_metrics_service_free
void hs_metrics_service_free(hs_service_t *service)
Definition:
hs_metrics.c:154
hs_metrics_update_by_service
void hs_metrics_update_by_service(const hs_metrics_key_t key, hs_service_t *service, const uint16_t port, int64_t n)
Definition:
hs_metrics.c:67
hs_metrics_service_init
void hs_metrics_service_init(hs_service_t *service)
Definition:
hs_metrics.c:136
hs_metrics_get_stores
const smartlist_t * hs_metrics_get_stores(void)
Definition:
hs_metrics.c:123
hs_metrics_entry.h
Header for feature/hs/hs_metrics_entry.c.
hs_service.h
Header file containing service data for the HS subsystem.
smartlist.h
Header for smartlist.c.
ed25519_public_key_t
Definition:
crypto_ed25519.h:23
hs_service_t
Definition:
hs_service.h:297
smartlist_t
Definition:
smartlist_core.h:26
Generated by
1.9.1