Functions
gsec_test_util.h File Reference
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <grpc/grpc.h>
Include dependency graph for gsec_test_util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

uint32_t gsec_test_bias_random_uint32 (uint32_t max_length)
 
void gsec_test_copy (const uint8_t *src, uint8_t **des, size_t source_len)
 
void gsec_test_copy_and_alter_random_byte (const uint8_t *src, uint8_t **des, size_t source_len)
 
int gsec_test_expect_compare_code_and_substr (grpc_status_code status1, grpc_status_code status2, const char *msg1, const char *msg2)
 
void gsec_test_random_array (uint8_t **bytes, size_t length)
 
void gsec_test_random_bytes (uint8_t *bytes, size_t length)
 

Function Documentation

◆ gsec_test_bias_random_uint32()

uint32_t gsec_test_bias_random_uint32 ( uint32_t  max_length)

This method returns a uint32 that's not quite uniformly random, but good enough for tests.

  • max_length: a max value the returned random number can choose.

Definition at line 43 of file gsec_test_util.cc.

◆ gsec_test_copy()

void gsec_test_copy ( const uint8_t src,
uint8_t **  des,
size_t  source_len 
)

This method copies data from a source to a destination buffer.

  • src: a source buffer.
  • des: a destination buffer.
  • source_len: the length of source buffer to be copied from its beginning.

Definition at line 49 of file gsec_test_util.cc.

◆ gsec_test_copy_and_alter_random_byte()

void gsec_test_copy_and_alter_random_byte ( const uint8_t src,
uint8_t **  des,
size_t  source_len 
)

This method copies data from a source to a destination buffer, and flips one byte in the destination buffer randomly.

  • src: a source buffer.
  • des: a destination buffer.
  • length: the length of source buffer to be copied from its beginning.

Definition at line 61 of file gsec_test_util.cc.

◆ gsec_test_expect_compare_code_and_substr()

int gsec_test_expect_compare_code_and_substr ( grpc_status_code  status1,
grpc_status_code  status2,
const char *  msg1,
const char *  msg2 
)

This method compares two grpc_status_code values, and verifies if one string is a substring of the other.

  • status1: the first grpc_status_code to be compared.
  • status2: the second grpc_status_code to be compared.
  • msg1: a string to be scanned.
  • msg2: a small string to be searched within msg1.

If both checks succeed, the method returns 1 and otherwise, it returns 0.

Definition at line 77 of file gsec_test_util.cc.

◆ gsec_test_random_array()

void gsec_test_random_array ( uint8_t **  bytes,
size_t  length 
)

This method returns an array of random bytes.

  • bytes: array to hold random bytes.
  • length: length of array to be populated.

Definition at line 33 of file gsec_test_util.cc.

◆ gsec_test_random_bytes()

void gsec_test_random_bytes ( uint8_t bytes,
size_t  length 
)

This method returns random bytes of certain length.

  • bytes: buffer to hold random bytes.
  • length: length of buffer to be populated.

Definition at line 25 of file gsec_test_util.cc.



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