.name = "arp",
.default_type_size = 4,
.default_type_length = 0,
+
+ .init = fr_arp_init,
+ .free = fr_arp_free,
};
bool tmp;
} fr_arp_ctx_t;
-static int _test_ctx_free(UNUSED fr_arp_ctx_t *ctx)
-{
- fr_arp_free();
-
- return 0;
-}
-
static int encode_test_ctx(void **out, TALLOC_CTX *ctx)
{
fr_arp_ctx_t *test_ctx;
- if (fr_arp_init() < 0) return -1;
+ fr_assert(instance_count > 0);
test_ctx = talloc_zero(ctx, fr_arp_ctx_t);
if (!test_ctx) return -1;
- talloc_set_destructor(test_ctx, _test_ctx_free);
-
*out = test_ctx;
return 0;
.name = "bfd",
.default_type_size = 1,
.default_type_length = 1,
+
+ .init = fr_bfd_init,
+ .free = fr_bfd_free,
};
return slen;
}
-static int _test_ctx_free(UNUSED fr_bfd_ctx_t *ctx)
-{
- fr_bfd_free();
-
- return 0;
-}
-
static int decode_test_ctx(void **out, TALLOC_CTX *ctx)
{
fr_bfd_ctx_t *test_ctx;
- if (fr_bfd_init() < 0) return -1;
-
test_ctx = talloc_zero(ctx, fr_bfd_ctx_t);
test_ctx->secret = talloc_strdup(test_ctx, "testing123");
test_ctx->tmp_ctx = talloc_zero(test_ctx, uint8_t);
- talloc_set_destructor(test_ctx, _test_ctx_free);
*out = test_ctx;
}
-static int _test_ctx_free(UNUSED fr_bfd_ctx_t *ctx)
-{
- fr_bfd_free();
-
- return 0;
-}
-
static int encode_test_ctx(void **out, TALLOC_CTX *ctx)
{
fr_bfd_ctx_t *test_ctx;
- if (fr_bfd_init() < 0) return -1;
-
test_ctx = talloc_zero(ctx, fr_bfd_ctx_t);
if (!test_ctx) return -1;
test_ctx->secret = talloc_strdup(test_ctx, "testing123");
- talloc_set_destructor(test_ctx, _test_ctx_free);
*out = test_ctx;
}
-static int _decode_test_ctx(UNUSED fr_dhcpv4_ctx_t *test_ctx)
-{
- fr_dhcpv4_global_free();
-
- return 0;
-}
-
static int decode_test_ctx(void **out, TALLOC_CTX *ctx)
{
fr_dhcpv4_ctx_t *test_ctx;
- if (fr_dhcpv4_global_init() < 0) return -1;
-
test_ctx = talloc_zero(ctx, fr_dhcpv4_ctx_t);
- talloc_set_destructor(test_ctx, _decode_test_ctx);
test_ctx->tmp_ctx = talloc(test_ctx, uint8_t);
*out = test_ctx;
return fr_dhcpv4_encode_dbuff(&FR_DBUFF_TMP(data, data_len), NULL, 0, 0, vps);
}
-static int _encode_test_ctx(UNUSED fr_dhcpv4_ctx_t *test_ctx)
-{
- fr_dhcpv4_global_free();
-
- return 0;
-}
-
static int encode_test_ctx(void **out, TALLOC_CTX *ctx)
{
fr_dhcpv4_ctx_t *test_ctx;
- if (fr_dhcpv4_global_init() < 0) return -1;
-
test_ctx = talloc_zero(ctx, fr_dhcpv4_ctx_t);
if (!test_ctx) return -1;
test_ctx->root = fr_dict_root(dict_dhcpv4);
- talloc_set_destructor(test_ctx, _encode_test_ctx);
*out = test_ctx;
.subtype_table_len = NUM_ELEMENTS(subtype_table),
.attr_valid = attr_valid,
-
.init = fr_dhcpv6_global_init,
.free = fr_dhcpv6_global_free,
return data_len;
}
-/*
- * Stub functions to enable test context
- */
-static int _test_ctx_free(UNUSED fr_dhcpv6_decode_ctx_t *ctx)
-{
- fr_dhcpv6_global_free();
-
- return 0;
-}
-
static int decode_test_ctx(void **out, TALLOC_CTX *ctx)
{
fr_dhcpv6_decode_ctx_t *test_ctx;
- if (fr_dhcpv6_global_init() < 0) return -1;
-
test_ctx = talloc_zero(ctx, fr_dhcpv6_decode_ctx_t);
if (!test_ctx) return -1;
test_ctx->tmp_ctx = talloc(test_ctx, uint8_t);
- talloc_set_destructor(test_ctx, _test_ctx_free);
*out = test_ctx;
}
-static int _test_ctx_free(UNUSED fr_dhcpv6_encode_ctx_t *ctx)
-{
- fr_dhcpv6_global_free();
-
- return 0;
-}
-
static int encode_test_ctx(void **out, TALLOC_CTX *ctx)
{
fr_dhcpv6_encode_ctx_t *test_ctx;
- if (fr_dhcpv6_global_init() < 0) return -1;
-
test_ctx = talloc_zero(ctx, fr_dhcpv6_encode_ctx_t);
if (!test_ctx) return -1;
test_ctx->root = fr_dict_root(dict_dhcpv6);
- talloc_set_destructor(test_ctx, _test_ctx_free);
*out = test_ctx;
.subtype_table = subtype_table,
.subtype_table_len = NUM_ELEMENTS(subtype_table),
.attr_valid = attr_valid,
+
+ .init = fr_dns_global_init,
+ .free = fr_dns_global_free,
};
/*
* Test points
*/
-static int _decode_test_ctx(UNUSED fr_dns_ctx_t *test_ctx)
-{
- fr_dns_global_free();
-
- return 0;
-}
-
static int decode_test_ctx(void **out, TALLOC_CTX *ctx)
{
fr_dns_ctx_t *test_ctx;
if (fr_dns_global_init() < 0) return -1;
test_ctx = talloc_zero(ctx, fr_dns_ctx_t);
- talloc_set_destructor(test_ctx, _decode_test_ctx);
test_ctx->tmp_ctx = talloc(test_ctx, uint8_t);
*out = test_ctx;
return fr_dbuff_set(dbuff, &work_dbuff);
}
-static int _test_ctx_free(UNUSED fr_dns_ctx_t *ctx)
-{
- fr_dns_global_free();
-
- return 0;
-}
-
static int encode_test_ctx(void **out, TALLOC_CTX *ctx)
{
fr_dns_ctx_t *test_ctx;
- if (fr_dns_global_init() < 0) return -1;
-
test_ctx = talloc_zero(ctx, fr_dns_ctx_t);
if (!test_ctx) return -1;
- talloc_set_destructor(test_ctx, _test_ctx_free);
test_ctx->tmp_ctx = talloc(test_ctx, uint8_t);
*out = test_ctx;
}
-static int _test_ctx_free(fr_radius_decode_ctx_t *ctx)
-{
- TALLOC_FREE(ctx->tags);
-
- fr_radius_free();
-
- return 0;
-}
-
static int decode_test_ctx(void **out, TALLOC_CTX *ctx)
{
static uint8_t vector[RADIUS_AUTH_VECTOR_LENGTH] = {
fr_radius_decode_ctx_t *test_ctx;
- if (fr_radius_init() < 0) return -1;
-
test_ctx = talloc_zero(ctx, fr_radius_decode_ctx_t);
test_ctx->common = talloc_zero(test_ctx, fr_radius_ctx_t);
test_ctx->request_authenticator = vector;
test_ctx->tmp_ctx = talloc_zero(test_ctx, uint8_t);
- talloc_set_destructor(test_ctx, _test_ctx_free);
*out = test_ctx;
}
-static int _test_ctx_free(UNUSED fr_radius_encode_ctx_t *ctx)
-{
- fr_radius_free();
-
- return 0;
-}
-
static int encode_test_ctx(void **out, TALLOC_CTX *ctx)
{
static uint8_t vector[RADIUS_AUTH_VECTOR_LENGTH] = {
fr_radius_encode_ctx_t *test_ctx;
- if (fr_radius_init() < 0) return -1;
-
test_ctx = talloc_zero(ctx, fr_radius_encode_ctx_t);
if (!test_ctx) return -1;
test_ctx->request_authenticator = vector;
test_ctx->rand_ctx.a = 6809;
test_ctx->rand_ctx.b = 2112;
- talloc_set_destructor(test_ctx, _test_ctx_free);
*out = test_ctx;
test_ctx = talloc_zero(ctx, fr_tacacs_ctx_t);
if (!test_ctx) return -1;
-// test_ctx->secret = talloc_strdup(test_ctx, "testing123");
test_ctx->root = fr_dict_root(dict_tacacs);
talloc_set_destructor(test_ctx, _encode_test_ctx);