51 const char *str, uint32_t uint)
59 ast_test_status_update(test,
"Expected event type: '%u', got '%u'\n",
66 ast_test_status_update(test,
"Failed to get string IE.\n");
72 ast_test_status_update(test,
"Failed to get uint IE.\n");
78 ast_test_status_update(test,
"CEL_CIDNAME IE check returned non-NULL %p\n", foo);
84 ast_test_status_update(test,
"UNIQUEID IE should be 0\n");
88 ast_test_status_update(test,
"Event looks good.\n");
98 enum ast_test_result_state res = AST_TEST_PASS;
99 struct ast_event *
event = NULL, *event2 = NULL;
102 static const char str[] =
"SIP/alligatormittens";
103 static const uint32_t uint = 0xb00bface;
107 info->name =
"ast_event_new_test";
108 info->category =
"/main/event/";
109 info->summary =
"Test event creation";
111 "This test exercises the API calls that allow allocation "
113 return AST_TEST_NOT_RUN;
125 ast_test_status_update(test,
"First, test dynamic event creation...\n");
128 ast_test_status_update(test,
"Failed to allocate ast_event object.\n");
134 ast_test_status_update(test,
"Failed to append str IE\n");
140 ast_test_status_update(test,
"Failed to append uint IE\n");
145 if (check_event(event, test, type,
"Custom", str, uint)) {
146 ast_test_status_update(test,
"Dynamically generated event broken\n");
157 ast_test_status_update(test,
"Failed to allocate ast_event object.\n");
162 if (check_event(event2, test, type,
"Custom", str, uint)) {
163 ast_test_status_update(test,
"Statically generated event broken\n");
169 ast_test_status_update(test,
"Events expected to be identical have different size: %d != %d\n",
194 static int unload_module(
void)
196 AST_TEST_UNREGISTER(event_new_test);
201 static int load_module(
void)
203 AST_TEST_REGISTER(event_new_test);
Channel Event CID name Used by: AST_EVENT_CEL Payload type: STR.
Asterisk main include file. File version handling, generic pbx functions.
enum ast_event_type ast_event_get_type(const struct ast_event *event)
Get the type for an event.
Channel Event Time (micro-seconds) Used by: AST_EVENT_CEL Payload type: UINT.
Channel Event User Event Name Used by: AST_EVENT_CEL Payload type: STR.
int ast_event_append_ie_str(struct ast_event **event, enum ast_event_ie_type ie_type, const char *str)
Append an information element that has a string payload.
Channel Event AMA flags Used by: AST_EVENT_CEL Payload type: UINT.
uint32_t ast_event_get_ie_uint(const struct ast_event *event, enum ast_event_ie_type ie_type)
Get the value of an information element that has an integer payload.
void ast_event_destroy(struct ast_event *event)
Destroy an event.
struct ast_event * ast_event_new(enum ast_event_type event_type,...)
Create a new event.
#define AST_TEST_DEFINE(hdr)
size_t ast_event_get_size(const struct ast_event *event)
Get the size of an event.
const char * ast_event_get_ie_str(const struct ast_event *event, enum ast_event_ie_type ie_type)
Get the value of an information element that has a string payload.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
int ast_event_append_ie_uint(struct ast_event **event, enum ast_event_ie_type ie_type, uint32_t data)
Append an information element that has an integer payload.