Tor  0.4.7.0-alpha-dev
Macros | Functions
hs_metrics.h File Reference

Header for feature/hs/hs_metrics.c. More...

#include "lib/container/smartlist.h"
#include "lib/crypt_ops/crypto_ed25519.h"
#include "feature/hs/hs_metrics_entry.h"
#include "feature/hs/hs_service.h"

Go to the source code of this file.

Macros

#define HS_METRICS_ENTRY_PRIVATE
 
#define hs_metrics_new_introduction(s)    hs_metrics_update_by_service(HS_METRICS_NUM_INTRODUCTIONS, (s), 0, 1)
 
#define hs_metrics_app_write_bytes(i, port, n)    hs_metrics_update_by_ident(HS_METRICS_APP_WRITE_BYTES, (i), (port), (n))
 
#define hs_metrics_app_read_bytes(i, port, n)    hs_metrics_update_by_ident(HS_METRICS_APP_READ_BYTES, (i), (port), (n))
 
#define hs_metrics_new_established_rdv(s)    hs_metrics_update_by_service(HS_METRICS_NUM_ESTABLISHED_RDV, (s), 0, 1)
 
#define hs_metrics_close_established_rdv(i)    hs_metrics_update_by_ident(HS_METRICS_NUM_ESTABLISHED_RDV, (i), 0, -1)
 
#define hs_metrics_new_rdv(i)    hs_metrics_update_by_ident(HS_METRICS_NUM_RDV, (i), 0, 1)
 
#define hs_metrics_new_established_intro(s)    hs_metrics_update_by_service(HS_METRICS_NUM_ESTABLISHED_INTRO, (s), 0, 1)
 
#define hs_metrics_close_established_intro(i)    hs_metrics_update_by_ident(HS_METRICS_NUM_ESTABLISHED_INTRO, (i), 0, 1)
 

Functions

void hs_metrics_service_init (hs_service_t *service)
 
void hs_metrics_service_free (hs_service_t *service)
 
const smartlist_ths_metrics_get_stores (void)
 
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)
 
void hs_metrics_update_by_service (const hs_metrics_key_t key, hs_service_t *service, const uint16_t port, int64_t n)
 

Detailed Description

Header for feature/hs/hs_metrics.c.

Definition in file hs_metrics.h.

Macro Definition Documentation

◆ hs_metrics_app_read_bytes

#define hs_metrics_app_read_bytes (   i,
  port,
 
)     hs_metrics_update_by_ident(HS_METRICS_APP_READ_BYTES, (i), (port), (n))

Number of bytes read from the application to the service.

Definition at line 43 of file hs_metrics.h.

◆ hs_metrics_app_write_bytes

#define hs_metrics_app_write_bytes (   i,
  port,
 
)     hs_metrics_update_by_ident(HS_METRICS_APP_WRITE_BYTES, (i), (port), (n))

Number of bytes written to the application from the service.

Definition at line 39 of file hs_metrics.h.

◆ hs_metrics_close_established_intro

#define hs_metrics_close_established_intro (   i)     hs_metrics_update_by_ident(HS_METRICS_NUM_ESTABLISHED_INTRO, (i), 0, 1)

Established introduction circuit closes. This is called when INTRO_ESTABLISHED circuit is marked for close.

Definition at line 67 of file hs_metrics.h.

◆ hs_metrics_close_established_rdv

#define hs_metrics_close_established_rdv (   i)     hs_metrics_update_by_ident(HS_METRICS_NUM_ESTABLISHED_RDV, (i), 0, -1)

Established rendezvous closed. This is called when the circuit in REND_JOINED state is marked for close.

Definition at line 53 of file hs_metrics.h.

◆ hs_metrics_new_established_intro

#define hs_metrics_new_established_intro (   s)     hs_metrics_update_by_service(HS_METRICS_NUM_ESTABLISHED_INTRO, (s), 0, 1)

New introduction circuit has been established. This is called when the INTRO_ESTABLISHED has been received by the service.

Definition at line 62 of file hs_metrics.h.

◆ hs_metrics_new_established_rdv

#define hs_metrics_new_established_rdv (   s)     hs_metrics_update_by_service(HS_METRICS_NUM_ESTABLISHED_RDV, (s), 0, 1)

Newly established rendezvous. This is called as soon as the circuit purpose is REND_JOINED which is when the RENDEZVOUS2 cell is sent.

Definition at line 48 of file hs_metrics.h.

◆ hs_metrics_new_introduction

#define hs_metrics_new_introduction (   s)     hs_metrics_update_by_service(HS_METRICS_NUM_INTRODUCTIONS, (s), 0, 1)

New introducion request received.

Definition at line 35 of file hs_metrics.h.

◆ hs_metrics_new_rdv

#define hs_metrics_new_rdv (   i)     hs_metrics_update_by_ident(HS_METRICS_NUM_RDV, (i), 0, 1)

New rendezvous circuit being launched.

Definition at line 57 of file hs_metrics.h.

Function Documentation

◆ hs_metrics_get_stores()

const smartlist_t* hs_metrics_get_stores ( void  )

Return a list of all the onion service metrics stores. This is the function attached to the .get_metrics() member of the subsys_t.

Definition at line 123 of file hs_metrics.c.

◆ hs_metrics_service_free()

void hs_metrics_service_free ( hs_service_t service)

Free the metrics store in the given service.

Definition at line 154 of file hs_metrics.c.

◆ hs_metrics_service_init()

void hs_metrics_service_init ( hs_service_t service)

Initialize the metrics store in the given service.

Definition at line 136 of file hs_metrics.c.

Referenced by register_service().

◆ 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 
)

Update the metrics key entry in the store of a service identified by the given identity public key. The port, if non 0, is used to find the correct metrics entry. The value n is the value used to update the entry.

This is used by callsite that have access to the key but not the service object so an extra lookup is done to find the service.

Definition at line 101 of file hs_metrics.c.

◆ 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 
)

Update the metrics key entry in the store in the given service. The port, if non 0, is used to find the correct metrics entry. The value n is the value used to update the entry.

Definition at line 67 of file hs_metrics.c.

Referenced by hs_metrics_update_by_ident().