41 static const char *test_category =
"/core/endpoints/";
49 info->name = __func__;
50 info->category = test_category;
51 info->summary =
"Test endpoint creation";
52 info->description =
"Test endpoint creation";
53 return AST_TEST_NOT_RUN;
64 ast_test_validate(
test, NULL != uut);
66 ast_test_validate(
test,
68 ast_test_validate(
test,
82 info->name = __func__;
83 info->category = test_category;
84 info->summary =
"Test defaults for new endpoints";
85 info->description =
"Test defaults for new endpoints";
86 return AST_TEST_NOT_RUN;
92 ast_test_validate(
test, NULL != uut);
94 ast_test_validate(
test, NULL != snapshot);
96 ast_test_validate(
test, 0 == strcmp(
"TEST/test_res", snapshot->id));
97 ast_test_validate(
test, 0 == strcmp(
"TEST", snapshot->tech));
98 ast_test_validate(
test, 0 == strcmp(
"test_res", snapshot->resource));
100 ast_test_validate(
test, -1 == snapshot->max_channels);
101 ast_test_validate(
test, 0 == snapshot->num_channels);
103 return AST_TEST_PASS;
113 info->name = __func__;
114 info->category = test_category;
115 info->summary =
"Test endpoint setters";
116 info->description =
"Test endpoint setters";
117 return AST_TEST_NOT_RUN;
123 ast_test_validate(
test, NULL != uut);
129 ast_test_validate(
test, NULL != snapshot);
132 ast_test_validate(
test, 314159 == snapshot->max_channels);
134 return AST_TEST_PASS;
137 static int unload_module(
void)
139 AST_TEST_UNREGISTER(create);
140 AST_TEST_UNREGISTER(defaults);
141 AST_TEST_UNREGISTER(setters);
145 static int load_module(
void)
147 AST_TEST_REGISTER(create);
148 AST_TEST_REGISTER(defaults);
149 AST_TEST_REGISTER(setters);
154 .support_level = AST_MODULE_SUPPORT_CORE,
156 .unload = unload_module,
Asterisk main include file. File version handling, generic pbx functions.
struct ast_endpoint * ast_endpoint_create(const char *tech, const char *resource)
Create an endpoint struct.
struct ast_endpoint_snapshot * ast_endpoint_snapshot_create(struct ast_endpoint *endpoint)
Create a snapshot of an endpoint.
const char * ast_endpoint_get_tech(const struct ast_endpoint *endpoint)
Gets the technology of the given endpoint.
void ast_endpoint_set_state(struct ast_endpoint *endpoint, enum ast_endpoint_state state)
Updates the state of the given endpoint.
const char * ast_endpoint_get_resource(const struct ast_endpoint *endpoint)
Gets the resource name of the given endpoint.
A snapshot of an endpoint's state.
void ast_endpoint_set_max_channels(struct ast_endpoint *endpoint, int max_channels)
Updates the maximum number of channels an endpoint supports.
#define AST_TEST_DEFINE(hdr)
void ast_endpoint_shutdown(struct ast_endpoint *endpoint)
Shutsdown an ast_endpoint.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.