tor  0.4.0.1-alpha
Functions
nss_countbytes.h File Reference
#include "lib/cc/torint.h"

Go to the source code of this file.

Functions

void tor_nss_countbytes_init (void)
 
struct PRFileDesc * tor_wrap_prfiledesc_with_byte_counter (struct PRFileDesc *stack)
 
int tor_get_prfiledesc_byte_counts (struct PRFileDesc *fd, uint64_t *n_read_out, uint64_t *n_written_out)
 

Detailed Description

Header for nss_countbytes.c, which lets us count the number of bytes actually written on a PRFileDesc.

Definition in file nss_countbytes.h.

Function Documentation

◆ tor_get_prfiledesc_byte_counts()

int tor_get_prfiledesc_byte_counts ( PRFileDesc *  fd,
uint64_t *  n_read_out,
uint64_t *  n_written_out 
)

Given a PRFileDesc returned by tor_wrap_prfiledesc_with_byte_counter(), or another PRFileDesc wrapping that PRFileDesc, set the provided pointers to the number of bytes read and written on the descriptor since it was created.

Return 0 on success, -1 on failure.

Definition at line 225 of file nss_countbytes.c.

Referenced by tor_tls_get_n_raw_bytes().

◆ tor_nss_countbytes_init()

void tor_nss_countbytes_init ( void  )

◆ tor_wrap_prfiledesc_with_byte_counter()

struct PRFileDesc* tor_wrap_prfiledesc_with_byte_counter ( PRFileDesc *  stack)

Wrap a PRFileDesc from NSPR with a new PRFileDesc that will count the total number of bytes read and written. Return the new PRFileDesc.

This function takes ownership of its input.

Definition at line 193 of file nss_countbytes.c.

Referenced by tor_tls_new().