Functions
alts_counter.cc File Reference
#include <grpc/support/port_platform.h>
#include "src/core/tsi/alts/frame_protector/alts_counter.h"
#include <string.h>
#include <grpc/support/alloc.h>
Include dependency graph for alts_counter.cc:

Go to the source code of this file.

Functions

grpc_status_code alts_counter_create (bool is_client, size_t counter_size, size_t overflow_size, alts_counter **crypter_counter, char **error_details)
 
void alts_counter_destroy (alts_counter *crypter_counter)
 
unsigned char * alts_counter_get_counter (alts_counter *crypter_counter)
 
size_t alts_counter_get_size (alts_counter *crypter_counter)
 
grpc_status_code alts_counter_increment (alts_counter *crypter_counter, bool *is_overflow, char **error_details)
 
static void maybe_copy_error_msg (const char *src, char **dst)
 

Function Documentation

◆ alts_counter_create()

grpc_status_code alts_counter_create ( bool  is_client,
size_t  counter_size,
size_t  overflow_size,
alts_counter **  crypter_counter,
char **  error_details 
)

This method creates and initializes an alts_counter instance.

  • is_client: a flag indicating if the alts_counter instance will be used at client (is_client = true) or server (is_client = false) side.
  • counter_size: size of buffer holding the counter value.
  • overflow_size: overflow size in bytes. The counter instance can be used to produce at most 2^(overflow_size*8) frames.
  • crypter_counter: an alts_counter instance to be returned from the method.
  • error_details: a buffer containing an error message if the method does not function correctly. It is legal to pass nullptr into error_details and otherwise, the parameter should be freed with gpr_free.

On success, the method returns GRPC_STATUS_OK. Otherwise, it returns an error status code along with its details specified in error_details (if error_details is not nullptr).

Definition at line 34 of file alts_counter.cc.

◆ alts_counter_destroy()

void alts_counter_destroy ( alts_counter crypter_counter)

This method de-allocates all memory allocated to an alts_coutner instance.

Definition at line 113 of file alts_counter.cc.

◆ alts_counter_get_counter()

unsigned char* alts_counter_get_counter ( alts_counter crypter_counter)

This method returns the counter buffer.

Definition at line 106 of file alts_counter.cc.

◆ alts_counter_get_size()

size_t alts_counter_get_size ( alts_counter crypter_counter)

This method returns the size of counter buffer.

Definition at line 99 of file alts_counter.cc.

◆ alts_counter_increment()

grpc_status_code alts_counter_increment ( alts_counter crypter_counter,
bool is_overflow,
char **  error_details 
)

This method increments the internal counter.

  • crypter_counter: an alts_counter instance.
  • is_overflow: after incrementing the internal counter, if an overflow occurs, is_overflow is set to true, and no further calls to alts_counter_increment() should be made. Otherwise, is_overflow is set to false.
  • error_details: a buffer containing an error message if the method does not function correctly. It is legal to pass nullptr into error_details and otherwise, the parameter should be freed with gpr_free.

On success, the method returns GRPC_STATUS_OK. Otherwise, it returns an error status code along with its details specified in error_details (if error_details is not nullptr).

If the lower overflow_size bytes are all zero, the counter has overflowed.

Definition at line 66 of file alts_counter.cc.

◆ maybe_copy_error_msg()

static void maybe_copy_error_msg ( const char *  src,
char **  dst 
)
static

Definition at line 27 of file alts_counter.cc.



grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:02